summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXNotify.c
diff options
context:
space:
mode:
Diffstat (limited to 'macosx/tkMacOSXNotify.c')
-rw-r--r--macosx/tkMacOSXNotify.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c
index 3e0dfde..b400423 100644
--- a/macosx/tkMacOSXNotify.c
+++ b/macosx/tkMacOSXNotify.c
@@ -24,8 +24,8 @@ typedef struct ThreadSpecificData {
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
-#define TSD_INIT() ThreadSpecificData *tsdPtr = \
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData))
+#define TSD_INIT() ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, \
+ sizeof(ThreadSpecificData))
static void TkMacOSXNotifyExitHandler(ClientData clientData);
static void TkMacOSXEventsSetupProc(ClientData clientData, int flags);
@@ -34,12 +34,11 @@ static void TkMacOSXEventsCheckProc(ClientData clientData, int flags);
#pragma mark TKApplication(TKNotify)
@interface NSApplication(TKNotify)
-- (void) _modalSession: (NSModalSession) session sendEvent: (NSEvent *) event;
+- (void)_modalSession:(NSModalSession)session sendEvent:(NSEvent *)event;
@end
@implementation NSWindow(TKNotify)
-- (id) tkDisplayIfNeeded
-{
+- (id)tkDisplayIfNeeded {
if (![self isAutodisplay]) {
[self displayIfNeeded];
}
@@ -48,18 +47,14 @@ static void TkMacOSXEventsCheckProc(ClientData clientData, int flags);
@end
@implementation TKApplication(TKNotify)
-- (NSEvent *) nextEventMatchingMask: (NSUInteger) mask
- untilDate: (NSDate *) expiration inMode: (NSString *) mode
- dequeue: (BOOL) deqFlag
-{
+- (NSEvent *)nextEventMatchingMask:(NSUInteger)mask
+ untilDate:(NSDate *)expiration inMode:(NSString *)mode
+ dequeue:(BOOL)deqFlag {
NSAutoreleasePool *pool = [NSAutoreleasePool new];
-
[NSApp makeWindowsPerform:@selector(tkDisplayIfNeeded) inOrder:NO];
-
int oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
NSEvent *event = [[super nextEventMatchingMask:mask untilDate:expiration
inMode:mode dequeue:deqFlag] retain];
-
Tcl_SetServiceMode(oldMode);
if (event) {
TSD_INIT();
@@ -73,12 +68,9 @@ static void TkMacOSXEventsCheckProc(ClientData clientData, int flags);
[pool drain];
return [event autorelease];
}
-
-- (void) sendEvent: (NSEvent *) theEvent
-{
+- (void)sendEvent:(NSEvent *)theEvent {
TSD_INIT();
int oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
-
tsdPtr->sendEventNestingLevel++;
[super sendEvent:theEvent];
tsdPtr->sendEventNestingLevel--;
@@ -143,7 +135,6 @@ void
Tk_MacOSXSetupTkNotifier(void)
{
TSD_INIT();
-
if (!tsdPtr->initialized) {
tsdPtr->initialized = 1;
@@ -192,7 +183,6 @@ TkMacOSXNotifyExitHandler(
ClientData clientData) /* Not used. */
{
TSD_INIT();
-
Tcl_DeleteEventSource(TkMacOSXEventsSetupProc,
TkMacOSXEventsCheckProc, GetMainEventQueue());
tsdPtr->initialized = 0;
@@ -224,15 +214,14 @@ TkMacOSXEventsSetupProc(
{
if (flags & TCL_WINDOW_EVENTS &&
![[NSRunLoop currentRunLoop] currentMode]) {
- static const Tcl_Time zeroBlockTime = { 0, 0 };
- TSD_INIT();
+ static Tcl_Time zeroBlockTime = { 0, 0 };
+ TSD_INIT();
if (!tsdPtr->currentEvent) {
NSEvent *currentEvent = [NSApp nextEventMatchingMask:NSAnyEventMask
untilDate:[NSDate distantPast]
inMode:GetRunLoopMode(TkMacOSXGetModalSession())
dequeue:YES];
-
if (currentEvent) {
tsdPtr->currentEvent =
TkMacOSXMakeUncollectableAndRetain(currentEvent);
@@ -274,7 +263,7 @@ TkMacOSXEventsCheckProc(
TSD_INIT();
if (tsdPtr->currentEvent) {
currentEvent = TkMacOSXMakeCollectableAndAutorelease(
- tsdPtr->currentEvent);
+ tsdPtr->currentEvent);
}
do {
modalSession = TkMacOSXGetModalSession();