diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 8dec80c..40f83ab 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -1435,6 +1435,18 @@ propagate (GdkWindow  **window,
     }
 }
 
+/* This is needed back for blocking WM_MOUSEMOVE when using extended devices */
+static gboolean
+doesnt_want_button_motion (gint mask,
+			   MSG *msg)
+{
+  return !((mask & GDK_POINTER_MOTION_MASK) ||
+	   ((msg->wParam & (MK_LBUTTON|MK_MBUTTON|MK_RBUTTON)) && (mask & GDK_BUTTON_MOTION_MASK)) ||
+	   ((msg->wParam & MK_LBUTTON) && (mask & GDK_BUTTON1_MOTION_MASK)) ||
+	   ((msg->wParam & MK_MBUTTON) && (mask & GDK_BUTTON2_MOTION_MASK)) ||
+	   ((msg->wParam & MK_RBUTTON) && (mask & GDK_BUTTON3_MOTION_MASK)));
+}
+
 static gboolean
 doesnt_want_key (gint mask,
 		 MSG *msg)
@@ -2261,6 +2273,7 @@ gdk_event_translate (MSG  *msg,
       if (GDK_WINDOW_DESTROYED (window))
 	break;
 
+
       /* TODO_CSW? Emulate X11's automatic active grab */
       generate_button_event (GDK_BUTTON_PRESS, button,
 			     window, msg);
@@ -2336,6 +2349,17 @@ gdk_event_translate (MSG  *msg,
       if (msg->pt.x + _gdk_offset_x == current_root_x &&
 	  msg->pt.y + _gdk_offset_y == current_root_y)
 	break;
+      
+      /* This is needed in order to block this message when 
+       * using extended input devices, like tablets 
+       */
+
+      if (!propagate (&window, msg,
+		     _gdk_display->keyboard_grab.window,
+		     _gdk_display->keyboard_grab.owner_events,
+		     GDK_ALL_EVENTS_MASK,
+                     doesnt_want_button_motion, TRUE))
+        break;      
 
       current_root_x = msg->pt.x + _gdk_offset_x;
       current_root_y = msg->pt.y + _gdk_offset_y;
