viewport: Use gtk_widget_set_overflow()

This commit is contained in:
Benjamin Otte 2019-02-08 18:05:40 +01:00
parent 49cbf2a16b
commit 8ef417dad1

View File

@ -31,7 +31,6 @@
#include "gtkmarshalers.h"
#include "gtkprivate.h"
#include "gtkscrollable.h"
#include "gtksnapshot.h"
#include "gtktypebuiltins.h"
#include "gtkwidgetprivate.h"
@ -94,8 +93,6 @@ static void gtk_viewport_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void gtk_viewport_destroy (GtkWidget *widget);
static void gtk_viewport_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_viewport_size_allocate (GtkWidget *widget,
int width,
int height,
@ -197,25 +194,6 @@ viewport_set_adjustment_values (GtkViewport *viewport,
viewport_size);
}
static GtkWidget *
gtk_viewport_pick (GtkWidget *widget,
double x,
double y)
{
if (x >= 0 && x <= gtk_widget_get_width (widget) &&
y >= 0 && y <= gtk_widget_get_height(widget))
{
return GTK_WIDGET_CLASS (gtk_viewport_parent_class)->pick (widget, x, y);
}
else
{
if (gtk_widget_contains (widget, x, y))
return widget;
else
return NULL;
}
}
static void
gtk_viewport_measure (GtkWidget *widget,
GtkOrientation orientation,
@ -251,10 +229,8 @@ gtk_viewport_class_init (GtkViewportClass *class)
gobject_class->get_property = gtk_viewport_get_property;
widget_class->destroy = gtk_viewport_destroy;
widget_class->snapshot = gtk_viewport_snapshot;
widget_class->size_allocate = gtk_viewport_size_allocate;
widget_class->measure = gtk_viewport_measure;
widget_class->pick = gtk_viewport_pick;
gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_VIEWPORT);
@ -359,6 +335,7 @@ gtk_viewport_init (GtkViewport *viewport)
widget = GTK_WIDGET (viewport);
gtk_widget_set_has_surface (widget, FALSE);
gtk_widget_set_overflow (widget, GTK_OVERFLOW_HIDDEN);
priv->shadow_type = GTK_SHADOW_IN;
priv->hadjustment = NULL;
@ -506,21 +483,6 @@ gtk_viewport_get_shadow_type (GtkViewport *viewport)
return priv->shadow_type;
}
static void
gtk_viewport_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
gtk_snapshot_push_clip (snapshot,
&GRAPHENE_RECT_INIT(
0, 0,
gtk_widget_get_width (widget),
gtk_widget_get_height (widget)));
GTK_WIDGET_CLASS (gtk_viewport_parent_class)->snapshot (widget, snapshot);
gtk_snapshot_pop (snapshot);
}
static void
gtk_viewport_size_allocate (GtkWidget *widget,
int width,