zyh6036 on X: the menu bar panel stays so far in front that even
WeChat's screenshot can't cover it, so it's hard to take a picture of.
The panel asked for AlwaysOnTop (NSFloatingWindowLevel, 3), but Wails'
SystemTray.PositionWindow sets the window it places to
NSPopUpMenuWindowLevel (101) every time (systemtray_darwin.m), and magpie
places the panel with it on each open and each resize. The live app's
panel read layer 101 in CGWindowList. Nothing in magpie's history chose
101 (git log -S finds only AlwaysOnTop, from the first commit).
placeByIcon now does PositionWindow and then sets NSStatusWindowLevel
(25), the level of the status bar itself: still over normal windows,
floating ones, the Dock (20) and the menu bar (24), and still on every
Space and over full-screen apps (the collection behavior is unchanged,
#2141), but under pop-up menus and anything a screenshot tool puts up at
25 or above. Both PositionWindow calls (togglePanelNow, sizeOpenPanel)
go through it. Other systems: setPanelLevel is a no-op.
What was run (mica, macOS 27, at 48fffb60c + this change; the panel tests again at the rebased head):
- TestPanelJoinsFullScreenSpaces now has a real SystemTray, places the
panel through placeByIcon and checks the level is
NSStatusWindowLevel. Broken by hand (setPanelLevel call removed): red,
"the panel is at level 101". Restored: green.
- A real build in a sandbox HOME (MAGPIE_ADDR 127.0.0.1:3536),
`magpie panel`, with a tiny AppKit helper: CGWindowList front to back
read the panel (439x521) at layer 25 over a normal titled window
(layer 0); a full-screen borderless overlay at NSScreenSaverWindowLevel
(1000) shown after it was in front of the panel, and so was one at
NSStatusWindowLevel (25) shown after it, as a screenshot overlay is.
Before the change the panel was at 101, over the one at 25.
- go test -count=1 -timeout 45m ./internal/gui: ok (714s). An earlier
run of it had two source guards (panelside_test.go) reading the old
PositionWindow call, updated here, and TestGatewayModeListsNoOwnSessions
red under load ("listing":true, the search asked before the list was
read), green alone: filed as #7064.
- go vet ./internal/gui on darwin, GOOS=windows, and Linux in WSL
(magpie-desktop, -tags gtk3): ok. gofmt -l: clean.
Not tried: the panel over a real full-screen app. mica's and mote's
screens are locked, and a window there doesn't enter full screen; the
full-screen guarantee is the unchanged collection behavior, which the
same test still checks. WeChat itself: not installed on any test Mac,
so its overlay's level isn't known; if it is below 25 this doesn't
reach it, and the reply asks the reporter to say.
28 lines
791 B
Go
28 lines
791 B
Go
//go:build !nogui
|
|
|
|
package gui
|
|
|
|
import (
|
|
"runtime"
|
|
|
|
"github.com/wailsapp/wails/v3/pkg/application"
|
|
)
|
|
|
|
// sizeOpenPanel gives the open panel its new size. On Windows the panel
|
|
// stays where the tray put it as it opened (panelRefit); elsewhere it is
|
|
// placed by the icon again, as before.
|
|
func (h *host) sizeOpenPanel(w *application.WebviewWindow, width, height int) {
|
|
if runtime.GOOS != "windows" {
|
|
w.SetSize(width, height)
|
|
h.placeByIcon(w)
|
|
return
|
|
}
|
|
b := w.Bounds()
|
|
var work panelRect
|
|
if s, err := w.GetScreen(); err == nil && s != nil {
|
|
work = panelRect{s.WorkArea.X, s.WorkArea.Y, s.WorkArea.Width, s.WorkArea.Height}
|
|
}
|
|
r := panelRefit(panelRect{b.X, b.Y, b.Width, b.Height}, work, width, height)
|
|
w.SetBounds(application.Rect{X: r.x, Y: r.y, Width: r.w, Height: r.h})
|
|
}
|