From a0386e535c064a15549c829b4656a4cce8df5877 Mon Sep 17 00:00:00 2001 From: BayLee4 <63376748+BayLee4@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:57:21 +0200 Subject: [PATCH] Cocoa Port: Fix mixed retina/non-retina displays bug --- .../cocoa/userinterface/DisplayWindowController.mm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.mm b/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.mm index 524c03298..9c7943662 100644 --- a/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.mm +++ b/desmume/src/frontend/cocoa/userinterface/DisplayWindowController.mm @@ -1465,6 +1465,15 @@ static std::unordered_map _screenMap; // - (void)windowDidChangeScreen:(NSNotification *)notification { [self updateDisplayID]; +#if defined(MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7) + NSScreen *screen = [[self window] screen]; + // Set up the scaling factor if this is a Retina window + if ([screen respondsToSelector:@selector(backingScaleFactor)]) + { + float scaleFactor = [screen backingScaleFactor]; + [[[self view] cdsVideoOutput] clientDisplay3DView]->Get3DPresenter()->SetScaleFactor(scaleFactor); + } +#endif } #if defined(MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)