[gtk+] Filter out events that the current window didn't select for



commit 67728ac004eff3cb2175a8c1db9bfbc749985cda
Author: Thomas Jaeger <ThJaeger gmail com>
Date:   Tue Sep 29 02:14:12 2009 -0400

    Filter out events that the current window didn't select for
    
    Signed-off-by: Thomas Jaeger <ThJaeger gmail com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=588649

 gdk/x11/gdkinput-x11.c    |   49 +++++++++++++++++++++++++++++++++++++++++++++
 gdk/x11/gdkinput-xfree.c  |    2 +-
 gdk/x11/gdkinputprivate.h |    3 ++
 3 files changed, 53 insertions(+), 1 deletions(-)
---
diff --git a/gdk/x11/gdkinput-x11.c b/gdk/x11/gdkinput-x11.c
index 5f1e3df..37841b1 100644
--- a/gdk/x11/gdkinput-x11.c
+++ b/gdk/x11/gdkinput-x11.c
@@ -702,6 +702,55 @@ _gdk_input_common_other_event (GdkEvent         *event,
 }
 
 gboolean
+_gdk_input_common_event_selected (GdkEvent         *event,
+				  GdkWindow        *window,
+				  GdkDevicePrivate *gdkdev)
+{
+  GdkWindowObject *priv = (GdkWindowObject *) window;
+
+  switch (event->type) {
+    case GDK_BUTTON_PRESS:
+      return priv->extension_events & GDK_BUTTON_PRESS_MASK;
+
+    case GDK_BUTTON_RELEASE:
+      return priv->extension_events & GDK_BUTTON_RELEASE_MASK;
+
+    case GDK_KEY_PRESS:
+      return priv->extension_events & GDK_KEY_PRESS_MASK;
+
+    case GDK_KEY_RELEASE:
+      return priv->extension_events & GDK_KEY_RELEASE_MASK;
+
+    case GDK_MOTION_NOTIFY:
+      if (priv->extension_events & GDK_POINTER_MOTION_MASK)
+	return TRUE;
+      if (gdkdev->button_count && (priv->extension_events & GDK_BUTTON_MOTION_MASK))
+	return TRUE;
+
+      if ((gdkdev->button_state[0] & 1 << 1) && (priv->extension_events & GDK_BUTTON1_MOTION_MASK))
+	return TRUE;
+      if ((gdkdev->button_state[0] & 1 << 2) && (priv->extension_events & GDK_BUTTON2_MOTION_MASK))
+	return TRUE;
+      if ((gdkdev->button_state[0] & 1 << 3) && (priv->extension_events & GDK_BUTTON3_MOTION_MASK))
+	return TRUE;
+
+      return FALSE;
+
+    case GDK_PROXIMITY_IN:
+	  return priv->extension_events & GDK_PROXIMITY_IN_MASK;
+
+    case GDK_PROXIMITY_OUT:
+	  return priv->extension_events & GDK_PROXIMITY_OUT_MASK;
+
+    default:
+      return FALSE;
+  }
+
+
+}
+
+
+gboolean
 _gdk_device_get_history (GdkDevice         *device,
 			 GdkWindow         *window,
 			 guint32            start,
diff --git a/gdk/x11/gdkinput-xfree.c b/gdk/x11/gdkinput-xfree.c
index 4d590ea..d0f217c 100644
--- a/gdk/x11/gdkinput-xfree.c
+++ b/gdk/x11/gdkinput-xfree.c
@@ -291,7 +291,7 @@ _gdk_input_other_event (GdkEvent *event,
       display->ignore_core_events)
     gdk_input_check_proximity (GDK_WINDOW_DISPLAY (window));
 
-  return TRUE;
+  return _gdk_input_common_event_selected(event, window, gdkdev);
 }
 
 gint
diff --git a/gdk/x11/gdkinputprivate.h b/gdk/x11/gdkinputprivate.h
index aeb440e..51233c7 100644
--- a/gdk/x11/gdkinputprivate.h
+++ b/gdk/x11/gdkinputprivate.h
@@ -179,6 +179,9 @@ gint               _gdk_input_common_other_event        (GdkEvent         *event
 							 XEvent           *xevent,
 							 GdkWindow        *window,
 							 GdkDevicePrivate *gdkdev);
+gboolean	   _gdk_input_common_event_selected     (GdkEvent         *event,
+							 GdkWindow        *window,
+							 GdkDevicePrivate *gdkdev);
 
 #endif /* !XINPUT_NONE */
 



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