diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2021-10-20 08:58:53 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2021-10-20 08:58:53 +0200 |
commit | e461189f0e67f237d7bfb8280b58a6881cf914d0 (patch) | |
tree | 8d092782b37427c5faefe3356f02d370615026d0 | |
parent | 85a30d20c373383fdec7740ed655f8a9a6da5efd (diff) | |
download | tdv-e461189f0e67f237d7bfb8280b58a6881cf914d0.tar.gz tdv-e461189f0e67f237d7bfb8280b58a6881cf914d0.tar.xz tdv-e461189f0e67f237d7bfb8280b58a6881cf914d0.zip |
sdgui: ignore Caps Lock for accelerators
-rw-r--r-- | src/sdgui.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/sdgui.c b/src/sdgui.c index d40d2d3..3c16acc 100644 --- a/src/sdgui.c +++ b/src/sdgui.c @@ -171,7 +171,9 @@ accelerate_hamburger (GdkEvent *event) GdkModifierType mods = 0; gtk_accelerator_parse (accelerator, &key, &mods); g_free (accelerator); - if (!key || event->key.keyval != key || event->key.state != mods) + + guint mask = gtk_accelerator_get_default_mod_mask (); + if (!key || event->key.keyval != key || (event->key.state & mask) != mods) return FALSE; gtk_button_clicked (GTK_BUTTON (g.hamburger)); @@ -187,7 +189,8 @@ on_key_press (G_GNUC_UNUSED GtkWidget *widget, GdkEvent *event, if (accelerate_hamburger (event)) return TRUE; - if (event->key.state == GDK_CONTROL_MASK) + guint mods = event->key.state & gtk_accelerator_get_default_mod_mask (); + if (mods == GDK_CONTROL_MASK) { // Can't use gtk_widget_add_accelerator() to change-current-page(-1/+1) // because that signal has arguments, which cannot be passed. @@ -202,7 +205,7 @@ on_key_press (G_GNUC_UNUSED GtkWidget *widget, GdkEvent *event, return TRUE; } } - if (event->key.state == GDK_MOD1_MASK) + if (mods == GDK_MOD1_MASK) { if (event->key.keyval >= GDK_KEY_0 && event->key.keyval <= GDK_KEY_9) |