Revert "paned: Use a GtkIcon as separator"

This reverts commit 749ef4d71c.

The GtkIcon and GtkGizmo measure code is different, the former uses
-gtk-icon-size.
This commit is contained in:
Timm Bäder 2018-08-27 18:55:31 +02:00
parent 00a27c1e28
commit 9fbcbc55d7

View File

@ -33,7 +33,7 @@
#include "gtkeventcontrollermotion.h" #include "gtkeventcontrollermotion.h"
#include "gtkgesturepan.h" #include "gtkgesturepan.h"
#include "gtkgesturesingle.h" #include "gtkgesturesingle.h"
#include "gtkiconprivate.h" #include "gtkgizmoprivate.h"
#include "gtkintl.h" #include "gtkintl.h"
#include "gtkmain.h" #include "gtkmain.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
@ -1383,6 +1383,26 @@ gtk_paned_snapshot (GtkWidget *widget,
gtk_snapshot_pop (snapshot); 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 static void
connect_drag_gesture_signals (GtkPaned *paned, connect_drag_gesture_signals (GtkPaned *paned,
GtkGesture *gesture) GtkGesture *gesture)
@ -1442,9 +1462,10 @@ gtk_paned_init (GtkPaned *paned)
g_signal_connect (controller, "motion", G_CALLBACK (gtk_paned_motion), paned); g_signal_connect (controller, "motion", G_CALLBACK (gtk_paned_motion), paned);
gtk_widget_add_controller (GTK_WIDGET (paned), controller); gtk_widget_add_controller (GTK_WIDGET (paned), controller);
priv->handle_widget = gtk_icon_new ("separator"); priv->handle_widget = gtk_gizmo_new ("separator",
gtk_icon_set_image (GTK_ICON (priv->handle_widget), NULL,
GTK_CSS_IMAGE_BUILTIN_PANE_SEPARATOR); NULL,
gtk_paned_render_handle);
gtk_widget_set_parent (priv->handle_widget, GTK_WIDGET (paned)); gtk_widget_set_parent (priv->handle_widget, GTK_WIDGET (paned));
} }