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

[core] Fix some mouse issues on SDL #3428

Merged
merged 3 commits into from Oct 16, 2023
Merged

[core] Fix some mouse issues on SDL #3428

merged 3 commits into from Oct 16, 2023

Conversation

ghost
Copy link

@ghost ghost commented Oct 16, 2023

Fixes

  1. Fixes the mouse wheel getting stucked scrolling up or down by adding the missing reset (R534-R536).

  2. Fixes the mouse sensitivity being really high on 3D by adding the missing previous mouse position registry (R538-R539).

  3. Fixes the mouse button presses not working properly by adding the missing previous mouse button registry (R561-R562) and by adding handling for SDL_MOUSEBUTTONUP (R619-R622).
    .
    VERY IMPORTANT NOTE: @raysan5
    The SDL2 mouse button order is LEFT, MIDDLE, RIGHT, ... (doc), but we currently use LEFT, RIGHT, MIDDLE, ... (L674-L676), so, when the migration to SDL2 is complete, that MouseButton enum on raylib.h needs to be adjusted. Until then, the middle and right mouse binds will be inverted.

Reference

Items 1, 2, 6 of #3313 (comment).

Environment

Tested this changes successfully on Linux (Ubuntu 22.04 64-bit, gcc 11.2.0) with SDL2 (2.28.4).

Edits

1: added line marks.
2: added another fix, environment, formatting.
3: added another fix.

@ghost ghost changed the title [core] Fix mouse wheel getting stucked scrolling up or down on SDL [core] Fix some mouse issues on SDL Oct 16, 2023
@raysan5 raysan5 merged commit 73363f8 into raysan5:master Oct 16, 2023
12 checks passed
@raysan5
Copy link
Owner

raysan5 commented Oct 16, 2023

@ubkp thank you very much for the review! Good catch the mouse button order! Yes, it should be reviewed, not sure if it follows glfw order...

@ghost ghost deleted the fix/sdl-mousewheel branch October 16, 2023 11:59
@ghost
Copy link
Author

ghost commented Oct 16, 2023

@raysan5 Checked it here and GLFW does indeed use LEFT, RIGHT, MIDDLE, ... (doc). I'd suggest not flipping them yet on MouseButton enum to not cause issues for anyone using current master branch. I can keep track here to remind this when the times comes, if you want.

@raysan5
Copy link
Owner

raysan5 commented Oct 16, 2023

@ubkp I see, probably the remap should be done on input polling then. Feel free to add a TODO in the code to remember it!

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