mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-08 04:57:32 -04:00
make keybind handling much much safer
This commit is contained in:
parent
78da941645
commit
3b6685c25f
1 changed files with 10 additions and 8 deletions
|
|
@ -77,14 +77,16 @@ fn handleKey(_: *wl.Listener(*wlr.Keyboard.event.Key), event: *wlr.Keyboard.even
|
|||
|
||||
var handled = false;
|
||||
const modifiers = server.seat.keyboard_group.keyboard.getModifiers();
|
||||
for (server.seat.keyboard_group.keyboard.xkb_state.?.keyGetSyms(keycode)) |sym| {
|
||||
if (server.keymaps.get(Keymap.hash(modifiers, sym))) |map| {
|
||||
if (event.state == .pressed and map.lua_press_ref_idx > 0) {
|
||||
map.callback(false);
|
||||
handled = true;
|
||||
} else if (event.state == .released and map.lua_release_ref_idx > 0) {
|
||||
map.callback(true);
|
||||
handled = true;
|
||||
if (server.seat.keyboard_group.keyboard.xkb_state) |xkb_state| {
|
||||
for (xkb_state.keyGetSyms(keycode)) |sym| {
|
||||
if (server.keymaps.get(Keymap.hash(modifiers, sym))) |map| {
|
||||
if (event.state == .pressed and map.lua_press_ref_idx > 0) {
|
||||
map.callback(false);
|
||||
handled = true;
|
||||
} else if (event.state == .released and map.lua_release_ref_idx > 0) {
|
||||
map.callback(true);
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue