MTLMain: Only compile NSView manipulation code on macOS

This commit is contained in:
OatmealDome 2022-07-23 04:30:48 -04:00
parent 8ad7fa0313
commit b32b27ae9a
1 changed files with 5 additions and 0 deletions

View File

@ -3,7 +3,10 @@
#include "VideoBackends/Metal/VideoBackend.h"
#if TARGET_OS_OSX
#include <AppKit/AppKit.h>
#endif
#include <Metal/Metal.h>
#include <QuartzCore/QuartzCore.h>
@ -156,6 +159,7 @@ void Metal::VideoBackend::InitBackendInfo()
void Metal::VideoBackend::PrepareWindow(WindowSystemInfo& wsi)
{
#if TARGET_OS_OSX
if (wsi.type != WindowSystemType::MacOS)
return;
NSView* view = static_cast<NSView*>(wsi.render_surface);
@ -163,4 +167,5 @@ void Metal::VideoBackend::PrepareWindow(WindowSystemInfo& wsi)
[view setWantsLayer:YES];
[view setLayer:layer];
wsi.render_surface = layer;
#endif
}