config: allow consuming/forwarding key events
This commit is contained in:
parent
6ee4fdb9f4
commit
18bc86d14f
12 changed files with 106 additions and 13 deletions
|
|
@ -903,6 +903,10 @@ impl Client {
|
|||
(rate, delay)
|
||||
}
|
||||
|
||||
pub fn set_forward(&self, seat: Seat, forward: bool) {
|
||||
self.send(&ClientMessage::SetForward { seat, forward })
|
||||
}
|
||||
|
||||
pub fn parse_keymap(&self, keymap: &str) -> Keymap {
|
||||
let res = self.send_with_response(&ClientMessage::ParseKeymap { keymap });
|
||||
get_response!(res, Keymap(0), ParseKeymap { keymap });
|
||||
|
|
|
|||
|
|
@ -436,6 +436,10 @@ pub enum ClientMessage<'a> {
|
|||
device: InputDevice,
|
||||
keymap: Keymap,
|
||||
},
|
||||
SetForward {
|
||||
seat: Seat,
|
||||
forward: bool,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
|
|
|||
|
|
@ -335,6 +335,26 @@ impl Seat {
|
|||
pub fn move_to_output(self, connector: Connector) {
|
||||
get!().move_to_output(WorkspaceSource::Seat(self), connector);
|
||||
}
|
||||
|
||||
/// Set whether the current key event is forwarded to the focused client.
|
||||
///
|
||||
/// This only has an effect if called from a keyboard shortcut.
|
||||
///
|
||||
/// By default, release events are forwarded and press events are consumed. Note that
|
||||
/// consuming release events can cause clients to get stuck in the pressed state.
|
||||
pub fn set_forward(self, forward: bool) {
|
||||
get!().set_forward(self, forward);
|
||||
}
|
||||
|
||||
/// This is a shorthand for `set_forward(true)`.
|
||||
pub fn forward(self) {
|
||||
self.set_forward(true)
|
||||
}
|
||||
|
||||
/// This is a shorthand for `set_forward(false)`.
|
||||
pub fn consume(self) {
|
||||
self.set_forward(false)
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns all seats.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue