[epiphany/gnome-3-18] window: Fix key event state comparisons



commit 41794b089c1b0fa4d8fc7946efd96df4be8af74f
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Tue Nov 22 18:38:01 2016 -0600

    window: Fix key event state comparisons
    
    GDK can set random bits in the state to indicate internal stuff. We have
    to use GDK_MODIFIER_MASK to mask out its reserved values before trying
    to look at the state.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772437

 src/ephy-window.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 33ae717..0b6e833 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -786,6 +786,7 @@ static gboolean
 ephy_window_bound_accels (GtkWidget *widget,
                          GdkEventKey *event)
 {
+<<<<<<< HEAD
        EphyWindow *window = EPHY_WINDOW (widget);
        EphyWindowPrivate *priv = window->priv;
        guint modifier = event->state & gtk_accelerator_get_default_mod_mask ();
@@ -838,7 +839,7 @@ ephy_window_bound_accels (GtkWidget *widget,
 static gboolean
 should_web_view_receive_key_press_event (GdkEventKey *event)
 {
-       if (event->state == GDK_CONTROL_MASK)
+       if ((event->state & GDK_MODIFIER_MASK) == GDK_CONTROL_MASK)
                return event->keyval != GDK_KEY_n &&
                       event->keyval != GDK_KEY_q &&
                       event->keyval != GDK_KEY_t &&
@@ -848,7 +849,7 @@ should_web_view_receive_key_press_event (GdkEventKey *event)
                       event->keyval != GDK_KEY_Page_Down &&
                       event->keyval != GDK_KEY_KP_3;
 
-       if (event->state == (GDK_SHIFT_MASK | GDK_CONTROL_MASK))
+       if ((event->state & GDK_MODIFIER_MASK) == (GDK_SHIFT_MASK | GDK_CONTROL_MASK))
                return event->keyval != GDK_KEY_N &&
                       event->keyval != GDK_KEY_T &&
                       event->keyval != GDK_KEY_Page_Up &&
@@ -856,7 +857,7 @@ should_web_view_receive_key_press_event (GdkEventKey *event)
                       event->keyval != GDK_KEY_Page_Down &&
                       event->keyval != GDK_KEY_KP_3;
 
-       if (event->state == GDK_MOD1_MASK)
+       if ((event->state & GDK_MODIFIER_MASK) == GDK_MOD1_MASK)
                return event->keyval != GDK_KEY_Left &&
                       event->keyval != GDK_KEY_Right;
 


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