paned: More fixes to keep windows in sync with widgets

Fixes sidebar in evince not showing up. This was caused by the
visiblility of the widget changing and the paned not fixing its child
window's visibility accordingly.
This commit is contained in:
Benjamin Otte 2011-05-25 04:24:26 +02:00
parent 2ebe1ef6f2
commit 8cfcb2c123

View File

@ -983,18 +983,6 @@ flip_child (GtkWidget *widget,
child_pos->x = 2 * x + width - child_pos->x - child_pos->width;
}
static gboolean
gtk_paned_get_child_visible (GtkPaned *paned,
guint id)
{
GtkPanedPrivate *priv = paned->priv;
GtkWidget *child;
child = id == CHILD1 ? priv->child1 : priv->child2;
return (child != NULL && gtk_widget_get_child_visible (child));
}
static void
gtk_paned_set_child_visible (GtkPaned *paned,
guint id,
@ -1002,28 +990,25 @@ gtk_paned_set_child_visible (GtkPaned *paned,
{
GtkPanedPrivate *priv = paned->priv;
GtkWidget *child;
gboolean was_visible;
was_visible = gtk_paned_get_child_visible (paned, id);
child = id == CHILD1 ? priv->child1 : priv->child2;
if (child == NULL)
return;
if (was_visible == visible)
return;
gtk_widget_set_child_visible (child, visible);
if (gtk_widget_get_mapped (GTK_WIDGET (paned)))
{
GdkWindow *window = id == CHILD1 ? priv->child1_window : priv->child2_window;
if (visible)
gdk_window_show (window);
else
gdk_window_hide (window);
if (visible != gdk_window_is_visible (window))
{
if (visible)
gdk_window_show (window);
else
gdk_window_hide (window);
}
}
}