From 05513d3435332e11e3ebcccf19669c789edde94a Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Thu, 8 Sep 2022 23:22:22 +0400 Subject: [PATCH] Move func "settings_(get|set)_show_bar_by_default" to Rust --- src/api/settings.rs | 10 ++++++++++ src/settings.c | 11 ----------- src/settings.rs | 10 ++++++++++ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/api/settings.rs b/src/api/settings.rs index e593b62..9b5f755 100644 --- a/src/api/settings.rs +++ b/src/api/settings.rs @@ -112,3 +112,13 @@ unsafe extern "C" fn settings_set_respect_resize_hints_in_floating_layout( .unwrap() .respect_resize_hints_in_floating_layout_set(value); } + +#[no_mangle] +unsafe extern "C" fn settings_get_show_bar_by_default() -> bool { + SETTINGS.unwrap().show_bar_by_default() +} + +#[no_mangle] +unsafe extern "C" fn settings_set_show_bar_by_default(value: bool) { + SETTINGS.unwrap().show_bar_by_default_set(value); +} diff --git a/src/settings.c b/src/settings.c index cd22e3d..b8a60b6 100644 --- a/src/settings.c +++ b/src/settings.c @@ -5,7 +5,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 UnitKind master_area_factor_per_unit = UNIT_MONITOR; -static bool show_bar_by_default = true; static UnitKind show_bar_per_unit = UNIT_MONITOR; static unsigned int snap_distance = 32; static bool swallow_floating = false; @@ -43,16 +42,6 @@ void settings_set_master_area_factor_per_unit(const UnitKind new_master_area_fac // TODO: notify WM to rearrange clients } -bool settings_get_show_bar_by_default() -{ - return show_bar_by_default; -} - -void settings_set_show_bar_by_default(const bool new_show_bar_by_default) -{ - show_bar_by_default = new_show_bar_by_default; -} - UnitKind settings_get_show_bar_per_unit() { return show_bar_per_unit; diff --git a/src/settings.rs b/src/settings.rs index 1b59937..e28e4e7 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -13,6 +13,7 @@ pub struct Settings { gap_size: c_int, max_clients_in_master: Option, respect_resize_hints_in_floating_layout: bool, + show_bar_by_default: bool, } impl Default for Settings { @@ -27,6 +28,7 @@ impl Default for Settings { gap_size: 10, max_clients_in_master: None, respect_resize_hints_in_floating_layout: false, + show_bar_by_default: true, } } } @@ -110,4 +112,12 @@ impl Settings { pub fn respect_resize_hints_in_floating_layout_set(&mut self, value: bool) { self.respect_resize_hints_in_floating_layout = value; } + + pub fn show_bar_by_default(&self) -> bool { + self.show_bar_by_default + } + + pub fn show_bar_by_default_set(&mut self, value: bool) { + self.show_bar_by_default = value; + } }