[gtk+/client-side-windows] Don't hide foreign children when emulating visibility



commit 64e7c7828d951953708248b21b1541058067c702
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Jun 26 20:11:57 2009 +0200

    Don't hide foreign children when emulating visibility
    
    We emulate visibility by unmapping (in X) all mapped (according to
    gdk) windows that are not visible (all parents mapped). This is because
    there may be client side windows inbetween the native windows in the
    hierarchy, so you can't know a native window is visible just because
    all the parent native windows are mapped.
    
    However, we don't want to unmap foreign windows, as that may cause all
    sort of unexpected issues. This should be safe, because generally the
    parent of a foreign window is a native window (e.g. a socket), so its
    gdk visibility state is the same as the Xserver one.
    
    This fixes an issue with the GDM notification area where the unmap of
    the plug caused spurious UnmapNotify events that confused GtkSocket and
    caused icons to become one pixel wide.

 gdk/gdkwindow.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 201f84a..56b8974 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -5707,6 +5707,9 @@ gdk_window_raise_internal (GdkWindow *window)
     }
 }
 
+/* Showing a non-native parent may cause children to become visible,
+   we need to handle this by manually showing them then. To simplify
+   things we hide them all when they are not visible. */
 static void
 show_all_visible_impls (GdkWindowObject *private, gboolean already_mapped)
 {
@@ -5716,7 +5719,12 @@ show_all_visible_impls (GdkWindowObject *private, gboolean already_mapped)
   for (l = private->children; l != NULL; l = l->next)
     {
       child = l->data;
-      if (GDK_WINDOW_IS_MAPPED (child))
+
+      /* For foreign windows, only show if if was
+	 explicitly hidden, otherwise we might cause
+	 suprising things to happen to the other client. */
+      if (GDK_WINDOW_IS_MAPPED (child) &&
+	  GDK_WINDOW_TYPE (child) != GDK_WINDOW_FOREIGN)
 	show_all_visible_impls (child, FALSE);
     }
 
@@ -5968,6 +5976,10 @@ gdk_window_show (GdkWindow *window)
   gdk_window_show_internal (window, TRUE);
 }
 
+/* Hiding a non-native parent may cause parents to become non-visible,
+   even if their parent native window is visible. We need to handle this
+   by manually hiding them then. To simplify things we hide them all
+   when they are not visible. */
 static void
 hide_all_visible_impls (GdkWindowObject *private)
 {
@@ -5978,7 +5990,11 @@ hide_all_visible_impls (GdkWindowObject *private)
     {
       child = l->data;
 
-      if (GDK_WINDOW_IS_MAPPED (child))
+      /* For foreign windows, only hide if if was
+	 explicitly hidden, otherwise we might cause
+	 suprising things to happen to the other client. */
+      if (GDK_WINDOW_IS_MAPPED (child) &&
+	  GDK_WINDOW_TYPE (child) != GDK_WINDOW_FOREIGN)
 	hide_all_visible_impls (child);
     }
 



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