Move func "settings_(get|set)_border_for_single_window" to Rust
This commit is contained in:
parent
616ebeb227
commit
911f65e750
3 changed files with 21 additions and 12 deletions
|
@ -21,6 +21,16 @@ unsafe extern "C" fn settings_set_bar_on_top_by_default(value: bool) {
|
|||
SETTINGS.unwrap().bar_on_top_by_default_set(value);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
unsafe extern "C" fn settings_get_border_for_single_window() -> c_uchar {
|
||||
SETTINGS.unwrap().border_for_single_window().into()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
unsafe extern "C" fn settings_set_border_for_single_window(value: c_uchar) {
|
||||
SETTINGS.unwrap().border_for_single_window_set(value.into());
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
unsafe extern "C" fn settings_get_border_width() -> c_int {
|
||||
SETTINGS.unwrap().border_width()
|
||||
|
|
|
@ -2,22 +2,10 @@
|
|||
|
||||
#include "constraints.h"
|
||||
|
||||
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 UnitKind show_bar_per_unit = UNIT_MONITOR;
|
||||
|
||||
SettingsForSingleWindow settings_get_border_for_single_window()
|
||||
{
|
||||
return border_for_single_window;
|
||||
}
|
||||
|
||||
void settings_set_border_for_single_window(const SettingsForSingleWindow new_border_for_single_window)
|
||||
{
|
||||
border_for_single_window = new_border_for_single_window;
|
||||
// TODO: notify WM to rearrange clients
|
||||
}
|
||||
|
||||
SettingsForSingleWindow settings_get_gap_for_single_window()
|
||||
{
|
||||
return gap_for_single_window;
|
||||
|
|
|
@ -5,6 +5,7 @@ use std::os::raw::*;
|
|||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Settings {
|
||||
bar_on_top_by_default: bool,
|
||||
border_for_single_window: ForSingleWindow,
|
||||
border_width: c_int,
|
||||
default_clients_in_master: c_int,
|
||||
default_master_area_factor: c_float,
|
||||
|
@ -30,6 +31,7 @@ impl Default for Settings {
|
|||
fn default() -> Self {
|
||||
Self {
|
||||
bar_on_top_by_default: true,
|
||||
border_for_single_window: Default::default(),
|
||||
border_width: 2,
|
||||
default_clients_in_master: 1,
|
||||
default_master_area_factor: 0.6,
|
||||
|
@ -83,6 +85,15 @@ impl Settings {
|
|||
self.bar_on_top_by_default = value;
|
||||
}
|
||||
|
||||
pub fn border_for_single_window(&self) -> ForSingleWindow {
|
||||
self.border_for_single_window
|
||||
}
|
||||
|
||||
// TODO: notify WM to rearrange clients
|
||||
pub fn border_for_single_window_set(&mut self, value: ForSingleWindow) {
|
||||
self.border_for_single_window = value;
|
||||
}
|
||||
|
||||
pub fn border_width(&self) -> c_int {
|
||||
self.border_width
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue