On Sat, Mar 15, 2025 at 07:53:56PM +0100, Adam Purkrt wrote:
> 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 | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/dmenu.c b/dmenu.c
> index 804da64..fd49549 100644
> --- a/dmenu.c
> +++ b/dmenu.c
> _AT_@ -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)
> --
> 2.48.1
>
>
Pushed, thanks for the patch!
--
Kind regards,
Hiltjo
Received on Mon Mar 17 2025 - 21:02:26 CET