diff --git a/internal/uidriver/glfw/ui.go b/internal/uidriver/glfw/ui.go index e4d780c93..3827dbf17 100644 --- a/internal/uidriver/glfw/ui.go +++ b/internal/uidriver/glfw/ui.go @@ -520,6 +520,10 @@ func (u *UserInterface) SetFullscreen(fullscreen bool) { } _ = u.t.Call(func() error { + if u.isNativeFullscreen() { + return nil + } + w, h := u.windowWidth, u.windowHeight u.setWindowSize(w, h, fullscreen) return nil diff --git a/internal/uidriver/glfw/ui_darwin.go b/internal/uidriver/glfw/ui_darwin.go index 3196c835d..e7c60dafb 100644 --- a/internal/uidriver/glfw/ui_darwin.go +++ b/internal/uidriver/glfw/ui_darwin.go @@ -38,6 +38,11 @@ package glfw // *x = bounds.origin.x; // *y = bounds.origin.y; // } +// +// static bool isNativeFullscreen() { +// return [[NSApplication sharedApplication] currentSystemPresentationOptions] & +// NSApplicationPresentationFullScreen; +// } import "C" import ( @@ -82,3 +87,7 @@ func currentMonitorByOS(w *glfw.Window) *glfw.Monitor { func (u *UserInterface) nativeWindow() uintptr { return u.window.GetCocoaWindow() } + +func (u *UserInterface) isNativeFullscreen() bool { + return bool(C.isNativeFullscreen()) +} diff --git a/internal/uidriver/glfw/ui_unix.go b/internal/uidriver/glfw/ui_unix.go index 69c8a2d82..22ae847c4 100644 --- a/internal/uidriver/glfw/ui_unix.go +++ b/internal/uidriver/glfw/ui_unix.go @@ -63,3 +63,7 @@ func (u *UserInterface) nativeWindow() uintptr { // TODO: Implement this. return 0 } + +func (u *UserInterface) isNativeFullscreen() bool { + return false +} diff --git a/internal/uidriver/glfw/ui_windows.go b/internal/uidriver/glfw/ui_windows.go index c2e7b12bb..b15c8df6e 100644 --- a/internal/uidriver/glfw/ui_windows.go +++ b/internal/uidriver/glfw/ui_windows.go @@ -145,3 +145,7 @@ func currentMonitorByOS(w *glfw.Window) *glfw.Monitor { func (u *UserInterface) nativeWindow() uintptr { return u.window.GetWin32Window() } + +func (u *UserInterface) isNativeFullscreen() bool { + return false +} diff --git a/internal/uidriver/glfw/window.go b/internal/uidriver/glfw/window.go index c53575f11..8a3c5d8eb 100644 --- a/internal/uidriver/glfw/window.go +++ b/internal/uidriver/glfw/window.go @@ -47,6 +47,10 @@ func (w *window) SetDecorated(decorated bool) { } _ = w.ui.t.Call(func() error { + if w.ui.isNativeFullscreen() { + return nil + } + v := glfw.False if decorated { v = glfw.True @@ -79,6 +83,10 @@ func (w *window) SetResizable(resizable bool) { return } _ = w.ui.t.Call(func() error { + if w.ui.isNativeFullscreen() { + return nil + } + v := glfw.False if resizable { v = glfw.True @@ -106,6 +114,10 @@ func (w *window) SetFloating(floating bool) { return } _ = w.ui.t.Call(func() error { + if w.ui.isNativeFullscreen() { + return nil + } + v := glfw.False if floating { v = glfw.True diff --git a/run.go b/run.go index 2a6f1476a..8afc618e3 100644 --- a/run.go +++ b/run.go @@ -270,6 +270,9 @@ func IsFullscreen() bool { // // SetFullscreen does nothing on browsers or mobiles. // +// SetFullscreen does nothing on macOS when the window is fullscreened natively by the macOS desktop +// instead of SetFullscreen(true). +// // SetFullscreen is concurrent-safe. func SetFullscreen(fullscreen bool) { uiDriver().SetFullscreen(fullscreen) diff --git a/window.go b/window.go index c89373a08..d80b28cdf 100644 --- a/window.go +++ b/window.go @@ -42,6 +42,9 @@ func IsWindowDecorated() bool { // SetWindowDecorated works only on desktops. // SetWindowDecorated does nothing on other platforms. // +// SetWindowDecorated does nothing on macOS when the window is fullscreened natively by the macOS desktop +// instead of SetFullscreen(true). +// // SetWindowDecorated is concurrent-safe. func SetWindowDecorated(decorated bool) { if w := uiDriver().Window(); w != nil { @@ -67,6 +70,9 @@ func IsWindowResizable() bool { // // If SetWindowResizable is called with true and Run is used, SetWindowResizable panics. Use RunGame instead. // +// SetWindowResizable does nothing on macOS when the window is fullscreened natively by the macOS desktop +// instead of SetFullscreen(true). +// // SetWindowResizable is concurrent-safe. func SetWindowResizable(resizable bool) { theUIContext.setWindowResizable(resizable) @@ -228,6 +234,9 @@ func IsWindowFloating() bool { // // SetWindowFloating does nothing on browsers or mobiles. // +// SetWindowFloating does nothing on macOS when the window is fullscreened natively by the macOS desktop +// instead of SetFullscreen(true). +// // SetWindowFloating is concurrent-safe. func SetWindowFloating(float bool) { if w := uiDriver().Window(); w != nil {