[gtk/wip/exalm/checks] checkbutton: Sync the indicator state with the widget
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/exalm/checks] checkbutton: Sync the indicator state with the widget
- Date: Thu, 20 May 2021 07:19:19 +0000 (UTC)
commit bad01edd2c625910c25cac563c903f7f5f31bb39
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Thu May 20 12:16:32 2021 +0500
checkbutton: Sync the indicator state with the widget
Clicking the whole check button toggles it, so make sure the hover and
active states are propagated to the indicator like in GTK3.
gtk/gtkcheckbutton.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
---
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index e9a30a1ce3..87df3e5844 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -399,6 +399,19 @@ get_group_active_button (GtkCheckButton *self)
return NULL;
}
+static void
+gtk_check_button_state_flags_changed (GtkWidget *widget,
+ GtkStateFlags previous_flags)
+{
+ GtkCheckButton *self = GTK_CHECK_BUTTON (widget);
+ GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
+ GtkStateFlags state = gtk_widget_get_state_flags (GTK_WIDGET (self));
+
+ gtk_widget_set_state_flags (priv->indicator_widget, state, TRUE);
+
+ GTK_WIDGET_CLASS (gtk_check_button_parent_class)->state_flags_changed (widget, previous_flags);
+}
+
static gboolean
gtk_check_button_focus (GtkWidget *widget,
GtkDirectionType direction)
@@ -499,6 +512,7 @@ gtk_check_button_class_init (GtkCheckButtonClass *class)
object_class->set_property = gtk_check_button_set_property;
object_class->get_property = gtk_check_button_get_property;
+ widget_class->state_flags_changed = gtk_check_button_state_flags_changed;
widget_class->focus = gtk_check_button_focus;
class->activate = gtk_check_button_real_activate;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]