[gtk+/client-side-windows: 200/284] Make gdk_window_get_toplevel() for CHILD window with root as parent
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+/client-side-windows: 200/284] Make gdk_window_get_toplevel() for CHILD window with root as parent
- Date: Thu, 2 Apr 2009 14:16:44 -0400 (EDT)
commit 8b7d8431aa57bc88cd4d4a7e875da15ebf7ac7b5
Author: Alexander Larsson <alexl redhat com>
Date: Wed Jan 28 16:37:56 2009 +0100
Make gdk_window_get_toplevel() for CHILD window with root as parent
Having GDK_WINDOW_CHILD windows with root as the parent apparently works,
and metacity uses it. The current gdk_window_get_toplevel() returns the
root window for that, which is wrong, so we check that explicitly.
---
gdk/gdkwindow.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 36cb4ef..978dd2e 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -1662,6 +1662,10 @@ gdk_window_get_parent (GdkWindow *window)
* @window: a #GdkWindow
*
* Gets the toplevel window that's an ancestor of @window.
+ *
+ * Any window type but %GDK_WINDOW_CHILD is considered a
+ * toplevel window, as is a %GDK_WINDOW_CHILD window that
+ * has a root window as parent.
*
* Return value: the toplevel window containing @window
**/
@@ -1673,8 +1677,14 @@ gdk_window_get_toplevel (GdkWindow *window)
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
obj = (GdkWindowObject *)window;
+
while (GDK_WINDOW_TYPE (obj) == GDK_WINDOW_CHILD)
- obj = (GdkWindowObject *)obj->parent;
+ {
+ if (obj->parent == NULL ||
+ GDK_WINDOW_TYPE (obj->parent) == GDK_WINDOW_ROOT)
+ break;
+ obj = obj->parent;
+ }
return GDK_WINDOW (obj);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]