For foreign parents, use the real parent not the root (which is what we list as parent in the APIs)

This commit is contained in:
Alexander Larsson 2008-12-03 22:00:56 +01:00 committed by Alexander Larsson
parent d326a638fb
commit ec4f8baa08
3 changed files with 14 additions and 5 deletions

View File

@ -267,6 +267,7 @@ GdkPixmap *_gdk_bitmap_create_from_data (GdkDrawable *drawable,
gint height);
void _gdk_window_impl_new (GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkVisual *visual,
GdkEventMask event_mask,

View File

@ -636,6 +636,7 @@ gdk_window_new (GdkWindow *parent,
int x, y, depth;
gboolean native;
GdkEventMask event_mask;
GdkWindow *real_parent;
g_return_val_if_fail (attributes != NULL, NULL);
@ -661,6 +662,7 @@ gdk_window_new (GdkWindow *parent,
/* Windows with a foreign parent are treated as if they are children
* of the root window, except for actual creation.
*/
real_parent = parent;
if (GDK_WINDOW_TYPE (parent) == GDK_WINDOW_FOREIGN)
parent = gdk_screen_get_root_window (screen);
@ -783,7 +785,7 @@ gdk_window_new (GdkWindow *parent,
event_mask = GDK_EXPOSURE_MASK;
/* Create the impl */
_gdk_window_impl_new (window, screen, visual, event_mask, attributes, attributes_mask);
_gdk_window_impl_new (window, real_parent, screen, visual, event_mask, attributes, attributes_mask);
}
else
{
@ -1019,9 +1021,9 @@ gdk_window_set_has_native (GdkWindow *window, gboolean has_native)
GdkVisual *visual;
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_ROOT);
if (GDK_WINDOW_DESTROYED (window))
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_ROOT ||
GDK_WINDOW_DESTROYED (window))
return;
private = (GdkWindowObject *) window;
@ -1043,7 +1045,7 @@ gdk_window_set_has_native (GdkWindow *window, gboolean has_native)
visual = gdk_drawable_get_visual (window);
old_impl = private->impl;
_gdk_window_impl_new (window, screen, visual, GDK_EXPOSURE_MASK, NULL, 0);
_gdk_window_impl_new (window, private->parent, screen, visual, GDK_EXPOSURE_MASK, NULL, 0);
new_impl = private->impl;
private->impl = old_impl;
@ -1482,6 +1484,11 @@ gdk_window_add_filter (GdkWindow *window,
private = (GdkWindowObject*) window;
if (private && GDK_WINDOW_DESTROYED (window))
return;
/* Filters are for the native events on the native window, so
ensure there is a native window. */
if (window)
gdk_window_set_has_native (window, TRUE);
if (private)
tmp_list = private->filters;

View File

@ -624,6 +624,7 @@ setup_toplevel_window (GdkWindow *window,
void
_gdk_window_impl_new (GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkVisual *visual,
GdkEventMask event_mask,
@ -652,7 +653,7 @@ _gdk_window_impl_new (GdkWindow *window,
private = (GdkWindowObject *) window;
screen_x11 = GDK_SCREEN_X11 (screen);
xparent = GDK_WINDOW_XID (private->parent);
xparent = GDK_WINDOW_XID (real_parent);
impl = g_object_new (_gdk_window_impl_get_type (), NULL);
private->impl = (GdkDrawable *)impl;