a11y atspi: Take dialog into account as top-level window

Since a dialog is also a top-level window, it should be taken
into account when trying to find the accessible's top-level
window, relative to which the position will be calulated for
`ATSPI_COORD_TYPE_WINDOW`.

Fixes: QTBUG-105042
Pick-to: 6.4 6.3 6.2
Change-Id: I74fae096fd886bab04187c122f268c26c91b86ab
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Michael Weghorn 2022-07-18 14:48:51 +02:00
parent d40dacf5f4
commit 49c966bc85

View File

@ -1523,11 +1523,12 @@ bool AtSpiAdaptor::inheritsQAction(QObject *object)
// Component // Component
static QAccessibleInterface * getWindow(QAccessibleInterface * interface) static QAccessibleInterface * getWindow(QAccessibleInterface * interface)
{ {
if (interface->role() == QAccessible::Window) if (interface->role() == QAccessible::Dialog || interface->role() == QAccessible::Window)
return interface; return interface;
QAccessibleInterface * parent = interface->parent(); QAccessibleInterface * parent = interface->parent();
while (parent && parent->role() != QAccessible::Window) while (parent && parent->role() != QAccessible::Dialog
&& parent->role() != QAccessible::Window)
parent = parent->parent(); parent = parent->parent();
return parent; return parent;