Always set window->parent (except or the root window itself); if the

Tue Oct 23 17:31:42 2001  Owen Taylor  <otaylor@redhat.com>

	* 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.
This commit is contained in:
Owen Taylor 2001-10-24 14:15:50 +00:00 committed by Owen Taylor
parent ec00283fca
commit b7c639eafe
10 changed files with 114 additions and 27 deletions

View File

@ -1,3 +1,13 @@
Tue Oct 23 17:31:42 2001 Owen Taylor <otaylor@redhat.com>
* 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 <hp@pobox.com>
* gtk/gtktextiter.c (gtk_text_iter_backward_chars): if we move to

View File

@ -1,3 +1,13 @@
Tue Oct 23 17:31:42 2001 Owen Taylor <otaylor@redhat.com>
* 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 <hp@pobox.com>
* gtk/gtktextiter.c (gtk_text_iter_backward_chars): if we move to

View File

@ -1,3 +1,13 @@
Tue Oct 23 17:31:42 2001 Owen Taylor <otaylor@redhat.com>
* 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 <hp@pobox.com>
* gtk/gtktextiter.c (gtk_text_iter_backward_chars): if we move to

View File

@ -1,3 +1,13 @@
Tue Oct 23 17:31:42 2001 Owen Taylor <otaylor@redhat.com>
* 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 <hp@pobox.com>
* gtk/gtktextiter.c (gtk_text_iter_backward_chars): if we move to

View File

@ -1,3 +1,13 @@
Tue Oct 23 17:31:42 2001 Owen Taylor <otaylor@redhat.com>
* 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 <hp@pobox.com>
* gtk/gtktextiter.c (gtk_text_iter_backward_chars): if we move to

View File

@ -1,3 +1,13 @@
Tue Oct 23 17:31:42 2001 Owen Taylor <otaylor@redhat.com>
* 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 <hp@pobox.com>
* gtk/gtktextiter.c (gtk_text_iter_backward_chars): if we move to

View File

@ -1,3 +1,13 @@
Tue Oct 23 17:31:42 2001 Owen Taylor <otaylor@redhat.com>
* 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 <hp@pobox.com>
* gtk/gtktextiter.c (gtk_text_iter_backward_chars): if we move to

View File

@ -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;
}

View File

@ -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;

View File

@ -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;