98 #ifdef QT_MAC_USE_COCOA |
98 #ifdef QT_MAC_USE_COCOA |
99 typedef struct _NSModalSession *NSModalSession; |
99 typedef struct _NSModalSession *NSModalSession; |
100 typedef struct _QCocoaModalSessionInfo { |
100 typedef struct _QCocoaModalSessionInfo { |
101 QPointer<QWidget> widget; |
101 QPointer<QWidget> widget; |
102 NSModalSession session; |
102 NSModalSession session; |
|
103 void *nswindow; |
103 } QCocoaModalSessionInfo; |
104 } QCocoaModalSessionInfo; |
104 #endif |
105 #endif |
105 |
106 |
106 class QEventDispatcherMacPrivate; |
107 class QEventDispatcherMacPrivate; |
107 |
108 |
172 #ifdef QT_MAC_USE_COCOA |
173 #ifdef QT_MAC_USE_COCOA |
173 // The following variables help organizing modal sessions: |
174 // The following variables help organizing modal sessions: |
174 static QStack<QCocoaModalSessionInfo> cocoaModalSessionStack; |
175 static QStack<QCocoaModalSessionInfo> cocoaModalSessionStack; |
175 static bool currentExecIsNSAppRun; |
176 static bool currentExecIsNSAppRun; |
176 static bool nsAppRunCalledByQt; |
177 static bool nsAppRunCalledByQt; |
|
178 static bool cleanupModalSessionsNeeded; |
177 static NSModalSession currentModalSessionCached; |
179 static NSModalSession currentModalSessionCached; |
|
180 static NSModalSession currentModalSession(); |
178 static void updateChildrenWorksWhenModal(); |
181 static void updateChildrenWorksWhenModal(); |
179 static NSModalSession currentModalSession(); |
|
180 static int activeModalSessionCount(); |
|
181 static void temporarilyStopAllModalSessions(); |
182 static void temporarilyStopAllModalSessions(); |
182 static void beginModalSession(QWidget *widget); |
183 static void beginModalSession(QWidget *widget); |
183 static void endModalSession(QWidget *widget); |
184 static void endModalSession(QWidget *widget); |
|
185 static void cancelWaitForMoreEvents(); |
|
186 static void cleanupModalSessions(); |
|
187 static void ensureNSAppInitialized(); |
184 #endif |
188 #endif |
185 |
189 |
186 MacSocketHash macSockets; |
190 MacSocketHash macSockets; |
187 QList<void *> queuedUserInputEvents; // List of EventRef in Carbon, and NSEvent * in Cocoa |
191 QList<void *> queuedUserInputEvents; // List of EventRef in Carbon, and NSEvent * in Cocoa |
188 CFRunLoopSourceRef postedEventsSource; |
192 CFRunLoopSourceRef postedEventsSource; |
189 CFRunLoopObserverRef waitingObserver; |
193 CFRunLoopObserverRef waitingObserver; |
190 CFRunLoopObserverRef firstTimeObserver; |
194 CFRunLoopObserverRef firstTimeObserver; |
191 QAtomicInt serialNumber; |
195 QAtomicInt serialNumber; |
192 int lastSerial; |
196 int lastSerial; |
193 bool interrupt; |
197 static bool interrupt; |
194 private: |
198 private: |
195 static Boolean postedEventSourceEqualCallback(const void *info1, const void *info2); |
199 static Boolean postedEventSourceEqualCallback(const void *info1, const void *info2); |
196 static void postedEventsSourcePerformCallback(void *info); |
200 static void postedEventsSourcePerformCallback(void *info); |
197 static void activateTimer(CFRunLoopTimerRef, void *info); |
201 static void activateTimer(CFRunLoopTimerRef, void *info); |
198 static void waitingObserverCallback(CFRunLoopObserverRef observer, |
202 static void waitingObserverCallback(CFRunLoopObserverRef observer, |