Wayland: build pointer enter/leave with enterExitEventWithType:#165
Merged
fredkiefer merged 1 commit intoJul 15, 2026
Merged
Conversation
+[NSEvent mouseEventWithType:] raises an NSInvalidArgumentException
("mouseEvent with wrong type") for NSMouseEntered and NSMouseExited,
because GSMouseEventMask does not include those types. The leave
handler reaches this whenever the pointer leaves while a button is
held, for example at the start of a drag, so both handlers must use
the enter/exit event constructor instead.
This was referenced Jul 15, 2026
Contributor
Author
|
@fredkiefer this PR is needed before #166 can work otherwise it will hang- this one I think can be checked unlike the soaking I would like to see with #166. |
fredkiefer
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #79
The Wayland pointer enter and leave handlers build NSMouseEntered and NSMouseExited events with
+[NSEvent mouseEventWithType:], which raisesNSInvalidArgumentException("mouseEvent with wrong type") becauseGSMouseEventMaskdoes not cover those two types; they belong toGSEnterExitEventMask. Both handlers now use+[NSEvent enterExitEventWithType:...], the correct constructor for enter/exit events.The raise happens inside
wl_display_dispatchin-[WaylandServer receivedEvent:], a run loop input source.-[NSApplication run]wraps event dispatch in NS_DURING/NS_HANDLER, so in normal use the exception is caught and logged and the application continues.-[NSApplication runModalSession:]has no such handler and dispatches events in NSModalPanelRunLoopMode, so an enter or leave raised while an NSOpenPanel or NSSavePanel is open unwinds the modal loop and the panel closes.This is issue #79: the file dialog closes as soon as the pointer moves over it or over another window of the same application. The same defect also aborts a drag, when the compositor sends
wl_pointer.leaveto take the pointer for the drag grab, which is why this PR is needed before #166.