diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c
index 81bd5b6..386fcba 100644
--- a/demos/gtk-demo/main.c
+++ b/demos/gtk-demo/main.c
@@ -945,6 +945,9 @@ main (int argc, char **argv)
     }
   /* -- End of hack -- */
   
+  if (g_getenv ("XI1"))
+    gdk_disable_multidevice ();
+
   gtk_init (&argc, &argv);
 
   setup_default_icon ();
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index 6fcc172..1a54660 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -84,7 +84,7 @@ static void         gdk_x11_device_manager_xi2_select_window_events (GdkEventTra
                                                                      GdkEventMask        event_mask);
 
 
-G_DEFINE_TYPE_WITH_CODE (GdkX11DeviceManagerXI2, gdk_x11_device_manager_xi2, GDK_TYPE_DEVICE_MANAGER,
+G_DEFINE_TYPE_WITH_CODE (GdkX11DeviceManagerXI2, gdk_x11_device_manager_xi2, GDK_TYPE_X11_DEVICE_MANAGER_CORE,
                          G_IMPLEMENT_INTERFACE (GDK_TYPE_EVENT_TRANSLATOR,
                                                 gdk_x11_device_manager_xi2_event_translator_init))
 
@@ -993,6 +993,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
                                             XEvent             *xevent)
 {
   GdkX11DeviceManagerXI2 *device_manager;
+  GdkEventTranslatorIface *parent_iface;
   XGenericEventCookie *cookie;
   gboolean return_val = TRUE;
   GdkWindow *window;
@@ -1003,6 +1004,19 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
   device_manager = (GdkX11DeviceManagerXI2 *) translator;
   cookie = &xevent->xcookie;
 
+  parent_iface = g_type_interface_peek_parent (GDK_EVENT_TRANSLATOR_GET_IFACE (translator));
+
+  if (xevent->type == KeyPress && xevent->xkey.keycode == 0 &&
+      parent_iface->translate_event (translator, display, event, xevent))
+    {
+      /* the core device manager sets a core device on the event,
+       * we need to override that with some XI2 device
+       */
+      gdk_event_set_device (event, gdk_x11_device_manager_xi2_get_client_pointer (device_manager));
+
+      return TRUE;
+    }
+
   if (!XGetEventData (dpy, cookie))
     return FALSE;
 
diff --git a/gdk/x11/gdkeventsource.c b/gdk/x11/gdkeventsource.c
index ec18202..9e1ac01 100644
--- a/gdk/x11/gdkeventsource.c
+++ b/gdk/x11/gdkeventsource.c
@@ -284,9 +284,14 @@ _gdk_x11_display_queue_events (GdkDisplay *display)
         case KeyPress:
         case KeyRelease:
           break;
-        default:
+        default: ;
+#if 0
           if (XFilterEvent (&xevent, None))
+{
+g_print ("filtered away a  %d event\n", xevent.type);
             continue;
+}
+#endif
         }
 
       event = gdk_event_source_translate_event (event_source, &xevent);
diff --git a/modules/input/gtkimcontextxim.c b/modules/input/gtkimcontextxim.c
index a6adf9f..895e872 100644
--- a/modules/input/gtkimcontextxim.c
+++ b/modules/input/gtkimcontextxim.c
@@ -717,7 +717,12 @@ gtk_im_context_xim_filter_keypress (GtkIMContext *context,
   xevent.state = event->state;
   xevent.keycode = event->hardware_keycode;
   xevent.same_screen = True;
-  
+
+  g_print ("%s event: display %s, window %x state %d\n",
+           (event->type == GDK_KEY_PRESS) ? "press" : "release",
+           DisplayString (xevent.display),
+           xevent.window,
+           xevent.state);
   if (XFilterEvent ((XEvent *)&xevent, GDK_WINDOW_XID (context_xim->client_window)))
     return TRUE;
   
