[gtk/gtk-4-2: 56/91] a11y: Avoid spurious selection changed events
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-4-2: 56/91] a11y: Avoid spurious selection changed events
- Date: Tue, 4 May 2021 02:05:41 +0000 (UTC)
commit c04139405a7bfcb91cd8efa7f9acfc641009d31c
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Apr 20 13:23:56 2021 -0400
a11y: Avoid spurious selection changed events
Only send selection-changed events when we either
had a non-empty selection before, or have one now.
This should help orca speak the right things, and
not the wrong things.
Related: #3549
gtk/a11y/gtkatspitext.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gtk/a11y/gtkatspitext.c b/gtk/a11y/gtkatspitext.c
index 7cf08fdf06..44a5605716 100644
--- a/gtk/a11y/gtkatspitext.c
+++ b/gtk/a11y/gtkatspitext.c
@@ -1326,9 +1326,12 @@ update_selection (TextChanged *changed,
int selection_bound)
{
gboolean caret_moved, bound_moved;
+ gboolean had_selection, has_selection;
caret_moved = cursor_position != changed->cursor_position;
bound_moved = selection_bound != changed->selection_bound;
+ had_selection = changed->cursor_position != changed->selection_bound;
+ has_selection = cursor_position != selection_bound;
if (!caret_moved && !bound_moved)
return;
@@ -1339,7 +1342,7 @@ update_selection (TextChanged *changed,
if (caret_moved)
changed->selection_changed (changed->data, "text-caret-moved", changed->cursor_position);
- if (caret_moved || bound_moved)
+ if (had_selection || has_selection)
changed->selection_changed (changed->data, "text-selection-changed", 0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]