config: allow destroying keymaps
This commit is contained in:
parent
3eb0f61ec1
commit
f1a3705699
4 changed files with 21 additions and 0 deletions
|
|
@ -782,6 +782,10 @@ impl Client {
|
|||
has
|
||||
}
|
||||
|
||||
pub fn destroy_keymap(&self, keymap: Keymap) {
|
||||
self.send(&ClientMessage::DestroyKeymap { keymap })
|
||||
}
|
||||
|
||||
pub fn seat_set_keymap(&self, seat: Seat, keymap: Keymap) {
|
||||
self.send(&ClientMessage::SeatSetKeymap { seat, keymap })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -382,6 +382,9 @@ pub enum ClientMessage<'a> {
|
|||
fds: Vec<(i32, i32)>,
|
||||
},
|
||||
DisableDefaultSeat,
|
||||
DestroyKeymap {
|
||||
keymap: Keymap,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
|
|
|||
|
|
@ -59,6 +59,15 @@ impl Keymap {
|
|||
pub fn is_invalid(self) -> bool {
|
||||
self == Self::INVALID
|
||||
}
|
||||
|
||||
/// Destroys this reference to the keymap.
|
||||
///
|
||||
/// Seats that are currently using this keymap are unaffected.
|
||||
pub fn destroy(self) {
|
||||
if self.is_valid() {
|
||||
get!().destroy_keymap(self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Parses a keymap.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue