From 343b9d246ff09e24842020e907a681984ea6d610 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 17 Jun 2023 22:36:47 -0400 Subject: [PATCH] colordialogbutton: Shuffle accessible roles around Make the color button itself take the button role, and make the internal toggle button just be generic. This solves the problem that labelled-by relations that are set up in ui files via mnemonics point at the toplevel, not the toggle button. --- gtk/gtkcolordialogbutton.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gtk/gtkcolordialogbutton.c b/gtk/gtkcolordialogbutton.c index dce03690d1..8fdb630396 100644 --- a/gtk/gtkcolordialogbutton.c +++ b/gtk/gtkcolordialogbutton.c @@ -110,7 +110,9 @@ gtk_color_dialog_button_init (GtkColorDialogButton *self) self->color = GDK_RGBA ("00000000"); - self->button = gtk_button_new (); + self->button = g_object_new (GTK_TYPE_BUTTON, + "accessible-role", GTK_ACCESSIBLE_ROLE_GENERIC, + NULL); g_signal_connect_swapped (self->button, "clicked", G_CALLBACK (button_clicked), self); gtk_widget_set_parent (self->button, GTK_WIDGET (self)); @@ -280,6 +282,7 @@ gtk_color_dialog_button_class_init (GtkColorDialogButtonClass *class) gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT); gtk_widget_class_set_css_name (widget_class, "colorbutton"); + gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_BUTTON); } /* }}} */ -- 2.30.2