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.
This commit is contained in:
Alexander Larsson 2009-06-26 20:11:57 +02:00
parent c84c0e92f8
commit 64e7c7828d

View File

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