From: Timm Bäder Date: Sat, 17 Mar 2018 10:13:23 +0000 (+0100) Subject: layout: Fix scrolling X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~22^2~913 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=fb763cd4caeb4eb22ee37e902b55d6f5df971437;p=gtk4.git layout: Fix scrolling We accidentally dropped the code that takes the adjustments into account at some point. --- diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c index 60e132714f..c7fe6c20b2 100644 --- a/gtk/gtklayout.c +++ b/gtk/gtklayout.c @@ -76,9 +76,6 @@ struct _GtkLayoutPrivate /* Properties */ GList *children; - gint scroll_x; - gint scroll_y; - guint freeze_count; }; @@ -141,8 +138,6 @@ static void gtk_layout_get_child_property (GtkContainer *container, guint property_id, GValue *value, GParamSpec *pspec); -static void gtk_layout_allocate_child (GtkLayout *layout, - GtkLayoutChild *child); static void gtk_layout_adjustment_changed (GtkAdjustment *adjustment, GtkLayout *layout); @@ -712,9 +707,6 @@ gtk_layout_init (GtkLayout *layout) priv->hadjustment = NULL; priv->vadjustment = NULL; - priv->scroll_x = 0; - priv->scroll_y = 0; - priv->freeze_count = 0; } @@ -740,15 +732,34 @@ gtk_layout_size_allocate (GtkWidget *widget, GtkLayout *layout = GTK_LAYOUT (widget); GtkLayoutPrivate *priv = layout->priv; GList *tmp_list; + int scroll_x = 0; + int scroll_y = 0; tmp_list = priv->children; + if (priv->hadjustment) + scroll_x = - gtk_adjustment_get_value (priv->hadjustment); + + if (priv->vadjustment) + scroll_y = - gtk_adjustment_get_value (priv->vadjustment); + while (tmp_list) { GtkLayoutChild *child = tmp_list->data; + GtkAllocation allocation; + GtkRequisition requisition; + GtkAllocation child_clip; + tmp_list = tmp_list->next; - gtk_layout_allocate_child (layout, child); + allocation.x = child->x + scroll_x; + allocation.y = child->y + scroll_y; + + gtk_widget_get_preferred_size (child->widget, &requisition, NULL); + allocation.width = requisition.width; + allocation.height = requisition.height; + + gtk_widget_size_allocate (child->widget, &allocation, -1, &child_clip); } gtk_layout_set_hadjustment_values (layout); @@ -812,27 +823,6 @@ gtk_layout_forall (GtkContainer *container, } } -/* Operations on children - */ - -static void -gtk_layout_allocate_child (GtkLayout *layout, - GtkLayoutChild *child) -{ - GtkAllocation allocation; - GtkRequisition requisition; - GtkAllocation child_clip; - - allocation.x = child->x; - allocation.y = child->y; - - gtk_widget_get_preferred_size (child->widget, &requisition, NULL); - allocation.width = requisition.width; - allocation.height = requisition.height; - - gtk_widget_size_allocate (child->widget, &allocation, -1, &child_clip); -} - /* Callbacks */ static void