Compare commits
3 commits
817fb2ee1b
...
6f66d11503
Author | SHA1 | Date | |
---|---|---|---|
6f66d11503 | |||
c057002a89 | |||
2687238a01 |
5 changed files with 60 additions and 41 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,
|
||||
|
|
|
@ -50,3 +50,33 @@ unsafe extern "C" fn settings_get_default_master_area_factor() -> c_float {
|
|||
unsafe extern "C" fn settings_set_default_master_area_factor(value: c_float) {
|
||||
SETTINGS.unwrap().default_master_area_factor_set(value);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
unsafe extern "C" fn settings_get_enable_swallowing() -> bool {
|
||||
SETTINGS.unwrap().enable_swallowing()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
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);
|
||||
}
|
||||
|
||||
#[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,9 +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 enable_swallowing = true;
|
||||
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
|
||||
static bool respect_resize_hints_in_floating_layout = false;
|
||||
|
@ -37,38 +34,6 @@ void settings_set_gap_for_single_window(const SettingsForSingleWindow new_gap_fo
|
|||
// TODO: notify WM to rearrange clients
|
||||
}
|
||||
|
||||
bool settings_get_enable_swallowing()
|
||||
{
|
||||
return enable_swallowing;
|
||||
}
|
||||
|
||||
void settings_set_enable_swallowing(const bool new_enable_swallowing)
|
||||
{
|
||||
enable_swallowing = new_enable_swallowing;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -8,6 +8,9 @@ pub struct Settings {
|
|||
border_width: c_int,
|
||||
default_clients_in_master: c_int,
|
||||
default_master_area_factor: c_float,
|
||||
enable_swallowing: bool,
|
||||
focus_on_wheel: bool,
|
||||
gap_size: c_int,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
|
@ -17,6 +20,9 @@ impl Default for Settings {
|
|||
border_width: 2,
|
||||
default_clients_in_master: 1,
|
||||
default_master_area_factor: 0.6,
|
||||
enable_swallowing: true,
|
||||
focus_on_wheel: true,
|
||||
gap_size: 10,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,4 +62,28 @@ impl Settings {
|
|||
self.default_master_area_factor =
|
||||
constraints::default_master_area_factor(value);
|
||||
}
|
||||
|
||||
pub fn enable_swallowing(&self) -> bool {
|
||||
self.enable_swallowing
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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…
Add table
Reference in a new issue