[epiphany/gnome-3-20] window: Fix key event state comparisons
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/gnome-3-20] window: Fix key event state comparisons
- Date: Wed, 23 Nov 2016 02:41:06 +0000 (UTC)
commit 8192d80eb64fcc83735fb7cfa795b69241b3d3a7
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 | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 2935a21..50ae36a 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -793,7 +793,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 &&
@@ -803,7 +803,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 &&
@@ -811,7 +811,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]