1
0
Fork 0
forked from wry/wry

config: add some utility functions

This commit is contained in:
Julian Orth 2022-05-02 17:34:31 +02:00
parent 518c1ad290
commit 56d3c5fce9
3 changed files with 15 additions and 15 deletions

View file

@ -84,29 +84,31 @@ impl Seat {
}
pub fn mono(self) -> bool {
let mut res = false;
(|| res = get!().mono(self))();
res
get!(false).mono(self)
}
pub fn set_mono(self, mono: bool) {
get!().set_mono(self, mono)
}
pub fn toggle_mono(self) {
self.set_mono(!self.mono());
}
pub fn split(self) -> Axis {
let mut res = Axis::Horizontal;
(|| res = get!().split(self))();
res
get!(Axis::Horizontal).split(self)
}
pub fn set_split(self, axis: Axis) {
get!().set_split(self, axis)
}
pub fn toggle_split(self) {
self.set_split(self.split().other());
}
pub fn input_devices(self) -> Vec<InputDevice> {
let mut res = vec![];
(|| res = get!().get_input_devices(Some(self)))();
res
get!().get_input_devices(Some(self))
}
pub fn create_split(self, axis: Axis) {

View file

@ -17,7 +17,7 @@ macro_rules! config {
macro_rules! get {
() => {{
get!(())
get!(Default::default())
}};
($def:expr) => {{
#[allow(unused_unsafe)]