Skip to content

SDL2: drain event queue every frame (fixes multi-second mouse lag) - #48

Closed
xjulian3x wants to merge 1 commit into
mrxenginner:miamifrom
xjulian3x:fix/sdl2-event-drain
Closed

xjulian3x wants to merge 1 commit into
mrxenginner:miamifrom
xjulian3x:fix/sdl2-event-drain

Conversation

@xjulian3x

Copy link
Copy Markdown
Contributor

inputEventHandler() polls exactly ONE event per call (if (SDL_PollEvent(...))), so the queue drains at frame rate while mouse motion floods it with events. The backlog grows continuously, producing multi-second cursor lag and an apparent near-zero mouse sensitivity in the frontend, plus starved input during gameplay. Draining the queue with while matches the GLFW skeleton (glfwPollEvents drains fully) and eliminates the lag. Reproduced on Wayland with sdl2-compat; applies to any SDL2 build.

@xjulian3x

Copy link
Copy Markdown
Contributor Author

Per the contributing guidelines this falls under 'improvements to the cross-platform skeleton' (inputEventHandler is in the SDL2 skeleton) and 'UX bug fixes': polling one event per frame caused multi-second frontend mouse lag. Matches the GLFW skeleton's behavior of fully draining the queue.

@xjulian3x

Copy link
Copy Markdown
Contributor Author

Superseded by #49 - the event drain is a prerequisite for the relative-mouse deltas, so both changes are combined there.

@xjulian3x xjulian3x closed this Oct 1, 2026
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