Skip to content

Commit

Permalink
Restore ToggleMaximise method in Window interface
Browse files Browse the repository at this point in the history
  • Loading branch information
fbbdev committed Feb 27, 2024
1 parent 29ed3b3 commit bc625e7
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 10 deletions.
20 changes: 10 additions & 10 deletions v3/pkg/application/messageprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import (
// as parameter through every function call.

const (
callRequest int = 0
clipboardRequest = 1
applicationRequest = 2
eventsRequest = 3
contextMenuRequest = 4
dialogRequest = 5
windowRequest = 6
screensRequest = 7
systemRequest = 8
browserRequest = 9
callRequest = 0
clipboardRequest = 1
applicationRequest = 2
eventsRequest = 3
contextMenuRequest = 4
dialogRequest = 5
windowRequest = 6
screensRequest = 7
systemRequest = 8
browserRequest = 9
)

type MessageProcessor struct {
Expand Down
3 changes: 3 additions & 0 deletions v3/pkg/application/messageprocessor_window.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ func (m *MessageProcessor) processWindowMethod(method int, rw http.ResponseWrite
case WindowUnMaximise:
window.UnMaximise()
m.ok(rw)
case WindowToggleMaximise:
window.ToggleMaximise()
m.ok(rw)
case WindowRestore:
window.Restore()
m.ok(rw)
Expand Down
14 changes: 14 additions & 0 deletions v3/pkg/application/webview_window.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,20 @@ func (w *WebviewWindow) ToggleFullscreen() {
})
}

// ToggleMaximise toggles the window between maximised and normal
func (w *WebviewWindow) ToggleMaximise() {
if w.impl == nil && !w.isDestroyed() {
return
}
InvokeSync(func() {
if w.IsMaximised() {
w.UnMaximise()
} else {
w.Maximise()
}
})
}

func (w *WebviewWindow) ToggleDevTools() {
if w.impl == nil && !w.isDestroyed() {
return
Expand Down
1 change: 1 addition & 0 deletions v3/pkg/application/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type Window interface {
Size() (width int, height int)
ToggleDevTools()
ToggleFullscreen()
ToggleMaximise()
UnFullscreen()
UnMaximise()
UnMinimise()
Expand Down
2 changes: 2 additions & 0 deletions v3/plugins/experimental/server/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ func (w Window) ToggleDevTools() {

func (w Window) ToggleFullscreen() {}

func (w Window) ToggleMaximise() {}

func (w Window) UnFullscreen() {}

func (w Window) UnMaximise() {}
Expand Down

0 comments on commit bc625e7

Please sign in to comment.