diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2012-01-04 11:34:02 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-05 11:40:08 +0100 |
commit | da47d70c32562458db629c73cd02325f190210f4 (patch) | |
tree | cbe7bd3c57f0673de3c2de5044e84b0cb5db78ff /src/plugins/platforms/cocoa/qcocoaeventdispatcher.h | |
parent | a8495549d05aa6588a333eb2bc79d5cc0eb48376 (diff) |
QCocoaEventDispatcherPrivate members should not be static
Keep the Cocoa event dispatcher's private data as normal members of
QCocoaEventDispatcherPrivate. This removes the global initializers for
the macTimerHash and cocoaModalSessionStask as well.
To keep timers working, we pass a pointer to the timer's MacTimerInfo
struct to the callback, instead of just the timer id. The MacTimerInfo
needs to keep a pointer back to the QCocoaEventDispatcherPrivate to get
access to the private's members.
Change-Id: Ic3a61e5e1d1d82030735de73cf0b0c70a13c21a4
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@nokia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaeventdispatcher.h')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaeventdispatcher.h | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h index c66b4b77f8..e6e8180085 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h @@ -130,13 +130,10 @@ public: void wakeUp(); void interrupt(); void flush(); - -private: - //friend void qt_mac_select_timer_callbk(__EventLoopTimer*, void*); - friend class QApplicationPrivate; }; struct MacTimerInfo { + QCocoaEventDispatcherPrivate *d_ptr; int id; int interval; Qt::TimerType timerType; @@ -166,26 +163,27 @@ class QCocoaEventDispatcherPrivate : public QAbstractEventDispatcherPrivate public: QCocoaEventDispatcherPrivate(); - static MacTimerHash macTimerHash; + MacTimerHash macTimerHash; + // Set 'blockSendPostedEvents' to true if you _really_ need // to make sure that qt events are not posted while calling // low-level cocoa functions (like beginModalForWindow). And // use a QBoolBlocker to be safe: - static bool blockSendPostedEvents; + bool blockSendPostedEvents; // The following variables help organizing modal sessions: - static QStack<QCocoaModalSessionInfo> cocoaModalSessionStack; - static bool currentExecIsNSAppRun; - static bool nsAppRunCalledByQt; - static bool cleanupModalSessionsNeeded; - static NSModalSession currentModalSessionCached; - static NSModalSession currentModalSession(); - static void updateChildrenWorksWhenModal(); - static void temporarilyStopAllModalSessions(); - static void beginModalSession(QWindow *widget); - static void endModalSession(QWindow *widget); - static void cancelWaitForMoreEvents(); - static void cleanupModalSessions(); - static void ensureNSAppInitialized(); + QStack<QCocoaModalSessionInfo> cocoaModalSessionStack; + bool currentExecIsNSAppRun; + bool nsAppRunCalledByQt; + bool cleanupModalSessionsNeeded; + NSModalSession currentModalSessionCached; + NSModalSession currentModalSession(); + void updateChildrenWorksWhenModal(); + void temporarilyStopAllModalSessions(); + void beginModalSession(QWindow *widget); + void endModalSession(QWindow *widget); + void cancelWaitForMoreEvents(); + void cleanupModalSessions(); + void ensureNSAppInitialized(); MacSocketHash macSockets; QList<void *> queuedUserInputEvents; // NSEvent * @@ -194,15 +192,15 @@ public: CFRunLoopObserverRef firstTimeObserver; QAtomicInt serialNumber; int lastSerial; - static bool interrupt; -private: + bool interrupt; + static Boolean postedEventSourceEqualCallback(const void *info1, const void *info2); static void postedEventsSourcePerformCallback(void *info); static void activateTimer(CFRunLoopTimerRef, void *info); static void waitingObserverCallback(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info); static void firstLoopEntry(CFRunLoopObserverRef ref, CFRunLoopActivity activity, void *info); - friend void processPostedEvents(QCocoaEventDispatcherPrivate *const d, const bool blockSendPostedEvents); + void processPostedEvents(); }; class QtCocoaInterruptDispatcher : public QObject |