]> Skullheadx's Git Forge - dmenu.git/commitdiff
XUngrabKeyboard() instead of XUngrabKey()
authorAdam Purkrt <adam@purkrt.cz>
Sat, 15 Mar 2025 18:53:56 +0000 (19:53 +0100)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Mon, 17 Mar 2025 20:01:05 +0000 (21:01 +0100)
XUngrabKey(), which is currently used in cleanup(), is not the right
counterpart to XGrabKeyboard(), which is used in grabkeyboard(),
called from main().

XUngrabKeyboard() is the function to use, as grabbing the whole
keyboard is different to grabbing individual keys.

With the current code the keyboard gets ungrabbed, as far as I can tell,
only by the final XCloseDisplay() in cleanup(), as the XUngrabKey()
there effectively does nothing.

dmenu.c

diff --git a/dmenu.c b/dmenu.c
index 804da6417935b03c29b062a8d75eeb958660d505..fd49549caf05f0329336679236ef124e0e7a1ee4 100644 (file)
--- a/dmenu.c
+++ b/dmenu.c
@@ -100,7 +100,7 @@ cleanup(void)
 {
        size_t i;
 
-       XUngrabKey(dpy, AnyKey, AnyModifier, root);
+       XUngrabKeyboard(dpy, CurrentTime);
        for (i = 0; i < SchemeLast; i++)
                free(scheme[i]);
        for (i = 0; items && items[i].text; ++i)