static bool
handle_keybinding(struct server *server, uint32_t modifiers, xkb_keysym_t sym, xkb_keycode_t code)
{
+ uint32_t evdev_scancode = code - 8;
+
struct keybind *keybind;
wl_list_for_each(keybind, &rc.keybinds, link) {
if (modifiers ^ keybind->modifiers) {
if (sym == XKB_KEY_NoSymbol) {
/* Use keycodes */
for (size_t i = 0; i < keybind->keycodes_len; i++) {
+ /*
+ * Update key-state before action_run() because
+ * the action might lead to seat_focus() in
+ * which case we pass the 'pressed-sent' keys to
+ * the new surface.
+ */
if (keybind->keycodes[i] == code) {
+ key_state_store_pressed_key_as_bound(evdev_scancode);
actions_run(NULL, server, &keybind->actions, 0);
return true;
}
/* Use syms */
for (size_t i = 0; i < keybind->keysyms_len; i++) {
if (xkb_keysym_to_lower(sym) == keybind->keysyms[i]) {
+ key_state_store_pressed_key_as_bound(evdev_scancode);
actions_run(NULL, server, &keybind->actions, 0);
return true;
}
if (server->input_mode == LAB_INPUT_STATE_MENU) {
if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
+ key_state_store_pressed_key_as_bound(event->keycode);
handle_menu_keys(server, &translated);
}
- handled = true;
- goto out;
+ return true;
}
if (server->osd_state.cycle_view) {
handled |= handle_keybinding(server, modifiers, XKB_KEY_NoSymbol, keycode);
if (handled) {
wlr_log(WLR_DEBUG, "keycodes matched");
- goto out;
+ return true;
}
/* Then fall back to keysyms */
}
if (handled) {
wlr_log(WLR_DEBUG, "translated keysyms matched");
- goto out;
+ return true;
}
/* And finally test for keysyms without modifier */
}
if (handled) {
wlr_log(WLR_DEBUG, "raw keysyms matched");
+ return true;
}
}