Fix windowevent and key repeat in sdl2-compat #3470
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.
WINDOWEVENT translation was broken when compiled with sdl2-compat.
The issue was in our
_pg_translate_windowevent
function. The current code was directly modifying the event type there but it seems like it is simply an implementation detail that we were relying on, and one isn't supposed to actually modify events inSDL_FilterEvents
based filtering. Plus, this is easier to fix on our side than fix on sdl2-compat side.I also took the opportunity to improve the comments while I was giving the implementation a good think.
This fixes a failing unit test so I don't see the need to add more tests here.
UPDATE: key repeat was broken and for similar reasons, I have fixed that here as well.