summaryrefslogtreecommitdiff
path: root/gtk/gtkviewport.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2017-06-18 15:45:42 +0200
committerMatthias Clasen <mclasen@redhat.com>2017-07-19 21:27:14 -0400
commitc2abb698bea9e9f16f3187e5dbb0f32ec555d694 (patch)
tree499d6f3d36102b4af5b432c2e7d45b70de5ce931 /gtk/gtkviewport.c
parente36ddfec177773ba993a8f8dcd566cf3fb3bb5aa (diff)
downloadgtk+-c2abb698bea9e9f16f3187e5dbb0f32ec555d694.tar.gz
Replace a few get_content_allocation calls with get_content_size
The position of the content allocation is almost never relevant since it's 0/0 for measure, size_allocate and snapshot.
Diffstat (limited to 'gtk/gtkviewport.c')
-rw-r--r--gtk/gtkviewport.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index 3bf7349aa6..e633844109 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -120,19 +120,19 @@ viewport_set_adjustment_values (GtkViewport *viewport,
GtkScrollablePolicy scroll_policy;
GtkScrollablePolicy other_scroll_policy;
GtkOrientation other_orientation;
- GtkAllocation view_allocation;
GtkWidget *child;
gdouble upper, value;
int viewport_size, other_viewport_size;
+ int view_width, view_height;
- gtk_widget_get_content_allocation (GTK_WIDGET (viewport), &view_allocation);
+ gtk_widget_get_content_size (GTK_WIDGET (viewport), &view_width, &view_height);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
adjustment = priv->hadjustment;
other_orientation = GTK_ORIENTATION_VERTICAL;
- viewport_size = view_allocation.width;
- other_viewport_size = view_allocation.height;
+ viewport_size = view_width;
+ other_viewport_size = view_height;
scroll_policy = priv->hscroll_policy;
other_scroll_policy = priv->vscroll_policy;
}
@@ -140,8 +140,8 @@ viewport_set_adjustment_values (GtkViewport *viewport,
{
adjustment = priv->vadjustment;
other_orientation = GTK_ORIENTATION_HORIZONTAL;
- viewport_size = view_allocation.height;
- other_viewport_size = view_allocation.width;
+ viewport_size = view_height;
+ other_viewport_size = view_width;
scroll_policy = priv->vscroll_policy;
other_scroll_policy = priv->hscroll_policy;
}
@@ -490,19 +490,12 @@ static void
gtk_viewport_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
- GtkAllocation content_allocation;
- GtkAllocation widget_allocation;
+ int width, height;
- gtk_widget_get_content_allocation (widget, &content_allocation);
- gtk_widget_get_allocation (widget, &widget_allocation);
+ gtk_widget_get_content_size (widget, &width, &height);
gtk_snapshot_push_clip (snapshot,
- &GRAPHENE_RECT_INIT(
- content_allocation.x - widget_allocation.x,
- content_allocation.y - widget_allocation.y,
- content_allocation.width,
- content_allocation.height),
- "Viewport");
+ &GRAPHENE_RECT_INIT(0, 0, width, height), "Viewport");
GTK_WIDGET_CLASS (gtk_viewport_parent_class)->snapshot (widget, snapshot);