diff options
Diffstat (limited to 'src/gui/kernel/qwindowsysteminterface_p.h')
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface_p.h | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index e9d2fadc84..1b5351db71 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -52,7 +52,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QWindowSystemInterfacePrivate { +class Q_GUI_EXPORT QWindowSystemInterfacePrivate { public: enum EventType { Close, @@ -77,7 +77,8 @@ public: Tablet, TabletEnterProximity, TabletLeaveProximity, - PlatformPanel + PlatformPanel, + ContextMenu }; class WindowSystemEvent { @@ -333,6 +334,21 @@ public: QPointer<QWindow> window; }; +#ifndef QT_NO_CONTEXTMENU + class ContextMenuEvent : public WindowSystemEvent { + public: + explicit ContextMenuEvent(QWindow *w, bool mouseTriggered, const QPoint &pos, + const QPoint &globalPos, Qt::KeyboardModifiers modifiers) + : WindowSystemEvent(ContextMenu), window(w), mouseTriggered(mouseTriggered), pos(pos), + globalPos(globalPos), modifiers(modifiers) { } + QPointer<QWindow> window; + bool mouseTriggered; + QPoint pos; // Only valid if triggered by mouse + QPoint globalPos; // Only valid if triggered by mouse + Qt::KeyboardModifiers modifiers; + }; +#endif + class WindowSystemEventList { QList<WindowSystemEvent *> impl; mutable QMutex mutex; @@ -349,6 +365,25 @@ public: { const QMutexLocker locker(&mutex); impl.append(e); } int count() const { const QMutexLocker locker(&mutex); return impl.count(); } + WindowSystemEvent *peekAtFirstOfType(EventType t) const + { + const QMutexLocker locker(&mutex); + for (int i = 0; i < impl.size(); ++i) { + if (impl.at(i)->type == t) + return impl.at(i); + } + return 0; + } + void remove(const WindowSystemEvent *e) + { + const QMutexLocker locker(&mutex); + for (int i = 0; i < impl.size(); ++i) { + if (impl.at(i) == e) { + impl.removeAt(i); + break; + } + } + } private: Q_DISABLE_COPY(WindowSystemEventList); }; @@ -356,7 +391,9 @@ public: static WindowSystemEventList windowSystemEventQueue; static int windowSystemEventsQueued(); - static WindowSystemEvent * getWindowSystemEvent(); + static WindowSystemEvent *getWindowSystemEvent(); + static WindowSystemEvent *peekWindowSystemEvent(EventType t); + static void removeWindowSystemEvent(WindowSystemEvent *event); static void handleWindowSystemEvent(WindowSystemEvent *ev); static QElapsedTimer eventTime; |