diff --git a/src/api/constraints.rs b/src/api/constraints.rs index 896ec1e..b8e032a 100644 --- a/src/api/constraints.rs +++ b/src/api/constraints.rs @@ -2,13 +2,6 @@ use crate::*; use std::os::raw::*; -#[no_mangle] -extern "C" fn constraints_default_master_area_factor( - default_master_area_factor: c_float, -) -> c_float { - constraints::default_master_area_factor(default_master_area_factor) -} - #[no_mangle] extern "C" fn constraints_gap_size(gap_size: c_int) -> c_int { constraints::gap_size(gap_size) diff --git a/src/api/settings.rs b/src/api/settings.rs index 47daa73..46a2d0e 100644 --- a/src/api/settings.rs +++ b/src/api/settings.rs @@ -40,3 +40,13 @@ unsafe extern "C" fn settings_get_default_clients_in_master() -> c_int { unsafe extern "C" fn settings_set_default_clients_in_master(value: c_int) { SETTINGS.unwrap().default_clients_in_master_set(value); } + +#[no_mangle] +unsafe extern "C" fn settings_get_default_master_area_factor() -> c_float { + SETTINGS.unwrap().default_master_area_factor() +} + +#[no_mangle] +unsafe extern "C" fn settings_set_default_master_area_factor(value: c_float) { + SETTINGS.unwrap().default_master_area_factor_set(value); +} diff --git a/src/constraints.h b/src/constraints.h index eb9ed90..16c4039 100644 --- a/src/constraints.h +++ b/src/constraints.h @@ -1,7 +1,6 @@ #ifndef _CONSTRAINTS_H #define _CONSTRAINTS_H -float constraints_default_master_area_factor(float default_master_area_factor); int constraints_gap_size(int gap_size); float constraints_master_area_factor(float master_area_factor); int constraints_max_clients_in_master(int max_clients_in_master); diff --git a/src/settings.c b/src/settings.c index 36b7231..8903509 100644 --- a/src/settings.c +++ b/src/settings.c @@ -3,7 +3,6 @@ #include "constraints.h" static SettingsForSingleWindow border_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN; -static float default_master_area_factor = 0.6; static SettingsForSingleWindow gap_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN; static bool enable_swallowing = true; static bool focus_on_wheel = true; @@ -27,16 +26,6 @@ void settings_set_border_for_single_window(const SettingsForSingleWindow new_bor // TODO: notify WM to rearrange clients } -float settings_get_default_master_area_factor() -{ - return default_master_area_factor; -} - -void settings_set_default_master_area_factor(const float new_default_master_area_factor) -{ - default_master_area_factor = constraints_default_master_area_factor(new_default_master_area_factor); -} - SettingsForSingleWindow settings_get_gap_for_single_window() { return gap_for_single_window; diff --git a/src/settings.rs b/src/settings.rs index 800c054..bc11154 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -7,6 +7,7 @@ pub struct Settings { bar_on_top_by_default: bool, border_width: c_int, default_clients_in_master: c_int, + default_master_area_factor: c_float, } impl Default for Settings { @@ -15,6 +16,7 @@ impl Default for Settings { bar_on_top_by_default: true, border_width: 2, default_clients_in_master: 1, + default_master_area_factor: 0.6, } } } @@ -45,4 +47,13 @@ impl Settings { self.default_clients_in_master = constraints::default_clients_in_master(value); } + + pub fn default_master_area_factor(&self) -> c_float { + self.default_master_area_factor + } + + pub fn default_master_area_factor_set(&mut self, value: c_float) { + self.default_master_area_factor = + constraints::default_master_area_factor(value); + } }