< prev index next >
src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m
Print this page
*** 347,356 ****
--- 347,357 ----
if ([event type] == NSApplicationDefined
&& TS_EQUAL([event timestamp], dummyEventTimestamp)
&& [event subtype] == NativeSyncQueueEvent) {
[seenDummyEventLock lockWhenCondition:NO];
[seenDummyEventLock unlockWithCondition:YES];
+
} else if ([event type] == NSApplicationDefined && [event subtype] == ExecuteBlockEvent) {
void (^block)() = (void (^)()) [event data1];
block();
[block release];
} else if ([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask)) {
*** 385,397 ****
[NSApp postEvent: event atStart: NO];
[pool drain];
}
!
!
! - (void)postDummyEvent {
seenDummyEventLock = [[NSConditionLock alloc] initWithCondition:NO];
dummyEventTimestamp = [NSProcessInfo processInfo].systemUptime;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSEvent* event = [NSEvent otherEventWithType: NSApplicationDefined
--- 386,396 ----
[NSApp postEvent: event atStart: NO];
[pool drain];
}
! - (void)postDummyEvent:(bool)useCocoa {
seenDummyEventLock = [[NSConditionLock alloc] initWithCondition:NO];
dummyEventTimestamp = [NSProcessInfo processInfo].systemUptime;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSEvent* event = [NSEvent otherEventWithType: NSApplicationDefined
*** 401,423 ****
windowNumber: 0
context: nil
subtype: NativeSyncQueueEvent
data1: 0
data2: 0];
! [NSApp postEvent: event atStart: NO];
[pool drain];
}
! - (void)waitForDummyEvent:(long long) timeout {
if (timeout >= 0) {
! double sec = ((double) timeout)/1000;
! [seenDummyEventLock lockWhenCondition:YES
beforeDate:[NSDate dateWithTimeIntervalSinceNow:sec]];
} else {
[seenDummyEventLock lockWhenCondition:YES];
}
[seenDummyEventLock unlock];
[seenDummyEventLock release];
seenDummyEventLock = nil;
}
--- 400,431 ----
windowNumber: 0
context: nil
subtype: NativeSyncQueueEvent
data1: 0
data2: 0];
! if (useCocoa) {
! [NSApp postEvent:event atStart:NO];
! } else {
! ProcessSerialNumber psn;
! GetCurrentProcess(&psn);
! CGEventPostToPSN(&psn, [event CGEvent]);
! }
[pool drain];
}
! - (void)waitForDummyEvent:(double)timeout {
! bool unlock = true;
if (timeout >= 0) {
! double sec = timeout / 1000;
! unlock = [seenDummyEventLock lockWhenCondition:YES
beforeDate:[NSDate dateWithTimeIntervalSinceNow:sec]];
} else {
[seenDummyEventLock lockWhenCondition:YES];
}
+ if (unlock) {
[seenDummyEventLock unlock];
+ }
[seenDummyEventLock release];
seenDummyEventLock = nil;
}
< prev index next >