diff options
author | Paul Olav Tvete <paul.tvete@theqtcompany.com> | 2016-05-25 16:28:52 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@theqtcompany.com> | 2016-05-31 08:03:10 +0000 |
commit | fd9eefba8089ff9cd0bfe986dc527bbdb0630b02 (patch) | |
tree | 8da1ee5f02d49b641bf1be2eaf73537e0ea5e5bf /src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h | |
parent | 1f1db8e85eb088f7aaf42c2e15b31e3bb84bfb0d (diff) |
Fix for popups
Introduce a singleton event filter that keeps working if
the popup is deleted. Move the event filter class to
qwaylandquickshellsurfaceitem, so it can be used by the
XDG shell.
Change-Id: I58998a7e62697bf6f54536d2c2e2732ceb4d970e
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
Diffstat (limited to 'src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h')
-rw-r--r-- | src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h b/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h index b2d4780ab..c2f46917e 100644 --- a/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h +++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h @@ -78,6 +78,26 @@ public: virtual bool mouseReleaseEvent(QMouseEvent *) { return false; } }; +class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickShellEventFilter : public QObject +{ + Q_OBJECT +public: + typedef void (*CallbackFunction)(void); + static void startFilter(QWaylandClient *client, CallbackFunction closePopupCallback); + static void cancelFilter(); + +private: + void stopFilter(); + + QWaylandQuickShellEventFilter(QObject *parent = nullptr); + bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE; + bool eventFilterInstalled; + bool waitForRelease; + QPointer<QWaylandClient> client; + CallbackFunction closePopups; + static QWaylandQuickShellEventFilter *self; +}; + QT_END_NAMESPACE #endif // QWAYLANDQUICKSHELLSURFACEITEM_P_H |