Closed PortableProgrammer closed 3 months ago
Using NSScreen.main
is actually the behavior I want. That way, inactive screens don't become active when they shouldn't, and the default behavior of macOS is respected by not allowing interaction on inactive screens. Running Ice with these changes also introduces at least one new bug where the frames of the menu bar icons weren't being correctly determined, which would lead to the mouse being presumed inside an empty menu bar space when it wasn't.
That said, I would love a separate PR for the isMouseOutsideMenuBar
fix.
Ice defaults to
NSScreen.main
(e.g. screen with current keyboard focus), causing mouse events to get discarded when the event happens on a screen that is not the default. For example, hovering over the menu bar on a secondary screen does not trigger the Show on Hover action until that screen becomes the main screen.This PR allows Ice to dynamically determine the mouse pointer's screen, which allows these dropped events to get processed correctly. This has the knock-on effect of removing the
screen
parameter from theisMouse...
functions, since it can be dynamically determined.During testing of this PR, Ice also exhibits rapid cycling of the hidden section during hover events when the menu bar is set to auto hide. This PR fixes that bug by allowing
isMouseOutsideMenuBar
to consider an auto-hidden menu bar as well as the standard always-shown menu bar.