[gtk+/xi2: 125/148] Merge branch 'master' into xi2



commit 3a2f18ca5fd2ae7e072913ae2f78d1211627823f
Merge: a2f4e52... 7abd4d1...
Author: Carlos Garnacho <carlos gnome org>
Date:   Sat Nov 28 12:42:16 2009 +0100

    Merge branch 'master' into xi2
    
    Conflicts:
    	gdk/gdkwindowimpl.h
    	gdk/x11/gdkevents-x11.c
    	gdk/x11/gdkinput.c
    	gdk/x11/gdkwindow-x11.c

 NEWS                                               |   47 +
 configure.in                                       |    6 +-
 contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-drawable.c |   41 +-
 demos/gtk-demo/Makefile.am                         |    1 +
 demos/gtk-demo/printing.c                          |    3 +-
 demos/gtk-demo/toolpalette.c                       |  792 +++
 demos/testpixbuf-save.c                            |    4 +-
 docs/reference/gdk-pixbuf/gdk-pixbuf.types         |    2 +
 docs/reference/gtk/Makefile.am                     |    2 +
 docs/reference/gtk/gtk-docs.sgml                   |    2 +
 docs/reference/gtk/gtk-sections.txt                |   85 +
 docs/reference/gtk/gtk.types                       |    2 +
 docs/reference/gtk/images/toolpalette.png          |  Bin 0 -> 10010 bytes
 docs/reference/gtk/running.sgml                    |   31 +-
 docs/reference/gtk/tmpl/gtknotebook.sgml           |    7 +-
 docs/reference/gtk/tmpl/gtktexttag.sgml            |    4 +-
 docs/reference/gtk/tmpl/gtkuimanager.sgml          |    3 +-
 docs/reference/gtk/visual_index.xml                |    3 +
 docs/tools/widgets.c                               |   29 +
 docs/tutorial/gtk-tut.sgml                         |    6 +-
 examples/gtkdial/gtkdial.c                         |    2 +-
 examples/tictactoe/tictactoe.c                     |    2 +-
 gdk-pixbuf/io-ani-animation.c                      |    4 +-
 gdk-pixbuf/io-gdip-animation.c                     |    4 +-
 gdk-pixbuf/io-gif-animation.c                      |    4 +-
 gdk-pixbuf/io-jpeg.c                               |    1 +
 gdk/directfb/gdkcolor-directfb.c                   |    2 +-
 gdk/directfb/gdkdisplay-directfb.c                 |    2 +-
 gdk/directfb/gdkdnd-directfb.c                     |    2 +-
 gdk/directfb/gdkdrawable-directfb.c                |    2 +-
 gdk/directfb/gdkgc-directfb.c                      |    2 +-
 gdk/directfb/gdkimage-directfb.c                   |    2 +-
 gdk/directfb/gdkinput-directfb.c                   |    2 +-
 gdk/directfb/gdkpixmap-directfb.c                  |    2 +-
 gdk/directfb/gdkvisual-directfb.c                  |    2 +-
 gdk/directfb/gdkwindow-directfb.c                  |    6 +-
 gdk/gdkcolor.c                                     |   10 +-
 gdk/gdkdraw.c                                      |   11 +-
 gdk/gdkgc.c                                        |    4 +-
 gdk/gdkimage.c                                     |    9 +-
 gdk/gdktypes.h                                     |    6 +
 gdk/gdkwindow.c                                    |  228 +-
 gdk/gdkwindowimpl.h                                |    1 +
 gdk/quartz/gdkcolor-quartz.c                       |    2 +-
 gdk/quartz/gdkdnd-quartz.c                         |    2 +-
 gdk/quartz/gdkdrawable-quartz.c                    |    2 +-
 gdk/quartz/gdkgc-quartz.c                          |    2 +-
 gdk/quartz/gdkimage-quartz.c                       |    2 +-
 gdk/quartz/gdkinput-old.c                          |    2 +-
 gdk/quartz/gdkinput.c                              |    2 +-
 gdk/quartz/gdkpixmap-quartz.c                      |    2 +-
 gdk/quartz/gdkscreen-quartz.c                      |   34 +
 gdk/quartz/gdkvisual-quartz.c                      |    2 +-
 gdk/quartz/gdkwindow-quartz.c                      |    1 +
 gdk/win32/gdkcolor-win32.c                         |    2 +-
 gdk/win32/gdkdnd-win32.c                           |   78 +-
 gdk/win32/gdkgc-win32.c                            |    2 +-
 gdk/win32/gdkimage-win32.c                         |    2 +-
 gdk/win32/gdkinput.c                               |    2 +-
 gdk/win32/gdkpixmap-win32.c                        |    2 +-
 gdk/win32/gdkvisual-win32.c                        |    2 +-
 gdk/win32/gdkwindow-win32.c                        |    2 +-
 gdk/x11/gdkdevicemanager-core.c                    |    8 +-
 gdk/x11/gdkdisplay-x11.c                           |    2 +-
 gdk/x11/gdkdnd-x11.c                               |    8 +-
 gdk/x11/gdkinput.c                                 |    6 +-
 gdk/x11/gdkkeys-x11.c                              |    2 +-
 gdk/x11/gdkvisual-x11.c                            |    2 +-
 gdk/x11/gdkwindow-x11.c                            |    1 +
 gtk/Makefile.am                                    |    4 +
 gtk/gtk.h                                          |    2 +
 gtk/gtk.symbols                                    |   64 +
 gtk/gtkaccessible.h                                |    3 +-
 gtk/gtkaction.c                                    |   85 +-
 gtk/gtkaction.h                                    |    3 +
 gtk/gtkactiongroup.c                               |    2 +-
 gtk/gtkcellrenderer.c                              |    2 +-
 gtk/gtkcellrendererspinner.c                       |    3 +
 gtk/gtkclipboard-quartz.c                          |  361 +-
 gtk/gtkclipboard.c                                 |   21 +-
 gtk/gtkcolorsel.c                                  |   35 +-
 gtk/gtkcontainer.c                                 |    2 +-
 gtk/gtkdnd.c                                       |   22 +
 gtk/gtkenums.h                                     |    2 +-
 gtk/gtkfilechooserdefault.c                        |   22 +-
 gtk/gtkfilechooserdialog.c                         |    2 +-
 gtk/gtkfilechooserentry.c                          |    2 +-
 gtk/gtkfilechooserwidget.c                         |    2 +-
 gtk/gtkfilesel.c                                   |    4 +-
 gtk/gtkfilesystemmodel.c                           |   28 +-
 gtk/gtkiconview.c                                  |   22 +-
 gtk/gtkimage.c                                     |    6 +-
 gtk/gtkimagemenuitem.c                             |    5 +-
 gtk/gtkimmodule.c                                  |    2 +-
 gtk/gtkkeyhash.c                                   |    2 +-
 gtk/gtknotebook.c                                  |  445 ++-
 gtk/gtknotebook.h                                  |    6 +
 gtk/gtksettings.c                                  |   43 +-
 gtk/gtkspinner.c                                   |   10 +-
 gtk/gtkstatusbar.c                                 |   56 +-
 gtk/gtkstatusbar.h                                 |    2 +
 gtk/gtkstyle.c                                     |   57 +-
 gtk/gtkstyle.h                                     |   22 +-
 gtk/gtktext.c                                      |    2 +-
 gtk/gtktextbtree.c                                 |    4 +
 gtk/gtktoolbar.c                                   |   14 -
 gtk/gtktoolbutton.c                                |   75 +-
 gtk/gtktoolitem.c                                  |  119 +-
 gtk/gtktoolitem.h                                  |    5 +
 gtk/gtktoolitemgroup.c                             | 2426 +++++++
 gtk/gtktoolitemgroup.h                             |   99 +
 gtk/gtktoolpalette.c                               | 1924 ++++++
 gtk/gtktoolpalette.h                               |  144 +
 gtk/gtktoolpaletteprivate.h                        |   55 +
 gtk/gtktoolshell.c                                 |   94 +-
 gtk/gtktoolshell.h                                 |   46 +-
 gtk/gtktreemodelfilter.c                           |    8 -
 gtk/gtktreeprivate.h                               |  148 +-
 gtk/gtktreeview.c                                  |  134 +-
 gtk/gtkuimanager.c                                 |   21 +-
 gtk/gtkwindow.c                                    |   20 +-
 gtk/gtkwindow.h                                    |    2 +
 gtk/stock-icons/16/gtk-orientation-landscape.png   |  Bin 608 -> 756 bytes
 gtk/stock-icons/16/gtk-orientation-landscape.svg   |   10 +-
 .../16/gtk-orientation-reverse-landscape.png       |  Bin 599 -> 751 bytes
 .../16/gtk-orientation-reverse-landscape.svg       |   10 +-
 gtk/stock-icons/24/gtk-orientation-landscape.png   |  Bin 932 -> 1097 bytes
 gtk/stock-icons/24/gtk-orientation-landscape.svg   |   10 +-
 .../24/gtk-orientation-reverse-landscape.png       |  Bin 920 -> 1059 bytes
 .../24/gtk-orientation-reverse-landscape.svg       |   10 +-
 gtk/tests/defaultvalue.c                           |    4 +
 gtk/tests/object.c                                 |   18 +-
 m4macros/gtk-2.0.m4                                |    2 +-
 modules/engines/ms-windows/msw_rc_style.c          |    2 +-
 modules/engines/ms-windows/msw_style.c             |    2 +-
 modules/engines/pixbuf/pixbuf-draw.c               |    2 +-
 modules/engines/pixbuf/pixbuf-rc-style.c           |    2 +-
 modules/input/gtkimcontextime.c                    |    2 +-
 modules/input/gtkimcontextmultipress.c             |    2 +-
 modules/input/gtkimcontextthai.c                   |    2 +-
 modules/input/gtkimcontextxim.c                    |    2 +-
 modules/input/imam-et.c                            |    2 +-
 modules/input/imcedilla.c                          |    2 +-
 modules/input/imcyrillic-translit.c                |    2 +-
 modules/input/iminuktitut.c                        |    2 +-
 modules/input/imipa.c                              |    2 +-
 modules/input/imti-er.c                            |    2 +-
 modules/input/imti-et.c                            |    2 +-
 modules/input/imviqr.c                             |    2 +-
 modules/other/gail/gailbutton.c                    |    4 +-
 modules/other/gail/gailimage.c                     |   14 +-
 modules/other/gail/gailtreeview.c                  |    2 +
 modules/other/gail/libgail-util/gailtextutil.c     |    2 +-
 modules/printbackends/cups/gtkprintbackendcups.c   |    2 +-
 modules/printbackends/cups/gtkprintercups.c        |    2 +-
 modules/printbackends/file/gtkprintbackendfile.c   |    2 +-
 modules/printbackends/lpr/gtkprintbackendlpr.c     |    4 +-
 modules/printbackends/papi/gtkprintbackendpapi.c   |    2 +-
 modules/printbackends/papi/gtkprinterpapi.c        |    2 +-
 modules/printbackends/test/gtkprintbackendtest.c   |    2 +-
 po-properties/en shaw po                           | 5767 ++++++++++++++++
 po-properties/gl.po                                | 3529 +++++-----
 po-properties/nds.po                               | 7102 ++++++++++++++++++++
 po-properties/sl.po                                | 4897 +++++++-------
 po/LINGUAS                                         |    1 +
 po/es.po                                           | 2240 ++++---
 po/et.po                                           | 1154 +----
 po/gl.po                                           | 2372 ++++----
 po/ja.po                                           | 2233 ++++---
 po/nb.po                                           | 2228 +++---
 po/nds.po                                          | 5167 ++++++++++++++
 po/pa.po                                           | 2268 ++++----
 po/sl.po                                           | 2825 ++++-----
 po/sv.po                                           | 2830 ++++-----
 tests/merge-2.ui                                   |    2 +-
 tests/testtreecolumns.c                            |    8 +-
 tests/testtreeview.c                               |    8 +-
 177 files changed, 37981 insertions(+), 15027 deletions(-)
