Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move methods from EventHandler to Window class #1235

Merged
merged 3 commits into from
Feb 21, 2025
Merged

Conversation

DanRStevens
Copy link
Collaborator

Move methods from EventHandler to Window class:

  • captureMouse
  • releaseMouse
  • warpMouse

Related:

The `Window` class didn't exist when these functions were first written. Now that there is a `Window` class, they seem a bit misplaced.
According to the documentation:
https://wiki.libsdl.org/SDL2/SDL_WarpMouseInWindow
> This function generates a mouse motion event if relative mode is not enabled. If relative mode is enabled, you can force mouse events for the warp by setting the SDL_HINT_MOUSE_RELATIVE_WARP_MOTION hint.

This was manually verified to be true.

That means we don't need to make a call to `mMouseMotionSignal.emit` here, since the generated event will be processed and cause that `Signal` to `emit` the event.
Now that there is a `Window` class to host such functionality, it seems out of place to keep it in `EventHandler`.

This removes the last refernce to an `extern` hack to access the Window handle.
@DanRStevens DanRStevens merged commit 40dbb75 into main Feb 21, 2025
8 checks passed
@DanRStevens DanRStevens deleted the moveMethodsToWindow branch February 21, 2025 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant