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

This commit is contained in:
Alex Kotov 2022-09-08 16:11:50 +04:00
parent 2687238a01
commit c057002a89
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 20 additions and 11 deletions

View File

@ -60,3 +60,13 @@ unsafe extern "C" fn settings_get_enable_swallowing() -> bool {
unsafe extern "C" fn settings_set_enable_swallowing(value: bool) {
SETTINGS.unwrap().enable_swallowing_set(value);
}
#[no_mangle]
unsafe extern "C" fn settings_get_focus_on_wheel() -> bool {
SETTINGS.unwrap().focus_on_wheel()
}
#[no_mangle]
unsafe extern "C" fn settings_set_focus_on_wheel(value: bool) {
SETTINGS.unwrap().focus_on_wheel_set(value);
}

View File

@ -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 bool focus_on_wheel = true;
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
@ -36,16 +35,6 @@ void settings_set_gap_for_single_window(const SettingsForSingleWindow new_gap_fo
// TODO: notify WM to rearrange clients
}
bool settings_get_focus_on_wheel()
{
return focus_on_wheel;
}
void settings_set_focus_on_wheel(const bool new_focus_on_wheel)
{
focus_on_wheel = new_focus_on_wheel;
}
int settings_get_gap_size()
{
return gap_size;

View File

@ -9,6 +9,7 @@ pub struct Settings {
default_clients_in_master: c_int,
default_master_area_factor: c_float,
enable_swallowing: bool,
focus_on_wheel: bool,
}
impl Default for Settings {
@ -19,6 +20,7 @@ impl Default for Settings {
default_clients_in_master: 1,
default_master_area_factor: 0.6,
enable_swallowing: true,
focus_on_wheel: true,
}
}
}
@ -66,4 +68,12 @@ impl Settings {
pub fn enable_swallowing_set(&mut self, value: bool) {
self.enable_swallowing = value;
}
pub fn focus_on_wheel(&self) -> bool {
self.focus_on_wheel
}
pub fn focus_on_wheel_set(&mut self, value: bool) {
self.focus_on_wheel = value;
}
}