Move func "settings_(get|set)_default_master_area_factor" to Rust
This commit is contained in:
parent
a3696a40f1
commit
817fb2ee1b
5 changed files with 21 additions and 19 deletions
|
@ -2,13 +2,6 @@ use crate::*;
|
|||
|
||||
use std::os::raw::*;
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn constraints_default_master_area_factor(
|
||||
default_master_area_factor: c_float,
|
||||
) -> c_float {
|
||||
constraints::default_master_area_factor(default_master_area_factor)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn constraints_gap_size(gap_size: c_int) -> c_int {
|
||||
constraints::gap_size(gap_size)
|
||||
|
|
|
@ -40,3 +40,13 @@ unsafe extern "C" fn settings_get_default_clients_in_master() -> c_int {
|
|||
unsafe extern "C" fn settings_set_default_clients_in_master(value: c_int) {
|
||||
SETTINGS.unwrap().default_clients_in_master_set(value);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
unsafe extern "C" fn settings_get_default_master_area_factor() -> c_float {
|
||||
SETTINGS.unwrap().default_master_area_factor()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
unsafe extern "C" fn settings_set_default_master_area_factor(value: c_float) {
|
||||
SETTINGS.unwrap().default_master_area_factor_set(value);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef _CONSTRAINTS_H
|
||||
#define _CONSTRAINTS_H
|
||||
|
||||
float constraints_default_master_area_factor(float default_master_area_factor);
|
||||
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);
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include "constraints.h"
|
||||
|
||||
static SettingsForSingleWindow border_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN;
|
||||
static float default_master_area_factor = 0.6;
|
||||
static SettingsForSingleWindow gap_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN;
|
||||
static bool enable_swallowing = true;
|
||||
static bool focus_on_wheel = true;
|
||||
|
@ -27,16 +26,6 @@ void settings_set_border_for_single_window(const SettingsForSingleWindow new_bor
|
|||
// TODO: notify WM to rearrange clients
|
||||
}
|
||||
|
||||
float settings_get_default_master_area_factor()
|
||||
{
|
||||
return default_master_area_factor;
|
||||
}
|
||||
|
||||
void settings_set_default_master_area_factor(const float new_default_master_area_factor)
|
||||
{
|
||||
default_master_area_factor = constraints_default_master_area_factor(new_default_master_area_factor);
|
||||
}
|
||||
|
||||
SettingsForSingleWindow settings_get_gap_for_single_window()
|
||||
{
|
||||
return gap_for_single_window;
|
||||
|
|
|
@ -7,6 +7,7 @@ pub struct Settings {
|
|||
bar_on_top_by_default: bool,
|
||||
border_width: c_int,
|
||||
default_clients_in_master: c_int,
|
||||
default_master_area_factor: c_float,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
|
@ -15,6 +16,7 @@ impl Default for Settings {
|
|||
bar_on_top_by_default: true,
|
||||
border_width: 2,
|
||||
default_clients_in_master: 1,
|
||||
default_master_area_factor: 0.6,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,4 +47,13 @@ impl Settings {
|
|||
self.default_clients_in_master =
|
||||
constraints::default_clients_in_master(value);
|
||||
}
|
||||
|
||||
pub fn default_master_area_factor(&self) -> c_float {
|
||||
self.default_master_area_factor
|
||||
}
|
||||
|
||||
pub fn default_master_area_factor_set(&mut self, value: c_float) {
|
||||
self.default_master_area_factor =
|
||||
constraints::default_master_area_factor(value);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue