Skip to content

Wayland: build pointer enter/leave with enterExitEventWithType:#165

Merged
fredkiefer merged 1 commit into
gnustep:masterfrom
DTW-Thalion:fix/wayland-enter-exit-event
Jul 15, 2026
Merged

Wayland: build pointer enter/leave with enterExitEventWithType:#165
fredkiefer merged 1 commit into
gnustep:masterfrom
DTW-Thalion:fix/wayland-enter-exit-event

Conversation

@DTW-Thalion

@DTW-Thalion DTW-Thalion commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Closes #79
The Wayland pointer enter and leave handlers build NSMouseEntered and NSMouseExited events with +[NSEvent mouseEventWithType:], which raises NSInvalidArgumentException ("mouseEvent with wrong type") because GSMouseEventMask does not cover those two types; they belong to GSEnterExitEventMask. Both handlers now use +[NSEvent enterExitEventWithType:...], the correct constructor for enter/exit events.

The raise happens inside wl_display_dispatch in -[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.leave to take the pointer for the drag grab, which is why this PR is needed before #166.

+[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.
@DTW-Thalion

Copy link
Copy Markdown
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
fredkiefer merged commit 8a522b8 into gnustep:master Jul 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Wayland Backend file open dialogs closing prematurely

2 participants