]> Pileus Git - ~andy/gtk/commitdiff
Avoid spurious core pointer events when the tablet pen is lifted.
authorRobert Ögren <gtk@roboros.com>
Thu, 28 Jul 2005 21:53:07 +0000 (21:53 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Thu, 28 Jul 2005 21:53:07 +0000 (21:53 +0000)
2005-07-28  Robert Ögren  <gtk@roboros.com>

Avoid spurious core pointer events when the tablet pen is lifted.
(#167000)

* gdk/win32/gdkinput-win32.c (set_ignore_core): New static function,
handles delayed unsetting of _gdk_input_ignore_core.
(_gdk_input_other_event): Call set_ignore_core instead of setting
_gdk_input_ignore_core directly.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-8
gdk/win32/gdkinput-win32.c

index ad780637dbf28673a1567fecdaeafe730724f7d4..c3a1e4c2c5b6d32ea942116eee79dc6e4bdb68f8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-07-28  Robert Ögren  <gtk@roboros.com>
+
+       Avoid spurious core pointer events when the tablet pen is lifted.
+       (#167000)
+
+       * gdk/win32/gdkinput-win32.c (set_ignore_core): New static function,
+       handles delayed unsetting of _gdk_input_ignore_core.
+       (_gdk_input_other_event): Call set_ignore_core instead of setting
+       _gdk_input_ignore_core directly.
+
 2005-07-28  Dom Lachowicz <cinamod@hotmail.com>
 
        * modules/engines/ms-windows/*: Re-sync with gtk-wimp CVS. Notable
index ad780637dbf28673a1567fecdaeafe730724f7d4..c3a1e4c2c5b6d32ea942116eee79dc6e4bdb68f8 100644 (file)
@@ -1,3 +1,13 @@
+2005-07-28  Robert Ögren  <gtk@roboros.com>
+
+       Avoid spurious core pointer events when the tablet pen is lifted.
+       (#167000)
+
+       * gdk/win32/gdkinput-win32.c (set_ignore_core): New static function,
+       handles delayed unsetting of _gdk_input_ignore_core.
+       (_gdk_input_other_event): Call set_ignore_core instead of setting
+       _gdk_input_ignore_core directly.
+
 2005-07-28  Dom Lachowicz <cinamod@hotmail.com>
 
        * modules/engines/ms-windows/*: Re-sync with gtk-wimp CVS. Notable
index ad780637dbf28673a1567fecdaeafe730724f7d4..c3a1e4c2c5b6d32ea942116eee79dc6e4bdb68f8 100644 (file)
@@ -1,3 +1,13 @@
+2005-07-28  Robert Ögren  <gtk@roboros.com>
+
+       Avoid spurious core pointer events when the tablet pen is lifted.
+       (#167000)
+
+       * gdk/win32/gdkinput-win32.c (set_ignore_core): New static function,
+       handles delayed unsetting of _gdk_input_ignore_core.
+       (_gdk_input_other_event): Call set_ignore_core instead of setting
+       _gdk_input_ignore_core directly.
+
 2005-07-28  Dom Lachowicz <cinamod@hotmail.com>
 
        * modules/engines/ms-windows/*: Re-sync with gtk-wimp CVS. Notable
index 25c4fd77bba475059fbf39c9eee5fdb3afacf74c..c7bb9a3aa6ceb3ca276c949c3b2997c436ec6212 100644 (file)
@@ -45,6 +45,8 @@
 
 #define DEBUG_WINTAB 1         /* Verbose debug messages enabled */
 
+#define PROXIMITY_OUT_DELAY 200 /* In milliseconds, see set_ignore_core */
+
 #endif
 
 #if defined(HAVE_WINTAB) || defined(HAVE_WHATEVER_OTHER)
@@ -652,6 +654,47 @@ get_modifier_key_state (void)
   return state;
 }
 
+#ifdef HAVE_WINTAB
+
+static guint ignore_core_timer = 0;
+
+static gboolean
+ignore_core_timefunc (gpointer data)
+{
+  /* The delay has passed */
+  _gdk_input_ignore_core = FALSE;
+  ignore_core_timer = 0;
+
+  return FALSE; /* remove timeout */
+}
+
+/*
+ * Set or unset the _gdk_input_ignore_core variable that tells GDK
+ * to ignore events for the core pointer when the tablet is in proximity
+ * The unsetting is delayed slightly so that if a tablet event arrives
+ * just after proximity out, it does not cause a core pointer event
+ * which e.g. causes GIMP to switch tools.
+ */
+static void
+set_ignore_core (gboolean ignore)
+{
+  if (ignore)
+    {
+      _gdk_input_ignore_core = TRUE;
+      /* Remove any pending clear */
+      if (ignore_core_timer)
+        {
+         g_source_remove (ignore_core_timer);
+         ignore_core_timer = 0;
+       }
+    }
+  else
+    if (!ignore_core_timer)
+      ignore_core_timer = g_timeout_add (PROXIMITY_OUT_DELAY,
+                                        ignore_core_timefunc, NULL);
+}
+#endif /* HAVE_WINTAB */
+
 gboolean 
 _gdk_input_other_event (GdkEvent  *event,
                        MSG       *msg,
@@ -934,12 +977,12 @@ _gdk_input_other_event (GdkEvent  *event,
       if (LOWORD (msg->lParam) == 0)
        {
          event->proximity.type = GDK_PROXIMITY_OUT;
-         _gdk_input_ignore_core = FALSE;
+         set_ignore_core (FALSE);
        }
       else
        {
          event->proximity.type = GDK_PROXIMITY_IN;
-         _gdk_input_ignore_core = TRUE;
+         set_ignore_core (TRUE);
        }
       event->proximity.time = _gdk_win32_get_next_tick (msg->time);
       event->proximity.device = &gdkdev->info;