From 9fbcbc55d78c965bbdc4266e35ce483b335ea673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Mon, 27 Aug 2018 18:55:31 +0200 Subject: [PATCH] Revert "paned: Use a GtkIcon as separator" This reverts commit 749ef4d71ca018a18fd608bf3b2e4c022727e2ae. The GtkIcon and GtkGizmo measure code is different, the former uses -gtk-icon-size. --- gtk/gtkpaned.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index 7356baff99..464110ce98 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -33,7 +33,7 @@ #include "gtkeventcontrollermotion.h" #include "gtkgesturepan.h" #include "gtkgesturesingle.h" -#include "gtkiconprivate.h" +#include "gtkgizmoprivate.h" #include "gtkintl.h" #include "gtkmain.h" #include "gtkmarshalers.h" @@ -1383,6 +1383,26 @@ gtk_paned_snapshot (GtkWidget *widget, gtk_snapshot_pop (snapshot); } +static gboolean +gtk_paned_render_handle (GtkGizmo *gizmo, + GtkSnapshot *snapshot) +{ + GtkWidget *widget = GTK_WIDGET (gizmo); + GtkCssStyle *style = gtk_css_node_get_style (gtk_widget_get_css_node (widget)); + int width, height; + + width = gtk_widget_get_width (widget); + height = gtk_widget_get_height (widget); + + if (width > 0 && height > 0) + gtk_css_style_snapshot_icon (style, + snapshot, + width, height, + GTK_CSS_IMAGE_BUILTIN_PANE_SEPARATOR); + + return FALSE; +} + static void connect_drag_gesture_signals (GtkPaned *paned, GtkGesture *gesture) @@ -1442,9 +1462,10 @@ gtk_paned_init (GtkPaned *paned) g_signal_connect (controller, "motion", G_CALLBACK (gtk_paned_motion), paned); gtk_widget_add_controller (GTK_WIDGET (paned), controller); - priv->handle_widget = gtk_icon_new ("separator"); - gtk_icon_set_image (GTK_ICON (priv->handle_widget), - GTK_CSS_IMAGE_BUILTIN_PANE_SEPARATOR); + priv->handle_widget = gtk_gizmo_new ("separator", + NULL, + NULL, + gtk_paned_render_handle); gtk_widget_set_parent (priv->handle_widget, GTK_WIDGET (paned)); }