From 8c3479f850b999aa8ad0f5d1421d4266d36ac5c6 Mon Sep 17 00:00:00 2001 From: neville Date: Fri, 31 Aug 2018 21:22:08 +0200 Subject: [PATCH] (OSX PowerPC) PowerPC Fixed --- ui/drivers/cocoa/ui_cocoa_msg_window.m | 2 +- ui/drivers/ui_cocoa.m | 24 +++++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ui/drivers/cocoa/ui_cocoa_msg_window.m b/ui/drivers/cocoa/ui_cocoa_msg_window.m index faf6739b99..71c83393c6 100644 --- a/ui/drivers/cocoa/ui_cocoa_msg_window.m +++ b/ui/drivers/cocoa/ui_cocoa_msg_window.m @@ -80,7 +80,7 @@ static enum ui_msg_window_response ui_msg_window_cocoa_dialog(ui_msg_window_stat break; } -#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9 +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 [alert beginSheetModalForWindow:(BRIDGE NSWindow *)ui_companion_driver_get_main_window() completionHandler:^(NSModalResponse returnCode) { [[NSApplication sharedApplication] stopModalWithCode:returnCode]; diff --git a/ui/drivers/ui_cocoa.m b/ui/drivers/ui_cocoa.m index a100e87ecf..cdcded040c 100644 --- a/ui/drivers/ui_cocoa.m +++ b/ui/drivers/ui_cocoa.m @@ -42,6 +42,7 @@ #import #endif +#if !((defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))) @interface WindowListener : NSResponder @end @@ -59,6 +60,7 @@ {} @end +#endif id apple_platform; @@ -72,7 +74,9 @@ id apple_platform; apple_view_type_t _vt; NSView* _renderView; id _sleepActivity; +#if !(defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__))) WindowListener *_listener; +#endif } @property (nonatomic, retain) NSWindow IBOutlet* window; @@ -261,11 +265,15 @@ static char** waiting_argv; [self.window setCollectionBehavior:NS_WINDOW_COLLECTION_BEHAVIOR_FULLSCREEN_PRIMARY]; } +#if !(defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__))) _listener = [WindowListener new]; +#endif [self.window setAcceptsMouseMovedEvents: YES]; +#if !(defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__))) [self.window setNextResponder:_listener]; self.window.delegate = _listener; +#endif [[self.window contentView] setAutoresizesSubviews:YES]; @@ -331,10 +339,12 @@ static char** waiting_argv; } _renderView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; - _renderView.frame = self.window.contentView.bounds; + [_renderView setFrame: [[self.window contentView] bounds]]; self.window.contentView = _renderView; +#if !(defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__))) [self.window.contentView setNextResponder:_listener]; +#endif } - (apple_view_type_t)viewType { @@ -349,15 +359,19 @@ static char** waiting_argv; return [NSApp isActive]; } +#define NS_FULLSCREEN_WINDOW_MASK (1 << 14) + - (void)setVideoMode:(gfx_ctx_mode_t)mode { - BOOL isFullScreen = (self.window.styleMask & NSFullScreenWindowMask) == NSFullScreenWindowMask; - if (mode.fullscreen && !isFullScreen) + BOOL isFullScreen = (self.window.styleMask & NS_FULLSCREEN_WINDOW_MASK) == NS_FULLSCREEN_WINDOW_MASK; + SEL fselector = NSSelectorFromString(BOXSTRING("toggleFullScreen")); + + if (mode.fullscreen && !isFullScreen && [self.window respondsToSelector:fselector]) { [self.window toggleFullScreen:self]; return; } - if (!mode.fullscreen && isFullScreen) + if (!mode.fullscreen && isFullScreen && [self.window respondsToSelector:fselector]) { [self.window toggleFullScreen:self]; } @@ -379,7 +393,7 @@ static char** waiting_argv; - (bool)setDisableDisplaySleep:(bool)disable { -#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9 +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 if (disable && _sleepActivity == nil) { _sleepActivity = [NSProcessInfo.processInfo beginActivityWithOptions:NSActivityIdleDisplaySleepDisabled reason:@"disable screen saver"];