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.
TestDockJoinLeadsCommandTab failed under a full local go test ./...: the
test app was LaunchServices' front app, yet last in Command-Tab's order
(lsappinfo visibleProcessList), kitty first.
Cause: setDock decided whether to activate magpie again by way of the
Dock (#1381's fix) from [NSApp isActive]. The Mac makes an activated app
the front app at once, but NSApp says it is active only once its main
thread has taken the activation in. On a loaded machine the join came
first, isActive read NO, dockStep chose a plain activate (a no-op for
the front app), and magpie stayed last. A temporary print in setDock
showed active=false in every failing run (3 of 5 at load ~120) and true
in the passing ones. The same can happen to a user when the panel's
focus and Open come close together on a busy Mac.
Fix: joining the Dock to the front always goes by way of the Dock
(activateAgain), whatever NSApp says. When magpie truly isn't active
(the tray's Open), the Dock's turn in front changes nothing: magpie is
activated after it either way. dockStep loses its active argument and
appActive is gone. docs/subsystems/gui-shell.md item 7 says so.
The test now activates magpie, waits for LaunchServices to call it the
front app, and joins, all in one turn of the main thread, so the join
always comes before NSApp knows: the busy-machine order, made certain.
Run:
- New test on the old dockStep: 5 of 5 red (magpie not first, kitty first).
With the fix: 25 of 25 green at load ~120-135.
- The old test (no injected order) with the fix: 10 of 10 green at load
~180; before the fix 3 of 5 red at load ~120.
- TestDockStep (table without active). go test ./internal/gui (GUI
build, darwin) 5 runs green. One run before them failed and its
output wasn't kept, so which test failed is unknown. After rebasing
onto 18e82adc6, one package run failed TestTrayCellClickReleasedPanel
(its own AppKit child, no setDock on its path); it passed alone and in
3 package runs after. Filed as #1661, cause not found.
go test -tags nogui ./internal/gui green. gofmt -l clean; go vet
./internal/gui (darwin), GOOS=linux and GOOS=windows go vet -tags nogui
./internal/gui clean.
Not tried: a real magpie build with osascript Command-Tabs (as 15872d977
did) after this change; the full-screen join (dockOnFullscreen), which
still reads isActive at NSWindowWillEnterFullScreen, long after any
activation, and is unchanged.
ttmouse on v0.1.1168: open magpie's window, Command-Tab to another app,
Command-Tab back, and magpie is last in the switcher.
Cause: magpie is out of the Dock (Accessory) until the window opens.
With Settings > Dock set to "while the window is open" (or a full-screen
window), the quick panel's focus activates magpie while it is still
Accessory, and it joins the Dock (Regular) after that. An app activated
before it joins stays last in LaunchServices' front-to-back order
(lsappinfo visibleProcessList), which Command-Tab follows, though it is
frontmost. Wails' Focus only calls activateIgnoringOtherApps when the
app isn't active, and calling it again while active is a no-op. setDock
also ran async (dispatch_async), so openMain's Show/Focus could come
before the policy change.
Fix:
- setDock runs on the main thread at once (InvokeSync), so openMain
joins before it shows the window.
- A pure dockStep(regular, on, active, front) decides the move. Joining
while already active activates the Dock and then magpie again
(activateAgain), which puts magpie first in the order. Joining while
not active just activates it; leaving never re-activates.
- The full-screen join does the same once the window is in full screen
(DidEnterFullScreen) if magpie was active when it joined.
- Dock "off" (the default) is unchanged: magpie stays out of the Dock
and out of Command-Tab, by design. The tray panel's behaviour is
unchanged.
- docs/subsystems/gui-shell.md: Runtime path item 7 for the Dock setting.
Run:
- TestDockStep (table, pure). TestDockJoinLeadsCommandTab (darwin GUI
build): a real Accessory Wails app activated, then setDock(true,
true) + window Show/Focus, asserts it is first in lsappinfo's order.
Red with `again` forced false (front was the test, kitty first in the
order), green with the fix.
- go test ./internal/gui (GUI build, darwin) passes; full
go test -tags nogui ./... passes; gofmt -l clean; go vet ./internal/gui
(darwin) and GOOS=linux / GOOS=windows go vet -tags nogui clean.
- Real build on this Mac, sandbox HOME, own bundle id, port 3481,
DockWindow on: launched with the quick panel, window opened through the
Mac's reopen, then two osascript Command-Tabs. Old build: magpie front
but 11th of 11 in the order (the report). New build: magpie 1st; after
Command-Tab, the other app 1st and magpie 2nd; Command-Tab again brings
magpie back. Dock "always": magpie 1st, round trip works. Dock "off":
stays UIElement, not in the order.
Not tried: the full-screen path in the real build, a human Command-Tab
(only osascript keystrokes), real accounts (not involved).
With Dock on "Hide", magpie runs as an Accessory app. A full-screen
window's title bar comes down only with the menu bar, and an Accessory app
has none, so the full-screen main window had no close, minimize or
full-screen button, and only Esc left full screen.
magpie now joins the Dock as a window starts entering full screen, from a
native NSWindowWillEnterFullScreenNotification observer: Wails hands that
event to Go later, and switching once the window is full screen doesn't
bring the title bar back. dock counts a full-screen main window (inDock),
so reopening the app or changing the Dock setting during full screen keeps
magpie in the Dock, and WindowDidExitFullScreen applies the setting again.
TestFullscreenKeepsDock checks inDock; it doesn't compile on main. On
macOS 27.0.1 with Dock on "Hide", main stays out of the Dock in full screen
with no title bar; this branch joins the Dock with the title bar and its
buttons, and leaves it after the green button, View > Toggle Full Screen
or Esc.
Fixes#763