From 779efe1cf99a35c8c0260f190194e6118dc4d066 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 | 7 ++++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/config.def.h b/config.def.h index 3e3ead3..bd69982 100644 --- a/config.def.h +++ b/config.def.h @@ -181,13 +181,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 cfc1b41..6b57359 100644 --- a/dwl.c +++ b/dwl.c @@ -300,6 +300,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 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); @@ -1573,7 +1574,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++) { @@ -1587,7 +1588,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; @@ -1600,7 +1601,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