Move func "settings_(get|set)_respect_resize_hints_in_floating_layout" to Rust

This commit is contained in:
Alex Kotov 2022-09-08 23:15:19 +04:00
parent 4fdc0d90e4
commit 61651952d2
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 26 additions and 12 deletions

View File

@ -97,3 +97,18 @@ unsafe extern "C" fn settings_set_max_clients_in_master(value: c_int) {
Some(value)
});
}
#[no_mangle]
unsafe extern "C" fn settings_get_respect_resize_hints_in_floating_layout(
) -> bool {
SETTINGS.unwrap().respect_resize_hints_in_floating_layout()
}
#[no_mangle]
unsafe extern "C" fn settings_set_respect_resize_hints_in_floating_layout(
value: bool,
) {
SETTINGS
.unwrap()
.respect_resize_hints_in_floating_layout_set(value);
}

View File

@ -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 respect_resize_hints_in_floating_layout = false;
static bool show_bar_by_default = true;
static UnitKind show_bar_per_unit = UNIT_MONITOR;
static unsigned int snap_distance = 32;
@ -44,17 +43,6 @@ void settings_set_master_area_factor_per_unit(const UnitKind new_master_area_fac
// TODO: notify WM to rearrange clients
}
bool settings_get_respect_resize_hints_in_floating_layout()
{
return respect_resize_hints_in_floating_layout;
}
void settings_set_respect_resize_hints_in_floating_layout(const bool new_respect_resize_hints_in_floating_layout)
{
respect_resize_hints_in_floating_layout = new_respect_resize_hints_in_floating_layout;
// TODO: notify WM to rearrange clients
}
bool settings_get_show_bar_by_default()
{
return show_bar_by_default;

View File

@ -12,6 +12,7 @@ pub struct Settings {
focus_on_wheel: bool,
gap_size: c_int,
max_clients_in_master: Option<c_int>,
respect_resize_hints_in_floating_layout: bool,
}
impl Default for Settings {
@ -25,6 +26,7 @@ impl Default for Settings {
focus_on_wheel: true,
gap_size: 10,
max_clients_in_master: None,
respect_resize_hints_in_floating_layout: false,
}
}
}
@ -99,4 +101,13 @@ impl Settings {
self.max_clients_in_master =
value.map(|value| constraints::max_clients_in_master(value));
}
pub fn respect_resize_hints_in_floating_layout(&self) -> bool {
self.respect_resize_hints_in_floating_layout
}
// TODO: notify WM to rearrange clients
pub fn respect_resize_hints_in_floating_layout_set(&mut self, value: bool) {
self.respect_resize_hints_in_floating_layout = value;
}
}