Files
magpie/internal/gui/glide_other.go
T
yetone d5873b0d85 gui: Windows on ARM puts the text size on WebView2 itself, since Wails can't pass it a double there (#2212, EdwinDigital)
On windows/arm64 Wails beta.24's SetZoom fails with
ErrDoubleArgUnsupported and only logs it: Go's stdcall on arm64 loads
x0-x7 and never d0 (golang/go#62583), so ICoreWebView2Controller::
put_ZoomFactor(double) can't be called through SyscallN. The text size
was saved and never applied.

zoom_windows_arm64.go calls put_ZoomFactor (vtbl slot 8) through a
two-instruction thunk in VirtualAlloc'd executable memory,
`fmov d0, x1; br x2`, called as SyscallN(thunk, this, bits, fn). The
controller is reached by reflection (WebviewWindow.impl.chromium.
controller). The window's Zoom option goes through the same broken call,
so on that platform the size is put on each page once navigation
completes (zoomsAfterLoad), on the UI thread. Other platforms are
unchanged: setPageZoom moves to zoom_other.go.

Run:
- The thunk's encoding in a C harness on macOS arm64 (MAP_JIT): it
  passed 1.25 in d0, returned the callee's HRESULT, kept `this`.
- On the Windows 11 AMD64 box, in a sandbox profile on its own port, a
  check build of this change (same reflection path and vtbl slot, the
  call made directly since amd64 passes doubles in X1): put_ZoomFactor
  returned S_OK for both windows at 110% and 150%, and screenshots show
  the page drawn at 150%.
- gofmt -l; go vet ./... darwin, GOOS=linux -tags nogui, GOOS=windows,
  and GOOS=windows GOARCH=arm64 (vet + build); go test ./internal/gui/.

Not tried: the thunk on real Windows on ARM hardware; the reporter is
asked to confirm. No GUI assets changed, so the Playwright suite wasn't run.
2026-10-15 00:34:14 +08:00

31 lines
1002 B
Go

//go:build !darwin && !nogui
package gui
import "github.com/wailsapp/wails/v3/pkg/application"
// The Dock is the Mac's; elsewhere magpie stays in the tray.
func dockPolicy(bool) application.ActivationPolicy { return application.ActivationPolicyAccessory }
func setDock(bool, bool) {}
func dockOnFullscreen() {}
// glidePanel steps the shown panel to height a frame at a time, keeping it
// by the tray icon as it goes.
func (h *host) glidePanel(height int, g Glide) bool {
w := h.panel
_, from := w.Size()
gen := h.glides.Add(1)
go stepGlide(g, from, height, func() bool { return h.glides.Load() == gen }, func(v int) {
application.InvokeSync(func() {
if h.panel == w { // not let go meanwhile (lightweight mode)
w.SetSize(h.panelW(), v)
_ = h.tray.PositionWindow(w, 6)
}
})
})
return true
}
// TintPanel: the page paints the panel's tint itself here.
func (h *host) TintPanel(c [4]uint8, ms int) bool { return false }