comparison mac/dw.m @ 1558:9c5d3ac5bec5

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.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 17 Jan 2012 06:49:05 +0000
parents 030e9bddc1c9
children bc3a11fe9a46
comparison
equal deleted inserted replaced
1557:030e9bddc1c9 1558:9c5d3ac5bec5
484 HMTX DWRunMutex; 484 HMTX DWRunMutex;
485 HMTX DWThreadMutex; 485 HMTX DWThreadMutex;
486 HMTX DWThreadMutex2; 486 HMTX DWThreadMutex2;
487 DWTID DWThread = (DWTID)-1; 487 DWTID DWThread = (DWTID)-1;
488 DWTID _dw_mutex_locked = (DWTID)-1; 488 DWTID _dw_mutex_locked = (DWTID)-1;
489
490 /* Send fake event to make sure the loop isn't stuck */
491 void _dw_wakeup_app()
492 {
493 [DWApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined
494 location:NSMakePoint(0, 0)
495 modifierFlags:0
496 timestamp:0
497 windowNumber:0
498 context:NULL
499 subtype:0
500 data1:0
501 data2:0]
502 atStart:NO];
503 }
489 504
490 /* Used for doing bitblts from the main thread */ 505 /* Used for doing bitblts from the main thread */
491 typedef struct _bitbltinfo 506 typedef struct _bitbltinfo
492 { 507 {
493 id src; 508 id src;
913 _event_handler([self window], nil, 13); 928 _event_handler([self window], nil, 13);
914 } 929 }
915 -(void)setMenu:(NSMenu *)input { windowmenu = input; [windowmenu retain]; } 930 -(void)setMenu:(NSMenu *)input { windowmenu = input; [windowmenu retain]; }
916 -(void)menuHandler:(id)sender 931 -(void)menuHandler:(id)sender
917 { 932 {
918 if(DWOSMinor > 5) 933 [DWObj performSelector:@selector(menuHandler:) withObject:sender afterDelay:0];
919 [DWObj performSelector:@selector(menuHandler:) withObject:sender afterDelay:0]; 934 _dw_wakeup_app();
920 else
921 [DWObj menuHandler:sender];
922 } 935 }
923 -(void)mouseDragged:(NSEvent *)theEvent { _event_handler(self, theEvent, 5); } 936 -(void)mouseDragged:(NSEvent *)theEvent { _event_handler(self, theEvent, 5); }
924 -(void)mouseMoved:(NSEvent *)theEvent 937 -(void)mouseMoved:(NSEvent *)theEvent
925 { 938 {
926 id hit = [self hitTest:[theEvent locationInWindow]]; 939 id hit = [self hitTest:[theEvent locationInWindow]];
2824 * Causes running dw_main() to return. 2837 * Causes running dw_main() to return.
2825 */ 2838 */
2826 void API dw_main_quit(void) 2839 void API dw_main_quit(void)
2827 { 2840 {
2828 [DWApp stop:nil]; 2841 [DWApp stop:nil];
2842 _dw_wakeup_app();
2829 } 2843 }
2830 2844
2831 /* 2845 /*
2832 * Runs a message loop for Dynamic Windows, for a period of milliseconds. 2846 * Runs a message loop for Dynamic Windows, for a period of milliseconds.
2833 * Parameters: 2847 * Parameters:
9708 break; 9722 break;
9709 } 9723 }
9710 } 9724 }
9711 } 9725 }
9712 } 9726 }
9713
9714 } 9727 }
9715
9716 } 9728 }
9717 9729
9718 /* Using domain sockets on unix for IPC */ 9730 /* Using domain sockets on unix for IPC */
9719 /* Create a named event semaphore which can be 9731 /* Create a named event semaphore which can be
9720 * opened from other processes. 9732 * opened from other processes.