[rhythmbox: 1/2] application: make keyboard shortcuts work when lock modifiers are set




commit f19be5337f7f9eeff996c20bc1f9fd8291054c25
Author: crvi <crvisqr gmail com>
Date:   Thu Feb 18 06:25:04 2021 +0530

    application: make keyboard shortcuts work when lock modifiers are set
    
    Ignore key modifiers which are valid, but not significant as keyboard
    accelerators for a GTK application. This would include num lock, caps
    lock etc. This should fix issues of rhythmbox shortcuts not working
    sometimes.

 shell/rb-application.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/shell/rb-application.c b/shell/rb-application.c
index 8492bb03b..5feaa3781 100644
--- a/shell/rb-application.c
+++ b/shell/rb-application.c
@@ -901,13 +901,18 @@ rb_application_activate_key (RBApplication *app, GdkEventKey *event)
        GList *l;
        GtkWidget *window;
        gboolean ret = FALSE;
+       guint event_keyval;
+       GdkModifierType event_mods;
 
        g_object_get (app->priv->shell, "window", &window, NULL);
 
+       event_keyval = gdk_keyval_to_lower (event->keyval);
+       event_mods = (gtk_accelerator_get_default_mod_mask () & event->state);
+
        for (l = app->priv->accelerators; l != NULL; l = l->next) {
                RBApplicationAccel *accel = l->data;
-               if (accel->keyval == event->keyval &&
-                   accel->mods == event->state) {
+               if (accel->keyval == event_keyval &&
+                   accel->mods == event_mods) {
                        GActionGroup *group;
 
                        group = gtk_widget_get_action_group (window, accel->prefix);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]