[gnome-software: 2/3] shell: Correctly check the Alt key is held




commit 706337205d171bd575ba29de0cbde0037441832d
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Wed Mar 2 07:14:06 2022 +0100

    shell: Correctly check the Alt key is held
    
    This allows Alt-based keyboard shortcuts to work even when NumLock is
    enabled.

 src/gs-shell.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index d8d9254e1..214a201c3 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -1019,9 +1019,10 @@ window_key_pressed_cb (GtkEventControllerKey *key_controller,
                        GsShell               *shell)
 {
        gboolean is_rtl = gtk_widget_get_direction (shell->button_back) == GTK_TEXT_DIR_RTL;
+       gboolean is_alt = (state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_ALT_MASK)) == GDK_ALT_MASK;
 
-       if ((!is_rtl && state == GDK_ALT_MASK && keyval == GDK_KEY_Left) ||
-           (is_rtl && state == GDK_ALT_MASK && keyval == GDK_KEY_Right) ||
+       if ((!is_rtl && is_alt && keyval == GDK_KEY_Left) ||
+           (is_rtl && is_alt && keyval == GDK_KEY_Right) ||
            keyval == GDK_KEY_Back) {
                go_back (shell);
                return GDK_EVENT_STOP;


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