-
Notifications
You must be signed in to change notification settings - Fork 423
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
Async mouse and keyboard input on windows #6235
base: master
Are you sure you want to change the base?
Conversation
This works because SDL queries for raw mouse and keyboard input on a separate thread and we sync all inputs to a `ConcurrentQueue`.
29b83bf
to
7fac7bf
Compare
This seems to break input on my VM setup. Yes I have a weird setup but it did work, so something has potentially changed or broken. I haven't yet investigated why, but can if required (if the issue isn't obvious). master: 2024-04-15.15.35.29.mp4this PR: 2024-04-15.15.34.02.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As commented
Hmm, it's weird that the relative mouse movements align with the cursor in one scenario but not the other. But I wouldn't call it broken, the framework cursor is still moving proportionally to your mouse movements. The weirder thing is that the mouse cursor isn't hidden when in relative mode. I have no idea what could cause any of this. But if you'll be looking at this, don't forget to enable event logging with SDL3.SDL_SetHint(SDL3.SDL_HINT_EVENT_LOGGING, "2"u8); |
I tried to show this, but it's actually not proportionally correct either. I'll see what I can find. |
Depends on:
This PR simply handles relative mouse and keyboard events in the
SDL_EventFilter
i.e.HandleEventFromFilter
.This works because SDL queries raw mouse and keyboard inputs on a separate thread. Our
SDL_EventFilter
will intercept those events before they are pushed to the internal SDL queue, handle them, and then request SDL to drop them.Testing
Apply the diff and toggle relative mouse mode in
TestSceneInputManger
.This isn't a perfect simulation of
SDL_PumpEvents()
lag, but it shows the async input in action.