Re: goocanvas 1.91.x releases?



On Wed, 2010-11-03 at 20:58 +0000, Damon Chaplin wrote:
> On Wed, 2010-11-03 at 21:21 +0100, Murray Cumming wrote:
> > On Wed, 2010-11-03 at 11:03 +0000, Damon Chaplin wrote:
> > > On Tue, 2010-11-02 at 11:42 +0100, Murray Cumming wrote:
> > > > On Wed, 2010-10-27 at 10:24 +0100, Damon Chaplin wrote:
> > > > > I guess I'll do another release soon.
> > > > 
> > > > This would be really helpful, please.
> > > 
> > > OK. I've put 1.90.2 up at:
> > >   http://download.gnome.org/sources/goocanvas/1.90/
> > > 
> > > There is a problem with the scrollbars again. I'm not sure if it is a
> > > GooCanvas bug or a GtkScrolledWindow bug though.
> > 
> > Tristan (who worked on the new GtkScrollable API), could you take a look
> > when you have a chance, please?
> > 
> > Damon, if the problem isn't obvious, please give Tristan a clue what to
> > look for.
> 
> It is obvious - the scrollbars disappear in the main demo.
> 
> If you resize the window, they appear for a brief moment then disappear
> again, which makes me think it is a GtkScrolledWindow issue.
> 

This is definitely odd... I added some trace to gtkscrolledwindow and
found that it seems scrolledwindow is not to blame for this particular
case.

I then added some trace to the canvas code, it seems that the canvas
code is loosing its canvas size and ends up setting the canvas
size to the window allocation size (I have no idea how that is
happening).

For scrollbars to appear, obviously the statement:
   adjustment->upper - adjustment->lower > adjustment->page_size

Must be true... somehow it seems that the goocanvas invariably
ends up setting adjustment->upper = allocation->width/height
(causing no scrollbars to appear at all).

I'm attaching a patch against goocanvas.c here just to point out
what I'm talking about, apply it and run the main demo and you will
see some startling numbers (i.e. what is set as the upper value
of the adjustment seems inconsistent and sometimes an unreasonably
large number).

For the hell of it (incase you're interested in seeing what happens
on the scrolled window side), I'll also attach the debug for
scrolled-window I've been using (however I might commit those 
GTK_NOTE() statements to GTK+ soon anyhow).

Cheers,
          -Tristan

Note I'm still not subscribed to this list... please keep me on CC.

