| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef Q_SPI_APPLICATION_H |
| 5 | #define Q_SPI_APPLICATION_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtGui/private/qtguiglobal_p.h> |
| 19 | #include <QtCore/QPointer> |
| 20 | #include <QtCore/QQueue> |
| 21 | #include <QtDBus/QDBusConnection> |
| 22 | #include <QtGui/QAccessibleInterface> |
| 23 | Q_MOC_INCLUDE(<QtDBus/QDBusMessage>) |
| 24 | |
| 25 | QT_REQUIRE_CONFIG(accessibility); |
| 26 | |
| 27 | QT_BEGIN_NAMESPACE |
| 28 | |
| 29 | /* |
| 30 | * Used for the root object. |
| 31 | * |
| 32 | * Uses the root object reference and reports its parent as the desktop object. |
| 33 | */ |
| 34 | class QSpiApplicationAdaptor :public QObject |
| 35 | { |
| 36 | Q_OBJECT |
| 37 | |
| 38 | public: |
| 39 | QSpiApplicationAdaptor(const QDBusConnection &connection, QObject *parent); |
| 40 | virtual ~QSpiApplicationAdaptor() {} |
| 41 | void sendEvents(bool active); |
| 42 | |
| 43 | Q_SIGNALS: |
| 44 | void windowActivated(QObject* window, bool active); |
| 45 | |
| 46 | protected: |
| 47 | bool eventFilter(QObject *obj, QEvent *event) override; |
| 48 | |
| 49 | private Q_SLOTS: |
| 50 | void notifyKeyboardListenerCallback(const QDBusMessage& message); |
| 51 | void notifyKeyboardListenerError(const QDBusError& error, const QDBusMessage& message); |
| 52 | |
| 53 | private: |
| 54 | static QKeyEvent* copyKeyEvent(QKeyEvent*); |
| 55 | |
| 56 | QQueue<std::pair<QPointer<QObject>, QKeyEvent*> > keyEvents; |
| 57 | QDBusConnection dbusConnection; |
| 58 | }; |
| 59 | |
| 60 | QT_END_NAMESPACE |
| 61 | |
| 62 | #endif |
| 63 | |