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

Inverted event->wheel.x values under Wayland driver #5202

Closed
UncombedCoconut opened this issue Jan 9, 2022 · 6 comments
Closed

Inverted event->wheel.x values under Wayland driver #5202

UncombedCoconut opened this issue Jan 9, 2022 · 6 comments
Assignees
Labels
help wanted Extra attention is needed
Milestone

Comments

@UncombedCoconut
Copy link

Hi, I have a Linux laptop whose mouse is a "SynPS/2 Synaptics TouchPad".
In case SDL_VIDEODRVER=wayland is set, I observe event->wheel.x values inverse to what they should be.
I don't know if this is a general issue or specific to my system. (The current behavior was decided/tested here: 1fa4bcc #2763)

Tested SDL version: commit 1f32dd8 # Sun Jan 9 06:36:18 2022 -0800
Test procedure:

mkdir build-sdl
cd build-sdl
cmake -DSDL_TEST:ON ../SDL
make -j
SDL_VIDEODRIVER=x11 ./test/testgesture --info event
SDL_VIDEODRIVER=wayland ./test/testgesture --info event

Test results (marked with driver and scroll direction):

[x11     L] INFO: SDL EVENT: Mouse: wheel scrolled -1 in x and 0 in y (reversed: 0) in window 2
[x11     R] INFO: SDL EVENT: Mouse: wheel scrolled 1 in x and 0 in y (reversed: 0) in window 2
[x11     D] INFO: SDL EVENT: Mouse: wheel scrolled 0 in x and -1 in y (reversed: 0) in window 2
[x11     U] INFO: SDL EVENT: Mouse: wheel scrolled 0 in x and 1 in y (reversed: 0) in window 2
[wayland L] INFO: SDL EVENT: Mouse: wheel scrolled 1 in x and 0 in y (reversed: 0) in window 1
[wayland R] INFO: SDL EVENT: Mouse: wheel scrolled -1 in x and 0 in y (reversed: 0) in window 1
[wayland D] INFO: SDL EVENT: Mouse: wheel scrolled 0 in x and -1 in y (reversed: 0) in window 1
[wayland U] INFO: SDL EVENT: Mouse: wheel scrolled 0 in x and 1 in y (reversed: 0) in window 1
@flibitijibibo
Copy link
Collaborator

Wayland logic: https://github.com/libsdl-org/SDL/blob/main/src/video/wayland/SDL_waylandevents.c#L583-L590

X11 logic:

Does seem like it should be inverted but I don't have any horizontal wheel hardware to check. If a maintainer has such hardware and wants to sneak this into 2.0.20 this one's all yours, otherwise it can wait another cycle...

@flibitijibibo flibitijibibo self-assigned this Jan 10, 2022
@flibitijibibo flibitijibibo added this to the 2.0.22 milestone Jan 10, 2022
@flibitijibibo flibitijibibo added bug help wanted Extra attention is needed labels Jan 10, 2022
@icculus
Copy link
Collaborator

icculus commented Jan 10, 2022

If a maintainer has such hardware

This reproduces on a basic laptop touchpad for me. Two fingers to the left is negative in x11 and positive in Wayland here (and opposite to the right, of course).

@flibitijibibo
Copy link
Collaborator

Cool - @slouken, mind if I change that - to a + before 2.0.20?

@slouken
Copy link
Collaborator

slouken commented Jan 10, 2022

Go for it. I'll build packages one more time this morning before release.

@flibitijibibo
Copy link
Collaborator

3e1b3bc

@UncombedCoconut, let us know if this doesn't actually fix it!

@UncombedCoconut
Copy link
Author

Thanks all. I confirm that your change does fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants