summaryrefslogtreecommitdiffstats
path: root/src/gui/accessible
Commit message (Collapse)AuthorAgeFilesLines
* a11y atspi: Don't crash when using DBus Properties GetAllNicolas Fella9 days1-3/+6
| | | | | | | | | | | | | | | | | GetAll only takes one argument, so trying to access the second one will access the arguments list out of bounds. Also, the argument list we get from the AT client might be insufficient compared to what we expect. Take actual argument list size into account when accessing arguments to generate the call. Fixes: QTBUG-137344 Pick-to: 6.10 6.9 Change-Id: Iff602b7036a71505234903893561ab3a87608146 Reviewed-by: MohammadHossein Qanbari <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]> Reviewed-by: Michael Weghorn <[email protected]>
* a11y: Move qt_accStripAmp helper to private QtGui headerMichael Weghorn2025-06-202-0/+78
| | | | | | | | | | | | | | | | | The qt_accStripAmp helper function takes a string that may contain an accelerator/mnemonic and escaped ampersand characters and returns a "plain text" version of this that is suitable for an accessible name of the widget/control containing that text. Move the helper function to a new private header (and source file) in QtGui in order to be able to reuse this in Qt Quick in an upcoming qtdeclarative commit. Task-number: QTBUG-134208 Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I4dfac2d179baf36101066962b6a5f542b3a6fc03 Reviewed-by: Volker Hilsheimer <[email protected]>
* a11y atspi: Warn on unimplemented Application iface methodMichael Weghorn2025-06-061-1/+2
| | | | | | | | | | | | | | | | As already happens in the implementation for the handling of all other AT-SPI interfaces (called from AtSpiAdaptor::handleMessage), also warn when an unimplemented/unknown method gets called for the Application interface: increase log level to warn and align message with the one used for the other interfaces, so this can be more easily identified. Task-number: QTBUG-137344 Pick-to: 6.10 Change-Id: I33d3811fd34ca0f9f4b1ab9d809f505c12c6517c Reviewed-by: Volker Hilsheimer <[email protected]>
* a11y atspi: Create local variable on stackMichael Weghorn2025-06-031-5/+3
| | | | | | | | | | There is no reason to allocate the OrgA11yAtspiSocketInterface object only used inside AtSpiAdaptor::registerApplication on the heap. Pick-to: 6.10 Change-Id: I2985acb5bd3e2f89c60de2b4ffa77b2a78cb4eff Reviewed-by: Volker Hilsheimer <[email protected]>
* a11y atspi: Set correct child index in children-changed:add eventMichael Weghorn2025-06-031-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When sending an object:children-changed:add AT-SPI2 event, set the actual index of the child instead of always using the child count of its parent. If the new child were added at the end, its index would be "[child count] - 1", but the new child doesn't necessarily have to have been added at the end. Therefore, use the actual child index either already used as loop variable or retrieved via QAccessibleInterface::indexOfChild instead. The mismatch could e.g. be demonstrated with a simple pyatspi script when typing Enter in LibreOffice Writer to create new paragraphs. Script: #!/usr/bin/python3 import pyatspi def listener(e): if not e.host_application.name.startswith('soffice'): return print(e) print(f'index in parent set in event: {e.detail1}') print(f'index in parent reported by child: {e.any_data.get_index_in_parent()}') pyatspi.Registry.registerEventListener(listener, "object:children-changed:add") pyatspi.Registry.start() Sample output without this commit in place: object:children-changed:add(4, 0, [paragraph | ]) source: [document frame | Untitled 1 - LibreOfficeDev Document] host_application: [application | soffice.bin] sender: [application | soffice.bin] index in parent set in event: 4 index in parent reported by child: 2 Sample output with this commit in place: object:children-changed:add(2, 0, [paragraph | ]) source: [document frame | Untitled 1 - LibreOfficeDev Document] host_application: [application | soffice.bin] sender: [application | soffice.bin] index in parent set in event: 2 index in parent reported by child: 2 Pick-to: 6.10 6.9 6.8 Change-Id: I30316c59f8ad6fd018089a8dca8e7a8d1d92d7ec Reviewed-by: Volker Hilsheimer <[email protected]>
* a11y atspi: Support Application iface "AtspiVersion" propertyMichael Weghorn2025-06-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | As the AT-SPI XML spec for the Application interface says, this should currently always be "2.1" [1]: <!-- AtspiVersion: You should return "2.1" here. This was intended to be the version of the atspi interfaces that the application supports, but atspi will probably move to using versioned interface names instead. Just return "2.1" here. --> <property name="AtspiVersion" type="s" access="read"/> This makes the expected value show up in Accerciser with pending merge request [2] in place instead of triggering a fallback path in Accerciser handling the null case for Qt applications. [1] https://gitlab.gnome.org/GNOME/at-spi2-core/-/blob/2d83e3a6dfa9e10243b296179a2ba85e37bdf1cc/xml/Application.xml#L19-26 [2] https://gitlab.gnome.org/GNOME/accerciser/-/merge_requests/95 Pick-to: 6.9 6.10 Change-Id: I0d849d5d6d160c48fd4fc2d443e4fde43cde5606 Reviewed-by: Volker Hilsheimer <[email protected]>
* a11y: Introduce QAccessible::Attribute::Locale, bridge to AT-SPIMichael Weghorn2025-05-283-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new Locale value for the QAccessible::Attribute enum class that can be used to specify the locale of an accessible object. Use this to implement support for the "Locale" property of the AT-SPI Accessible interface. [1] If no locale has explicitly been specified, report the default locale in the AT-SPI adaptor, as is already the case in the implementation of the "GetLocale" method of the AT-SPI Application interface. Being able to explicitly specify a locale is of particular interest when an application contains objects whose locale differs from the default application locale, e.g. documents or paragraphs written in a different language. Demo LibreOffice change making use of this new API: [2] Sample use case with the above-mentioned LibreOffice change in place: 1) start LibreOffice Writer, using English UI and document language 2) type "Hello world" for the first paragraph 3) press Enter to create a new paragraph 4) copy-paste "你好世界" ("Hello world" in Chinese) into the new paragraph 5) start Accerciser 6) select the first paragraph in Accerciser's treeview of the LibreOffice a11y hierarchy 7) query locale in Accerciser's IPython console In [1]: acc.get_object_locale() Out[1]: 'en_GB' 8) select the second paragraph in Accerciser's treeview of the LibreOffice a11y hierarchy 9) query locale in Accerciser's IPython console In [2]: acc.get_object_locale() Out[2]: 'zh_CN' For UIA on Windows, UIA_CulturePropertyId [3] seems to be the equivalent property that the new attribute could be mapped to (to be done separately, not implemented in this commit). [1] https://gitlab.gnome.org/GNOME/at-spi2-core/-/blob/2e65b0877d67667b06e0dc6ad918a6fd4943c371/xml/Accessible.xml#L55-67 [2] https://gerrit.libreoffice.org/c/core/+/185709 [3] https://learn.microsoft.com/en-us/windows/win32/winauto/uiauto-automation-element-propids [ChangeLog][QtGui][QAccessible::Attribute] Added new Locale enum value that can be used to specify the locale of an accessible object. Fixes: QTBUG-137144 Change-Id: Ice11b9e45b512305dbb8195961b8b08e1389c69e Reviewed-by: Volker Hilsheimer <[email protected]>
* For qdebug operator<< of pointer types, always check for nullptrDaniel Trevitz2025-05-171-4/+3
| | | | | | | | Also, use a consistent syntax for when the pointer is null. Fixes: QTBUG-135856 Change-Id: I2f5c80a5650b1be6cc0d70cde7cd1e1c1990df9a Reviewed-by: Christian Ehrlicher <[email protected]>
* a11y: reduce the number of activation observer callsMorten Sørvig2025-05-013-6/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | Reduce the number of activation calls by calling the observer callbacks on active state change only, instead of on each setActive() call. The accessibility backends typically make setActive() calls on each accessibility event, which can result in a large number (100k+) of activation calls if there are many (hundreds) of installed activation observers. This change keeps the following behavior compatibilities: - Each observer is called at least once on setActive(), even if the active state has not changed since it was installed. - Going from active to inactive is supported, though Qt currently does not appear to do this. As a drive-by refactor, make it possible to activate accessibility by calling QAccessible::setActive(), by making it call QPlatformAccessible::setActive(). Change-Id: Iee17160f153b825be032b441923e3529c2f00242 Reviewed-by: Tor Arne Vestbø <[email protected]>
* A11Y: Wrap generated D-Bus proxies into a custom namespaceIvan Solovev2025-03-316-3/+9
| | | | | | | | | | | | | | | | Commit 351b7a31aa24a704dba09121d91cb34190892315 added a new feature of wrapping the generated D-Bus proxies into custom namespaces. Use this feature to avoid potential clashes with the proxies generated by other modules (see QTBUG-133553 as an example). Amends 38251c36edf11316a2467169b1d491bf13520fd3, but keeping it only in dev because it depends on the new feature of qdbusxml2cpp. Task-number: QTBUG-134305 Change-Id: I585cdda3f002ef7fa6dd3a76a3b4f2c9c68d2297 Reviewed-by: Matthias Rauter <[email protected]> Reviewed-by: Juha Vuolle <[email protected]> Reviewed-by: Joerg Bornemann <[email protected]>
* macOS a11y: maintain reference count for cached elementsVolker Hilsheimer2025-03-282-8/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Retain elements when storing them in the cache, so that they only get destroyed when they are neither stored as rows/columns, and removed from the cache. If storing an element in the cache replaces a different element with the same ID, release that before retaining the new one. Give the insertElement() function a bool return value so that callers know whether the element has been retained, so that they can correctly release their own reference. Release elements when they are removed from the cache so that it's easier to see that the calls are balanced. For that to work, forward declare QMacAccessibilityElement as an NSObject type. A special case are place-holder cell elements. Those are not inserted into the cache until the interface is requested, so when those get inserted into the cache, we don't have a local reference to release - it's the reference held by the rows/columns array. However, we don't want stale elements in the cache, so when we release the rows and columns arrays, also remove all cell entries from the cache. Otherwise we end up with stale elements reporting outdated values. As this might invalidate references that our test object holds, refresh the test object when triggering a model update. Amends 1f7e926411d1e0d958c37dc597f24101d410c46b. Pick-to: 6.9 6.8 Fixes: QTBUG-134784 Change-Id: Ib3cce35058e4c80e3edc97ae578584610ee93487 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Add security header for qaccessible.cppEven Oscar Andersen2025-03-271-0/+1
| | | | | | | | | | The text interface, like textAtOffset, parses data coming in from the user. Therefor tagging as security critical. Task-number: QTBUG-134483 Pick-to: 6.9 6.8 Change-Id: I3c97813d4fba719e7972693510a0b9a78cb1348f Reviewed-by: Lorn Potter <[email protected]>
* a11y atspi: Report app parentMichael Weghorn2025-01-282-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | While the application's a11y object doesn't have a parent within Qt's a11y hierarchy, the AT-SPI registry/desktop is the parent of all application objects. Therefore, report that one instead of using a null path. With that in place, querying the application parent via Accerciser's IPython console now gives the expected result: In [16]: acc.role Out[16]: <enum ATSPI_ROLE_APPLICATION of type Atspi.Role> In [17]: acc.parent Out[17]: <Atspi.Accessible object at 0x7fbebc3fc1c0 (AtspiAccessible at 0x139d6410)> In [18]: acc.parent.role Out[18]: <enum ATSPI_ROLE_DESKTOP_FRAME of type Atspi.Role> While at it, also add a "m_" prefix for the AtspiAdaptor::accessibilityRegistry member. Fixes: QTBUG-132935 Pick-to: 6.9 Change-Id: I0e174f73c837b233fe4d5788d1c375b404000025 Reviewed-by: Jan Arve Sæther <[email protected]>
* Replace qdebug.h includes in public headers with forward-declarationsAhmad Samir2025-01-151-1/+1
| | | | | | | | | | | | | | | | | | | qdebug.h includes many Qt and STL headers, so if you include a Qt header you get all those transitive includes, which may affect build time. - Where appropriate use the printf-like syntax of qDebug() and co., these don't need the QDebug streaming operators - qfloat16 is used in an inline member function, so include it explicitly [ChangeLog][Potentially Source Incompatible Changes] Various Qt public headers don't include QDebug any more; if you need QDebug's streaming you'll have to include it in your code. Task-number: QTBUG-132439 Pick-to: 6.9 Change-Id: I750587e17a3b38fa226cd3af8eaccc8da580f436 Reviewed-by: Thiago Macieira <[email protected]>
* Replace QPair/qMakePair with std::pair in qtbase/guiIsak Fyksen2025-01-096-10/+9
| | | | | | | | Task-number: QTBUG-115841 Pick-to: 6.9 Change-Id: Iebd96760ff7b3d7674816553312ba8dc3229c86a Reviewed-by: Marc Mutz <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* Fix GCC -Wextra-semi after member function definitionsAhmad Samir2024-12-121-1/+2
| | | | | | | | Fixes: QTBUG-132101 Pick-to: 6.9 6.8 Change-Id: Ia2e13bdaf11c639c5590639717b5d31140352c44 Reviewed-by: Giuseppe D'Angelo <[email protected]> Reviewed-by: Thiago Macieira <[email protected]>
* a11y atspi: Don't redefine libatspi constantsMichael Weghorn2024-11-212-41/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of redefining ATSPI_DBUS_* constants that are already defined in libatspi, just use those from libatspi's atspi/atspi-constants.h header directly. They are available in that public header since this libatspi 2.1.5 commit [1]: commit 1caa8f4613c87fec43406285a6597fd6f6408457 Author: Mike Gorse <[email protected]> Date: Wed Jul 27 16:54:19 2011 -0500 Move DBus interface name constants into atspi-constants.h Move DBus interface name constants into a public header, so that they can be used by application-side AT-SPI code (ie, at-spi2-atk). Also, replace QSPI_REGISTRY_NAME and QSPI_OBJECT_PATH_ROOT with the corresponding libatspi constants ATSPI_DBUS_NAME_REGISTRY and ATSPI_DBUS_PATH_ROOT. [1] https://gitlab.gnome.org/GNOME/at-spi2-core/-/commit/1caa8f4613c87fec43406285a6597fd6f6408457 Change-Id: Idc7384fa70f36973260cb89dd1cf0fe9b5d16c73 Reviewed-by: Volker Hilsheimer <[email protected]>
* a11y atspi: Fix wrong signal/slot connectionJoerg Bornemann2024-11-111-1/+2
| | | | | | | | | | | | | This amends commit 38251c36edf11316a2467169b1d491bf13520fd3. QDBusServiceWatcher doesn't have a checkEnabledState signal. Use the correct serviceRegistered signal. Fixes: QTBUG-131009 Pick-to: 6.8 6.8.1 Change-Id: I3f0cdb53929c263d05438b1f5324b51163346d49 Reviewed-by: Volker Hilsheimer <[email protected]> Reviewed-by: <[email protected]>
* a11y atspi: Send AT-SPI signals with correct signatureMichael Weghorn2024-11-072-4/+3
| | | | | | | | | | | | | | | | | | | | | The AT-SPI2 XML spec for all signals/events [1] that Qt emits specifies the DBus arguments signature as "siiva{sv}". Qt however was incorrectly sending arguments with an "siiv(so)" signature instead, by sending the QSpiObjectReference as last argument. Fix this by sending the events with the proper signature, using an empty QMap<QString, QVariant> for the properties (that translates to an "a{sv}" type for DBus). [1] https://gitlab.gnome.org/GNOME/at-spi2-core/-/blob/33b45aea12331335eaeb7edb45132466114013e9/xml/Event.xml Fixes: QTBUG-130843 Pick-to: 6.8 Change-Id: If023763626be3d17b091466b17829d62d29fdede Reviewed-by: Jan Arve Sæther <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* a11y atspi: Watch for enabled status changeAlessandro Astone2024-11-063-15/+46
| | | | | | | | | | | | | | | | | | | | | On log-in this may be disabled and only enabled later; that prevents clients like plasmashell to enable a11y features. We need to watch changes to the org.a11y.Status properties and enable the a11y integration on-demand. As the in-line comment said, qdbusxml2cpp does not generate NOTIFY signals for DBus properties, so use the raw PropertiesChanged signal to receive those notifications. Downstream bugs: - https://bugs.kde.org/show_bug.cgi?id=495096 - https://bugs.kde.org/show_bug.cgi?id=495098 Pick-to: 6.8 Pick-to: 6.7 Change-Id: I4d0adf61af875464d3cd47759631d2a3aac664f0 Reviewed-by: Joerg Bornemann <[email protected]> Reviewed-by: Michael Weghorn <[email protected]>
* a11y: Add new BlockQuote roleMichael Weghorn2024-10-183-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new QAccessible::BlockQuote role that can be used to report quoted content to assistive technology as such (e.g. by browsers or document editors like LibreOffice). This matches the role as specified in e.g. ARIA [1], IAccessible2 [2] and AT-SPI [3]. Map the role to platform APIs as described in the The W3C Core Accessibility mappings spec [4]: * Linux/AT-SPI: ATSPI_ROLE_BLOCK_QUOTE * Windows/UIA: UIA_GroupControlTypeId with a UIA_LocalizedControlTypePropertyId of "blockquote" * macOS/NSAccessibility: NSAccessibilityGroupRole In the QAccessible::Role enum, also add comments for the other IAccessible2 roles that have been added in the meantime, to match the existing approach. (Note however that Qt itself doesn't even use IAccessible2 for its Windows a11y bridge any more since 2017 commit 0cf6297c15be45d852be98c862bd0211e6de1aa2, so it's a bit unclear to me whether there's really value in keeping those IAccessible2 references there in the long run.) [1] https://w3c.github.io/aria/#blockquote [2] https://github.com/LinuxA11y/IAccessible2/blob/2b8c2c79417bad4b464761a142fab45ffde8bfa8/api/AccessibleRole.idl#L318 [3] https://docs.gtk.org/atspi2/enum.Role.html#block_quote [4] https://www.w3.org/TR/core-aam-1.2/#role-map-blockquote [ChangeLog][QtGui][QAccessible] Added new BlockQuote role that can be used to report quoted content as such to assistive technology. Fixes: QTBUG-128870 Change-Id: I8707d9d77640b67416f726d266b4cbec5ac09422 Reviewed-by: Volker Hilsheimer <[email protected]>
* a11y: Use desktop file name as app's accessible IDMichael Weghorn2024-09-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | As the QGuiApplication::desktopFileName doc [1] says: > This is the file name, without the full path or the > trailing ".desktop" extension of the desktop entry that > represents this application according to the freedesktop > desktop entry specification. Since the desktop entry represents the application, also use the desktop file name for the accessible ID of the application object. This e.g. makes Okular's application object report an accessible ID of "org.kde.okular" instead of just "QApplication" as the AT-SPI2 AccessibleId property on Linux. [1] https://doc.qt.io/qt-6/qguiapplication.html#desktopFileName-prop Pick-to: 6.8 Change-Id: I554da7baaf817866db9044128f73a9ea634cddbf Reviewed-by: Volker Hilsheimer <[email protected]>
* a11y atspi: Update link to IAccessible2 text attribute specMichael Weghorn2024-08-301-1/+1
| | | | | | | | | | | | | It is now maintained in the IAccessible2 upstream git repo, see IAccessible2 commit [1] and the corresponding issue [2] and pull request [3]. [1] https://github.com/LinuxA11y/IAccessible2/commit/0f5091199e2314a2d1f9bf3354bee3f55f95e45f [2] https://github.com/LinuxA11y/IAccessible2/issues/24 [3] https://github.com/LinuxA11y/IAccessible2/pull/27 Change-Id: I604037cf633a7b0734bb2dc592c3d9e17a057b11 Reviewed-by: Volker Hilsheimer <[email protected]>
* QAccessible: eliminate use of QPairEimen Oueslati2024-08-294-6/+6
| | | | | | | | Replace Qpair with std::pair Task-number: QTBUG-115841 Change-Id: I0743447be0f8554dd3b87265f294c6ca116eafff Reviewed-by: Mate Barany <[email protected]>
* a11y atspi: Map QAccessible::Border to AT-SPI2 panel roleMichael Weghorn2024-08-171-1/+1
| | | | | | | | | | | | | | | Instead of mapping QAccessible::Border to ATSPI_ROLE_FRAME ("A top level window with a title bar, border, menubar, etc." [1]), map it to ATSPI_ROLE_PANEL ("A generic container that is often used to group objects."), as widgets using that role (in particular QFrame) are not top-level windows, but rather containers for other widgets. [1] https://docs.gtk.org/atspi2/enum.Role.html#frame Fixes: QTBUG-127552 Pick-to: 6.8 6.7 6.5 Change-Id: I565793b6e02903402cfc764e2e38d391a2960af1 Reviewed-by: Volker Hilsheimer <[email protected]>
* GUI: accessible - silence clang's fallthrough warningTim Blechmann2024-06-291-0/+1
| | | | | | Pick-to: 6.7 6.8 Change-Id: I868aee05315e1258a8872137407a0c5132251c71 Reviewed-by: Jan Arve Sæther <[email protected]>
* Gui: Make more logging categories staticUlf Hermann2024-06-241-2/+2
| | | | | | | Non-static, non-forward-declared logging categories are deprecated. Change-Id: I818ab0b192bed72e6a0ecdda2bb288bce1110a4c Reviewed-by: Fabian Kosmale <[email protected]>
* Straighten out various logging categoriesUlf Hermann2024-06-192-2/+2
| | | | | | | | | | | | Either make them static or declare them in a header. We want them to be static wherever possible, in order to reduce the number of visible symbols. If they can't be static, however, they should at least be declared in only one place. Task-number: QTBUG-67692 Change-Id: I6f3b596ed4f0adc9873dd0a5f54f055a991a6207 Reviewed-by: Thiago Macieira <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* Accessibility: remove compatibility alias for AnnouncementPolitenessVolker Hilsheimer2024-06-191-2/+0
| | | | | | | | It was only needed to support a smooth submodule update. Pick-to: 6.8 Change-Id: I7546b8565bd3f2cb2c5141fc6ea36d1c76f11c48 Reviewed-by: Jan Arve Sæther <[email protected]>
* QAccessible: rename AnnouncementPriority to AnnouncementPolitenessVolker Hilsheimer2024-06-184-21/+25
| | | | | | | | | | Better name given the value names, as discussed during header review. Keep AnnouncementPriority as an alias until dependencies are updated. Pick-to: 6.8 Change-Id: I7b60c429fb60fc30378a9560da12abb87499225f Reviewed-by: Michael Weghorn <[email protected]> Reviewed-by: Jan Arve Sæther <[email protected]>
* Clean up QAccessible based on header review commentsVolker Hilsheimer2024-06-182-5/+7
| | | | | | | | | | | | | | | | Fix the change of the InvalidEvent value to be the same as in Qt 6.7, where AcceleratorChanged was the last valid event. Add trailing comma and Q_ENUM. Remove superfluous inline, make QAccessibleAnnouncementEvent constructor explicit, declare destructor as override. Amends 010952a55ee9ca9731f8ad15f2773d0bae645840 and 9ec1de2528b871099d416d15592fcc5ef9242a64 based on header review. Pick-to: 6.8 Change-Id: I96f00871acd2bb340ac7fc762a7fca8ac2f61dc9 Reviewed-by: Michael Weghorn <[email protected]> Reviewed-by: Jan Arve Sæther <[email protected]>
* QAccessibleCache: Generalize macOS-specific hooks to all Apple platformsTor Arne Vestbø2024-06-043-11/+11
| | | | | | | | | These are used from the iOS platform plugin as well, so rename the hooks to make it clear what's going on. Pick-to: 6.8 Change-Id: I701550a189b0047b8c604c9c27986f780aa157d4 Reviewed-by: Volker Hilsheimer <[email protected]>
* Add Identifier role to QAccessible and use it in OS interfacesJens Trillmann2024-06-015-29/+45
| | | | | | | | | | | | | | * 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 <[email protected]>
* Rename AT-SPI specific DBusConnection type to fix clang warningsVolker Hilsheimer2024-05-316-16/+16
| | | | | | | | | | | | | | | DBusConnection is forward declared as a class, and after c9e62c24440e99ace02dcceffea2ae6542f49224 we include a header that forward declares it as a struct. This triggers a warning, and also indicates that we have an ODR violation. Rename the offending type in Qt. Fixes: QTBUG-125623 Change-Id: I13ffdceec82b86910a60083aebc2afc47f9f3a4e Reviewed-by: Tim Blechmann <[email protected]> Reviewed-by: Michael Weghorn <[email protected]> Reviewed-by: Robert Löhning <[email protected]>
* a11y atspi: Bridge QAccessibleAttributesInterface to AT-SPIMichael Weghorn2024-05-223-4/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bridges the 2 currently existing attribute types for the newly added QAccessibleAttributesInterface to AT-SPI2 by using the corresponding object attributes. QAccessible::Attribute::Level semantically matches the "aria-level" ARIA attribute, and is mapped to the "level" AT-SPI object attribute as described in the Core Accessibility API Mappings specification for both, headings [1] and non-headings [2]. All of the key-value pairs set in the QAccessible::Attribute::Custom attribute are bridged to the AT-SPI level as object attributes using the same names and values. Together with a corresponding demo change [3] for LibreOffice implementing support for the QAccessible::Attribute::Level attribute in the qt6-based LibreOffice variant, this makes the specific use-case for reporting the heading level mentioned in QTBUG-119057 work with the Orca screen reader. Also tweak the QAccessibleAttributesInterface::attributeValue documentation to clarify the type to be returned in the QVariant. (The newly added AT-SPI implementation has corresponding asserts.) [1] https://www.w3.org/TR/core-aam-1.2/#ariaLevelHeading [2] https://www.w3.org/TR/core-aam-1.2/#ariaLevel [3] https://gerrit.libreoffice.org/c/core/+/159309 Task-number: QTBUG-119057 Change-Id: I7ccdbbcd601c176319ca547d4bdf50b8f93bd7d8 Reviewed-by: Volker Hilsheimer <[email protected]>
* a11y: Make AnnouncementPriority a Q_ENUMAleix Pol2024-05-221-0/+1
| | | | | | | | It makes it possible to have it used from QML. Change-Id: Ie4a1ef432f2a06e1d4bbe106bd41b5843e24d8bb Reviewed-by: Volker Hilsheimer <[email protected]> Reviewed-by: Michael Weghorn <[email protected]>
* a11y atspi: Bridge help text to AT-SPIMichael Weghorn2024-05-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | at-spi2-core commit [1] commit 8f1c70155b4132de2c567b3034e4f242e0450df5 Author: Mike Gorse <[email protected]> Date: Wed Jan 3 16:52:31 2024 -0600 Add HelpText property and corresponding functions in atk and libatspi. Closes #146 added a HelpText property to AT-SPI2. Qt already has a corresponding QAccessible::Help, so report that as the HelpText property in the AT-SPI adaptor. [1] https://gitlab.gnome.org/GNOME/at-spi2-core/-/commit/8f1c70155b4132de2c567b3034e4f242e0450df5 Fixes: QTBUG-124197 Change-Id: I01489c1fdac953658d379951207f91784f3d1dfe Reviewed-by: Volker Hilsheimer <[email protected]>
* Add -Wweak-vtables to headerscleanJesus Fernandez2024-05-192-2/+4
| | | | | | | | | | | | | | | | | | | This requires some fixes in several classes that are also included in this patch. The QTestEvent hierarchy is all-inline and changes layout depending on QT_GUI_LIB and QT_WIDGETS_LIB, so we can't just export it. Suppress the warning in that header for now. Created QTBUG-104486 to track a fix for the real issue. The QFutureInterface hierarchy is also all-inline, but templates, so doesn't trigger, except the <void> specialization. Created QTBUG-125115 to track a fix for the real issue. Done-with: Marc Mutz <[email protected]> Task-number: QTBUG-45582 Change-Id: I96b3e109aa989b70e0d4809b90bd53a369e50d55 Reviewed-by: Fabian Kosmale <[email protected]>
* a11y atspi: Forward new QAccessibleAnnouncementEvent to AT-SPIMichael Weghorn2024-05-142-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | Forward the newly added QAccessibleAnnouncementEvent to the AT-SPI level as a corresponding AT-SPI Announcement event. The AtspiLive enum to specify the priority/politeness level was added in at-spi2-core/libatspi commit [1] which is contained in libatspi versions >= 2.50, so define the relevant values ATSPI_LIVE_ASSERTIVE and ATSPI_LIVE_POLITE manually for older libatspi versions. (Note that the mention of binary compatibility in above-mentioned at-spi2-core commit only applies for ATK, not AT-SPI, so is not relevant here.) This makes announcement from the example app attached to QTBUG-75003 work when using the Orca screen reader on Linux. [1] https://gitlab.gnome.org/GNOME/at-spi2-core/-/commit/32c9420ec82f07da8033c675a2bbf25e535f0509 Task-number: QTBUG-75003 Change-Id: I752aadca2abdda58b3869e17e74fcd9d7572f915 Reviewed-by: Axel Spoerl <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* a11y atspi: Include atspi.h instead of atspi-constants.hMichael Weghorn2024-05-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The atspi.h header includes atspi-constants.h and other libatspi headers. Include the former here instead of manually including the latter, in order to also implicitly include atspi-version.h added in libatspi 2.50 commit [1]: commit 927344a34cd5bf81fc64da4968241735ecb4f03b Author: Mike Gorse <[email protected]> Date: Thu Jul 20 15:02:03 2023 -0500 Add atspi_get_version() to return the runtime version of the AT-SPI library Also adds ATSPI_MAJOR_VERSION, ATSPI_MINOR_VERSION, and ATSPI_MICRO_VERSION. Fixes #129 This is in order to be able to use the new version defines for version- specific code in upcoming commits. [1] https://gitlab.gnome.org/GNOME/at-spi2-core/-/commit/927344a34cd5bf81fc64da4968241735ecb4f03b Task-number: QTBUG-75003 Change-Id: If2d21c7dcff291c93fed2aa0d7c8f7acd7fae77d Reviewed-by: Volker Hilsheimer <[email protected]>
* a11y: Add new QAccessibleAnnouncementEventMichael Weghorn2024-05-143-0/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new QAccessibleAnnouncementEvent that can be used to request the announcement of a message by assistive technologies (most prominently screen readers). The priority/urgency of the message can be specified using one of the values of the newly added AnnouncementPriority enum. As suggested by the maintainer of the Orca screen reader in a similar merge request for GTK [1], add some clarification that assertive priority should only be used for things that are actually worth interrupting the user's current task immediately rather than waiting for the next graceful opportunity like the end of the sentence currently spoken by the screen reader. All of AT-SPI on Linux, UIA on Windows and NSAccessibility on macOS have corresponding API: * Linux/AT-SPI: Announcement event (initially added in commit [2], possibility to set priority/politeness level added in commit [3]) * Windows/UIA: UiaRaiseNotificationEvent [4] * macOS/NSAccessibility: announcementRequested function [5] Bridging to the corresponding platform API in the platform backends is left for separate upcoming commits. [1] https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6461#note_1993454 [2] https://gitlab.gnome.org/GNOME/at-spi2-core/-/commit/26835da29918be2c0da6c08fb70d893de22891d2 [3] https://gitlab.gnome.org/GNOME/at-spi2-core/-/commit/32c9420ec82f07da8033c675a2bbf25e535f0509 [4] https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcoreapi/nf-uiautomationcoreapi-uiaraisenotificationevent [5] https://developer.apple.com/documentation/appkit/nsaccessibility/notification/1530633-announcementrequested [ChangeLog][QtGui][QAccessibleAnnouncementEvent] Added new QAccessibleAnnouncementEvent that can be used to request the announcement of a message by assistive technologies. Task-number: QTBUG-75003 Change-Id: Ief60ae7c5a9c8bf8404ad9b2749e253acc5d77c5 Reviewed-by: Volker Hilsheimer <[email protected]>
* Clean up windows accessibility backendMiguel Costa2024-03-2712-1445/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | What was done: * Removed headers in src/gui/accessible/windows/apisupport: as of v13.1.0, MinGW supports most of the definitions in these headers. Including uiautomation.h should be enough. * Removed the QWindowsUiaWrapper class: it's not meant to be extended or itself instantiated, is an "ultra-thin" layer (it even preserves the "all-caps" Win types of function args), and is in effect only a MinGW-bound "kludge". Instead of this class, use the UI Automation API directly, with the assumption that it's available and fully functional, as specified in the MS docs. Any gaps between this assumption and what is delivered by MinGW are bridged with specific (and explicit) temporary "kludges". * Implemented said specific "kludges" in qwindowsuiautomation. For Windows builds, the header just includes uiautomation.h, and the .cpp is empty. For MinGW, the header contains definitions still missing from uiautomation.h, and the .cpp implements functions of the UI Automation core library through imports from the uiautomationcore DLL. * Windows plugins (and tst_qaccessibility): use the UI Automation API definitions directly, instead of the "ultra-thin" wrapper. * Windows plugin builds: use uiautomationcore library, if found. What's intended: * Unburden Gui of the Windows UI Automation COM interfaces and other definitions that are copied in the uia*.h headers. * Make the Windows plugins independent of MinGW shortcomings. * Remove the QWindowsUiaWrapper class that essentially only hides these shortcomings and the "kludge" code needed to overcome them. * As MinGW adds further support to the UI Automation API over time, make it noticeable which workarounds are no longer needed. The current approach of hiding "kludges" in a wrapper class will also hide the fact that they're no longer needed, if/when that time comes. Change-Id: I0070636817d5de81d0b106e9179e2d0442362e2a Reviewed-by: Wladimir Leuschner <[email protected]> Reviewed-by: Oliver Wolff <[email protected]>
* a11y: Add new QAccessibleAttributesInterfaceMichael Weghorn2024-02-293-2/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new QAccessibleAttributes interface that implements support for reporting (object) attributes (as compared to offset-specific text attributes, which are handled by the QAccessibleTextInterface). The concept of object attributes/properties can be found in all of ARIA, AT-SPI2 on Linux, IAccessible2 and UIA on Windows and NSAccessibility on macOS, and while some of the properties/attributes on these platforms can be mapped to from information retrieved via existing QAccessible* interfaces, a lot of relevant information cannot be made available this way. The new interface is meant to bridge this gap. Each attribute is handled as a key-value pair. Other than for the handling of text attributes (where a single string is used for all attributes, s. QAccessibleTextInterface::attributes), the object attributes handled by the new interface use the newly introduced QAccessible::Attribute enum class for keys. This helps to clearly define the semantics of each attribute and simplifies mapping to the different platform representations in the platform a11y bridges. Initially, two attribute types, Custom and Level are added, s. the documentation added with this commit for more details. Mapping of these two attributes to their platform equivalent for AT-SPI2 on Linux and UIA on Windows will be added in following commits. The Core Accessibility API Mappings specification [1] can be very useful when considering new attributes to add and how to bridge them to the specific platform APIs. Conceptually, the possibility to expose object-specific attributes might seem a good fit for the existing QAccessibleInterface, but adding new virtual methods to non-leaf classes would be an ABI-incompatible change [2], so adding a new interface/class is necessary. There is also a related discussion for Gtk 4 in [3], which - other than Gtk 3 - currently also lacks API to support many AT-SPI object attributes relevant for assistive technology like screen readers. The implementation here is also inspired by the dicussion there. A sample implementation for LibreOffice can be found at [4]. [1] https://www.w3.org/TR/core-aam-1.2/ [2] https://community.kde.org/Policies/Binary_Compatibility_Examples#Add_new_virtuals_to_a_non-leaf_class [3] https://gitlab.gnome.org/GNOME/gtk/-/issues/6196 [4] https://gerrit.libreoffice.org/c/core/+/159309 [ChangeLog][QtGui][QAccessibleAttributesInterface] Added new QAccessibleAttributesInterface that can be used to expose object attributes/properties to assistive technology. Task-number: QTBUG-119057 Change-Id: I9d51c818e82673d1e755a3c909d3e8f5bb064a35 Reviewed-by: Volker Hilsheimer <[email protected]>
* a11y atspi: Map checkable and hasPopup states to AT-SPIMichael Weghorn2024-02-281-1/+4
| | | | | | | | | | | These states have direct equivalents in AT-SPI, so map them accordingly. Fixes: QTBUG-119080 Pick-to: 6.7 6.6 Change-Id: I5a78a75d135a853b3773c34aa2a45c0791cefebc Reviewed-by: Volker Hilsheimer <[email protected]> Reviewed-by: Liang Qi <[email protected]>
* Doc: Fix QDoc warnings for overloadsPaul Wicking2024-02-141-2/+2
| | | | | Change-Id: I9a77b6ea0026748c7f97f73b327118f7a9212d52 Reviewed-by: Topi Reiniö <[email protected]>
* a11y atspi: Add null checks in table iface methodsMichael Weghorn2023-12-151-12/+27
| | | | | | | | | | | | | | | Add null checks to cover the cases where QAccessibleTableInterface::cellAt returns nullptr (which happens e.g. when called with invalid indices via AT-SPI) or where the cell object doesn't implement the QAccessibleTableCellInterface, which would previously result in crashes. Fixes: QTBUG-119167 Pick-to: 6.7 6.6 Change-Id: Ieb42617b32ca829af09ae1d54f5de9ec029e3ab2 Reviewed-by: Jan Arve Sæther <[email protected]>
* a11y: Fix bug where some characters were not spoken while moving cursorJan Arve Sæther2023-11-231-0/+56
| | | | | | | | | | | | | | | | | | The problem occurred when we moved the cursor to the penultimate character of the string, because the boundary condition was wrong. It is important to realize that the offsets are moved *between* each character (and also before and after the whole string), just like you would move a cursor. This means that the offsets can be in the range [0, len] (closed interval) The problem could only be reproduced with JAWS. Pick-to: 6.6 6.5 6.2 Fixes: QTBUG-115156 Change-Id: I0c5f05fa391e6c7744ab22d71afe8904b49e89bc Reviewed-by: Volker Hilsheimer <[email protected]> Reviewed-by: Michael Weghorn <[email protected]>
* a11y atspi: Ignore malformed text attr instead of crashingMichael Weghorn2023-11-161-5/+7
| | | | | | | | | | | | | | If the attribute does not follow the required "name:value" syntax, ignore it, rather than crashing if it doesn't contain any colon. Same issue as spotted by Jan Arve Sæther during the review of a QTBUG-118106 related change that would have introduced the same issue in UIA code. Pick-to: 6.6 6.5 Change-Id: Id391502ed7aec7f09ef2826a456f2e4737af045e Reviewed-by: Jan Arve Sæther <[email protected]>
* a11y uia: Report UIA_StrikethroughStyleAttributeIdMichael Weghorn2023-11-151-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | Implement support for getting the strikethrough style (UIA attribute UIA_StrikethroughStyleAttributeId [1]) by checking for the corresponding IAccessible2 text attribute "text-line-through-type" [2] and mapping the value accordingly if set. Only report those attributes from the QAccessibleTextInterface::attributes return value, if they apply for the whole range of the QWindowsUiaTextRangeProvider. With this in place, the NVDA screen reader on Windows announces "strikethrough" as expected when asked to report the formatting information (e.g. via NVDA+f shortcut) for the QTBUG-118106 example. [1] https://learn.microsoft.com/en-us/windows/win32/winauto/uiauto-textattribute-ids [2] https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes Task-number: QTBUG-118106 Change-Id: I2fa060bd3bf493227bba766385f34d224497784c Reviewed-by: Jan Arve Sæther <[email protected]>
* a11y atspi: Bridge IA2 strikeout text attrs to AT-SPIMichael Weghorn2023-11-151-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | When the text attributes an accessible interface reports include one of the various "text-line-through-*" IAccessible2 text attributes with a value that indicates that strikethrough is applied [1], bridge that to the AT-SPI layer via the "strikethrough" attribute with a value of "true". See also the ATK documentation [2] for the `ATK_TEXT_ATTR_STRIKETHROUGH` text attribute. This will not only be used by an upcoming change that implements reporting that for Qt's own text widgets, but is also needed for third-party applications. Change for LibreOffice that makes use of this: [3] [1] https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes [2] https://gnome.pages.gitlab.gnome.org/atk/AtkText.html#AtkTextAttribute [3] https://gerrit.libreoffice.org/c/core/+/157939 Task-number: QTBUG-118106 Change-Id: Ieb98584a3c6270d8db508d59994f9ba244e2bc64 Reviewed-by: Jan Arve Sæther <[email protected]>