# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1326782945 0 # Node ID 9c5d3ac5bec51ea7d4f2a7414d6f5833be78ec98 # Parent 030e9bddc1c9d35e49a7bab17aada730b6b6065d Attempted fix on Mac for 10.5 menu event delay issue. And possible dw_main_quit() issue... but crash on Lion still isn't fixed. diff -r 030e9bddc1c9 -r 9c5d3ac5bec5 mac/dw.m --- a/mac/dw.m Mon Jan 16 21:24:11 2012 +0000 +++ b/mac/dw.m Tue Jan 17 06:49:05 2012 +0000 @@ -487,6 +487,21 @@ DWTID DWThread = (DWTID)-1; DWTID _dw_mutex_locked = (DWTID)-1; +/* Send fake event to make sure the loop isn't stuck */ +void _dw_wakeup_app() +{ + [DWApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined + location:NSMakePoint(0, 0) + modifierFlags:0 + timestamp:0 + windowNumber:0 + context:NULL + subtype:0 + data1:0 + data2:0] + atStart:NO]; +} + /* Used for doing bitblts from the main thread */ typedef struct _bitbltinfo { @@ -915,10 +930,8 @@ -(void)setMenu:(NSMenu *)input { windowmenu = input; [windowmenu retain]; } -(void)menuHandler:(id)sender { - if(DWOSMinor > 5) - [DWObj performSelector:@selector(menuHandler:) withObject:sender afterDelay:0]; - else - [DWObj menuHandler:sender]; + [DWObj performSelector:@selector(menuHandler:) withObject:sender afterDelay:0]; + _dw_wakeup_app(); } -(void)mouseDragged:(NSEvent *)theEvent { _event_handler(self, theEvent, 5); } -(void)mouseMoved:(NSEvent *)theEvent @@ -2826,6 +2839,7 @@ void API dw_main_quit(void) { [DWApp stop:nil]; + _dw_wakeup_app(); } /* @@ -9710,9 +9724,7 @@ } } } - } - } /* Using domain sockets on unix for IPC */