mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-06 19:00:12 +00:00
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
This commit is contained in:
parent
5fc008024b
commit
c04139405a
@ -1326,9 +1326,12 @@ update_selection (TextChanged *changed,
|
|||||||
int selection_bound)
|
int selection_bound)
|
||||||
{
|
{
|
||||||
gboolean caret_moved, bound_moved;
|
gboolean caret_moved, bound_moved;
|
||||||
|
gboolean had_selection, has_selection;
|
||||||
|
|
||||||
caret_moved = cursor_position != changed->cursor_position;
|
caret_moved = cursor_position != changed->cursor_position;
|
||||||
bound_moved = selection_bound != changed->selection_bound;
|
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)
|
if (!caret_moved && !bound_moved)
|
||||||
return;
|
return;
|
||||||
@ -1339,7 +1342,7 @@ update_selection (TextChanged *changed,
|
|||||||
if (caret_moved)
|
if (caret_moved)
|
||||||
changed->selection_changed (changed->data, "text-caret-moved", changed->cursor_position);
|
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);
|
changed->selection_changed (changed->data, "text-selection-changed", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user