ac4af582301a4e8a29245dbba767eba31334ddf9
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5db1b07ed9 |
gui: the tray panel's Usage tab is drawn again in Settings' currency picked alone, and when its read came before the state (dLdgKyRd)
dLdgKyRd on Discord, v0.1.3025 on macOS: the menu-bar panel's Usage tab said ≈$12.36 while the window's Usage page said ≈¥82.61 for the same day. v0.1.2913 ( |
||
|
|
2ba044aa66 |
gui: the Mac panel's page is told when Wails hides it, so it follows Settings' units (blrbrzkj)
blrbrzkj on Discord: Settings said ¥ 人民币 and 中文(万 / 亿), while the tray panel's Usage tab still showed ≈$7.18 and 16M. On the Mac a page in an ordered-out window keeps drawing, so magpie tells it when it is hidden (hideWebview) and shown (showWebview), and the page reloads its state, settings included, on the shown signal. The panel is mostly closed by a click elsewhere, which Wails' HideOnFocusLost does with a plain Hide, and by Escape (HideOnEscape), likewise. The page was never told it was hidden there, so the shown signal was a no-op (magpieWindowVisibility returns early when it was never told otherwise), and the panel kept the currency and number units it was first drawn with until magpie restarted. sayWailsHides (windowvisibility.go), on the panel: on the Mac the page is told on WindowLostFocus, as hideWebview tells it, and Escape hides the panel through hideWebview. Other systems are unchanged: WebView2 and WebKitGTK mark a hidden window's page hidden themselves. Tests: - TestPanelHiddenByWailsMarksPageOutOfSight (AppKit, darwin): makes the real panel (h.makePanel), closes it by a WindowLostFocus event and by the Escape key binding, as Wails does, shows it with showWebview, and checks the page saw itself hidden and marked. The probe page now reports what it saw when it is told it is shown, so a native hidden event before the told one can't be the record it sends. - panel-units-follow.test.cjs: the page half. A panel open on its Usage tab in $ and K/M; Settings picks ¥ and 万 / 亿; hidden and shown, the panel re-reads the state and shows ≈¥185, 15.4 亿 (億 in zh-TW) and a 万 axis, then back to ≈$26.40 and 1.54B. zh, en, zh-TW, ja, de; Chromium and WebKit. Run on mote (macOS 27.2), at this tree: - go test -run 'TestClosingWindowMarksPageOutOfSight|TestPanelHiddenByWailsMarksPageOutOfSight' ./internal/gui/: ok - go vet ./internal/gui/, GOOS=linux go vet -tags nogui, GOOS=windows go vet: ok; gofmt -l: nothing - node --test panel-units-follow, window-visibility, number-units: 20/20 Broken by hand: - sayWailsHides(w) not called: the AppKit test times out with no hidden report. - only its Escape binding removed: red, "hidden=true marked=false play=running". - the page's visibilitychange without loadBack (a copy of the assets): panel-units-follow red, "shown again, the panel reads the state again". - The panel test written to show without a told hide (the old Mac path) was 0/12 on the unchanged page, which is how the cause was found. Not tried: the real tray panel by hand on a Mac (the AppKit test makes the real panel window but no status item); blrbrzkj's system isn't known, and on Windows and Linux the page is marked hidden by the webview itself, so this changes nothing there. |