diff --git a/ChangeLog b/ChangeLog index b6e5c1a51c..dfe1ce46c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Tue Oct 23 17:31:42 2001 Owen Taylor + + * gdk/x11/gdkwindow-x11.c gdk/win32/gdkwindow-win32.c: Always + set window->parent (except or the root window itself); if + the window's parent is not a GdkWindow, or is a window of + type GDK_WINDOW_FOREIGN, set window->parent to the root parent. + + * gdk/gdkwindow.c (gdk_window_get_toplevels): Don't include + windows of type GDK_WINDOW_FOREIGN. + 2001-10-24 Havoc Pennington * gtk/gtktextiter.c (gtk_text_iter_backward_chars): if we move to diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index b6e5c1a51c..dfe1ce46c8 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,13 @@ +Tue Oct 23 17:31:42 2001 Owen Taylor + + * gdk/x11/gdkwindow-x11.c gdk/win32/gdkwindow-win32.c: Always + set window->parent (except or the root window itself); if + the window's parent is not a GdkWindow, or is a window of + type GDK_WINDOW_FOREIGN, set window->parent to the root parent. + + * gdk/gdkwindow.c (gdk_window_get_toplevels): Don't include + windows of type GDK_WINDOW_FOREIGN. + 2001-10-24 Havoc Pennington * gtk/gtktextiter.c (gtk_text_iter_backward_chars): if we move to diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index b6e5c1a51c..dfe1ce46c8 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +Tue Oct 23 17:31:42 2001 Owen Taylor + + * gdk/x11/gdkwindow-x11.c gdk/win32/gdkwindow-win32.c: Always + set window->parent (except or the root window itself); if + the window's parent is not a GdkWindow, or is a window of + type GDK_WINDOW_FOREIGN, set window->parent to the root parent. + + * gdk/gdkwindow.c (gdk_window_get_toplevels): Don't include + windows of type GDK_WINDOW_FOREIGN. + 2001-10-24 Havoc Pennington * gtk/gtktextiter.c (gtk_text_iter_backward_chars): if we move to diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index b6e5c1a51c..dfe1ce46c8 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,13 @@ +Tue Oct 23 17:31:42 2001 Owen Taylor + + * gdk/x11/gdkwindow-x11.c gdk/win32/gdkwindow-win32.c: Always + set window->parent (except or the root window itself); if + the window's parent is not a GdkWindow, or is a window of + type GDK_WINDOW_FOREIGN, set window->parent to the root parent. + + * gdk/gdkwindow.c (gdk_window_get_toplevels): Don't include + windows of type GDK_WINDOW_FOREIGN. + 2001-10-24 Havoc Pennington * gtk/gtktextiter.c (gtk_text_iter_backward_chars): if we move to diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index b6e5c1a51c..dfe1ce46c8 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,13 @@ +Tue Oct 23 17:31:42 2001 Owen Taylor + + * gdk/x11/gdkwindow-x11.c gdk/win32/gdkwindow-win32.c: Always + set window->parent (except or the root window itself); if + the window's parent is not a GdkWindow, or is a window of + type GDK_WINDOW_FOREIGN, set window->parent to the root parent. + + * gdk/gdkwindow.c (gdk_window_get_toplevels): Don't include + windows of type GDK_WINDOW_FOREIGN. + 2001-10-24 Havoc Pennington * gtk/gtktextiter.c (gtk_text_iter_backward_chars): if we move to diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index b6e5c1a51c..dfe1ce46c8 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,13 @@ +Tue Oct 23 17:31:42 2001 Owen Taylor + + * gdk/x11/gdkwindow-x11.c gdk/win32/gdkwindow-win32.c: Always + set window->parent (except or the root window itself); if + the window's parent is not a GdkWindow, or is a window of + type GDK_WINDOW_FOREIGN, set window->parent to the root parent. + + * gdk/gdkwindow.c (gdk_window_get_toplevels): Don't include + windows of type GDK_WINDOW_FOREIGN. + 2001-10-24 Havoc Pennington * gtk/gtktextiter.c (gtk_text_iter_backward_chars): if we move to diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index b6e5c1a51c..dfe1ce46c8 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,13 @@ +Tue Oct 23 17:31:42 2001 Owen Taylor + + * gdk/x11/gdkwindow-x11.c gdk/win32/gdkwindow-win32.c: Always + set window->parent (except or the root window itself); if + the window's parent is not a GdkWindow, or is a window of + type GDK_WINDOW_FOREIGN, set window->parent to the root parent. + + * gdk/gdkwindow.c (gdk_window_get_toplevels): Don't include + windows of type GDK_WINDOW_FOREIGN. + 2001-10-24 Havoc Pennington * gtk/gtktextiter.c (gtk_text_iter_backward_chars): if we move to diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 68f540bdcd..b8729093d0 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -320,7 +320,9 @@ _gdk_window_destroy_hierarchy (GdkWindow *window, private->bg_pixmap = NULL; } - if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN) + if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_FOREIGN) + g_assert (private->children == NULL); + else { children = tmp = private->children; private->children = NULL; @@ -695,7 +697,8 @@ gdk_window_get_toplevels (void) tmp_list = ((GdkWindowObject *)_gdk_parent_root)->children; while (tmp_list) { - new_list = g_list_prepend (new_list, tmp_list->data); + if (GDK_WINDOW_TYPE (tmp_list->data) != GDK_WINDOW_FOREIGN) + new_list = g_list_prepend (new_list, tmp_list->data); tmp_list = tmp_list->next; } diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 0eef880b8a..c0fdf522aa 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -407,7 +407,6 @@ gdk_window_new (GdkWindow *parent, { GdkWindow *window; GdkWindowObject *private; - GdkWindowObject *parent_private; GdkWindowImplWin32 *impl; GdkDrawableImplWin32 *draw_impl; @@ -439,7 +438,6 @@ gdk_window_new (GdkWindow *parent, (attributes->window_type == GDK_WINDOW_TEMP ? "TEMP" : "???")))))); - parent_private = (GdkWindowObject*) parent; if (GDK_WINDOW_DESTROYED (parent)) return NULL; @@ -451,6 +449,12 @@ gdk_window_new (GdkWindow *parent, draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl); draw_impl->wrapper = GDK_DRAWABLE (window); + /* Windows with a foreign parent are treated as if they are children + * of the root window, except for actual creation. + */ + if (GDK_WINDOW_TYPE (parent) == GDK_WINDOW_FOREIGN) + parent = _gdk_parent_root; + private->parent = (GdkWindowObject *)parent; if (attributes_mask & GDK_WA_X) @@ -491,7 +495,7 @@ gdk_window_new (GdkWindow *parent, impl->event_mask = GDK_STRUCTURE_MASK | attributes->event_mask; - if (parent_private && parent_private->guffaw_gravity) + if (private->parent && private->parent->guffaw_gravity) { /* XXX ??? */ } @@ -535,8 +539,8 @@ gdk_window_new (GdkWindow *parent, GDK_NOTE (MISC, g_print ("...GDK_INPUT_ONLY, system colormap\n")); } - if (parent_private) - parent_private->children = g_list_prepend (parent_private->children, window); + if (private->parent) + private->parent->children = g_list_prepend (private->parent->children, window); switch (private->window_type) { @@ -691,7 +695,6 @@ gdk_window_foreign_new (GdkNativeWindow anid) { GdkWindow *window; GdkWindowObject *private; - GdkWindowObject *parent_private; GdkWindowImplWin32 *impl; GdkDrawableImplWin32 *draw_impl; @@ -707,11 +710,10 @@ gdk_window_foreign_new (GdkNativeWindow anid) parent = GetParent ((HWND)anid); private->parent = gdk_win32_handle_table_lookup ((GdkNativeWindow) parent); + if (!private->parent || GDK_WINDOW_TYPE (private->parent) == GDK_WINDOW_FOREIGN) + private->parent = (GdkWindowObject *)_gdk_parent_root; - parent_private = (GdkWindowObject *)private->parent; - - if (parent_private) - parent_private->children = g_list_prepend (parent_private->children, window); + private->parent->children = g_list_prepend (private->parent->children, window); draw_impl->handle = (HWND) anid; GetClientRect ((HWND) anid, &rect); @@ -1106,6 +1108,12 @@ gdk_window_reparent (GdkWindow *window, x, y, impl->width, impl->height, TRUE)) WIN32_API_FAILED ("MoveWindow"); } + + /* From here on, we treat parents of type GDK_WINDOW_FOREIGN like + * the root window + */ + if (GDK_WINDOW_TYPE (new_parent) == GDK_WINDOW_FOREIGN) + new_parent = _gdk_parent_root; window_private->parent = (GdkWindowObject *)new_parent; diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index be79501995..5b2df95ecf 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -318,7 +318,6 @@ gdk_window_new (GdkWindow *parent, { GdkWindow *window; GdkWindowObject *private; - GdkWindowObject *parent_private; GdkWindowImplX11 *impl; GdkDrawableImplX11 *draw_impl; @@ -347,7 +346,6 @@ gdk_window_new (GdkWindow *parent, g_return_val_if_fail (GDK_IS_WINDOW (parent), NULL); - parent_private = (GdkWindowObject*) parent; if (GDK_WINDOW_DESTROYED (parent)) return NULL; @@ -358,8 +356,14 @@ gdk_window_new (GdkWindow *parent, impl = GDK_WINDOW_IMPL_X11 (private->impl); draw_impl = GDK_DRAWABLE_IMPL_X11 (private->impl); draw_impl->wrapper = GDK_DRAWABLE (window); - + xdisplay = draw_impl->xdisplay = GDK_WINDOW_XDISPLAY (parent); + + /* Windows with a foreign parent are treated as if they are children + * of the root window, except for actual creation. + */ + if (GDK_WINDOW_TYPE (parent) == GDK_WINDOW_FOREIGN) + parent = _gdk_parent_root; private->parent = (GdkWindowObject *)parent; @@ -386,8 +390,7 @@ gdk_window_new (GdkWindow *parent, * attributes->window_type for input-only windows * before */ - if (GDK_WINDOW_TYPE (parent) == GDK_WINDOW_ROOT && - GDK_WINDOW_TYPE (parent) == GDK_WINDOW_FOREIGN) + if (GDK_WINDOW_TYPE (parent) == GDK_WINDOW_ROOT) private->window_type = GDK_WINDOW_TEMP; else private->window_type = GDK_WINDOW_CHILD; @@ -424,7 +427,7 @@ gdk_window_new (GdkWindow *parent, else xattributes.override_redirect = False; - if (parent_private && parent_private->guffaw_gravity) + if (private->parent && private->parent->guffaw_gravity) { xattributes.win_gravity = StaticGravity; xattributes_mask |= CWWinGravity; @@ -436,8 +439,7 @@ gdk_window_new (GdkWindow *parent, case GDK_WINDOW_TOPLEVEL: case GDK_WINDOW_DIALOG: case GDK_WINDOW_TEMP: - if (GDK_WINDOW_TYPE (parent) != GDK_WINDOW_ROOT && - GDK_WINDOW_TYPE (parent) != GDK_WINDOW_FOREIGN) + if (GDK_WINDOW_TYPE (parent) != GDK_WINDOW_ROOT) { g_warning (G_STRLOC "Toplevel windows must be created as children of\n" "of a window of type GDK_WINDOW_ROOT or GDK_WINDOW_FOREIGN"); @@ -527,8 +529,8 @@ gdk_window_new (GdkWindow *parent, (attributes->cursor) : NULL)); - if (parent_private) - parent_private->children = g_list_prepend (parent_private->children, window); + if (private->parent) + private->parent->children = g_list_prepend (private->parent->children, window); switch (GDK_WINDOW_TYPE (private)) { @@ -644,7 +646,6 @@ gdk_window_foreign_new (GdkNativeWindow anid) { GdkWindow *window; GdkWindowObject *private; - GdkWindowObject *parent_private; GdkWindowImplX11 *impl; GdkDrawableImplX11 *draw_impl; XWindowAttributes attrs; @@ -675,11 +676,10 @@ gdk_window_foreign_new (GdkNativeWindow anid) draw_impl->wrapper = GDK_DRAWABLE (window); private->parent = gdk_xid_table_lookup (parent); + if (!private->parent || GDK_WINDOW_TYPE (private->parent) == GDK_WINDOW_FOREIGN) + private->parent = (GdkWindowObject *)_gdk_parent_root; - parent_private = (GdkWindowObject *)private->parent; - - if (parent_private) - parent_private->children = g_list_prepend (parent_private->children, window); + private->parent->children = g_list_prepend (private->parent->children, window); draw_impl->xid = anid; draw_impl->xdisplay = gdk_display; @@ -1210,6 +1210,12 @@ gdk_window_reparent (GdkWindow *window, GDK_WINDOW_XID (window), GDK_WINDOW_XID (new_parent), x, y); + + /* From here on, we treat parents of type GDK_WINDOW_FOREIGN like + * the root window + */ + if (GDK_WINDOW_TYPE (new_parent) == GDK_WINDOW_FOREIGN) + new_parent = _gdk_parent_root; window_private->parent = (GdkWindowObject *)new_parent;