From 3b906a9c8fa438c771d3d430292467482d62ae11 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Thu, 28 Feb 2002 21:09:04 +0000 Subject: Initialize private->event_mask from attributes we retrieved for the Thu Feb 28 14:49:08 2002 Owen Taylor * gdk/x11/gdkwindow-x11.c (gdk_window_foreign_new): Initialize private->event_mask from attributes we retrieved for the window. --- gdk/x11/gdkwindow-x11.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'gdk') diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 21bcc8b0a..53779c08c 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -629,6 +629,21 @@ gdk_window_new (GdkWindow *parent, return window; } +static GdkEventMask +x_event_mask_to_gdk_event_mask (long mask) +{ + GdkEventMask event_mask = 0; + int i; + + for (i = 0; i < _gdk_nenvent_masks; i++) + { + if (mask & _gdk_event_mask_table[i]) + event_mask |= 1 << (i + 1); + } + + return event_mask; +} + /** * gdk_window_foreign_new: * @anid: a native window handle. @@ -692,6 +707,8 @@ gdk_window_foreign_new (GdkNativeWindow anid) private->window_type = GDK_WINDOW_FOREIGN; private->destroyed = FALSE; + private->event_mask = x_event_mask_to_gdk_event_mask (attrs.your_event_mask); + if (attrs.map_state == IsUnmapped) private->state = GDK_WINDOW_STATE_WITHDRAWN; else @@ -2448,7 +2465,6 @@ gdk_window_get_events (GdkWindow *window) { XWindowAttributes attrs; GdkEventMask event_mask; - int i; g_return_val_if_fail (window != NULL, 0); g_return_val_if_fail (GDK_IS_WINDOW (window), 0); @@ -2461,13 +2477,7 @@ gdk_window_get_events (GdkWindow *window) GDK_WINDOW_XID (window), &attrs); - event_mask = 0; - for (i = 0; i < _gdk_nenvent_masks; i++) - { - if (attrs.your_event_mask & _gdk_event_mask_table[i]) - event_mask |= 1 << (i + 1); - } - + event_mask = x_event_mask_to_gdk_event_mask (attrs.your_event_mask); GDK_WINDOW_OBJECT (window)->event_mask = event_mask; return event_mask; -- cgit v1.2.1