---
diff --cc gdk/gdkwindowimpl.h
index c418a12,3a5029b..dc0ca75
--- a/gdk/gdkwindowimpl.h
+++ b/gdk/gdkwindowimpl.h
@@@ -144,6 -142,11 +144,7 @@@ struct _GdkWindowImplIfac
    void         (* destroy)              (GdkWindow       *window,
  					 gboolean         recursing,
  					 gboolean         foreign_destroy);
 -
 -  void         (* input_window_destroy) (GdkWindow       *window);
 -  void         (* input_window_crossing)(GdkWindow       *window,
 -					 gboolean         enter);
+   gboolean     supports_native_bg;
  };
  
  /* Interface Functions */
diff --cc gdk/x11/gdkdevicemanager-core.c
index 20ed550,0000000..a1ec416
mode 100644,000000..100644
--- a/gdk/x11/gdkdevicemanager-core.c
+++ b/gdk/x11/gdkdevicemanager-core.c
@@@ -1,894 -1,0 +1,898 @@@
 +/* GDK - The GIMP Drawing Kit
 + * Copyright (C) 2009 Carlos Garnacho <carlosg gnome org>
 + *
 + * This library is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU Lesser General Public
 + * License as published by the Free Software Foundation; either
 + * version 2 of the License, or (at your option) any later version.
 + *
 + * This library is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 + * Lesser General Public License for more details.
 + *
 + * You should have received a copy of the GNU Lesser General Public
 + * License along with this library; if not, write to the
 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 + * Boston, MA 02111-1307, USA.
 + */
 +
 +#include "config.h"
 +
 +#include <gdk/gdktypes.h>
 +#include <gdk/gdkdevicemanager.h>
 +#include "gdkdevicemanager-core.h"
 +#include "gdkeventtranslator.h"
 +#include "gdkdevice-core.h"
 +#include "gdkkeysyms.h"
 +#include "gdkx.h"
 +
 +#ifdef HAVE_XKB
 +#include <X11/XKBlib.h>
 +#endif
 +
 +
 +#define HAS_FOCUS(toplevel)                           \
 +  ((toplevel)->has_focus || (toplevel)->has_pointer_focus)
 +
 +static void    gdk_device_manager_core_finalize    (GObject *object);
 +static void    gdk_device_manager_core_constructed (GObject *object);
 +
 +static GList * gdk_device_manager_core_list_devices (GdkDeviceManager *device_manager,
 +                                                     GdkDeviceType     type);
 +
 +static void     gdk_device_manager_event_translator_init (GdkEventTranslatorIface *iface);
 +
 +static gboolean gdk_device_manager_core_translate_event  (GdkEventTranslator *translator,
 +                                                          GdkDisplay         *display,
 +                                                          GdkEvent           *event,
 +                                                          XEvent             *xevent);
 +
 +
 +G_DEFINE_TYPE_WITH_CODE (GdkDeviceManagerCore, gdk_device_manager_core, GDK_TYPE_DEVICE_MANAGER,
 +                         G_IMPLEMENT_INTERFACE (GDK_TYPE_EVENT_TRANSLATOR,
 +                                                gdk_device_manager_event_translator_init))
 +
 +static void
 +gdk_device_manager_core_class_init (GdkDeviceManagerCoreClass *klass)
 +{
 +  GdkDeviceManagerClass *device_manager_class = GDK_DEVICE_MANAGER_CLASS (klass);
 +  GObjectClass *object_class = G_OBJECT_CLASS (klass);
 +
 +  object_class->finalize = gdk_device_manager_core_finalize;
 +  object_class->constructed = gdk_device_manager_core_constructed;
 +  device_manager_class->list_devices = gdk_device_manager_core_list_devices;
 +}
 +
 +static void
 +gdk_device_manager_event_translator_init (GdkEventTranslatorIface *iface)
 +{
 +  iface->translate_event = gdk_device_manager_core_translate_event;
 +}
 +
 +static GdkDevice *
 +create_core_pointer (GdkDeviceManager *device_manager,
 +                     GdkDisplay       *display)
 +{
 +  return g_object_new (GDK_TYPE_DEVICE_CORE,
 +                       "name", "Core Pointer",
 +                       "type", GDK_DEVICE_TYPE_MASTER,
 +                       "input-source", GDK_SOURCE_MOUSE,
 +                       "input-mode", GDK_MODE_SCREEN,
 +                       "has-cursor", TRUE,
 +                       "display", display,
 +                       "device-manager", device_manager,
 +                       NULL);
 +}
 +
 +static GdkDevice *
 +create_core_keyboard (GdkDeviceManager *device_manager,
 +                      GdkDisplay       *display)
 +{
 +  return g_object_new (GDK_TYPE_DEVICE_CORE,
 +                       "name", "Core Keyboard",
 +                       "type", GDK_DEVICE_TYPE_MASTER,
 +                       "input-source", GDK_SOURCE_KEYBOARD,
 +                       "input-mode", GDK_MODE_SCREEN,
 +                       "has-cursor", FALSE,
 +                       "display", display,
 +                       "device-manager", device_manager,
 +                       NULL);
 +}
 +
 +static void
 +gdk_device_manager_core_init (GdkDeviceManagerCore *device_manager)
 +{
 +}
 +
 +static void
 +gdk_device_manager_core_finalize (GObject *object)
 +{
 +  GdkDeviceManagerCore *device_manager_core;
 +
 +  device_manager_core = GDK_DEVICE_MANAGER_CORE (object);
 +
 +  g_object_unref (device_manager_core->core_pointer);
 +  g_object_unref (device_manager_core->core_keyboard);
 +
 +  G_OBJECT_CLASS (gdk_device_manager_core_parent_class)->finalize (object);
 +}
 +
 +static void
 +gdk_device_manager_core_constructed (GObject *object)
 +{
 +  GdkDeviceManagerCore *device_manager;
 +  GdkDisplay *display;
 +
 +  device_manager = GDK_DEVICE_MANAGER_CORE (object);
 +  display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (object));
 +  device_manager->core_pointer = create_core_pointer (GDK_DEVICE_MANAGER (device_manager), display);
 +  device_manager->core_keyboard = create_core_keyboard (GDK_DEVICE_MANAGER (device_manager), display);
 +
 +  _gdk_device_set_associated_device (device_manager->core_pointer, device_manager->core_keyboard);
 +  _gdk_device_set_associated_device (device_manager->core_keyboard, device_manager->core_pointer);
 +}
 +
 +static void
 +translate_key_event (GdkDisplay           *display,
 +                     GdkDeviceManagerCore *device_manager,
 +		     GdkEvent             *event,
 +		     XEvent               *xevent)
 +{
 +  GdkKeymap *keymap = gdk_keymap_get_for_display (display);
++  GdkModifierType consumed, state;
 +  gunichar c = 0;
 +  gchar buf[7];
 +
 +  event->key.type = xevent->xany.type == KeyPress ? GDK_KEY_PRESS : GDK_KEY_RELEASE;
 +  event->key.time = xevent->xkey.time;
 +  event->key.device = device_manager->core_keyboard;
 +
 +  event->key.state = (GdkModifierType) xevent->xkey.state;
 +  event->key.group = _gdk_x11_get_group_for_state (display, xevent->xkey.state);
 +  event->key.hardware_keycode = xevent->xkey.keycode;
 +
 +  event->key.keyval = GDK_VoidSymbol;
 +
 +  gdk_keymap_translate_keyboard_state (keymap,
 +				       event->key.hardware_keycode,
 +				       event->key.state,
 +				       event->key.group,
 +				       &event->key.keyval,
- 				       NULL, NULL, NULL);
++                                       NULL, NULL, &consumed);
++
++  state = event->key.state & ~consumed;
++  _gdk_keymap_add_virtual_modifiers (keymap, &state);
++  event->key.state |= state;
 +
