diff --git a/src/api/constraints.rs b/src/api/constraints.rs index b8e032a..228a2df 100644 --- a/src/api/constraints.rs +++ b/src/api/constraints.rs @@ -2,11 +2,6 @@ use crate::*; use std::os::raw::*; -#[no_mangle] -extern "C" fn constraints_gap_size(gap_size: c_int) -> c_int { - constraints::gap_size(gap_size) -} - #[no_mangle] extern "C" fn constraints_master_area_factor( master_area_factor: c_float, diff --git a/src/api/settings.rs b/src/api/settings.rs index 84dac17..f2e13d7 100644 --- a/src/api/settings.rs +++ b/src/api/settings.rs @@ -70,3 +70,13 @@ unsafe extern "C" fn settings_get_focus_on_wheel() -> bool { unsafe extern "C" fn settings_set_focus_on_wheel(value: bool) { SETTINGS.unwrap().focus_on_wheel_set(value); } + +#[no_mangle] +unsafe extern "C" fn settings_get_gap_size() -> c_int { + SETTINGS.unwrap().gap_size() +} + +#[no_mangle] +unsafe extern "C" fn settings_set_gap_size(value: c_int) { + SETTINGS.unwrap().gap_size_set(value); +} diff --git a/src/constraints.h b/src/constraints.h index 16c4039..6084c32 100644 --- a/src/constraints.h +++ b/src/constraints.h @@ -1,7 +1,6 @@ #ifndef _CONSTRAINTS_H #define _CONSTRAINTS_H -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); unsigned int constraints_snap_distance(unsigned int snap_distance); diff --git a/src/settings.c b/src/settings.c index 8782cb0..1ac1cd9 100644 --- a/src/settings.c +++ b/src/settings.c @@ -4,7 +4,6 @@ static SettingsForSingleWindow border_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN; static SettingsForSingleWindow gap_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN; -static int gap_size = 10; static UnitKind master_area_factor_per_unit = UNIT_MONITOR; static int max_clients_in_master = 0; // 0 for no maximum static bool respect_resize_hints_in_floating_layout = false; @@ -35,17 +34,6 @@ void settings_set_gap_for_single_window(const SettingsForSingleWindow new_gap_fo // TODO: notify WM to rearrange clients } -int settings_get_gap_size() -{ - return gap_size; -} - -void settings_set_gap_size(const int new_gap_size) -{ - gap_size = constraints_gap_size(new_gap_size); - // TODO: notify WM to rearrange clients -} - UnitKind settings_get_master_area_factor_per_unit() { return master_area_factor_per_unit; diff --git a/src/settings.rs b/src/settings.rs index 7811565..927d510 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -10,6 +10,7 @@ pub struct Settings { default_master_area_factor: c_float, enable_swallowing: bool, focus_on_wheel: bool, + gap_size: c_int, } impl Default for Settings { @@ -21,6 +22,7 @@ impl Default for Settings { default_master_area_factor: 0.6, enable_swallowing: true, focus_on_wheel: true, + gap_size: 10, } } } @@ -76,4 +78,12 @@ impl Settings { pub fn focus_on_wheel_set(&mut self, value: bool) { self.focus_on_wheel = value; } + + pub fn gap_size(&self) -> c_int { + self.gap_size + } + + pub fn gap_size_set(&mut self, value: c_int) { + self.gap_size = constraints::gap_size(value); + } }