diff options
Diffstat (limited to 'src/osd/mac/windowcontroller.mm')
-rw-r--r-- | src/osd/mac/windowcontroller.mm | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/src/osd/mac/windowcontroller.mm b/src/osd/mac/windowcontroller.mm index aa09e96b0d5..dd49d559b0b 100644 --- a/src/osd/mac/windowcontroller.mm +++ b/src/osd/mac/windowcontroller.mm @@ -88,6 +88,20 @@ } @end +void MacPollInputs() +{ + NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny + untilDate:[NSDate distantPast] // do not wait for event + inMode:NSDefaultRunLoopMode + dequeue:YES]; + + if (event) + { + [NSApp sendEvent:event]; + [NSApp updateWindows]; + } +} + void *GetOSWindow(void *wincontroller) { MAMEWindowController *wc = (MAMEWindowController *)wincontroller; @@ -102,30 +116,22 @@ void *CreateMAMEWindow(char *title, int x, int y, int w, int h, bool isFullscree NSWindow *window = [NSWindow alloc]; MAMEWindowController *controller = [MAMEWindowController alloc]; - /* To avoid event handling issues like SDL has, we run MAME in - a separate NSThread. This means all UI calls from MAME - must be delegated over to the main thread because the - Cocoa UI stuff is not thread-safe */ - dispatch_sync(dispatch_get_main_queue(), ^{ - [window initWithContentRect:bounds - styleMask:style - backing:NSBackingStoreBuffered - defer:NO]; - [controller initWithWindow:window]; - - NSString *nstitle = [[NSString alloc] initWithUTF8String:title]; - [window setTitle:nstitle]; - [nstitle release]; - - if (isFullscreen) - { - [controller goFullscreen]; - } - else - { - [window makeKeyAndOrderFront:nil]; - } - }); + [window initWithContentRect:bounds + styleMask:style + backing:NSBackingStoreBuffered + defer:NO]; + [controller initWithWindow:window]; + NSString *nstitle = [[NSString alloc] initWithUTF8String:title]; + [window setTitle:nstitle]; + [nstitle release]; + if (isFullscreen) + { + [controller goFullscreen]; + } + else + { + [window makeKeyAndOrderFront:nil]; + } return (void *)controller; } |