Move func "settings_(get|set)_default_clients_in_master" to Rust
This commit is contained in:
parent
275076396e
commit
a3696a40f1
5 changed files with 21 additions and 19 deletions
|
@ -2,13 +2,6 @@ use crate::*;
|
||||||
|
|
||||||
use std::os::raw::*;
|
use std::os::raw::*;
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
extern "C" fn constraints_default_clients_in_master(
|
|
||||||
default_clients_in_master: c_int,
|
|
||||||
) -> c_int {
|
|
||||||
constraints::default_clients_in_master(default_clients_in_master)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
extern "C" fn constraints_default_master_area_factor(
|
extern "C" fn constraints_default_master_area_factor(
|
||||||
default_master_area_factor: c_float,
|
default_master_area_factor: c_float,
|
||||||
|
|
|
@ -30,3 +30,13 @@ unsafe extern "C" fn settings_get_border_width() -> c_int {
|
||||||
unsafe extern "C" fn settings_set_border_width(value: c_int) {
|
unsafe extern "C" fn settings_set_border_width(value: c_int) {
|
||||||
SETTINGS.unwrap().border_width_set(value);
|
SETTINGS.unwrap().border_width_set(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
unsafe extern "C" fn settings_get_default_clients_in_master() -> c_int {
|
||||||
|
SETTINGS.unwrap().default_clients_in_master()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
unsafe extern "C" fn settings_set_default_clients_in_master(value: c_int) {
|
||||||
|
SETTINGS.unwrap().default_clients_in_master_set(value);
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef _CONSTRAINTS_H
|
#ifndef _CONSTRAINTS_H
|
||||||
#define _CONSTRAINTS_H
|
#define _CONSTRAINTS_H
|
||||||
|
|
||||||
int constraints_default_clients_in_master(int default_clients_in_master);
|
|
||||||
float constraints_default_master_area_factor(float default_master_area_factor);
|
float constraints_default_master_area_factor(float default_master_area_factor);
|
||||||
int constraints_gap_size(int gap_size);
|
int constraints_gap_size(int gap_size);
|
||||||
float constraints_master_area_factor(float master_area_factor);
|
float constraints_master_area_factor(float master_area_factor);
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include "constraints.h"
|
#include "constraints.h"
|
||||||
|
|
||||||
static SettingsForSingleWindow border_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN;
|
static SettingsForSingleWindow border_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN;
|
||||||
static int default_clients_in_master = 1;
|
|
||||||
static float default_master_area_factor = 0.6;
|
static float default_master_area_factor = 0.6;
|
||||||
static SettingsForSingleWindow gap_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN;
|
static SettingsForSingleWindow gap_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN;
|
||||||
static bool enable_swallowing = true;
|
static bool enable_swallowing = true;
|
||||||
|
@ -28,16 +27,6 @@ void settings_set_border_for_single_window(const SettingsForSingleWindow new_bor
|
||||||
// TODO: notify WM to rearrange clients
|
// TODO: notify WM to rearrange clients
|
||||||
}
|
}
|
||||||
|
|
||||||
int settings_get_default_clients_in_master()
|
|
||||||
{
|
|
||||||
return default_clients_in_master;
|
|
||||||
}
|
|
||||||
|
|
||||||
void settings_set_default_clients_in_master(const int new_default_clients_in_master)
|
|
||||||
{
|
|
||||||
default_clients_in_master = constraints_default_clients_in_master(new_default_clients_in_master);
|
|
||||||
}
|
|
||||||
|
|
||||||
float settings_get_default_master_area_factor()
|
float settings_get_default_master_area_factor()
|
||||||
{
|
{
|
||||||
return default_master_area_factor;
|
return default_master_area_factor;
|
||||||
|
|
|
@ -6,6 +6,7 @@ use std::os::raw::*;
|
||||||
pub struct Settings {
|
pub struct Settings {
|
||||||
bar_on_top_by_default: bool,
|
bar_on_top_by_default: bool,
|
||||||
border_width: c_int,
|
border_width: c_int,
|
||||||
|
default_clients_in_master: c_int,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Settings {
|
impl Default for Settings {
|
||||||
|
@ -13,6 +14,7 @@ impl Default for Settings {
|
||||||
Self {
|
Self {
|
||||||
bar_on_top_by_default: true,
|
bar_on_top_by_default: true,
|
||||||
border_width: 2,
|
border_width: 2,
|
||||||
|
default_clients_in_master: 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,4 +36,13 @@ impl Settings {
|
||||||
pub fn border_width_set(&mut self, value: c_int) {
|
pub fn border_width_set(&mut self, value: c_int) {
|
||||||
self.border_width = constraints::border_width(value);
|
self.border_width = constraints::border_width(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn default_clients_in_master(&self) -> c_int {
|
||||||
|
self.default_clients_in_master
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn default_clients_in_master_set(&mut self, value: c_int) {
|
||||||
|
self.default_clients_in_master =
|
||||||
|
constraints::default_clients_in_master(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue