diff --git a/mkdocs-website/docs/en/API/fullapi.md b/mkdocs-website/docs/en/API/fullapi.md index 71d93d9a105..c6b505e9dd8 100644 --- a/mkdocs-website/docs/en/API/fullapi.md +++ b/mkdocs-website/docs/en/API/fullapi.md @@ -298,6 +298,7 @@ import "github.com/wailsapp/wails/v3/pkg/application" - [func \(w \*WebviewWindow\) Size\(\) \(int, int\)](#WebviewWindow.Size) - [func \(w \*WebviewWindow\) ToggleDevTools\(\)](#WebviewWindow.ToggleDevTools) - [func \(w \*WebviewWindow\) ToggleFullscreen\(\)](#WebviewWindow.ToggleFullscreen) + - [func \(w \*WebviewWindow\) ToggleMaximise\(\)](#WebviewWindow.ToggleMaximise) - [func \(w \*WebviewWindow\) UnFullscreen\(\)](#WebviewWindow.UnFullscreen) - [func \(w \*WebviewWindow\) UnMaximise\(\)](#WebviewWindow.UnMaximise) - [func \(w \*WebviewWindow\) UnMinimise\(\)](#WebviewWindow.UnMinimise) @@ -3715,6 +3716,16 @@ func (w *WebviewWindow) ToggleFullscreen() ToggleFullscreen toggles the window between fullscreen and normal + + +### func \(\*WebviewWindow\) [ToggleMaximise](https://github.com/wailsapp/wails/blob/master/v3/pkg/application/webview_window.go#L720) + +```go +func (w *WebviewWindow) ToggleMaximise() +``` + +ToggleMaximise toggles the window between maximised and normal + ### func \(\*WebviewWindow\) [UnFullscreen](https://github.com/wailsapp/wails/blob/master/v3/pkg/application/webview_window.go#L859) diff --git a/mkdocs-website/docs/en/changelog.md b/mkdocs-website/docs/en/changelog.md index 3d5e4422f82..b77a6bdc787 100644 --- a/mkdocs-website/docs/en/changelog.md +++ b/mkdocs-website/docs/en/changelog.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [linux] add task `run:linux` by [@marcus-crane](https://github.com/marcus-crane) in [#3146](https://github.com/wailsapp/wails/pull/3146) - export `SetIcon` method by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/3147) - Improve `OnShutdown` by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/3189) +- restore `ToggleMaximise` method in `Window` interface by [@fbbdev](https://github.com/fbbdev) in [#3281](https://github.com/wailsapp/wails/pull/3281) ### Fixed @@ -39,6 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix replace line in `go.mod` to use relative paths. Fixes Windows paths with spaces - @leaanthony. - Fix MacOS systray click handling when no attached window by [thomas-senechal](https://github.com/thomas-senechal) in PR [#3207](https://github.com/wailsapp/wails/pull/3207) - Fix failing Windows build due to unknown option by [thomas-senechal](https://github.com/thomas-senechal) in PR [#3208](https://github.com/wailsapp/wails/pull/3208) +- Fix wrong baseURL when open window twice by @5aaee9 in PR [#3273](https://github.com/wailsapp/wails/pull/3273) - Fix ordering of if branches in `WebviewWindow.Restore` method by [@fbbdev](https://github.com/fbbdev) in [#3279](https://github.com/wailsapp/wails/pull/3279) ### Changed diff --git a/v3/examples/window-api/assets/index.html b/v3/examples/window-api/assets/index.html index f30607c9304..29dc32d5be3 100644 --- a/v3/examples/window-api/assets/index.html +++ b/v3/examples/window-api/assets/index.html @@ -145,6 +145,9 @@

UnFullscreen

Restore

+
+

ToggleMaximise

+
diff --git a/v3/internal/assetserver/assetserver.go b/v3/internal/assetserver/assetserver.go index 4acddcddf3e..0d80007e763 100644 --- a/v3/internal/assetserver/assetserver.go +++ b/v3/internal/assetserver/assetserver.go @@ -7,7 +7,6 @@ import ( "net/http" "net/http/httptest" "net/url" - "path" "strings" "time" ) @@ -160,8 +159,7 @@ func GetStartURL(userURL string) (string, error) { return "", fmt.Errorf("Error parsing URL: " + err.Error()) } if parsedURL.Scheme == "" { - baseURL.Path = path.Join(baseURL.Path, userURL) - startURL = baseURL.String() + startURL = baseURL.ResolveReference(&url.URL{Path: userURL}).String() // if the original URL had a trailing slash, add it back if strings.HasSuffix(userURL, "/") && !strings.HasSuffix(startURL, "/") { startURL = startURL + "/" diff --git a/v3/pkg/application/messageprocessor.go b/v3/pkg/application/messageprocessor.go index d9a8e685878..de8b9ac4e19 100644 --- a/v3/pkg/application/messageprocessor.go +++ b/v3/pkg/application/messageprocessor.go @@ -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 { diff --git a/v3/pkg/application/messageprocessor_window.go b/v3/pkg/application/messageprocessor_window.go index aa69a9e77ff..1e5f12f0c32 100644 --- a/v3/pkg/application/messageprocessor_window.go +++ b/v3/pkg/application/messageprocessor_window.go @@ -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) diff --git a/v3/pkg/application/webview_window.go b/v3/pkg/application/webview_window.go index 2ef512f6a9e..833ba7a91d8 100644 --- a/v3/pkg/application/webview_window.go +++ b/v3/pkg/application/webview_window.go @@ -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 diff --git a/v3/pkg/application/window.go b/v3/pkg/application/window.go index 46a8420cc7c..2398cd3682b 100644 --- a/v3/pkg/application/window.go +++ b/v3/pkg/application/window.go @@ -67,6 +67,7 @@ type Window interface { Size() (width int, height int) ToggleDevTools() ToggleFullscreen() + ToggleMaximise() UnFullscreen() UnMaximise() UnMinimise() diff --git a/v3/plugins/experimental/server/window.go b/v3/plugins/experimental/server/window.go index 7348d456f0e..9c50f6ff9f5 100644 --- a/v3/plugins/experimental/server/window.go +++ b/v3/plugins/experimental/server/window.go @@ -217,6 +217,8 @@ func (w Window) ToggleDevTools() { func (w Window) ToggleFullscreen() {} +func (w Window) ToggleMaximise() {} + func (w Window) UnFullscreen() {} func (w Window) UnMaximise() {}