From 406655a9fcd512a4ffd1514b2ea777b1fb5a3d52 Mon Sep 17 00:00:00 2001 From: arbee Date: Mon, 16 Sep 2019 22:12:14 -0400 Subject: [PATCH] OSD_MAC: window now visible and has a title, but doesn't render (nw) --- src/osd/mac/windowcontroller.mm | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/osd/mac/windowcontroller.mm b/src/osd/mac/windowcontroller.mm index 396fbc49238..aa09e96b0d5 100644 --- a/src/osd/mac/windowcontroller.mm +++ b/src/osd/mac/windowcontroller.mm @@ -102,20 +102,30 @@ 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]; + } }); - if (isFullscreen) - { - [controller goFullscreen]; - } - - [window makeKeyAndOrderFront:nil]; - return (void *)controller; }