diff --git a/src/goocanvas.c b/src/goocanvas.c
index 79b70a6..aedcdc6 100644
--- a/src/goocanvas.c
+++ b/src/goocanvas.c
@@ -1642,12 +1642,19 @@ goo_canvas_configure_hadjustment (GooCanvas *canvas,
 
   canvas->freeze_count++;
 
+  g_object_freeze_notify (G_OBJECT (adj));
+
+  g_print ("Configuring hadjustment for window width %d\n", window_width);
+
   if (gtk_adjustment_get_upper (adj) != window_width)
     {
       gtk_adjustment_set_upper (adj, window_width);
+
       changed = TRUE;
     }
 
+  g_print ("hadjustment upper value %f\n", gtk_adjustment_get_upper (adj));
+
   gtk_widget_get_allocation (widget, &allocation);
   page_size = gtk_adjustment_get_page_size (adj);
   if (page_size != allocation.width)
@@ -1673,6 +1680,9 @@ goo_canvas_configure_hadjustment (GooCanvas *canvas,
 
   if (value_changed)
     gtk_adjustment_value_changed (adj);
+
+  g_object_thaw_notify (G_OBJECT (adj));
+
 }
 
 
@@ -1690,12 +1700,19 @@ goo_canvas_configure_vadjustment (GooCanvas *canvas,
 
   canvas->freeze_count++;
 
+  g_object_freeze_notify (G_OBJECT (adj));
+
+  g_print ("Configuring vadjustment for window height %d\n", window_height);
+
   if (gtk_adjustment_get_upper (adj) != window_height)
     {
       gtk_adjustment_set_upper (adj, window_height);
+
       changed = TRUE;
     }
 
+  g_print ("vadjustment upper value %f\n", gtk_adjustment_get_upper (adj));
+
   gtk_widget_get_allocation (widget, &allocation);
   page_size = gtk_adjustment_get_page_size (adj);
   if (page_size != allocation.height)
@@ -1721,6 +1738,8 @@ goo_canvas_configure_vadjustment (GooCanvas *canvas,
 
   if (value_changed)
     gtk_adjustment_value_changed (adj);
+
+  g_object_thaw_notify (G_OBJECT (adj));
 }
 
 
diff --git a/gtk/gtkdebug.h b/gtk/gtkdebug.h
index b9fb218..0132d59 100644
--- a/gtk/gtkdebug.h
+++ b/gtk/gtkdebug.h
@@ -48,7 +48,8 @@ typedef enum {
   GTK_DEBUG_ICONTHEME       = 1 << 9,
   GTK_DEBUG_PRINTING        = 1 << 10,
   GTK_DEBUG_BUILDER         = 1 << 11,
-  GTK_DEBUG_SIZE_REQUEST    = 1 << 12
+  GTK_DEBUG_SIZE_REQUEST    = 1 << 12,
+  GTK_DEBUG_SCROLLED_WINDOW = 1 << 13
 } GtkDebugFlag;
 
 #ifdef G_ENABLE_DEBUG
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index a4d067a..3df3e87 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -210,6 +210,7 @@ static const GDebugKey gtk_debug_keys[] = {
   {"printing", GTK_DEBUG_PRINTING},
   {"builder", GTK_DEBUG_BUILDER},
   {"size-request", GTK_DEBUG_SIZE_REQUEST},
+  {"scrolled-window", GTK_DEBUG_SCROLLED_WINDOW},
 };
 #endif /* G_ENABLE_DEBUG */
 
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 1b794d4..579fbfa 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -33,6 +33,7 @@
 #include "gtkscrolledwindow.h"
 #include "gtkwindow.h"
 #include "gtktypeutils.h"
+#include "gtkdebug.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"
 
@@ -1648,12 +1649,26 @@ gtk_scrolled_window_size_allocate (GtkWidget     *widget,
        * observes the adjustments to detect scrollbar visibility and also avoids 
        * infinite recursion
        */
+      GTK_NOTE (SCROLLED_WINDOW,
+		g_print ("SWindow allocating child %s sb visibility h:%s v:%s inner loop start\n",
+			 G_OBJECT_TYPE_NAME (child),
+			 priv->hscrollbar_visible ? "visible" : "invisible",
+			 priv->vscrollbar_visible ? "visible" : "invisible"));
+
       do
 	{
 	  previous_hvis = priv->hscrollbar_visible;
 	  previous_vvis = priv->vscrollbar_visible;
 	  gtk_scrolled_window_allocate_child (scrolled_window, &relative_allocation);
 
+	  GTK_NOTE (SCROLLED_WINDOW,
+		    g_print ("SWindow allocated child %s width %d/height %d, "
+			     "new visibility h:%s v:%s\n",
+			     G_OBJECT_TYPE_NAME (child),
+			     relative_allocation.width, relative_allocation.height,
+			     priv->hscrollbar_visible ? "visible" : "invisible",
+			     priv->vscrollbar_visible ? "visible" : "invisible"));
+
 	  /* If, after the first iteration, the hscrollbar and the
 	   * vscrollbar flip visiblity, then we need both.
 	   */
@@ -1664,6 +1679,11 @@ gtk_scrolled_window_size_allocate (GtkWidget     *widget,
 	      priv->hscrollbar_visible = TRUE;
 	      priv->vscrollbar_visible = TRUE;
 
+	      GTK_NOTE (SCROLLED_WINDOW,
+			g_print ("SWindow allocating child %s, both scrollbars visibility flipped.. "
+				 "breaking out\n",
+				 G_OBJECT_TYPE_NAME (child)));
+
 	      gtk_scrolled_window_allocate_child (scrolled_window, &relative_allocation);
 
 	      break;
@@ -1673,6 +1693,12 @@ gtk_scrolled_window_size_allocate (GtkWidget     *widget,
 	}
       while (previous_hvis != priv->hscrollbar_visible ||
 	     previous_vvis != priv->vscrollbar_visible);
+
+      GTK_NOTE (SCROLLED_WINDOW,
+		g_print ("SWindow allocating child %s, inner loop finished\n",
+			 G_OBJECT_TYPE_NAME (child)));
+
+
     }
   else
     {
@@ -1870,6 +1896,16 @@ gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
 	  visible = priv->hscrollbar_visible;
 	  priv->hscrollbar_visible = (adjustment->upper - adjustment->lower >
 					      adjustment->page_size);
+
+	  GTK_NOTE (SCROLLED_WINDOW,
+		    g_print ("SWindow hadjustment lower %f upper %f page_size %f\n",
+			     adjustment->lower, adjustment->upper, adjustment->page_size));
+
+	  GTK_NOTE (SCROLLED_WINDOW,
+		    g_print ("SWindow hadjustment changed, visibility old:%s, new:%s\n",
+			     visible ? "visible" : "invisible",
+			     priv->hscrollbar_visible ? "visible" : "invisible"));
+
 	  if (!priv->inside_allocate && priv->hscrollbar_visible != visible)
 	    gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
 	}
@@ -1884,6 +1920,16 @@ gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
 	  visible = priv->vscrollbar_visible;
 	  priv->vscrollbar_visible = (adjustment->upper - adjustment->lower >
 					      adjustment->page_size);
+
+	  GTK_NOTE (SCROLLED_WINDOW,
+		    g_print ("SWindow vadjustment lower %f upper %f page_size %f\n",
+			     adjustment->lower, adjustment->upper, adjustment->page_size));
+
+	  GTK_NOTE (SCROLLED_WINDOW,
+		    g_print ("SWindow vadjustment changed, visibility old:%s, new:%s\n",
+			     visible ? "visible" : "invisible",
+			     priv->vscrollbar_visible ? "visible" : "invisible"));
+
 	  if (!priv->inside_allocate && priv->vscrollbar_visible != visible)
 	    gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
 	}


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