458 |
457 |
459 } |
458 } |
460 |
459 |
461 /* |
460 /* |
462 * Class: sun_lwawt_macosx_LWCToolkit |
461 * Class: sun_lwawt_macosx_LWCToolkit |
463 * Method: startNativeNestedEventLoop |
462 * Method: executeNextAppKitEvent |
464 * Signature: ()V |
463 * Signature: ()V |
465 */ |
464 */ |
466 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_startNativeNestedEventLoop |
465 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_executeNextAppKitEvent |
467 (JNIEnv *env, jclass cls) |
466 (JNIEnv *env, jclass cls) |
468 { |
467 { |
469 if(!shouldKeepRunningNestedLoop) { |
468 // Simply get the next event in native loop and pass it to execution |
470 NSRunLoop *theRL = [NSRunLoop currentRunLoop]; |
469 // We'll be called repeatedly so there's no need to block here |
471 NSApplication * app = [NSApplication sharedApplication]; |
470 NSRunLoop *theRL = [NSRunLoop currentRunLoop]; |
472 shouldKeepRunningNestedLoop = YES; |
471 NSApplication * app = [NSApplication sharedApplication]; |
473 while (shouldKeepRunningNestedLoop && [theRL runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]) |
472 NSEvent * event = [app nextEventMatchingMask: 0xFFFFFFFF untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]; |
474 { |
473 if (event != nil) { |
475 NSEvent * event = [app nextEventMatchingMask: 0xFFFFFFFF untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]; |
474 [app sendEvent: event]; |
476 if (event != nil) { |
475 } |
477 [app sendEvent: event]; |
476 } |
478 } |
|
479 } |
|
480 } |
|
481 } |
|
482 |
|
483 /* |
|
484 * Class: sun_lwawt_macosx_LWCToolkit |
|
485 * Method: stopNativeNestedEventLoop |
|
486 * Signature: ()V |
|
487 */ |
|
488 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_stopNativeNestedEventLoop |
|
489 (JNIEnv *env, jclass cls) |
|
490 { |
|
491 shouldKeepRunningNestedLoop = NO; |
|
492 } |
|