[gtk+] switch: Put the slider node last
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] switch: Put the slider node last
- Date: Thu, 20 Jul 2017 01:55:13 +0000 (UTC)
commit d25af7ce10625ddd6090745a80b319d9b992a56b
Author: Timm Bäder <mail baedert org>
Date: Wed Jun 28 15:57:42 2017 +0200
switch: Put the slider node last
Makes sense since we draw it over both labels. Also make this obvious by
using the default snapshot implementation.
gtk/gtkswitch.c | 22 +++++-----------------
1 files changed, 5 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index db6fd47..bddd46f 100644
--- a/gtk/gtkswitch.c
+++ b/gtk/gtkswitch.c
@@ -40,9 +40,9 @@
*
* |[<!-- language="plain" -->
* switch
- * ├── slider
* ├── label
- * ╰── label
+ * ├── label
+ * ╰── slider
* ]|
*
* GtkSwitch has four css nodes, the main node with the name switch and subnodes
@@ -370,17 +370,6 @@ gtk_switch_size_allocate (GtkWidget *widget,
}
static void
-gtk_switch_snapshot (GtkWidget *widget,
- GtkSnapshot *snapshot)
-{
- GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;
-
- gtk_widget_snapshot_child (widget, priv->on_label, snapshot);
- gtk_widget_snapshot_child (widget, priv->off_label, snapshot);
- gtk_widget_snapshot_child (widget, priv->slider, snapshot);
-}
-
-static void
gtk_switch_set_action_name (GtkActionable *actionable,
const gchar *action_name)
{
@@ -571,7 +560,6 @@ gtk_switch_class_init (GtkSwitchClass *klass)
widget_class->measure = gtk_switch_measure;
widget_class->size_allocate = gtk_switch_size_allocate;
- widget_class->snapshot = gtk_switch_snapshot;
klass->activate = gtk_switch_activate;
klass->state_set = state_set;
@@ -648,9 +636,6 @@ gtk_switch_init (GtkSwitch *self)
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
- priv->slider = gtk_gizmo_new ("slider", NULL, NULL, NULL);
- gtk_widget_set_parent (priv->slider, GTK_WIDGET (self));
-
gesture = gtk_gesture_multi_press_new (GTK_WIDGET (self));
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), FALSE);
gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (gesture), TRUE);
@@ -686,6 +671,9 @@ gtk_switch_init (GtkSwitch *self)
*/
priv->off_label = gtk_label_new (C_("switch", "OFF"));
gtk_widget_set_parent (priv->off_label, GTK_WIDGET (self));
+
+ priv->slider = gtk_gizmo_new ("slider", NULL, NULL, NULL);
+ gtk_widget_set_parent (priv->slider, GTK_WIDGET (self));
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]