From da27c652223910d2ecedf79ad167d8287eb5e7e5 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Sun, 28 Apr 2024 09:26:37 +0200 Subject: [PATCH] Fix modes code to support keycodes patch --- config.def.h | 14 +++++++------- dwl.c | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/config.def.h b/config.def.h index 4de08af..f565161 100644 --- a/config.def.h +++ b/config.def.h @@ -176,13 +176,13 @@ static const Key keys[] = { static const Modekey modekeys[] = { /* mode modifier key function argument */ - { BROWSER, { 0, XKB_KEY_f, spawn, SHCMD("firefox") } }, - { BROWSER, { 0, XKB_KEY_f, entermode, {.i = NORMAL} } }, - { BROWSER, { 0, XKB_KEY_b, spawn, SHCMD("brave") } }, - { BROWSER, { 0, XKB_KEY_b, entermode, {.i = NORMAL} } }, - { BROWSER, { 0, XKB_KEY_g, spawn, SHCMD("google-chrome-stable") } }, - { BROWSER, { 0, XKB_KEY_g, entermode, {.i = NORMAL} } }, - { BROWSER, { 0, XKB_KEY_Escape, entermode, {.i = NORMAL} } }, + { BROWSER, { 0, Key_f, spawn, SHCMD("firefox") } }, + { BROWSER, { 0, Key_f, entermode, {.i = NORMAL} } }, + { BROWSER, { 0, Key_b, spawn, SHCMD("brave") } }, + { BROWSER, { 0, Key_b, entermode, {.i = NORMAL} } }, + { BROWSER, { 0, Key_g, spawn, SHCMD("google-chrome-stable") } }, + { BROWSER, { 0, Key_g, entermode, {.i = NORMAL} } }, + { BROWSER, { 0, Key_Escape, entermode, {.i = NORMAL} } }, }; static const Button buttons[] = { diff --git a/dwl.c b/dwl.c index 9a47641..8c35374 100644 --- a/dwl.c +++ b/dwl.c @@ -292,7 +292,7 @@ static void incnmaster(const Arg *arg); static void inputdevice(struct wl_listener *listener, void *data); static int keybinding(uint32_t mods, xkb_keycode_t keycode); static int keybinding(uint32_t mods, xkb_keysym_t sym); -static int modekeybinding(uint32_t mods, xkb_keysym_t sym); +static int modekeybinding(uint32_t mods, xkb_keycode_t sym); static void keypress(struct wl_listener *listener, void *data); static void keypressmod(struct wl_listener *listener, void *data); static int keyrepeat(void *data); @@ -1448,7 +1448,7 @@ keybinding(uint32_t mods, xkb_keycode_t keycode) const Key *k; if (active_mode_index >= 0) { - return modekeybinding(mods, sym); + return modekeybinding(mods, keycode); } for (k = keys; k < END(keys); k++) { @@ -1462,7 +1462,7 @@ keybinding(uint32_t mods, xkb_keycode_t keycode) } int -modekeybinding(uint32_t mods, xkb_keysym_t sym) +modekeybinding(uint32_t mods, xkb_keycode_t keycode) { int handled = 0; const Modekey *mk; @@ -1475,7 +1475,7 @@ modekeybinding(uint32_t mods, xkb_keysym_t sym) k = &mk->key; if (CLEANMASK(mods) == CLEANMASK(k->mod) && - sym == k->keysym && k->func) { + keycode == k->keycode && k->func) { k->func(&k->arg); handled = 1; } -- 2.48.1