Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions v3/pkg/application/webview_window_android.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down
20 changes: 15 additions & 5 deletions v3/pkg/application/webview_window_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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)
Expand Down
16 changes: 9 additions & 7 deletions v3/pkg/application/webview_window_ios.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand All @@ -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) {}
Expand Down
4 changes: 4 additions & 0 deletions v3/pkg/application/webview_window_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
7 changes: 4 additions & 3 deletions v3/pkg/application/webview_window_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions v3/pkg/application/webview_window_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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))
}
Expand Down
Loading