commit 2267b49baf049c6d3164c7fc6461ea1b2b157fbc parent a21bf9934e37e000d4a4778f843da9ed0f8755c5 Author: falkTX <falktx@falktx.com> Date: Fri, 13 Aug 2021 22:26:11 +0100 Get NSWindow from view if we do not have one directly Diffstat:
M | dgl/src/pugl.cpp | | | 11 | +++++++---- |
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/dgl/src/pugl.cpp b/dgl/src/pugl.cpp @@ -203,8 +203,10 @@ const char* puglGetWindowTitle(const PuglView* const view) double puglGetDesktopScaleFactor(const PuglView* const view) { #if defined(DISTRHO_OS_MAC) - return (view->impl->window ? [view->impl->window screen] - : [NSScreen mainScreen]).backingScaleFactor; + if (NSWindow* const window = view->impl->window ? view->impl->window + : [view->impl->wrapperView window]) + return [window screen].backingScaleFactor; + return [NSScreen mainScreen].backingScaleFactor; #else return 1.0; @@ -221,8 +223,9 @@ void puglRaiseWindow(PuglView* const view) #if defined(DISTRHO_OS_HAIKU) // nothing here yet #elif defined(DISTRHO_OS_MAC) - if (view->impl->window) - [view->impl->window orderFrontRegardless]; + if (NSWindow* const window = view->impl->window ? view->impl->window + : [view->impl->wrapperView window]) + [window orderFrontRegardless]; #elif defined(DISTRHO_OS_WINDOWS) SetForegroundWindow(view->impl->hwnd); SetActiveWindow(view->impl->hwnd);