changeset 5040:5417a0f03b0f

RT-26395: Mac: Mouse pressed event does not react at once (button) - Max OSX 10.8.2 Reviewed-by: anthony, ant, zvegintsev
author Petr Pchelko <petrpchelko@gmail.com>
date Wed, 11 Sep 2013 11:33:30 +0400
parents fc8e8676d9a2
children 81798bc43ce4
files modules/graphics/src/main/native-glass/mac/GlassApplication.m
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/native-glass/mac/GlassApplication.m	Wed Sep 11 11:30:40 2013 +0400
+++ b/modules/graphics/src/main/native-glass/mac/GlassApplication.m	Wed Sep 11 11:33:30 2013 +0400
@@ -629,7 +629,10 @@
     NSRunLoop *theRL = [NSRunLoop currentRunLoop];
     NSApplication * app = [NSApplication sharedApplication];
     shouldKeepRunningNestedLoop = YES;
-    while (shouldKeepRunningNestedLoop && [theRL runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]])
+    // Cannot use [NSDate distantFuture] because the period is big the app could hang in a runloop
+    // if the event came before entering the RL
+    while (shouldKeepRunningNestedLoop && [theRL runMode:NSDefaultRunLoopMode
+                                              beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.010]])
     {
         NSEvent * event = [app nextEventMatchingMask: 0xFFFFFFFF untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES];