Settings' Auto restart after an update brought the main window back if it was up, and on Windows a window minimised to the taskbar counts as up, so the new version showed it on screen (quietly, without focus). Now the old version notes whether it was minimised: the restart-quiet mark reads "<seconds> minimised" (mainUp reads up and minimised together on the main thread). The new version, on Windows, puts the window straight onto the taskbar with SetWindowPlacement and SW_SHOWMINNOACTIVE, never shown on screen and never activated, at its kept place and size, with WPF_RESTORETOMAXIMIZED when it was maximised (placeMain split into placeAt and the maximise). A mark of the seconds alone, from an older version, still reads as a window up. A restart the user clicked is unchanged. The first auto update into this version is still made by the old one, which doesn't write the word, so the window comes back minimised from the update after it. macOS and Linux keep showing it quietly: #5926. Run: - Windows (xiaomi-gpu, in the signed-in console session through a one-shot schtasks /it, since the windows are real): TestRestartMinimisedComesBackMinimised, which starts the test binary as a Wails app three times: minimised, minimised and maximised, and shown. It checks the window comes back minimised, is never shown whole (WindowShow while not iconic), doesn't take the foreground, mainUp says up and minimised, and that SC_RESTORE brings it back (maximised when it was) with its page visible (the page reports document.visibilityState). PASS. - Windows over ssh: go test -count=1 ./internal/gui/ fails only TestGatewayHeldByAContainer, TestPluginAgentMissingSaysSo (#5324), TestLodyImportHandoff, TestImportStatusUnreadableIsUnknown, TestUpdateThatWontStart (#4115, #1827) and TestProviderSaveClientCert (filed #5928); all six fail the same at origin/main987eac0aa. - mote (darwin): go test -count=1 ./internal/gui/ ok (166s); at the head rebased on6b92824ff, the three vets and -run 'Quiet|Restart|Lightweight|Main' ./internal/gui/ ok. - gofmt clean; go vet darwin, GOOS=windows and GOOS=linux -tags nogui ./internal/gui/ ok (GOOS=linux with the GUI needs cgo and doesn't cross-compile from mote, on main too). Broken by hand: showsMinimised false on Windows (the old show): the two minimised cases red ("came back not minimised"). Without WPF_RESTORETOMAXIMIZED: the maximised case red ("maximised=false, want true"). Taking the minimised flag out of the mark is red in TestRestartBySelfComesBackQuietly. Not tried: a real update of the installed app on Windows (the schtasks run drives the same openMain path the app's start takes); the Windows test stays green with no show of our own after SC_RESTORE (the restored page reports visible), so none was added.
12 lines
312 B
Go
12 lines
312 B
Go
//go:build !windows && !nogui
|
|
|
|
package gui
|
|
|
|
import "github.com/wailsapp/wails/v3/pkg/application"
|
|
|
|
// showsMinimised: here a window a restart by itself brings back minimised
|
|
// is shown quietly instead (#3495 covers Windows).
|
|
const showsMinimised = false
|
|
|
|
func showMinimised(*application.WebviewWindow, bool) {}
|