-   _gdk_keymap_add_virtual_modifiers (keymap, &event->key.state);
 +  event->key.is_modifier = _gdk_keymap_key_is_modifier (keymap, event->key.hardware_keycode);
 +
 +  /* Fill in event->string crudely, since various programs
 +   * depend on it.
 +   */
 +  event->key.string = NULL;
 +
 +  if (event->key.keyval != GDK_VoidSymbol)
 +    c = gdk_keyval_to_unicode (event->key.keyval);
 +
 +  if (c)
 +    {
 +      gsize bytes_written;
 +      gint len;
 +
 +      /* Apply the control key - Taken from Xlib
 +       */
 +      if (event->key.state & GDK_CONTROL_MASK)
 +	{
 +	  if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F;
 +	  else if (c == '2')
 +	    {
 +	      event->key.string = g_memdup ("\0\0", 2);
 +	      event->key.length = 1;
 +	      buf[0] = '\0';
 +	      goto out;
 +	    }
 +	  else if (c >= '3' && c <= '7') c -= ('3' - '\033');
 +	  else if (c == '8') c = '\177';
 +	  else if (c == '/') c = '_' & 0x1F;
 +	}
 +
 +      len = g_unichar_to_utf8 (c, buf);
 +      buf[len] = '\0';
 +
 +      event->key.string = g_locale_from_utf8 (buf, len,
 +					      NULL, &bytes_written,
 +					      NULL);
 +      if (event->key.string)
 +	event->key.length = bytes_written;
 +    }
 +  else if (event->key.keyval == GDK_Escape)
 +    {
 +      event->key.length = 1;
 +      event->key.string = g_strdup ("\033");
 +    }
 +  else if (event->key.keyval == GDK_Return ||
 +	  event->key.keyval == GDK_KP_Enter)
 +    {
 +      event->key.length = 1;
 +      event->key.string = g_strdup ("\r");
 +    }
 +
 +  if (!event->key.string)
 +    {
 +      event->key.length = 0;
 +      event->key.string = g_strdup ("");
 +    }
 +
 + out:
 +#ifdef G_ENABLE_DEBUG
 +  if (_gdk_debug_flags & GDK_DEBUG_EVENTS)
 +    {
 +      g_message ("%s:\t\twindow: %ld	 key: %12s  %d",
 +		 event->type == GDK_KEY_PRESS ? "key press  " : "key release",
 +		 xevent->xkey.window,
 +		 event->key.keyval ? gdk_keyval_name (event->key.keyval) : "(none)",
 +		 event->key.keyval);
 +
 +      if (event->key.length > 0)
 +	g_message ("\t\tlength: %4d string: \"%s\"",
 +		   event->key.length, buf);
 +    }
 +#endif /* G_ENABLE_DEBUG */
 +  return;
 +}
 +
 +#ifdef G_ENABLE_DEBUG
 +static const char notify_modes[][19] = {
 +  "NotifyNormal",
 +  "NotifyGrab",
 +  "NotifyUngrab",
 +  "NotifyWhileGrabbed"
 +};
 +
 +static const char notify_details[][23] = {
 +  "NotifyAncestor",
 +  "NotifyVirtual",
 +  "NotifyInferior",
 +  "NotifyNonlinear",
 +  "NotifyNonlinearVirtual",
 +  "NotifyPointer",
 +  "NotifyPointerRoot",
 +  "NotifyDetailNone"
 +};
 +#endif
 +
 +static void
 +set_user_time (GdkWindow *window,
 +	       GdkEvent  *event)
 +{
 +  g_return_if_fail (event != NULL);
 +
 +  window = gdk_window_get_toplevel (event->client.window);
 +  g_return_if_fail (GDK_IS_WINDOW (window));
 +
 +  /* If an event doesn't have a valid timestamp, we shouldn't use it
 +   * to update the latest user interaction time.
 +   */
 +  if (gdk_event_get_time (event) != GDK_CURRENT_TIME)
 +    gdk_x11_window_set_user_time (gdk_window_get_toplevel (window),
 +                                  gdk_event_get_time (event));
 +}
 +
 +static void
 +generate_focus_event (GdkDeviceManagerCore *device_manager,
 +                      GdkWindow            *window,
 +		      gboolean              in)
 +{
 +  GdkEvent event;
 +
 +  event.type = GDK_FOCUS_CHANGE;
 +  event.focus_change.window = window;
 +  event.focus_change.send_event = FALSE;
 +  event.focus_change.in = in;
 +  event.focus_change.device = device_manager->core_keyboard;
 +
 +  gdk_event_put (&event);
 +}
 +
 +static gboolean
 +set_screen_from_root (GdkDisplay *display,
 +		      GdkEvent   *event,
 +		      Window      xrootwin)
 +{
 +  GdkScreen *screen;
 +
 +  screen = _gdk_x11_display_screen_for_xrootwin (display, xrootwin);
 +
 +  if (screen)
 +    {
 +      gdk_event_set_screen (event, screen);
 +
 +      return TRUE;
 +    }
 +
 +  return FALSE;
 +}
 +
 +static GdkCrossingMode
 +translate_crossing_mode (int mode)
 +{
 +  switch (mode)
 +    {
 +    case NotifyNormal:
 +      return GDK_CROSSING_NORMAL;
 +    case NotifyGrab:
 +      return GDK_CROSSING_GRAB;
 +    case NotifyUngrab:
 +      return GDK_CROSSING_UNGRAB;
 +    default:
 +      g_assert_not_reached ();
 +    }
 +}
 +
 +static GdkNotifyType
 +translate_notify_type (int detail)
 +{
 +  switch (detail)
 +    {
 +    case NotifyInferior:
 +      return GDK_NOTIFY_INFERIOR;
 +    case NotifyAncestor:
 +      return GDK_NOTIFY_ANCESTOR;
 +    case NotifyVirtual:
 +      return GDK_NOTIFY_VIRTUAL;
 +    case NotifyNonlinear:
 +      return GDK_NOTIFY_NONLINEAR;
 +    case NotifyNonlinearVirtual:
 +      return GDK_NOTIFY_NONLINEAR_VIRTUAL;
 +    default:
 +      g_assert_not_reached ();
 +    }
 +}
 +
 +static gboolean
 +is_parent_of (GdkWindow *parent,
 +              GdkWindow *child)
 +{
 +  GdkWindow *w;
 +
 +  w = child;
 +  while (w != NULL)
 +    {
 +      if (w == parent)
 +	return TRUE;
 +
 +      w = gdk_window_get_parent (w);
 +    }
 +
 +  return FALSE;
 +}
 +
 +static GdkWindow *
 +get_event_window (GdkEventTranslator *translator,
 +                  XEvent             *xevent)
 +{
 +  GdkDeviceManager *device_manager;
 +  GdkDisplay *display;
 +  GdkWindow *window;
 +
 +  device_manager = GDK_DEVICE_MANAGER (translator);
 +  display = gdk_device_manager_get_display (device_manager);
 +  window = gdk_window_lookup_for_display (display, xevent->xany.window);
 +
 +  /* Apply keyboard grabs to non-native windows */
 +  if (xevent->type == KeyPress || xevent->type == KeyRelease)
 +    {
 +      GdkDeviceGrabInfo *info;
 +      gulong serial;
 +
 +      serial = _gdk_windowing_window_get_next_serial (display);
 +      info = _gdk_display_has_device_grab (display,
 +                                           GDK_DEVICE_MANAGER_CORE (device_manager)->core_keyboard,
 +                                           serial);
 +      if (info &&
 +          (!is_parent_of (info->window, window) ||
 +           !info->owner_events))
 +        {
 +          /* Report key event against grab window */
 +          window = info->window;
 +        }
 +    }
 +
 +  return window;
 +}
 +
 +static gboolean
 +gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
 +                                         GdkDisplay         *display,
 +                                         GdkEvent           *event,
 +                                         XEvent             *xevent)
 +{
 +  GdkDeviceManagerCore *device_manager;
 +  GdkWindow *window;
 +  GdkWindowObject *window_private;
 +  GdkWindowImplX11 *window_impl = NULL;
 +  gboolean return_val;
 +  GdkToplevelX11 *toplevel = NULL;
 +  GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
 +
 +  device_manager = GDK_DEVICE_MANAGER_CORE (translator);
 +  return_val = FALSE;
 +
 +  window = get_event_window (translator, xevent);
 +  window_private = (GdkWindowObject *) window;
 +
 +  if (window && GDK_WINDOW_DESTROYED (window))
 +    return FALSE;
 +
 +  if (window)
 +    {
 +      toplevel = _gdk_x11_window_get_toplevel (window);
 +      window_impl = GDK_WINDOW_IMPL_X11 (window_private->impl);
 +      g_object_ref (window);
 +    }
 +
 +  event->any.window = window;
 +  event->any.send_event = xevent->xany.send_event ? TRUE : FALSE;
 +
 +  if (window_private && GDK_WINDOW_DESTROYED (window))
 +    {
 +      if (xevent->type != DestroyNotify)
 +	{
 +	  return_val = FALSE;
 +	  goto done;
 +	}
 +    }
 +
 +  if (window &&
 +      (xevent->type == MotionNotify ||
 +       xevent->type == ButtonRelease))
 +    {
 +      if (_gdk_moveresize_handle_event (xevent))
 +	{
 +          return_val = FALSE;
 +          goto done;
 +        }
 +    }
 +
 +  /* We do a "manual" conversion of the XEvent to a
 +   *  GdkEvent. The structures are mostly the same so
 +   *  the conversion is fairly straightforward. We also
 +   *  optionally print debugging info regarding events
 +   *  received.
 +   */
 +
 +  return_val = TRUE;
 +
 +  switch (xevent->type)
 +    {
 +    case KeyPress:
 +      if (window_private == NULL)
 +        {
 +          return_val = FALSE;
 +          break;
 +        }
 +      translate_key_event (display, device_manager, event, xevent);
 +      set_user_time (window, event);
 +      break;
 +
 +    case KeyRelease:
 +      if (window_private == NULL)
 +        {
 +          return_val = FALSE;
 +          break;
 +        }
 +
 +      /* Emulate detectable auto-repeat by checking to see
 +       * if the next event is a key press with the same
 +       * keycode and timestamp, and if so, ignoring the event.
 +       */
 +
 +      if (!display_x11->have_xkb_autorepeat && XPending (xevent->xkey.display))
 +	{
 +	  XEvent next_event;
 +
 +	  XPeekEvent (xevent->xkey.display, &next_event);
 +
 +	  if (next_event.type == KeyPress &&
 +	      next_event.xkey.keycode == xevent->xkey.keycode &&
 +	      next_event.xkey.time == xevent->xkey.time)
 +	    {
 +	      return_val = FALSE;
 +	      break;
 +	    }
 +	}
 +
 +      translate_key_event (display, device_manager, event, xevent);
 +      break;
 +
 +    case ButtonPress:
 +      GDK_NOTE (EVENTS,
 +		g_message ("button press:\t\twindow: %ld  x,y: %d %d  button: %d",
 +			   xevent->xbutton.window,
 +			   xevent->xbutton.x, xevent->xbutton.y,
 +			   xevent->xbutton.button));
 +
 +      if (window_private == NULL)
 +	{
 +	  return_val = FALSE;
 +	  break;
 +	}
 +
 +      /* If we get a ButtonPress event where the button is 4 or 5,
 +	 it's a Scroll event */
 +      switch (xevent->xbutton.button)
 +        {
 +        case 4: /* up */
 +        case 5: /* down */
 +        case 6: /* left */
 +        case 7: /* right */
 +	  event->scroll.type = GDK_SCROLL;
 +
 +          if (xevent->xbutton.button == 4)
 +            event->scroll.direction = GDK_SCROLL_UP;
 +          else if (xevent->xbutton.button == 5)
 +            event->scroll.direction = GDK_SCROLL_DOWN;
 +          else if (xevent->xbutton.button == 6)
 +            event->scroll.direction = GDK_SCROLL_LEFT;
 +          else
 +            event->scroll.direction = GDK_SCROLL_RIGHT;
 +
 +	  event->scroll.window = window;
 +	  event->scroll.time = xevent->xbutton.time;
 +	  event->scroll.x = (gdouble) xevent->xbutton.x;
 +	  event->scroll.y = (gdouble) xevent->xbutton.y;
 +	  event->scroll.x_root = (gdouble) xevent->xbutton.x_root;
 +	  event->scroll.y_root = (gdouble) xevent->xbutton.y_root;
 +	  event->scroll.state = (GdkModifierType) xevent->xbutton.state;
 +	  event->scroll.device = device_manager->core_pointer;
 +
 +	  if (!set_screen_from_root (display, event, xevent->xbutton.root))
 +	    {
 +	      return_val = FALSE;
 +	      break;
 +	    }
 +
 +          break;
 +
 +        default:
 +	  event->button.type = GDK_BUTTON_PRESS;
 +	  event->button.window = window;
 +	  event->button.time = xevent->xbutton.time;
 +	  event->button.x = (gdouble) xevent->xbutton.x;
 +	  event->button.y = (gdouble) xevent->xbutton.y;
 +	  event->button.x_root = (gdouble) xevent->xbutton.x_root;
 +	  event->button.y_root = (gdouble) xevent->xbutton.y_root;
 +	  event->button.axes = NULL;
 +	  event->button.state = (GdkModifierType) xevent->xbutton.state;
 +	  event->button.button = xevent->xbutton.button;
 +	  event->button.device = device_manager->core_pointer;
 +
 +	  if (!set_screen_from_root (display, event, xevent->xbutton.root))
 +            return_val = FALSE;
 +
 +          break;
 +	}
 +
 +      set_user_time (window, event);
 +
 +      break;
 +
 +    case ButtonRelease:
 +      GDK_NOTE (EVENTS,
 +		g_message ("button release:\twindow: %ld  x,y: %d %d  button: %d",
 +			   xevent->xbutton.window,
 +			   xevent->xbutton.x, xevent->xbutton.y,
 +			   xevent->xbutton.button));
 +
 +      if (window_private == NULL)
 +	{
 +	  return_val = FALSE;
 +	  break;
 +	}
 +
 +      /* We treat button presses as scroll wheel events, so ignore the release */
 +      if (xevent->xbutton.button == 4 || xevent->xbutton.button == 5 ||
 +          xevent->xbutton.button == 6 || xevent->xbutton.button == 7)
 +	{
 +	  return_val = FALSE;
 +	  break;
 +	}
 +
 +      event->button.type = GDK_BUTTON_RELEASE;
 +      event->button.window = window;
 +      event->button.time = xevent->xbutton.time;
 +      event->button.x = (gdouble) xevent->xbutton.x;
 +      event->button.y = (gdouble) xevent->xbutton.y;
 +      event->button.x_root = (gdouble) xevent->xbutton.x_root;
 +      event->button.y_root = (gdouble) xevent->xbutton.y_root;
 +      event->button.axes = NULL;
 +      event->button.state = (GdkModifierType) xevent->xbutton.state;
 +      event->button.button = xevent->xbutton.button;
 +      event->button.device = device_manager->core_pointer;
 +
 +      if (!set_screen_from_root (display, event, xevent->xbutton.root))
 +        return_val = FALSE;
 +
 +      break;
 +
 +    case MotionNotify:
 +      GDK_NOTE (EVENTS,
 +		g_message ("motion notify:\t\twindow: %ld  x,y: %d %d  hint: %s",
 +			   xevent->xmotion.window,
 +			   xevent->xmotion.x, xevent->xmotion.y,
 +			   (xevent->xmotion.is_hint) ? "true" : "false"));
 +
 +      if (window_private == NULL)
 +	{
 +	  return_val = FALSE;
 +	  break;
 +	}
 +
 +      event->motion.type = GDK_MOTION_NOTIFY;
 +      event->motion.window = window;
 +      event->motion.time = xevent->xmotion.time;
 +      event->motion.x = (gdouble) xevent->xmotion.x;
 +      event->motion.y = (gdouble) xevent->xmotion.y;
 +      event->motion.x_root = (gdouble) xevent->xmotion.x_root;
 +      event->motion.y_root = (gdouble) xevent->xmotion.y_root;
 +      event->motion.axes = NULL;
 +      event->motion.state = (GdkModifierType) xevent->xmotion.state;
 +      event->motion.is_hint = xevent->xmotion.is_hint;
 +      event->motion.device = device_manager->core_pointer;
 +
 +      if (!set_screen_from_root (display, event, xevent->xbutton.root))
 +	{
 +	  return_val = FALSE;
 +	  break;
 +	}
 +
 +      break;
 +
 +    case EnterNotify:
 +      GDK_NOTE (EVENTS,
 +		g_message ("enter notify:\t\twindow: %ld  detail: %d subwin: %ld",
 +			   xevent->xcrossing.window,
 +			   xevent->xcrossing.detail,
 +			   xevent->xcrossing.subwindow));
 +
 +      if (window_private == NULL)
 +        {
 +          return_val = FALSE;
 +          break;
 +        }
 +
 +      if (!set_screen_from_root (display, event, xevent->xbutton.root))
 +	{
 +	  return_val = FALSE;
 +	  break;
 +	}
 +
 +      event->crossing.type = GDK_ENTER_NOTIFY;
 +      event->crossing.window = window;
 +      event->crossing.device = device_manager->core_pointer;
 +
 +      /* If the subwindow field of the XEvent is non-NULL, then
 +       *  lookup the corresponding GdkWindow.
 +       */
 +      if (xevent->xcrossing.subwindow != None)
 +	event->crossing.subwindow = gdk_window_lookup_for_display (display, xevent->xcrossing.subwindow);
 +      else
 +	event->crossing.subwindow = NULL;
 +
 +      event->crossing.time = xevent->xcrossing.time;
 +      event->crossing.x = (gdouble) xevent->xcrossing.x;
 +      event->crossing.y = (gdouble) xevent->xcrossing.y;
 +      event->crossing.x_root = (gdouble) xevent->xcrossing.x_root;
 +      event->crossing.y_root = (gdouble) xevent->xcrossing.y_root;
 +
 +      event->crossing.mode = translate_crossing_mode (xevent->xcrossing.mode);
 +      event->crossing.detail = translate_notify_type (xevent->xcrossing.detail);
 +
 +      event->crossing.focus = xevent->xcrossing.focus;
 +      event->crossing.state = xevent->xcrossing.state;
 +
 +      break;
 +
 +    case LeaveNotify:
 +      GDK_NOTE (EVENTS,
 +		g_message ("leave notify:\t\twindow: %ld  detail: %d subwin: %ld",
 +			   xevent->xcrossing.window,
 +			   xevent->xcrossing.detail, xevent->xcrossing.subwindow));
 +
 +      if (window_private == NULL)
 +        {
 +          return_val = FALSE;
 +          break;
 +        }
 +
 +      if (!set_screen_from_root (display, event, xevent->xbutton.root))
 +	{
 +	  return_val = FALSE;
 +	  break;
 +	}
 +
 +      event->crossing.type = GDK_LEAVE_NOTIFY;
 +      event->crossing.window = window;
 +      event->crossing.device = device_manager->core_pointer;
 +
 +      /* If the subwindow field of the XEvent is non-NULL, then
 +       *  lookup the corresponding GdkWindow.
 +       */
 +      if (xevent->xcrossing.subwindow != None)
 +	event->crossing.subwindow = gdk_window_lookup_for_display (display, xevent->xcrossing.subwindow);
 +      else
 +	event->crossing.subwindow = NULL;
 +
 +      event->crossing.time = xevent->xcrossing.time;
 +      event->crossing.x = (gdouble) xevent->xcrossing.x;
 +      event->crossing.y = (gdouble) xevent->xcrossing.y;
 +      event->crossing.x_root = (gdouble) xevent->xcrossing.x_root;
 +      event->crossing.y_root = (gdouble) xevent->xcrossing.y_root;
 +
 +      event->crossing.mode = translate_crossing_mode (xevent->xcrossing.mode);
 +      event->crossing.detail = translate_notify_type (xevent->xcrossing.detail);
 +
 +      event->crossing.focus = xevent->xcrossing.focus;
 +      event->crossing.state = xevent->xcrossing.state;
 +
 +      break;
 +
 +      /* We only care about focus events that indicate that _this_
 +       * window (not a ancestor or child) got or lost the focus
 +       */
 +    case FocusIn:
 +      GDK_NOTE (EVENTS,
 +		g_message ("focus in:\t\twindow: %ld, detail: %s, mode: %s",
 +			   xevent->xfocus.window,
 +			   notify_details[xevent->xfocus.detail],
 +			   notify_modes[xevent->xfocus.mode]));
 +
 +      if (toplevel)
 +	{
 +	  gboolean had_focus = HAS_FOCUS (toplevel);
 +
 +	  switch (xevent->xfocus.detail)
 +	    {
 +	    case NotifyAncestor:
 +	    case NotifyVirtual:
 +	      /* When the focus moves from an ancestor of the window to
 +	       * the window or a descendent of the window, *and* the
 +	       * pointer is inside the window, then we were previously
 +	       * receiving keystroke events in the has_pointer_focus
 +	       * case and are now receiving them in the
 +	       * has_focus_window case.
 +	       */
 +	      if (toplevel->has_pointer &&
 +		  xevent->xfocus.mode != NotifyGrab &&
 +		  xevent->xfocus.mode != NotifyUngrab)
 +		toplevel->has_pointer_focus = FALSE;
 +
 +	      /* fall through */
 +	    case NotifyNonlinear:
 +	    case NotifyNonlinearVirtual:
 +	      if (xevent->xfocus.mode != NotifyGrab &&
 +		  xevent->xfocus.mode != NotifyUngrab)
 +		toplevel->has_focus_window = TRUE;
 +	      /* We pretend that the focus moves to the grab
 +	       * window, so we pay attention to NotifyGrab
 +	       * NotifyUngrab, and ignore NotifyWhileGrabbed
 +	       */
 +	      if (xevent->xfocus.mode != NotifyWhileGrabbed)
 +		toplevel->has_focus = TRUE;
 +	      break;
 +	    case NotifyPointer:
 +	      /* The X server sends NotifyPointer/NotifyGrab,
 +	       * but the pointer focus is ignored while a
 +	       * grab is in effect
 +	       */
 +	      if (xevent->xfocus.mode != NotifyGrab &&
 +		  xevent->xfocus.mode != NotifyUngrab)
 +		toplevel->has_pointer_focus = TRUE;
 +	      break;
 +	    case NotifyInferior:
 +	    case NotifyPointerRoot:
 +	    case NotifyDetailNone:
 +	      break;
 +	    }
 +
 +	  if (HAS_FOCUS (toplevel) != had_focus)
 +	    generate_focus_event (device_manager, window, TRUE);
 +	}
 +      break;
 +    case FocusOut:
 +      GDK_NOTE (EVENTS,
 +		g_message ("focus out:\t\twindow: %ld, detail: %s, mode: %s",
 +			   xevent->xfocus.window,
 +			   notify_details[xevent->xfocus.detail],
 +			   notify_modes[xevent->xfocus.mode]));
 +
 +      if (toplevel)
 +	{
 +	  gboolean had_focus = HAS_FOCUS (toplevel);
 +
 +	  switch (xevent->xfocus.detail)
 +	    {
 +	    case NotifyAncestor:
 +	    case NotifyVirtual:
 +	      /* When the focus moves from the window or a descendent
 +	       * of the window to an ancestor of the window, *and* the
 +	       * pointer is inside the window, then we were previously
 +	       * receiving keystroke events in the has_focus_window
 +	       * case and are now receiving them in the
 +	       * has_pointer_focus case.
 +	       */
 +	      if (toplevel->has_pointer &&
 +		  xevent->xfocus.mode != NotifyGrab &&
 +		  xevent->xfocus.mode != NotifyUngrab)
 +		toplevel->has_pointer_focus = TRUE;
 +
 +	      /* fall through */
 +	    case NotifyNonlinear:
 +	    case NotifyNonlinearVirtual:
 +	      if (xevent->xfocus.mode != NotifyGrab &&
 +		  xevent->xfocus.mode != NotifyUngrab)
 +		toplevel->has_focus_window = FALSE;
 +	      if (xevent->xfocus.mode != NotifyWhileGrabbed)
 +		toplevel->has_focus = FALSE;
 +	      break;
 +	    case NotifyPointer:
 +	      if (xevent->xfocus.mode != NotifyGrab &&
 +		  xevent->xfocus.mode != NotifyUngrab)
 +		toplevel->has_pointer_focus = FALSE;
 +	    break;
 +	    case NotifyInferior:
 +	    case NotifyPointerRoot:
 +	    case NotifyDetailNone:
 +	      break;
 +	    }
 +
 +	  if (HAS_FOCUS (toplevel) != had_focus)
 +	    generate_focus_event (device_manager, window, FALSE);
 +	}
 +      break;
 +
 +    default:
 +        return_val = FALSE;
 +    }
 +
 + done:
 +  if (return_val)
 +    {
 +      if (event->any.window)
 +	g_object_ref (event->any.window);
 +
 +      if (((event->any.type == GDK_ENTER_NOTIFY) ||
 +	   (event->any.type == GDK_LEAVE_NOTIFY)) &&
 +	  (event->crossing.subwindow != NULL))
 +	g_object_ref (event->crossing.subwindow);
 +    }
 +  else
 +    {
 +      /* Mark this event as having no resources to be freed */
 +      event->any.window = NULL;
 +      event->any.type = GDK_NOTHING;
 +    }
 +
 +  if (window)
 +    g_object_unref (window);
 +
 +  return return_val;
 +}
 +
 +static GList *
 +gdk_device_manager_core_list_devices (GdkDeviceManager *device_manager,
 +                                      GdkDeviceType     type)
 +{
 +  GdkDeviceManagerCore *device_manager_core;
 +  GList *devices = NULL;
 +
 +  if (type == GDK_DEVICE_TYPE_MASTER)
 +    {
 +      device_manager_core = (GdkDeviceManagerCore *) device_manager;
 +      devices = g_list_prepend (devices, device_manager_core->core_keyboard);
 +      devices = g_list_prepend (devices, device_manager_core->core_pointer);
 +    }
 +
 +  return devices;
 +}
diff --cc gdk/x11/gdkdisplay-x11.c
index 08813d7,2b10a93..8c01ad0
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@@ -2481,228 -1475,6 +2481,228 @@@ gdk_display_supports_composite (GdkDisp
  	 x11_display->have_xfixes;
  }
  
 +/**
 + * gdk_display_list_devices:
 + * @display: a #GdkDisplay
 + *
 + * Returns the list of available input devices attached to @display.
 + * The list is statically allocated and should not be freed.
 + *
 + * Return value: a list of #GdkDevice
 + *
 + * Since: 2.2
 + **/
 +GList *
 +gdk_display_list_devices (GdkDisplay *display)
 +{
 +  g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
 +
 +  return GDK_DISPLAY_X11 (display)->input_devices;
 +}
 +
 +/**
 + * gdk_event_send_client_message_for_display:
 + * @display: the #GdkDisplay for the window where the message is to be sent.
 + * @event: the #GdkEvent to send, which should be a #GdkEventClient.
 + * @winid: the window to send the client message to.
 + *
 + * On X11, sends an X ClientMessage event to a given window. On
 + * Windows, sends a message registered with the name
 + * GDK_WIN32_CLIENT_MESSAGE.
 + *
 + * This could be used for communicating between different
 + * applications, though the amount of data is limited to 20 bytes on
 + * X11, and to just four bytes on Windows.
 + *
 + * Returns: non-zero on success.
 + *
 + * Since: 2.2
 + */
 +gboolean
 +gdk_event_send_client_message_for_display (GdkDisplay     *display,
 +					   GdkEvent       *event,
 +					   GdkNativeWindow winid)
 +{
 +  XEvent sev;
 +
 +  g_return_val_if_fail(event != NULL, FALSE);
 +
 +  /* Set up our event to send, with the exception of its target window */
 +  sev.xclient.type = ClientMessage;
 +  sev.xclient.display = GDK_DISPLAY_XDISPLAY (display);
 +  sev.xclient.format = event->client.data_format;
 +  sev.xclient.window = winid;
 +  memcpy(&sev.xclient.data, &event->client.data, sizeof (sev.xclient.data));
 +  sev.xclient.message_type = gdk_x11_atom_to_xatom_for_display (display, event->client.message_type);
 +
 +  return _gdk_send_xevent (display, winid, False, NoEventMask, &sev);
 +}
 +
 +/**
 + * gdk_display_add_client_message_filter:
 + * @display: a #GdkDisplay for which this message filter applies
 + * @message_type: the type of ClientMessage events to receive.
 + *   This will be checked against the @message_type field
 + *   of the XClientMessage event struct.
 + * @func: the function to call to process the event.
 + * @data: user data to pass to @func.
 + *
 + * Adds a filter to be called when X ClientMessage events are received.
 + * See gdk_window_add_filter() if you are interested in filtering other
 + * types of events.
 + *
 + * Since: 2.2
 + **/
 +void
 +gdk_display_add_client_message_filter (GdkDisplay   *display,
 +				       GdkAtom       message_type,
 +				       GdkFilterFunc func,
 +				       gpointer      data)
 +{
 +  GdkClientFilter *filter;
 +  g_return_if_fail (GDK_IS_DISPLAY (display));
 +  filter = g_new (GdkClientFilter, 1);
 +
 +  filter->type = message_type;
 +  filter->function = func;
 +  filter->data = data;
 +
 +  GDK_DISPLAY_X11(display)->client_filters =
 +    g_list_append (GDK_DISPLAY_X11 (display)->client_filters,
 +		   filter);
 +}
 +
 +/**
 + * gdk_add_client_message_filter:
 + * @message_type: the type of ClientMessage events to receive. This will be
 + *     checked against the <structfield>message_type</structfield> field of the
 + *     XClientMessage event struct.
 + * @func: the function to call to process the event.
 + * @data: user data to pass to @func.
 + *
 + * Adds a filter to the default display to be called when X ClientMessage events
 + * are received. See gdk_display_add_client_message_filter().
 + **/
 +void
 +gdk_add_client_message_filter (GdkAtom       message_type,
 +			       GdkFilterFunc func,
 +			       gpointer      data)
 +{
 +  gdk_display_add_client_message_filter (gdk_display_get_default (),
 +					 message_type, func, data);
 +}
 +
 +/*
 + *--------------------------------------------------------------
 + * gdk_flush
 + *
 + *   Flushes the Xlib output buffer and then waits
 + *   until all requests have been received and processed
 + *   by the X server. The only real use for this function
 + *   is in dealing with XShm.
 + *
 + * Arguments:
 + *
 + * Results:
 + *
 + * Side effects:
 + *
 + *--------------------------------------------------------------
 + */
 +void
 +gdk_flush (void)
 +{
 +  GSList *tmp_list = _gdk_displays;
 +
 +  while (tmp_list)
 +    {
 +      XSync (GDK_DISPLAY_XDISPLAY (tmp_list->data), False);
 +      tmp_list = tmp_list->next;
 +    }
 +}
 +
 +/**
 + * gdk_x11_register_standard_event_type:
 + * @display: a #GdkDisplay
 + * @event_base: first event type code to register
 + * @n_events: number of event type codes to register
 + *
 + * Registers interest in receiving extension events with type codes
 + * between @event_base and <literal>event_base + n_events - 1</literal>.
 + * The registered events must have the window field in the same place
 + * as core X events (this is not the case for e.g. XKB extension events).
 + *
 + * If an event type is registered, events of this type will go through
 + * global and window-specific filters (see gdk_window_add_filter()).
 + * Unregistered events will only go through global filters.
 + * GDK may register the events of some X extensions on its own.
 + *
 + * This function should only be needed in unusual circumstances, e.g.
 + * when filtering XInput extension events on the root window.
 + *
 + * Since: 2.4
 + **/
 +void
 +gdk_x11_register_standard_event_type (GdkDisplay *display,
 +				      gint        event_base,
 +				      gint        n_events)
 +{
 +  GdkEventTypeX11 *event_type;
 +  GdkDisplayX11 *display_x11;
 +
 +  display_x11 = GDK_DISPLAY_X11 (display);
 +  event_type = g_new (GdkEventTypeX11, 1);
 +
 +  event_type->base = event_base;
 +  event_type->n_events = n_events;
 +
 +  display_x11->event_types = g_slist_prepend (display_x11->event_types, event_type);
 +}
 +
 +static Bool
 +graphics_expose_predicate (Display  *display,
 +			   XEvent   *xevent,
 +			   XPointer  arg)
 +{
 +  if (xevent->xany.window == GDK_DRAWABLE_XID ((GdkDrawable *)arg) &&
 +      (xevent->xany.type == GraphicsExpose ||
 +       xevent->xany.type == NoExpose))
 +    return True;
 +  else
 +    return False;
 +}
 +
 +/**
 + * gdk_event_get_graphics_expose:
 + * @window: the #GdkWindow to wait for the events for.
 + *
 + * Waits for a GraphicsExpose or NoExpose event from the X server.
 + * This is used in the #GtkText and #GtkCList widgets in GTK+ to make sure any
 + * GraphicsExpose events are handled before the widget is scrolled.
 + *
 + * Return value:  a #GdkEventExpose if a GraphicsExpose was received, or %NULL if a
 + * NoExpose event was received.
 + *
-  * Deprecated:2.18
++ * Deprecated: 2.18
 + **/
 +GdkEvent*
 +gdk_event_get_graphics_expose (GdkWindow *window)
 +{
 +  GdkDisplay *display;
 +  XEvent xevent;
 +
 +  g_return_val_if_fail (window != NULL, NULL);
 +
 +  display = gdk_drawable_get_display (GDK_DRAWABLE (window));
 +
 +  XIfEvent (GDK_WINDOW_XDISPLAY (window), &xevent,
 +	    graphics_expose_predicate, (XPointer) window);
 +
 +  if (xevent.xany.type == GraphicsExpose)
 +    return gdk_event_translator_translate (GDK_EVENT_TRANSLATOR (display),
 +                                           display, &xevent);
 +  return NULL;
 +}
  
  #define __GDK_DISPLAY_X11_C__
  #include "gdkaliasdef.c"
