[gtk+] Fixing hangs with GtkScrolledWindow



commit f20ac5792fe306885329817f7e6e9dabf0e91da0
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Fri Nov 19 00:53:13 2010 +0900

    Fixing hangs with GtkScrolledWindow
    
    Now gtk_widget_size_allocate() unsets the resize_needed flags
    before returning, essentially this means that any widget that
    has a queued resize and is allocated before resize time, including
    queued resizes from inside a size_allocate() method will be
    cancelled.

 gtk/gtkwidget.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 4ced3d9..1c3955b 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -4386,6 +4386,11 @@ gtk_widget_queue_draw (GtkWidget *widget)
  * be called when a widget for some reason has a new size request.
  * For example, when you change the text in a #GtkLabel, #GtkLabel
  * queues a resize to ensure there's enough space for the new text.
+ *
+ * <note><para>You cannot call gtk_widget_queue_resize() on a widget
+ * from inside it's implementation of the GtkWidgetClass::size_allocate 
+ * virtual method. Calls to gtk_widget_queue_resize() from inside
+ * GtkWidgetClass::size_allocate will be silently ignored.</para></note>
  **/
 void
 gtk_widget_queue_resize (GtkWidget *widget)
@@ -4671,6 +4676,11 @@ gtk_widget_size_allocate (GtkWidget	*widget,
 
   g_signal_emit (widget, widget_signals[SIZE_ALLOCATE], 0, &real_allocation);
 
+  /* Size allocation is god... after consulting god, no further requests or allocations are needed */
+  priv->width_request_needed  = FALSE;
+  priv->height_request_needed = FALSE;
+  priv->alloc_needed          = FALSE;
+
   if (gtk_widget_get_mapped (widget))
     {
       if (!gtk_widget_get_has_window (widget) && priv->redraw_on_alloc && position_changed)



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