Fix T56909: wrong interface scale on macOS 10.14, when using 10.14 SDK.

This does not affect existing releases as far as I can tell, only new builds
using the new SDK have the problem.
This commit is contained in:
Brecht Van Lommel 2018-09-30 19:28:15 +02:00
parent d6ca699d7e
commit 786870e26f
Notes: blender-bot 2023-02-14 10:29:32 +01:00
Referenced by issue #76246, "Paste Objects" doesn't copy source objects' collection heirarchy
Referenced by issue #58229, Blender 2.79 & 2.8 - Undo when dealing with separate by loose parts ends up with duplicate objects
Referenced by issue #58193, Blender 2.8 - Adding new collection from the Objects Menu, does not add the collection to the scene
Referenced by issue #58195, Blender 2.8 - No way of adding collections that are manually created to the scene collection
Referenced by issue #58188, Extreme FPS loss (24x) between 2.79 and 2.8 with particle systems
Referenced by issue #58190, Blender 2.8 - Paste selection from buffer - Disabling 'Active Collection' doesnt work
Referenced by issue #57886, Some image empties crash blender2.8
Referenced by issue #56909, OSX Mojave wrong interface scaling
1 changed files with 11 additions and 8 deletions

View File

@ -551,7 +551,15 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
//Creates the OpenGL View inside the window
m_openGLView = [[CocoaOpenGLView alloc] initWithFrame:rect];
if (m_systemCocoa->m_nativePixel) {
// Needs to happen early when building with the 10.14 SDK, otherwise
// has no effect until resizeing the window.
if ([m_openGLView respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) {
[m_openGLView setWantsBestResolutionOpenGLSurface:YES];
}
}
[m_openGLView setSystemAndWindowCocoa:systemCocoa windowCocoa:this];
[m_window setContentView:m_openGLView];
@ -563,14 +571,9 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
updateDrawingContext();
activateDrawingContext();
// XXX jwilkins: This seems like it belongs in GHOST_ContextCGL, but probably not GHOST_ContextEGL
if (m_systemCocoa->m_nativePixel) {
if ([m_openGLView respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) {
[m_openGLView setWantsBestResolutionOpenGLSurface:YES];
NSRect backingBounds = [m_openGLView convertRectToBacking:[m_openGLView bounds]];
m_nativePixelSize = (float)backingBounds.size.width / (float)rect.size.width;
}
NSRect backingBounds = [m_openGLView convertRectToBacking:[m_openGLView bounds]];
m_nativePixelSize = (float)backingBounds.size.width / (float)rect.size.width;
}
setTitle(title);