From 6185cf95fb6ea26ba3857b10aca3a68df13ded1c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 20 Apr 2020 23:14:25 -0400 Subject: [PATCH] Fix label accessibility Emit accessible change signals after setting the new selection limits. This was broken in commit f6bedd0d5e4c8f7b, and showed up as broken accessibility tests. --- gtk/gtklabel.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 6d2023ac60..dda9b0d558 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -4536,6 +4536,8 @@ gtk_label_select_region_index (GtkLabel *self, gint end_index) { g_return_if_fail (GTK_IS_LABEL (self)); + gboolean anchor_changed; + gboolean bound_changed; if (self->select_info && self->select_info->selectable) { @@ -4601,14 +4603,17 @@ gtk_label_select_region_index (GtkLabel *self, g_object_freeze_notify (G_OBJECT (self)); - if (self->select_info->selection_anchor != anchor_index) - _gtk_label_accessible_selection_bound_changed (self); - if (self->select_info->selection_end != end_index) - _gtk_label_accessible_cursor_position_changed (self); + anchor_changed = self->select_info->selection_anchor != anchor_index; + bound_changed = self->select_info->selection_end != end_index; self->select_info->selection_anchor = anchor_index; self->select_info->selection_end = end_index; + if (anchor_changed) + _gtk_label_accessible_selection_bound_changed (self); + if (bound_changed) + _gtk_label_accessible_cursor_position_changed (self); + clipboard = gtk_widget_get_primary_clipboard (GTK_WIDGET (self)); if (anchor_index != end_index)