1
0
Fork 0
forked from wry/wry

autocommit 2022-03-24 18:27:42 CET

This commit is contained in:
Julian Orth 2022-03-24 18:27:42 +01:00
parent b3a27f889a
commit 3b1b843821
17 changed files with 388 additions and 212 deletions

View file

@ -185,6 +185,17 @@ impl Client {
}
}
pub fn mono(&self, seat: Seat) -> bool {
let res = self.with_response(|| self.send(&ClientMessage::GetMono { seat }));
match res {
Response::GetMono { mono } => mono,
_ => {
log::error!("Server did not send a response to a get_mono request");
false
}
}
}
pub fn split(&self, seat: Seat) -> Axis {
let res = self.with_response(|| self.send(&ClientMessage::GetSplit { seat }));
match res {
@ -246,6 +257,10 @@ impl Client {
self.send(&ClientMessage::SetBorderWidth { width })
}
pub fn set_mono(&self, seat: Seat, mono: bool) {
self.send(&ClientMessage::SetMono { seat, mono });
}
pub fn set_split(&self, seat: Seat, axis: Axis) {
self.send(&ClientMessage::SetSplit { seat, axis });
}

View file

@ -65,6 +65,13 @@ pub enum ClientMessage<'a> {
seat: Seat,
axis: Axis,
},
GetMono {
seat: Seat,
},
SetMono {
seat: Seat,
mono: bool,
},
RemoveSeat {
seat: Seat,
},
@ -136,6 +143,7 @@ pub enum Response {
None,
GetSeats { seats: Vec<Seat> },
GetSplit { axis: Axis },
GetMono { mono: bool },
GetRepeatRate { rate: i32, delay: i32 },
ParseKeymap { keymap: Keymap },
CreateSeat { seat: Seat },

View file

@ -104,6 +104,16 @@ impl Seat {
get!().seat_set_repeat_rate(self, rate, delay)
}
pub fn mono(self) -> bool {
let mut res = false;
(|| res = get!().mono(self))();
res
}
pub fn set_mono(self, mono: bool) {
get!().set_mono(self, mono)
}
pub fn split(self) -> Axis {
let mut res = Axis::Horizontal;
(|| res = get!().split(self))();