[gtk+] paned: More fixes to keep windows in sync with widgets



commit 8cfcb2c1235e03690a95e03d65152b1e9e1af45d
Author: Benjamin Otte <otte redhat com>
Date:   Wed May 25 04:24:26 2011 +0200

    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.

 gtk/gtkpaned.c |   29 +++++++----------------------
 1 files changed, 7 insertions(+), 22 deletions(-)
---
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 0fe290e..85c4200 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -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);
+        }
     }
 }
 



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