Added handling of QT_LINUX_ACCESSIBILITY_ALWAYS_ON variable.

By setting this variable to non empty value we can, bypass
checking ScreenReaderEnabled proprty of org.a11y.Status
dbus interface. Not all accessibility readers set this.
The variable is also useful for debugging.

Change-Id: I6c5a1a51065948248e068dfff4755d6818ed9fb1
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
bb10
Tomasz Olszak 2014-03-26 00:26:41 +01:00 committed by The Qt Project
parent b1d6af35a4
commit 790bc92bc0
2 changed files with 16 additions and 1 deletions

View File

@ -97,6 +97,15 @@ QT_BEGIN_NAMESPACE
Accessibility, and the Unix/X11 AT-SPI standard. Other backends
can be supported using QAccessibleBridge.
In the Unix/X11 AT-SPI implementation, applications become accessible
when two conditions are met:
\list
\li org.a11y.Status.IsEnabled DBus property is true
\li org.a11y.Status.ScreenReaderEnabled DBus property is true
\endlist
An alternative to setting the DBus AT-SPI properties is to set
the QT_LINUX_ACCESSIBILITY_ALWAYS_ON environment variable.
In addition to QAccessible's static functions, Qt offers one
generic interface, QAccessibleInterface, that can be used to wrap
all widgets and objects (e.g., QPushButton). This single

View File

@ -84,8 +84,14 @@ void DBusConnection::serviceRegistered()
QDBusConnection c = QDBusConnection::sessionBus();
OrgA11yStatusInterface *a11yStatus = new OrgA11yStatusInterface(A11Y_SERVICE, A11Y_PATH, c, this);
//The variable was introduced because on some embedded platforms there are custom accessibility
//clients which don't set Status.ScreenReaderEnabled to true. The variable is also useful for
//debugging.
static const bool a11yAlwaysOn = !qEnvironmentVariableIsSet("QT_LINUX_ACCESSIBILITY_ALWAYS_ON");
// a11yStatus->isEnabled() returns always true (since Gnome 3.6)
bool enabled = a11yStatus->screenReaderEnabled();
bool enabled = a11yAlwaysOn || a11yStatus->screenReaderEnabled();
if (enabled != m_enabled) {
m_enabled = enabled;
if (m_a11yConnection.isConnected()) {