diff --git a/v3/pkg/application/webview_window_android.go b/v3/pkg/application/webview_window_android.go index a03646c2e42..e79ee1b2bef 100644 --- a/v3/pkg/application/webview_window_android.go +++ b/v3/pkg/application/webview_window_android.go @@ -136,6 +136,8 @@ func (w *androidWebviewWindow) setFrameless(_ bool) {} func (w *androidWebviewWindow) setFullscreenButtonEnabled(_ bool) {} +func (w *androidWebviewWindow) setFullscreenButtonState(_ ButtonState) {} + func (w *androidWebviewWindow) setMaxSize(_ int, _ int) {} func (w *androidWebviewWindow) setMinSize(_ int, _ int) {} diff --git a/v3/pkg/application/webview_window_darwin.go b/v3/pkg/application/webview_window_darwin.go index c0833b69e8c..7722c757500 100644 --- a/v3/pkg/application/webview_window_darwin.go +++ b/v3/pkg/application/webview_window_darwin.go @@ -461,10 +461,11 @@ void windowRestore(void* nsWindow) { } } -// disable window fullscreen button -void setFullscreenButtonEnabled(void* nsWindow, bool enabled) { - NSButton *fullscreenButton = [(WebviewWindow*)nsWindow standardWindowButton:NSWindowZoomButton]; - fullscreenButton.enabled = enabled; +// setFullscreenButtonState sets the fullscreen button state +static void setFullscreenButtonState(void *window, int state) { + WebviewWindow* nsWindow = (WebviewWindow*)window; + NSButton *fullscreenButton = [nsWindow standardWindowButton:NSWindowZoomButton]; + setButtonState(fullscreenButton, state); } // Set the titlebar style @@ -1041,7 +1042,15 @@ func (w *macosWebviewWindow) hide() { } func (w *macosWebviewWindow) setFullscreenButtonEnabled(enabled bool) { - C.setFullscreenButtonEnabled(w.nsWindow, C.bool(enabled)) + state := ButtonDisabled + if enabled { + state = ButtonEnabled + } + w.setFullscreenButtonState(state) +} + +func (w *macosWebviewWindow) setFullscreenButtonState(state ButtonState) { + C.setFullscreenButtonState(w.nsWindow, C.int(state)) } func (w *macosWebviewWindow) disableSizeConstraints() { @@ -1390,6 +1399,7 @@ func (w *macosWebviewWindow) run() { w.setMinimiseButtonState(options.MinimiseButtonState) w.setMaximiseButtonState(options.MaximiseButtonState) w.setCloseButtonState(options.CloseButtonState) + w.setFullscreenButtonState(options.FullscreenButtonState) // Ignore mouse events if requested w.setIgnoreMouseEvents(options.IgnoreMouseEvents) diff --git a/v3/pkg/application/webview_window_ios.go b/v3/pkg/application/webview_window_ios.go index b2e9e13b7e5..ca4ac2ecff8 100644 --- a/v3/pkg/application/webview_window_ios.go +++ b/v3/pkg/application/webview_window_ios.go @@ -142,13 +142,13 @@ func (w *iosWebviewWindow) setAbsolutePosition(_ int, _ int) {} func (w *iosWebviewWindow) setAlwaysOnTop(_ bool) {} func (w *iosWebviewWindow) setBackgroundColour(col RGBA) { - if w.nativeHandle == nil { - return - } - C.ios_window_set_background_color( - w.nativeHandle, - C.uchar(col.Red), C.uchar(col.Green), C.uchar(col.Blue), C.uchar(col.Alpha), - ) + if w.nativeHandle == nil { + return + } + C.ios_window_set_background_color( + w.nativeHandle, + C.uchar(col.Red), C.uchar(col.Green), C.uchar(col.Blue), C.uchar(col.Alpha), + ) } func (w *iosWebviewWindow) setEnabled(_ bool) {} @@ -157,6 +157,8 @@ func (w *iosWebviewWindow) setFrameless(_ bool) {} func (w *iosWebviewWindow) setFullscreenButtonEnabled(_ bool) {} +func (w *iosWebviewWindow) setFullscreenButtonState(_ ButtonState) {} + func (w *iosWebviewWindow) setMaxSize(_ int, _ int) {} func (w *iosWebviewWindow) setMinSize(_ int, _ int) {} diff --git a/v3/pkg/application/webview_window_linux.go b/v3/pkg/application/webview_window_linux.go index 279a4126eb1..d29b4229e2f 100644 --- a/v3/pkg/application/webview_window_linux.go +++ b/v3/pkg/application/webview_window_linux.go @@ -97,6 +97,10 @@ func (w *linuxWebviewWindow) setFullscreenButtonEnabled(enabled bool) { // Not implemented } +func (w *linuxWebviewWindow) setFullscreenButtonState(state ButtonState) { + // Not implemented +} + func (w *linuxWebviewWindow) setMinimiseButtonEnabled(enabled bool) { //C.enableMinimiseButton(w.nsWindow, C.bool(enabled)) } diff --git a/v3/pkg/application/webview_window_options.go b/v3/pkg/application/webview_window_options.go index e6f6dae5d25..f13298a5091 100644 --- a/v3/pkg/application/webview_window_options.go +++ b/v3/pkg/application/webview_window_options.go @@ -128,9 +128,10 @@ type WebviewWindowOptions struct { Linux LinuxWindow // Toolbar button states - MinimiseButtonState ButtonState - MaximiseButtonState ButtonState - CloseButtonState ButtonState + MinimiseButtonState ButtonState + MaximiseButtonState ButtonState + CloseButtonState ButtonState + FullscreenButtonState ButtonState // If true, the window's devtools will be available (default true in builds without the `production` build tag) DevToolsEnabled bool diff --git a/v3/pkg/application/webview_window_windows.go b/v3/pkg/application/webview_window_windows.go index 71a47f43714..535cdfaa696 100644 --- a/v3/pkg/application/webview_window_windows.go +++ b/v3/pkg/application/webview_window_windows.go @@ -463,6 +463,7 @@ func (w *windowsWebviewWindow) run() { w.setMinimiseButtonState(options.MinimiseButtonState) w.setMaximiseButtonState(options.MaximiseButtonState) w.setCloseButtonState(options.CloseButtonState) + w.setFullscreenButtonState(options.FullscreenButtonState) // Register the window with the application getNativeApplication().registerWindow(w) @@ -2449,6 +2450,14 @@ func (w *windowsWebviewWindow) setCloseButtonState(state ButtonState) { } } +func (w *windowsWebviewWindow) setFullscreenButtonEnabled(_ bool) { + // Not implemented on Windows +} + +func (w *windowsWebviewWindow) setFullscreenButtonState(_ ButtonState) { + // Not implemented on Windows +} + func (w *windowsWebviewWindow) setGWLStyle(style int) { w32.SetWindowLong(w.hwnd, w32.GWL_STYLE, uint32(style)) }