gtk_icon_view_layout (GtkIconView *icon_view)
{
GtkAllocation allocation;
- GtkRequisition requisition;
GtkWidget *widget;
GList *icons;
gint y = 0, maximum_width = 0;
gint row;
gint item_width;
+ gboolean size_changed = FALSE;
if (icon_view->priv->layout_idle_id != 0)
{
while (icons != NULL);
if (maximum_width != icon_view->priv->width)
- icon_view->priv->width = maximum_width;
+ {
+ icon_view->priv->width = maximum_width;
+ size_changed = TRUE;
+ }
y += icon_view->priv->margin;
if (y != icon_view->priv->height)
- icon_view->priv->height = y;
+ {
+ icon_view->priv->height = y;
+ size_changed = TRUE;
+ }
gtk_icon_view_set_adjustment_upper (icon_view->priv->hadjustment,
icon_view->priv->width);
gtk_icon_view_set_adjustment_upper (icon_view->priv->vadjustment,
icon_view->priv->height);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), &requisition, NULL);
-
- if (icon_view->priv->width != requisition.width ||
- icon_view->priv->height != requisition.height)
+ if (size_changed)
gtk_widget_queue_resize_no_redraw (widget);
gtk_widget_get_allocation (widget, &allocation);
gint width; /* Width and height of the buffer */
gint height;
+ /* This is used to monitor the overall size request
+ * and decide whether we need to queue resizes when
+ * the buffer content changes.
+ *
+ * FIXME: This could be done in a simpler way by
+ * consulting the above width/height of the buffer + some
+ * padding values, however all of this request code needs
+ * to be changed to use GtkSizeRequestIface and deserves
+ * more attention.
+ */
+ GtkRequisition cached_size_request;
+
/* The virtual cursor position is normally the same as the
* actual (strong) cursor position, except in two circumstances:
*
tmp_list = g_slist_next (tmp_list);
}
+
+ /* Cache the requested size of the text view so we can
+ * compare it in the changed_handler() */
+ priv->cached_size_request = *requisition;
}
static void
}
{
- GtkRequisition old_req;
+ GtkRequisition old_req = priv->cached_size_request;
GtkRequisition new_req;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), &old_req, NULL);
-
/* Use this instead of gtk_widget_size_request wrapper
* to avoid the optimization which just returns widget->requisition
* if a resize hasn't been queued.