Load the Linux SPI Accessibility bridge

This is mostly a copy of XCB's atspi brige loading, only it creates the
original QPlatformAccessility() instance if the atspi bridge is not
available, to match the current behavior.

This also moves accesibility module to be lazy-loaded to match both Mir
and XCB QPAs.

Change-Id: I7b7ccadbec3760ab8a9449124db0db3f28c1f355
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This commit is contained in:
David Edmundson 2017-09-15 18:34:49 +02:00 committed by Frederik Gladhorn
parent 9d082d91f3
commit 833e1cef06
3 changed files with 17 additions and 4 deletions

View File

@ -18,6 +18,9 @@ CONFIG += link_pkgconfig wayland-scanner
qtConfig(xkbcommon-evdev): \ qtConfig(xkbcommon-evdev): \
QMAKE_USE_PRIVATE += xkbcommon_evdev QMAKE_USE_PRIVATE += xkbcommon_evdev
qtHaveModule(linuxaccessibility_support_private): \
QT += linuxaccessibility_support_private
QMAKE_USE += wayland-client QMAKE_USE += wayland-client
INCLUDEPATH += $$PWD/../shared INCLUDEPATH += $$PWD/../shared

View File

@ -86,6 +86,10 @@
#include "qwaylandinputdeviceintegration_p.h" #include "qwaylandinputdeviceintegration_p.h"
#include "qwaylandinputdeviceintegrationfactory_p.h" #include "qwaylandinputdeviceintegrationfactory_p.h"
#ifndef QT_NO_ACCESSIBILITY_ATSPI_BRIDGE
#include <QtLinuxAccessibilitySupport/private/bridge_p.h>
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace QtWaylandClient { namespace QtWaylandClient {
@ -129,9 +133,6 @@ QWaylandIntegration::QWaylandIntegration()
: mFontDb(new QGenericUnixFontDatabase()) : mFontDb(new QGenericUnixFontDatabase())
#endif #endif
, mNativeInterface(new QWaylandNativeInterface(this)) , mNativeInterface(new QWaylandNativeInterface(this))
#if QT_CONFIG(accessibility)
, mAccessibility(new QPlatformAccessibility())
#endif
{ {
initializeInputDeviceIntegration(); initializeInputDeviceIntegration();
mDisplay.reset(new QWaylandDisplay(this)); mDisplay.reset(new QWaylandDisplay(this));
@ -277,6 +278,15 @@ QVariant QWaylandIntegration::styleHint(StyleHint hint) const
#if QT_CONFIG(accessibility) #if QT_CONFIG(accessibility)
QPlatformAccessibility *QWaylandIntegration::accessibility() const QPlatformAccessibility *QWaylandIntegration::accessibility() const
{ {
if (!mAccessibility) {
#ifndef QT_NO_ACCESSIBILITY_ATSPI_BRIDGE
Q_ASSERT_X(QCoreApplication::eventDispatcher(), "QXcbIntegration",
"Initializing accessibility without event-dispatcher!");
mAccessibility.reset(new QSpiAccessibleBridge());
#else
mAccessibility.reset(new QPlatformAccessibility());
#endif
}
return mAccessibility.data(); return mAccessibility.data();
} }
#endif #endif

View File

@ -145,7 +145,7 @@ private:
QScopedPointer<QPlatformNativeInterface> mNativeInterface; QScopedPointer<QPlatformNativeInterface> mNativeInterface;
QScopedPointer<QPlatformInputContext> mInputContext; QScopedPointer<QPlatformInputContext> mInputContext;
#if QT_CONFIG(accessibility) #if QT_CONFIG(accessibility)
QScopedPointer<QPlatformAccessibility> mAccessibility; mutable QScopedPointer<QPlatformAccessibility> mAccessibility;
#endif #endif
bool mFailed = false; bool mFailed = false;
bool mClientBufferIntegrationInitialized = false; bool mClientBufferIntegrationInitialized = false;