Index: gsd-mouse-manager.c
===================================================================
--- gsd-mouse-manager.c	(revision 234)
+++ gsd-mouse-manager.c	(working copy)
@@ -424,21 +424,19 @@
                                                      NULL, NULL, NULL);
                 if (keyval == GDK_Control_L || keyval == GDK_Control_R) {
                         if (xev->type == KeyPress) {
-                                XAllowEvents (gdk_x11_get_default_xdisplay (),
+                                XAllowEvents (xev->xkey.display,
                                               SyncKeyboard,
                                               xev->xkey.time);
                         } else {
-                                XAllowEvents (gdk_x11_get_default_xdisplay (),
+                                XAllowEvents (xev->xkey.display,
                                               AsyncKeyboard,
                                               xev->xkey.time);
                                 gsd_locate_pointer (screen);
                         }
                 } else {
-                        XAllowEvents (gdk_x11_get_default_xdisplay (),
+                        XAllowEvents (xev->xkey.display,
                                       ReplayKeyboard,
                                       xev->xkey.time);
-                        XUngrabKeyboard (gdk_x11_get_default_xdisplay (),
-                                         xev->xkey.time);
                 }
         }
         return GDK_FILTER_CONTINUE;
