Keyboard: eat key before running mapping
To see why this is needed, compare the following flows:
- user: press key 'j' with Super already pressed
- Keyboard: handle mapping, focusing next view
- Seat: send wl_keyboard.enter with keys Super and 'j'
- Keyboard: eat key 'j'
versus:
- user: press key 'j' with Super already pressed
- Keyboard: eat key 'j'
- Keyboard: handle mapping, focusing next view
- Seat: send wl_keyboard.enter with key Super.
The necessity of this was already mentioned in 1e3b8ed1; however,
without a comment in code, it was removed in 393bfb42
as superfluous.
Hopefully, the newly added comment will prevent such mistakes in the
future.
Fixes https://github.com/riverwm/river/issues/978
This commit is contained in:
@ -359,6 +359,25 @@ pub fn enterMode(self: *Self, mode_id: u32) void {
|
||||
}
|
||||
}
|
||||
|
||||
/// Is there a user-defined mapping for passed keycode, modifiers and keyboard state?
|
||||
pub fn hasMapping(
|
||||
self: *Self,
|
||||
keycode: xkb.Keycode,
|
||||
modifiers: wlr.Keyboard.ModifierMask,
|
||||
released: bool,
|
||||
xkb_state: *xkb.State,
|
||||
) bool {
|
||||
const modes = &server.config.modes;
|
||||
for (modes.items[self.mode_id].mappings.items) |*mapping| {
|
||||
if (mapping.match(keycode, modifiers, released, xkb_state, .no_translate) or
|
||||
mapping.match(keycode, modifiers, released, xkb_state, .translate))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Handle any user-defined mapping for passed keycode, modifiers and keyboard state
|
||||
/// Returns true if a mapping was run
|
||||
pub fn handleMapping(
|
||||
|
Reference in New Issue
Block a user