summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2019-03-08 13:19:13 +0100
committerBenjamin Otte <otte@redhat.com>2019-03-08 13:20:17 +0100
commitb114d45c5f9020ee8b7eec1776bef3ced837fd36 (patch)
tree6d664faf1322f82334e3c4164cc9521d99d5f0ed
parent9a1c6980705938e003acb428901be6981b8a6160 (diff)
downloadgtk+-b114d45c5f9020ee8b7eec1776bef3ced837fd36.tar.gz
colorswatch: Use gtk_widget_set_overflow()
-rw-r--r--gtk/gtkcolorswatch.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c
index 516326e6c1..7ad2bb0945 100644
--- a/gtk/gtkcolorswatch.c
+++ b/gtk/gtkcolorswatch.c
@@ -35,7 +35,6 @@
#include "gtkmodelbutton.h"
#include "gtkpopover.h"
#include "gtkprivate.h"
-#include "gtkroundedboxprivate.h"
#include "gtksnapshot.h"
#include "gtkstylecontextprivate.h"
#include "gtkwidgetprivate.h"
@@ -43,8 +42,6 @@
#include "a11y/gtkcolorswatchaccessibleprivate.h"
-#include "gsk/gskroundedrectprivate.h"
-
/*
* GtkColorSwatch has two CSS nodes, the main one named colorswatch
* and a subnode named overlay. The main node gets the .light or .dark
@@ -97,30 +94,21 @@ swatch_snapshot (GtkWidget *widget,
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
GtkColorSwatchPrivate *priv = gtk_color_swatch_get_instance_private (swatch);
- GtkStyleContext *context;
-
- context = gtk_widget_get_style_context (widget);
if (priv->has_color)
{
cairo_pattern_t *pattern;
cairo_matrix_t matrix;
- GskRoundedRect content_box;
-
- gtk_rounded_boxes_init_for_style (NULL,
- NULL,
- &content_box,
- gtk_style_context_lookup_style (context),
- 0, 0,
- gtk_widget_get_width (widget),
- gtk_widget_get_height (widget));
- gtk_snapshot_push_rounded_clip (snapshot, &content_box);
if (priv->use_alpha && !gdk_rgba_is_opaque (&priv->color))
{
cairo_t *cr;
- cr = gtk_snapshot_append_cairo (snapshot, &content_box.bounds);
+ cr = gtk_snapshot_append_cairo (snapshot,
+ &GRAPHENE_RECT_INIT (
+ 0, 0,
+ gtk_widget_get_width (widget),
+ gtk_widget_get_height (widget)));
cairo_set_source_rgb (cr, 0.33, 0.33, 0.33);
cairo_paint (cr);
@@ -136,7 +124,10 @@ swatch_snapshot (GtkWidget *widget,
gtk_snapshot_append_color (snapshot,
&priv->color,
- &content_box.bounds);
+ &GRAPHENE_RECT_INIT (
+ 0, 0,
+ gtk_widget_get_width (widget),
+ gtk_widget_get_height (widget)));
}
else
{
@@ -146,10 +137,11 @@ swatch_snapshot (GtkWidget *widget,
gtk_snapshot_append_color (snapshot,
&color,
- &content_box.bounds);
+ &GRAPHENE_RECT_INIT (
+ 0, 0,
+ gtk_widget_get_width (widget),
+ gtk_widget_get_height (widget)));
}
-
- gtk_snapshot_pop (snapshot);
}
gtk_widget_snapshot_child (widget, priv->overlay_widget, snapshot);
@@ -576,6 +568,7 @@ gtk_color_swatch_init (GtkColorSwatch *swatch)
gtk_widget_set_can_focus (GTK_WIDGET (swatch), TRUE);
gtk_widget_set_has_surface (GTK_WIDGET (swatch), FALSE);
+ gtk_widget_set_overflow (GTK_WIDGET (swatch), GTK_OVERFLOW_HIDDEN);
gesture = gtk_gesture_long_press_new ();
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture),