From 2be1c4755debb7f0193b3e321503eee5f3cf998e Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Thu, 7 Jun 2018 13:44:23 -0400 Subject: [PATCH] Unset Lock key masks when closing menu This addresses an issue that occurs when trying to close the menu using the configured shortcut without modifiers, but Lock keys (NumLock, etc) are enabled. Fixes #70 --- src/frontend/menu-keyboard.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/frontend/menu-keyboard.c b/src/frontend/menu-keyboard.c index 33c3e2e..81197d7 100644 --- a/src/frontend/menu-keyboard.c +++ b/src/frontend/menu-keyboard.c @@ -23,12 +23,17 @@ gboolean brisk_menu_window_key_press(BriskMenuWindow *self, GdkEvent *event, __brisk_unused__ gpointer v) { autofree(gchar) *accel_name = NULL; + GdkModifierType lock_masks = GDK_MOD2_MASK | GDK_LOCK_MASK | GDK_MOD5_MASK; + guint mods; if (!self->shortcut) { return GDK_EVENT_PROPAGATE; } - accel_name = gtk_accelerator_name(event->key.keyval, event->key.state); + /* Unset mask of the lock keys */ + mods = event->key.state & ~(lock_masks); + + accel_name = gtk_accelerator_name(event->key.keyval, mods); if (!accel_name || g_ascii_strcasecmp(self->shortcut, accel_name) != 0) { return GDK_EVENT_PROPAGATE; }