[nautilus: 1/2] rename-file-popover: fix key event state checking



commit 0f8c18520977d6ed0a7e7e1cfc9cfe6bbf42995c
Author: Ernestas Kulik <ernestask gnome org>
Date:   Fri Dec 8 16:59:08 2017 +0200

    rename-file-popover: fix key event state checking
    
    Currently, when checking if the user pressed ctrl-z, an equality check
    is used on the state to determine whether the ctrl key is pressed. That
    does not work, however, as there may be other modifier masks applied, be
    it internal GDK values or mapping of num lock to mod2.
    
    That is fixed by using binary AND on the state with the relevant mask.
    
    Closes #149.

 src/nautilus-rename-file-popover-controller.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/nautilus-rename-file-popover-controller.c b/src/nautilus-rename-file-popover-controller.c
index 09d5d7980..83a13d6d9 100644
--- a/src/nautilus-rename-file-popover-controller.c
+++ b/src/nautilus-rename-file-popover-controller.c
@@ -195,7 +195,7 @@ name_entry_on_key_pressed (GtkWidget *widget,
         return name_entry_on_f2_pressed (widget, self);
     }
     else if (key_event->keyval == GDK_KEY_z &&
-             key_event->state == GDK_CONTROL_MASK)
+             (key_event->state & GDK_CONTROL_MASK) != 0)
     {
         return name_entry_on_undo (widget, self);
     }


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