tray: the Mac's menu bar icon can be Command-dragged again, so Hidden Bar and the like can move it (#792, BennettChina: after v0.1.865 a Command-click no longer opened the panel, but the icon still didn't move) — magpie's own monitor of mouse-downs on the icon (#629, which keeps it from flickering) took every left click on it and handed it to the action, so the button never saw a Command-held mouse-down, and that is what starts the system's drag. One with Command held is now left to the button. On this Mac (macOS 26.2) with a GUI build in a sandbox HOME: a synthetic Command-drag of its icon 60 px right did nothing on origin/main and swapped it with its neighbour with the change; the same drag moved a bare NSStatusItem, and one set up as Wails does (sendActionOn mouse-down, its local monitor) in both cases; a plain click still opened and closed the panel. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows), go test ./internal/gui/ and go test -tags nogui -count=1 ./... under a temp HOME pass.
This commit is contained in:
@@ -390,7 +390,9 @@ static void mpHighlight(int on) {
|
||||
|
||||
// mpOwnClicks hands a left click on the item to its action before the
|
||||
// button sees it: the button's own tracking would light it on mouse-down
|
||||
// and put it out on mouse-up, a flicker before mpHighlight's.
|
||||
// and put it out on mouse-up, a flicker before mpHighlight's. One with
|
||||
// Command held is left to the button, which is what lets the system move
|
||||
// the item (#792: Command-dragging it, as Hidden Bar asks, did nothing).
|
||||
static void mpOwnClicks(void) {
|
||||
static dispatch_once_t once;
|
||||
dispatch_once(&once, ^{
|
||||
@@ -400,6 +402,7 @@ static void mpOwnClicks(void) {
|
||||
if (b == nil || e.window != b.window) return e;
|
||||
NSPoint p = [b convertPoint:e.locationInWindow fromView:nil];
|
||||
if (!NSPointInRect(p, b.bounds)) return e;
|
||||
if (e.modifierFlags & NSEventModifierFlagCommand) return e;
|
||||
// Route quota clicks before the generic action, within this
|
||||
// one monitor; local monitor ordering is not guaranteed.
|
||||
CGFloat x = p.x - (b.bounds.size.width - mpHitW) / 2;
|
||||
|
||||
Reference in New Issue
Block a user