[gtk+/client-side-windows: 205/284] Only sync the display if creating a native window implicitly



commit a6e647863d8da7f81b2ae906f17341edfe929773
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Jan 29 19:52:12 2009 +0100

    Only sync the display if creating a native window implicitly
---
 gdk/gdkwindow.c           |    6 ------
 gdk/x11/gdkdrawable-x11.c |   12 ++++++++++--
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index b442865..102fc90 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -1305,12 +1305,6 @@ gdk_window_set_has_native (GdkWindow *window, gboolean has_native)
 
       if (gdk_window_is_viewable (window))
 	GDK_WINDOW_IMPL_GET_IFACE (private->impl)->show (window);
-
-      /* We sync here to ensure the window is created in the Xserver when
-       * this function returns. This is required because the returned XID
-       * for this window must be valid immediately, even with another
-       * connection to the Xserver */
-      gdk_display_sync (gdk_drawable_get_display (window));
     }
   else
     {
diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c
index 5c4abce..2e53041 100644
--- a/gdk/x11/gdkdrawable-x11.c
+++ b/gdk/x11/gdkdrawable-x11.c
@@ -875,14 +875,22 @@ gdk_x11_drawable_get_xid (GdkDrawable *drawable)
       
       /* Try to ensure the window has a native window */
       if (!_gdk_window_has_impl (window))
-	gdk_window_set_has_native (window, TRUE);
+	{
+	  gdk_window_set_has_native (window, TRUE);
+
+	  /* We sync here to ensure the window is created in the Xserver when
+	   * this function returns. This is required because the returned XID
+	   * for this window must be valid immediately, even with another
+	   * connection to the Xserver */
+	  gdk_display_sync (gdk_drawable_get_display (window));
+	}
       
       if (!GDK_WINDOW_IS_X11 (window))
         {
           g_warning (G_STRLOC " drawable is not a native X11 window");
           return None;
         }
-
+      
       impl = ((GdkWindowObject *)drawable)->impl;
     }
   else if (GDK_IS_PIXMAP (drawable))



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