freeze window size persistence until maximized detection is available
Saving w.Canvas().Size() when the window is maximized persists the maximized dimensions, corrupting the stored size for the next launch. Commented out the save calls until per-OS maximized detection (IsZoomed / _NET_WM_STATE / NSWindow.isZoomed) is implemented. Roadmap entry updated to reflect frozen status. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+9
-7
@@ -5,14 +5,16 @@ Completed work is recorded in [CHANGELOG.md](CHANGELOG.md), not here.
|
|||||||
|
|
||||||
## Open Items
|
## Open Items
|
||||||
|
|
||||||
### Window size — skip saving when maximized
|
### Window size persistence *(frozen)*
|
||||||
|
|
||||||
When the window is closed or the app quits while maximized, the maximized
|
Window size is currently **not** saved on quit or close. Saving was disabled
|
||||||
dimensions are persisted and the window opens at that size on the next launch.
|
because `w.Canvas().Size()` returns the maximized dimensions when the window is
|
||||||
The fix requires detecting the window's maximized state via the native OS API
|
maximized, which would corrupt the stored size on the next launch.
|
||||||
(`IsZoomed` on Windows, `_NET_WM_STATE` on X11/Linux, `NSWindow.isZoomed` on
|
|
||||||
macOS). A platform-specific implementation per OS is needed; a cross-platform
|
Re-enabling requires a cross-platform way to detect the maximized state before
|
||||||
Fyne API for this does not exist in v2.x.
|
saving. Fyne v2.x has no API for this; it needs per-OS native calls:
|
||||||
|
`IsZoomed` (Windows), `_NET_WM_STATE` (X11/Linux), `NSWindow.isZoomed`
|
||||||
|
(macOS). Unfreeze once that detection is in place.
|
||||||
|
|
||||||
### History tab — column filters (Trigger / Job / State)
|
### History tab — column filters (Trigger / Job / State)
|
||||||
|
|
||||||
|
|||||||
+16
-8
@@ -33,14 +33,22 @@ func configureSystemTray(a fyne.App, w fyne.Window) {
|
|||||||
// Russian system) because it only recognizes an existing quit by matching the
|
// Russian system) because it only recognizes an existing quit by matching the
|
||||||
// localized label — which our literal "Quit" does not. Setting IsQuit makes
|
// localized label — which our literal "Quit" does not. Setting IsQuit makes
|
||||||
// Fyne reuse this item instead of adding a duplicate, regardless of locale.
|
// Fyne reuse this item instead of adding a duplicate, regardless of locale.
|
||||||
saveWindowSize := func() {
|
|
||||||
size := w.Canvas().Size()
|
// Window size persistence is frozen: w.Canvas().Size() returns the maximized
|
||||||
prefs := a.Preferences()
|
// dimensions when the window is maximized, so saving here would corrupt the
|
||||||
prefs.SetFloat("window.width", float64(size.Width))
|
// stored size. Needs cross-platform maximized-state detection (IsZoomed /
|
||||||
prefs.SetFloat("window.height", float64(size.Height))
|
// _NET_WM_STATE / NSWindow.isZoomed) before it can be re-enabled safely.
|
||||||
}
|
// See ROADMAP.md — "Window size — skip saving when maximized".
|
||||||
|
//
|
||||||
|
// saveWindowSize := func() {
|
||||||
|
// size := w.Canvas().Size()
|
||||||
|
// prefs := a.Preferences()
|
||||||
|
// prefs.SetFloat("window.width", float64(size.Width))
|
||||||
|
// prefs.SetFloat("window.height", float64(size.Height))
|
||||||
|
// }
|
||||||
|
|
||||||
quit := fyne.NewMenuItem("Quit", func() {
|
quit := fyne.NewMenuItem("Quit", func() {
|
||||||
saveWindowSize()
|
// saveWindowSize()
|
||||||
a.Quit()
|
a.Quit()
|
||||||
})
|
})
|
||||||
quit.IsQuit = true
|
quit.IsQuit = true
|
||||||
@@ -58,7 +66,7 @@ func configureSystemTray(a fyne.App, w fyne.Window) {
|
|||||||
// Closing hides the window instead of quitting because scheduler tools are
|
// Closing hides the window instead of quitting because scheduler tools are
|
||||||
// expected to keep working in the background. The explicit Quit tray item
|
// expected to keep working in the background. The explicit Quit tray item
|
||||||
// remains the way to stop the process.
|
// remains the way to stop the process.
|
||||||
saveWindowSize()
|
// saveWindowSize()
|
||||||
w.Hide()
|
w.Hide()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user