Commit 85fea77
authored
fix(menubar): ignore clicks while the system menu bar is auto-hidden offscreen (#574)
When another application is running in macOS fullscreen mode and the system menu bar is auto-hidden, fast clicks at the top of the screen (before the menu bar visually reveals on hover) were hijacked by Thaw: with `Show on click` enabled the Thaw Bar popped open, and regardless of that setting the always-hidden section could be expanded offscreen. The two affected click paths in `HIDEventManager.handleShowOnClick` and `ControlItem.performAction` both lacked any visibility guard, and `NSScreen.getMenuBarHeight()` returns a cached value that keeps the existing geometry check in `isMouseInsideMenuBar` passing even when the menu bar window is no longer rendered.
This change introduces a new uncached `NSScreen.isSystemMenuBarVisible()` helper that asks the Window Server whether any menu bar status items are currently on-screen for the active space via `Bridging.getMenuBarWindowList(option: [.onScreen, .activeSpace, .itemsOnly])`, and short-circuits both click handlers when the answer is no. The items list was chosen over `WindowInfo.menuBarWindow(for:)` after empirical testing on a fullscreen repro showed the menu bar window flips to `kCGWindowIsOnscreen` at the start of the reveal animation, well before the items become visible to the user; the items list more closely tracks the perceived reveal state. No precondition on `MenuBarManager.isMenuBarHiddenBySystem` is applied because `NSApp.currentSystemPresentationOptions` is per-app and reports `0` even when another app is fullscreen, so the visibility check is both necessary and sufficient. Clicks fall through normally once the user hovers and the menu bar fully repopulates, preserving expected behaviour inside fullscreen spaces.
Fixes #481
Signed-off-by: Amir Zarrinkafsh <3339418+nightah@users.noreply.github.com>1 parent 121a9c9 commit 85fea77
3 files changed
Lines changed: 37 additions & 0 deletions
File tree
- Thaw
- Events
- MenuBar/ControlItem
- Utilities
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
741 | 741 | | |
742 | 742 | | |
743 | 743 | | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
744 | 756 | | |
745 | 757 | | |
746 | 758 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
557 | 557 | | |
558 | 558 | | |
559 | 559 | | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
560 | 572 | | |
561 | 573 | | |
562 | 574 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
749 | 749 | | |
750 | 750 | | |
751 | 751 | | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
752 | 765 | | |
753 | 766 | | |
754 | 767 | | |
| |||
0 commit comments