vcl/qt5/QtAccessibleWidget.cxx | 13 ++++++++++++- vcl/unx/gtk3/gtkinst.cxx | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-)
New commits: commit 8495e77f4d49733f645cdacfb71729b91e5c4f30 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Jul 16 15:03:20 2024 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed Jul 17 06:25:13 2024 +0200 tdf#155447 gtk3 a11y: Use GtkBuilder ID as accessible ID Set the GtkBuilder ID (the ID set in the .ui file) as the accessible ID of the GtkWidget for welded widgets in the gtk3 VCL plugin. For non-welded widgets, that would happen in `atk_object_wrapper_new`, similar to how Change-Id: I2281d15c38a229410469c29a14fdc4221aeb3e1e Author: Michael Weghorn <m.wegh...@posteo.de> Date: Tue Jul 16 13:57:41 2024 +0200 tdf#155447 qt a11y: Report accessible ID implements it for the qt6 VCL plugin. However, since native widgets are now used almost everywhere for the gtk3 VCL plugin, the implementation in `atk_object_wrapper_new` does not take effect for most of the UI, including the spell checking dialog mentioned in tdf#155447. This commit makes sure an accessible ID is set for such cases as well. Using the GtkBuilder ID is also mentioned in the `atk_object_set_accessible_id` doc [1]: > Sets the accessible ID of the accessible. This is not meant to be > presented to the user, but to be an ID which is stable over application > development. Typically, this is the gtkbuilder ID. Such an ID will be > available for instance to identify a given well-known accessible object > for tailored screen reading, or for automatic regression testing. GTK 4 currently doesn't have API to set an accessible ID. [1] https://docs.gtk.org/atk/method.Object.set_accessible_id.html Change-Id: I6061888f38aa40a0d3c4e680b7daa1649d5954e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170586 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 698f2dbe1575..4f4b42e52192 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -3458,6 +3458,20 @@ public: if (!bTakeOwnership) g_object_ref(m_pWidget); +#if !GTK_CHECK_VERSION(4, 0, 0) + const char* pId = gtk_buildable_get_name(GTK_BUILDABLE(m_pWidget)); + if (pId) + { + static auto func = reinterpret_cast<void(*)(AtkObject*, const char*)>(dlsym(nullptr, "atk_object_set_accessible_id")); + if (func) + { + AtkObject* pAtkObject = gtk_widget_get_accessible(m_pWidget); + assert(pAtkObject); + (*func)(pAtkObject, pId); + } + } +#endif + localizeDecimalSeparator(); } commit c64b823b74cbd3063d6e87643bd68ea5343b2f54 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Jul 16 13:57:41 2024 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed Jul 17 06:25:06 2024 +0200 tdf#155447 qt a11y: Report accessible ID For Qt >= 6.8, report the accessible ID provided by `XAccessibleContext2::getAccessibleId` when `QtAccessibleWidget::text` gets called with param `QAccessible::Identifier`, as introduced in qtbase commit [1]: commit 9ec1de2528b871099d416d15592fcc5ef9242a64 Author: Jens Trillmann <jens.trillm...@governikus.de> Date: Wed Mar 13 14:00:38 2024 +0100 Add Identifier role to QAccessible and use it in OS interfaces * Unify the default identifier creation for QAccessibleInterface on all platforms to be the same as the previous identifier on Linux. This may change some identifiers on Windows. [ChangeLog][QAccessible][QAccessibleInterface] Add possibility to add unique identifier to QAccessibleInterface to give a11y elements consistent identifiers. Task-number: QTBUG-123361 Change-Id: I8c42956a4c497e71909d71dcb27bc87433937b69 Reviewed-by: Volker Hilsheimer <volker.hilshei...@qt.io> `VCLXAccessibleComponent::getAccessibleId` returns the ID of the corresponding `vcl::Window` which equals to the GtkBuilder ID set in the .ui file, e.g. "SpellingDialog" for the spelling dialog (see `cui/uiconfig/ui/spellingdialog.ui`). This could be used for reliable identification by ATs, e.g. to identify the spelling dialog and specific widgets in it (see tdf#155447) or for automated tests. [1] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=9ec1de2528b871099d416d15592fcc5ef9242a64 Change-Id: I2281d15c38a229410469c29a14fdc4221aeb3e1e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170583 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 9320516bee0c..21c5f1477fb3 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -36,6 +36,8 @@ #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/XAccessibleAction.hpp> #include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleContext2.hpp> #include <com/sun/star/accessibility/XAccessibleEditableText.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> #include <com/sun/star/accessibility/XAccessibleEventListener.hpp> @@ -363,6 +365,15 @@ QString QtAccessibleWidget::text(QAccessible::Text text) const case QAccessible::Description: case QAccessible::DebugDescription: return toQString(xAc->getAccessibleDescription()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) + case QAccessible::Identifier: + { + Reference<XAccessibleContext2> xContext(getAccessibleContextImpl(), UNO_QUERY); + if (!xContext.is()) + return QString(); + return toQString(xContext->getAccessibleId()); + } +#endif case QAccessible::Value: case QAccessible::Help: case QAccessible::Accelerator: commit 5b9dec4caa727cd46ae9163812ecfc3142157cd1 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Jul 16 13:43:45 2024 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed Jul 17 06:24:59 2024 +0200 tdf#155447 qt a11y: Don't report "Unknown" for unsupported props Return an empty string instead of "Unknown" for unsupported properties/text types in `QtAccessibleWidget::text`. Explicitly returning a non-empty string can be misleading, and e.g. also prevents the default calculation of an accessible ID that Qt does internally when an empty string is returned for `QAccessible::Identifier` which was introduced into qtbase in [1] commit 9ec1de2528b871099d416d15592fcc5ef9242a64 Author: Jens Trillmann <jens.trillm...@governikus.de> Date: Wed Mar 13 14:00:38 2024 +0100 Add Identifier role to QAccessible and use it in OS interfaces * Unify the default identifier creation for QAccessibleInterface on all platforms to be the same as the previous identifier on Linux. This may change some identifiers on Windows. [ChangeLog][QAccessible][QAccessibleInterface] Add possibility to add unique identifier to QAccessibleInterface to give a11y elements consistent identifiers. Task-number: QTBUG-123361 Change-Id: I8c42956a4c497e71909d71dcb27bc87433937b69 Reviewed-by: Volker Hilsheimer <volker.hilshei...@qt.io> [1] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=9ec1de2528b871099d416d15592fcc5ef9242a64 Change-Id: I5eb5bd7adbc998a74a25f3c6c9ef373bd8faf1c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170582 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 2a9236e6339f..9320516bee0c 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -368,7 +368,7 @@ QString QtAccessibleWidget::text(QAccessible::Text text) const case QAccessible::Accelerator: case QAccessible::UserText: default: - return QString("Unknown"); + return QString(); } } QAccessible::Role QtAccessibleWidget::role() const