Index: gtk/gtkdnd.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkdnd.c,v
retrieving revision 1.153
diff -u -p -r1.153 gtkdnd.c
--- gtk/gtkdnd.c	27 Apr 2006 05:16:43 -0000	1.153
+++ gtk/gtkdnd.c	28 Dec 2006 11:02:07 -0000
@@ -354,6 +354,7 @@ gtk_drag_get_ipc_widget (GdkScreen *scre
   GtkWidget *result;
   GSList *drag_widgets = g_object_get_data (G_OBJECT (screen), 
 					    "gtk-dnd-ipc-widgets");
+  GdkDisplay *display = gdk_screen_get_display (screen);
   
   if (drag_widgets)
     {
@@ -371,6 +372,8 @@ gtk_drag_get_ipc_widget (GdkScreen *scre
       gtk_widget_show (result);
     }
 
+  g_object_set_data (G_OBJECT (display), "gtk-dnd-ipc-widget", result);
+
   return result;
 }
 
@@ -388,10 +391,15 @@ gtk_drag_release_ipc_widget (GtkWidget *
   GdkScreen *screen = gtk_widget_get_screen (widget);
   GSList *drag_widgets = g_object_get_data (G_OBJECT (screen),
 					    "gtk-dnd-ipc-widgets");
+  GdkDisplay *display = gdk_screen_get_display (screen);
+  GtkWidget *current_drag_widget = g_object_get_data (G_OBJECT (display),
+						      "gtk-dnd-ipc-widget");
   drag_widgets = g_slist_prepend (drag_widgets, widget);
   g_object_set_data (G_OBJECT (screen),
 		     I_("gtk-dnd-ipc-widgets"),
 		     drag_widgets);
+  if (current_drag_widget == widget)
+    g_object_set_data (G_OBJECT (display), "gtk-dnd-ipc-widget", NULL);
 }
 
 static guint32
@@ -2185,8 +2193,6 @@ gtk_drag_begin_internal (GtkWidget      
       return NULL;
     }
 
-  gdk_keyboard_grab (ipc_widget->window, FALSE, time);
-    
   /* We use a GTK grab here to override any grabs that the widget
    * we are dragging from might have held
    */
Index: gtk/gtkmain.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmain.c,v
retrieving revision 1.282
diff -u -p -r1.282 gtkmain.c
--- gtk/gtkmain.c	23 Nov 2006 22:10:03 -0000	1.282
+++ gtk/gtkmain.c	28 Dec 2006 11:02:10 -0000
@@ -1351,8 +1351,11 @@ rewrite_event_for_grabs (GdkEvent *event
     case GDK_KEY_PRESS:
     case GDK_KEY_RELEASE:
       display = gdk_drawable_get_display (event->key.window);
-      if (!gdk_keyboard_grab_info_libgtk_only (display, &grab_window, &owner_events) ||
-	  !owner_events)
+      grab_widget = g_object_get_data (G_OBJECT (display), "gtk-dnd-ipc-widget");
+      if (grab_widget != NULL)
+	grab_window = grab_widget->window;
+      else if (!gdk_keyboard_grab_info_libgtk_only (display, &grab_window, &owner_events) ||
+	       !owner_events)
 	return NULL;
       break;
 
