Merge pull request #846 from BayLee4/fix_retina

Cocoa Port: Fix mixed retina/non-retina display touchscreen bug
This commit is contained in:
Roger Manuel 2024-10-10 12:48:59 -07:00 committed by GitHub
commit 2bc5b0d86b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 0 deletions

View File

@ -1465,6 +1465,15 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _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)