summaryrefslogtreecommitdiff
path: root/gtk/gtktoolpalette.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2017-05-07 14:16:59 +0200
committerMatthias Clasen <mclasen@redhat.com>2017-07-19 21:27:12 -0400
commit70613c9128ed6b4f4dc63c16d061d3c5d37fb165 (patch)
tree0eead135d381bd580cac4bfa3677f4c8dc4b262b /gtk/gtktoolpalette.c
parent7ddd497f695ace24cb726f6eb98eefd6ccd8d3c3 (diff)
downloadgtk+-70613c9128ed6b4f4dc63c16d061d3c5d37fb165.tar.gz
toolpalette: Port to snapshot()
Diffstat (limited to 'gtk/gtktoolpalette.c')
-rw-r--r--gtk/gtktoolpalette.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c
index 87547bb0bf..fdae646e45 100644
--- a/gtk/gtktoolpalette.c
+++ b/gtk/gtktoolpalette.c
@@ -29,6 +29,7 @@
#include "gtkprivate.h"
#include "gtkscrollable.h"
#include "gtkorientableprivate.h"
+#include "gtkwidgetprivate.h"
#include "gtkintl.h"
#define DEFAULT_ICON_SIZE GTK_ICON_SIZE_SMALL_TOOLBAR
@@ -707,18 +708,6 @@ gtk_tool_palette_adjustment_value_changed (GtkAdjustment *adjustment,
gtk_tool_palette_size_allocate (widget, &allocation);
}
-static gboolean
-gtk_tool_palette_draw (GtkWidget *widget,
- cairo_t *cr)
-{
- gtk_render_background (gtk_widget_get_style_context (widget), cr,
- 0, 0,
- gtk_widget_get_allocated_width (widget),
- gtk_widget_get_allocated_height (widget));
-
- return GTK_WIDGET_CLASS (gtk_tool_palette_parent_class)->draw (widget, cr);
-}
-
static void
gtk_tool_palette_add (GtkContainer *container,
GtkWidget *child)
@@ -854,6 +843,26 @@ gtk_tool_palette_screen_changed (GtkWidget *widget,
gtk_tool_palette_reconfigured (palette);
}
+static void
+gtk_tool_palette_snapshot (GtkWidget *widget,
+ GtkSnapshot *snapshot)
+{
+ GtkAllocation content_allocation;
+
+ gtk_widget_get_content_allocation (widget, &content_allocation);
+
+ gtk_snapshot_push_clip (snapshot,
+ &GRAPHENE_RECT_INIT(
+ content_allocation.x,
+ content_allocation.y,
+ content_allocation.width,
+ content_allocation.height),
+ "ToolPalette Clip");
+
+ GTK_WIDGET_CLASS (gtk_tool_palette_parent_class)->snapshot (widget, snapshot);
+
+ gtk_snapshot_pop (snapshot);
+}
static void
gtk_tool_palette_class_init (GtkToolPaletteClass *cls)
@@ -869,7 +878,7 @@ gtk_tool_palette_class_init (GtkToolPaletteClass *cls)
wclass->measure = gtk_tool_palette_measure;
wclass->size_allocate = gtk_tool_palette_size_allocate;
- wclass->draw = gtk_tool_palette_draw;
+ wclass->snapshot = gtk_tool_palette_snapshot;
cclass->add = gtk_tool_palette_add;
cclass->remove = gtk_tool_palette_remove;