Cocoa: Explicitly set layer on surface creation

Implicitly setting the layer doesn't work when there is already a layer.
Our view is now layer-hosting for Vulkan.

Fixes #1340.
This commit is contained in:
Camilla Löwy 2019-03-27 16:28:16 +01:00
parent 9e54b97cfa
commit e108c0de0d

View File

@ -400,14 +400,6 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
_glfwInputWindowDamage(window); _glfwInputWindowDamage(window);
} }
- (id)makeBackingLayer
{
if (window->ns.layer)
return window->ns.layer;
return [super makeBackingLayer];
}
- (void)cursorUpdate:(NSEvent *)event - (void)cursorUpdate:(NSEvent *)event
{ {
updateCursorImage(window); updateCursorImage(window);
@ -1737,6 +1729,7 @@ VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
} }
[window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]]; [window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]];
[window->ns.view setLayer:window->ns.layer];
[window->ns.view setWantsLayer:YES]; [window->ns.view setWantsLayer:YES];
memset(&sci, 0, sizeof(sci)); memset(&sci, 0, sizeof(sci));