Move func "settings_(get|set)_gap_size" to Rust
This commit is contained in:
parent
c057002a89
commit
6f66d11503
5 changed files with 20 additions and 18 deletions
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue