diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2011-05-18 21:24:57 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2011-05-18 22:34:33 +0200 |
commit | 55cc9f33399dab8b52ee071bab609680b66c4325 (patch) | |
tree | 88adc515815eb9d0dad159b3c83e0c7f322e2939 /gdk/x11/gdkeventtranslator.c | |
parent | 53d77a829aa82163aaf81e12d9b1366fb407cc22 (diff) | |
download | gtk+-55cc9f33399dab8b52ee071bab609680b66c4325.tar.gz |
gdk: Add _gdk_x11_event_translator_get_window()
This method can be implemented by event translators so they
return the right window from XGenericEventCookie events, as
ev->xany.window isn't meaningful for these.
GdkEventSource now also uses this to find out the right window
filters to apply.
Diffstat (limited to 'gdk/x11/gdkeventtranslator.c')
-rw-r--r-- | gdk/x11/gdkeventtranslator.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/gdk/x11/gdkeventtranslator.c b/gdk/x11/gdkeventtranslator.c index bbd79dcae2..4589b1d802 100644 --- a/gdk/x11/gdkeventtranslator.c +++ b/gdk/x11/gdkeventtranslator.c @@ -20,7 +20,7 @@ #include "config.h" #include "gdkeventtranslator.h" - +#include "gdkwindow-x11.h" typedef GdkEventTranslatorIface GdkEventTranslatorInterface; G_DEFINE_INTERFACE (GdkEventTranslator, _gdk_x11_event_translator, G_TYPE_OBJECT); @@ -87,3 +87,24 @@ _gdk_x11_event_translator_select_window_events (GdkEventTranslator *translator, if (iface->select_window_events) iface->select_window_events (translator, window, event_mask); } + +GdkWindow * +_gdk_x11_event_translator_get_window (GdkEventTranslator *translator, + GdkDisplay *display, + XEvent *xevent) +{ + GdkEventTranslatorIface *iface; + GdkWindow *window = NULL; + + g_return_val_if_fail (GDK_IS_EVENT_TRANSLATOR (translator), NULL); + + iface = GDK_EVENT_TRANSLATOR_GET_IFACE (translator); + + if (iface->get_window) + window = iface->get_window (translator, xevent); + + if (!window) + window = gdk_x11_window_lookup_for_display (display, xevent->xany.window); + + return window; +} |