From 3f49d335d15728c43913780c8b02d7c8fcb48042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Wed, 18 May 2022 12:40:40 +0100 Subject: [PATCH] Allow selectable labels contents to be selected by mnemonic expecially by the mnemonic of another label that targets it. https://gitlab.gnome.org/GNOME/gtk/-/issues/4927 see also https://bugs.documentfoundation.org/show_bug.cgi?id=137748 --- gtk/gtklabel.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index ac25549370..46a909c794 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -2020,6 +2020,12 @@ gtk_label_mnemonic_activate (GtkWidget *widget, if (self->mnemonic_widget) return gtk_widget_mnemonic_activate (self->mnemonic_widget, group_cycling); + /* Not a label for something else, but is selectable, so set focus into + * the label itself. + */ + if (gtk_label_get_selectable (self) && gtk_widget_get_focusable (widget)) + return gtk_label_grab_focus (widget); + /* Try to find the widget to activate by traversing the * widget's ancestry. */