[gtk+/events-refactor: 786/1085] GdkDisplayX11: Add internal version of get_event_window().
- From: Carlos Garnacho <carlosg src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+/events-refactor: 786/1085] GdkDisplayX11: Add internal version of get_event_window().
- Date: Tue, 29 Sep 2009 10:48:27 +0000 (UTC)
commit 8f1b078d642a9dea2128653297d3f986119333b9
Author: Carlos Garnacho <carlos lanedo com>
Date: Sun Aug 23 18:35:33 2009 +0200
GdkDisplayX11: Add internal version of get_event_window().
gdk/x11/gdkdisplay-x11.c | 38 +++++++++++++++++++++++++++++++++++++-
1 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 2674958..da980a2 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -317,6 +317,36 @@ gdk_check_wm_state_changed (GdkWindow *window)
do_net_wm_state_changes (window);
}
+static GdkWindow *
+get_event_window (GdkEventTranslator *translator,
+ XEvent *xevent)
+{
+ GdkDisplay *display;
+ Window xwindow;
+
+ display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (translator));
+
+ switch (xevent->type)
+ {
+ case DestroyNotify:
+ xwindow = xevent->xdestroywindow.window;
+ break;
+ case UnmapNotify:
+ xwindow = xevent->xunmap.window;
+ break;
+ case MapNotify:
+ xwindow = xevent->xmap.window;
+ break;
+ case ConfigureNotify:
+ xwindow = xevent->xconfigure.window;
+ break;
+ default:
+ xwindow = xevent->xany.window;
+ }
+
+ return gdk_window_lookup_for_display (display, xwindow);
+}
+
static gboolean
gdk_display_x11_translate_event (GdkEventTranslator *translator,
GdkDisplay *display,
@@ -337,11 +367,17 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
* Basically this means substructure events
* are reported same as structure events
*/
- window = gdk_event_translator_get_event_window (translator, display, xevent);
+ window = get_event_window (translator, xevent);
window_private = (GdkWindowObject *) window;
if (window)
{
+ /* We may receive events such as NoExpose/GraphicsExpose
+ * and ShmCompletion for pixmaps
+ */
+ if (!GDK_IS_WINDOW (window))
+ return FALSE;
+
screen = GDK_WINDOW_SCREEN (window);
screen_x11 = GDK_SCREEN_X11 (screen);
toplevel = _gdk_x11_window_get_toplevel (window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]