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

This commit is contained in:
Alex Kotov 2022-09-08 23:31:12 +04:00
parent a21e309883
commit 256654e586
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
3 changed files with 20 additions and 11 deletions

View file

@ -132,3 +132,13 @@ unsafe extern "C" fn settings_get_snap_distance() -> c_uint {
unsafe extern "C" fn settings_set_snap_distance(value: c_uint) {
SETTINGS.unwrap().snap_distance_set(value);
}
#[no_mangle]
unsafe extern "C" fn settings_get_swallow_floatting() -> bool {
SETTINGS.unwrap().swallow_floating()
}
#[no_mangle]
unsafe extern "C" fn settings_set_swallow_floating(value: bool) {
SETTINGS.unwrap().swallow_floating_set(value);
}

View file

@ -6,7 +6,6 @@ static SettingsForSingleWindow border_for_single_window = SETTINGS_FOR_SINGLE_WI
static SettingsForSingleWindow gap_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN;
static UnitKind master_area_factor_per_unit = UNIT_MONITOR;
static UnitKind show_bar_per_unit = UNIT_MONITOR;
static bool swallow_floating = false;
SettingsForSingleWindow settings_get_border_for_single_window()
{
@ -51,13 +50,3 @@ void settings_set_show_bar_per_unit(const UnitKind new_show_bar_per_unit)
show_bar_per_unit = new_show_bar_per_unit;
// TODO: notify WM to rearrange clients
}
bool settings_get_swallow_floating()
{
return swallow_floating;
}
void settings_set_swallow_floating(const bool new_swallow_floating)
{
swallow_floating = new_swallow_floating;
}

View file

@ -15,6 +15,7 @@ pub struct Settings {
respect_resize_hints_in_floating_layout: bool,
show_bar_by_default: bool,
snap_distance: c_uint,
swallow_floating: bool,
}
impl Default for Settings {
@ -31,6 +32,7 @@ impl Default for Settings {
respect_resize_hints_in_floating_layout: false,
show_bar_by_default: true,
snap_distance: 32,
swallow_floating: false,
}
}
}
@ -130,4 +132,12 @@ impl Settings {
pub fn snap_distance_set(&mut self, value: c_uint) {
self.snap_distance = constraints::snap_distance(value);
}
pub fn swallow_floating(&self) -> bool {
self.swallow_floating
}
pub fn swallow_floating_set(&mut self, value: bool) {
self.swallow_floating = value;
}
}