diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-12-20 08:14:24 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2023-12-20 22:29:50 +0100 |
commit | 1a81fd69e10ad1ce7193fe7231ff29b2b94f67c7 (patch) | |
tree | ea4e6367f3df64d8da20d185dc3f510eb6adf105 /vcl/unx/gtk4 | |
parent | fad76223d1cff3746a5d2e4ce56b93ecd1c80f61 (diff) |
gtk4 a11y: Take SELECTABLE/EXPANDABLE states into account
The Gtk API has no direct equivalent for the selectable
and expandable states, but sets them on the AT-SPI layer
whenever a value for the selected/expanded states is
explicitly set.
Therefore, only explicitly set values for these
if the selectable/expandable state is present,
to avoid the expandable/selectable state being
set on AT-SPI layer when it shouldn't.
Change-Id: Ib0cf2095d4834869856bf786e662115f6a328e13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161046
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl/unx/gtk4')
-rw-r--r-- | vcl/unx/gtk4/a11y.cxx | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/vcl/unx/gtk4/a11y.cxx b/vcl/unx/gtk4/a11y.cxx index 48c22beb21ee..6bc89f15c401 100644 --- a/vcl/unx/gtk4/a11y.cxx +++ b/vcl/unx/gtk4/a11y.cxx @@ -296,11 +296,7 @@ static void applyStates(GtkAccessible* pGtkAccessible, pGtkAccessible, GTK_ACCESSIBLE_STATE_BUSY, bool(nStates & com::sun::star::accessibility::AccessibleStateType::BUSY), GTK_ACCESSIBLE_STATE_DISABLED, - bool(!(nStates & com::sun::star::accessibility::AccessibleStateType::ENABLED)), - GTK_ACCESSIBLE_STATE_EXPANDED, - bool(nStates & com::sun::star::accessibility::AccessibleStateType::EXPANDED), - GTK_ACCESSIBLE_STATE_SELECTED, - bool(nStates & com::sun::star::accessibility::AccessibleStateType::SELECTED), -1); + bool(!(nStates & com::sun::star::accessibility::AccessibleStateType::ENABLED)), -1); // when explicitly setting any value for GTK_ACCESSIBLE_STATE_CHECKED, // Gtk will also report ATSPI_STATE_CHECKABLE on the AT-SPI layer @@ -314,6 +310,20 @@ static void applyStates(GtkAccessible* pGtkAccessible, gtk_accessible_update_state(pGtkAccessible, GTK_ACCESSIBLE_STATE_CHECKED, eState, -1); } + if (nStates & com::sun::star::accessibility::AccessibleStateType::EXPANDABLE) + { + gtk_accessible_update_state( + pGtkAccessible, GTK_ACCESSIBLE_STATE_EXPANDED, + bool(nStates & com::sun::star::accessibility::AccessibleStateType::EXPANDED), -1); + } + + if (nStates & com::sun::star::accessibility::AccessibleStateType::SELECTABLE) + { + gtk_accessible_update_state( + pGtkAccessible, GTK_ACCESSIBLE_STATE_SELECTED, + bool(nStates & com::sun::star::accessibility::AccessibleStateType::SELECTED), -1); + } + const sal_Int16 nRole = xContext->getAccessibleRole(); if (nRole == com::sun::star::accessibility::AccessibleRole::TOGGLE_BUTTON) { |