Upstream fixes for vulkan surface creation and the retina hint

e108c0de0d
980fc9b52f
This commit is contained in:
Kovid Goyal 2019-03-28 13:09:22 +05:30
parent 6f3a9d6d29
commit b10312e249
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 9 additions and 12 deletions

View File

@ -117,6 +117,7 @@ typedef struct _GLFWwindowNS
id layer;
GLFWbool maximized;
GLFWbool retina;
// Cached window properties to filter out duplicate events
int width, height;

View File

@ -592,14 +592,6 @@ static GLFWapplicationshouldhandlereopenfun handle_reopen_callback = NULL;
_glfwInputWindowDamage(window);
}
- (id)makeBackingLayer
{
if (window->ns.layer)
return window->ns.layer;
return [super makeBackingLayer];
}
- (void)cursorUpdate:(NSEvent *)event
{
updateCursorImage(window);
@ -728,7 +720,7 @@ static GLFWapplicationshouldhandlereopenfun handle_reopen_callback = NULL;
window->ns.yscale = yscale;
_glfwInputWindowContentScale(window, xscale, yscale);
if (window->ns.layer)
if (window->ns.retina && window->ns.layer)
[window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]];
}
}
@ -1285,8 +1277,7 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window];
if (wndconfig->ns.retina)
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
window->ns.retina = wndconfig->ns.retina;
if (fbconfig->transparent)
{
@ -2031,7 +2022,9 @@ VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
return VK_ERROR_EXTENSION_NOT_PRESENT;
}
[window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]];
if (window->ns.retina)
[window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]];
[window->ns.view setLayer:window->ns.layer];
[window->ns.view setWantsLayer:YES];
memset(&sci, 0, sizeof(sci));

View File

@ -299,6 +299,9 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
[window->context.nsgl.object setValues:&opaque forParameter:NSOpenGLContextParameterSurfaceOpacity];
}
if (window->ns.retina)
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
[window->context.nsgl.object setView:window->ns.view];
window->context.makeCurrent = makeContextCurrentNSGL;