From 4482301882cb9afc314d632c125fff466e929676 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 8 Aug 2021 17:45:44 +0900 Subject: [PATCH] internal/uidriver/glfw: Better implementation of isNativeFullscreen The old implementation can return false when the window is not active. --- internal/uidriver/glfw/ui_darwin.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/uidriver/glfw/ui_darwin.go b/internal/uidriver/glfw/ui_darwin.go index bbf879013..bec34bc38 100644 --- a/internal/uidriver/glfw/ui_darwin.go +++ b/internal/uidriver/glfw/ui_darwin.go @@ -42,9 +42,12 @@ package glfw // } // } // -// static bool isNativeFullscreen() { -// return [[NSApplication sharedApplication] currentSystemPresentationOptions] & -// NSApplicationPresentationFullScreen; +// static bool isNativeFullscreen(uintptr_t windowPtr) { +// if (!windowPtr) { +// return false; +// } +// NSWindow* window = (NSWindow*)windowPtr; +// return (window.styleMask & NSWindowStyleMaskFullScreen) != 0; // } // // static void setNativeCursor(int cursorID) { @@ -118,7 +121,7 @@ func (u *UserInterface) nativeWindow() uintptr { } func (u *UserInterface) isNativeFullscreen() bool { - return bool(C.isNativeFullscreen()) + return bool(C.isNativeFullscreen(C.uintptr_t(u.window.GetCocoaWindow()))) } func (u *UserInterface) setNativeCursor(shape driver.CursorShape) {