diff --cc gdk/x11/gdkinput.c
index cb6cd7d,95485d7..8348ffa
--- a/gdk/x11/gdkinput.c
+++ b/gdk/x11/gdkinput.c
@@@ -183,11 -454,15 +185,13 @@@ gdk_input_set_extension_events (GdkWind
        unset_extension_events (window);
      }
  
+ #ifndef XINPUT_NONE
    for (tmp_list = display_x11->input_devices; tmp_list; tmp_list = tmp_list->next)
      {
 -      GdkDevicePrivate *gdkdev = tmp_list->data;
 -
 -      if (!GDK_IS_CORE (gdkdev))
 -	_gdk_input_select_events ((GdkWindow *)impl_window, gdkdev);
 +      GdkDevice *dev = tmp_list->data;
 +      _gdk_input_select_device_events (GDK_WINDOW (impl_window), dev);
      }
+ #endif /* !XINPUT_NONE */
  }
  
  void
diff --cc gdk/x11/gdkwindow-x11.c
index ddc4852,5f3c13e..422a983
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@@ -5625,62 -5602,10 +5625,63 @@@ gdk_window_impl_iface_init (GdkWindowIm
    iface->queue_antiexpose = _gdk_x11_window_queue_antiexpose;
    iface->queue_translation = _gdk_x11_window_queue_translation;
    iface->destroy = _gdk_x11_window_destroy;
 -  iface->input_window_destroy = _gdk_input_window_destroy;
 -  iface->input_window_crossing = _gdk_input_crossing_event;
+   iface->supports_native_bg = TRUE;
  }
  
 +static Bool
 +timestamp_predicate (Display *display,
 +		     XEvent  *xevent,
 +		     XPointer arg)
 +{
 +  Window xwindow = GPOINTER_TO_UINT (arg);
 +  GdkDisplay *gdk_display = gdk_x11_lookup_xdisplay (display);
 +
 +  if (xevent->type == PropertyNotify &&
 +      xevent->xproperty.window == xwindow &&
 +      xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (gdk_display,
 +								       "GDK_TIMESTAMP_PROP"))
 +    return True;
 +
 +  return False;
 +}
 +
 +/**
 + * gdk_x11_get_server_time:
 + * @window: a #GdkWindow, used for communication with the server.
 + *          The window must have GDK_PROPERTY_CHANGE_MASK in its
 + *          events mask or a hang will result.
 + *
 + * Routine to get the current X server time stamp.
 + *
 + * Return value: the time stamp.
 + **/
 +guint32
 +gdk_x11_get_server_time (GdkWindow *window)
 +{
 +  Display *xdisplay;
 +  Window   xwindow;
 +  guchar c = 'a';
 +  XEvent xevent;
 +  Atom timestamp_prop_atom;
 +
 +  g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
 +  g_return_val_if_fail (!GDK_WINDOW_DESTROYED (window), 0);
 +
 +  xdisplay = GDK_WINDOW_XDISPLAY (window);
 +  xwindow = GDK_WINDOW_XWINDOW (window);
 +  timestamp_prop_atom =
 +    gdk_x11_get_xatom_by_name_for_display (GDK_WINDOW_DISPLAY (window),
 +					   "GDK_TIMESTAMP_PROP");
 +
 +  XChangeProperty (xdisplay, xwindow, timestamp_prop_atom,
 +		   timestamp_prop_atom,
 +		   8, PropModeReplace, &c, 1);
 +
 +  XIfEvent (xdisplay, &xevent,
 +	    timestamp_predicate, GUINT_TO_POINTER(xwindow));
 +
 +  return xevent.xproperty.time;
 +}
 +
  #define __GDK_WINDOW_X11_C__
  #include "gdkaliasdef.c"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]