Keyboard: ignore >32 simultaneous key presses
wlroots implements this behavior with its key press tracking but continues to forward the events to the compositor. Matching the wlroots behavior here seems like the best way to avoid strange edge cases and this is unlikely to ever be an annoying limit in practice. Also take this oppurtunity to finally refactor away the hasMapping() function in a way that doesn't sacrifice correctness even when hitting this 32 key press limit.
This commit is contained in:
@ -355,25 +355,6 @@ 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