Index: gdk/win32/gdkinput-win32.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/win32/gdkinput-win32.c,v
retrieving revision 1.50.2.2
diff -u -r1.50.2.2 gdkinput-win32.c
--- gdk/win32/gdkinput-win32.c	25 Feb 2005 00:09:52 -0000	1.50.2.2
+++ gdk/win32/gdkinput-win32.c	17 Mar 2005 18:11:07 -0000
@@ -726,6 +726,46 @@
   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 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 (500, ignore_core_timefunc, NULL);
+}
+#endif /* HAVE_WINTAB */
+
 gboolean 
 _gdk_input_other_event (GdkEvent  *event,
 			MSG       *msg,
@@ -1030,12 +1070,12 @@
       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;
