[gtk/gtk-4-2: 28/91] menubutton: Propagate focus-on-click
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-4-2: 28/91] menubutton: Propagate focus-on-click
- Date: Tue, 4 May 2021 02:05:40 +0000 (UTC)
commit a4aaab2e5b6855e0d9e4f0a9b15ae8761dc2b5d2
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Apr 11 15:22:00 2021 -0400
menubutton: Propagate focus-on-click
Propagate the focus-on-click setting to the button
inside, so that setting menubuttons as !focus-on-click
works as expected. This helps for menubuttons in
header bars, where dragging on the button will otherwise
steal focus from the content.
gtk/gtkmenubutton.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
---
diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c
index eee296e37f..15f06eb23a 100644
--- a/gtk/gtkmenubutton.c
+++ b/gtk/gtkmenubutton.c
@@ -214,6 +214,22 @@ gtk_menu_button_get_property (GObject *object,
}
}
+static void
+gtk_menu_button_notify (GObject *object,
+ GParamSpec *pspec)
+{
+ if (strcmp (pspec->name, "focus-on-click") == 0)
+ {
+ GtkMenuButton *self = GTK_MENU_BUTTON (object);
+
+ gtk_widget_set_focus_on_click (self->button,
+ gtk_widget_get_focus_on_click (GTK_WIDGET (self)));
+ }
+
+ if (G_OBJECT_CLASS (gtk_menu_button_parent_class)->notify)
+ G_OBJECT_CLASS (gtk_menu_button_parent_class)->notify (object, pspec);
+}
+
static void
gtk_menu_button_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state_flags)
@@ -318,6 +334,7 @@ gtk_menu_button_class_init (GtkMenuButtonClass *klass)
gobject_class->set_property = gtk_menu_button_set_property;
gobject_class->get_property = gtk_menu_button_get_property;
+ gobject_class->notify = gtk_menu_button_notify;
gobject_class->dispose = gtk_menu_button_dispose;
widget_class->measure = gtk_menu_button_measure;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]