[gtk+/client-side-windows: 15/284] Ensure we have native window before reparenting to toplevel



commit aee3c571b0bb8c703bfd8e692d0d06ae3faad8a5
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Dec 4 12:56:26 2008 +0100

    Ensure we have native window before reparenting to toplevel
---
 gdk/gdkwindow.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index fb3dccb..2808ecc 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -924,6 +924,11 @@ gdk_window_reparent (GdkWindow *window,
   was_toplevel = private->parent == NULL;
   was_mapped = GDK_WINDOW_IS_MAPPED (window);
   show = FALSE;
+
+  /* Reparenting to toplevel. Ensure we have a native window so this can work */
+  if (new_parent_private->window_type == GDK_WINDOW_ROOT ||
+      new_parent_private->window_type == GDK_WINDOW_FOREIGN)
+    gdk_window_set_has_native (window, TRUE);
   
   if (gdk_window_has_impl (private))
     {
@@ -932,12 +937,9 @@ gdk_window_reparent (GdkWindow *window,
     }
   else
     {
-      if (new_parent_private->window_type == GDK_WINDOW_ROOT)
-	{
-	  /* TODO: We need to convert to a native window here */
-	  g_warning ("Reparenting client side windows to the root window not yet supported");
-	  return;
-	}
+      /* This shouldn't happen, as we created a native in this case, check anyway to see if that ever fails */
+      g_assert (new_parent_private->window_type != GDK_WINDOW_ROOT &&
+		new_parent_private->window_type != GDK_WINDOW_FOREIGN);
 
       show = was_mapped;
       gdk_window_hide (window);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]