-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Wayland] Add mouse grab/lock functionality. #15103
[Wayland] Add mouse grab/lock functionality. #15103
Conversation
This PR makes my touch pad think it's always dragging in the last direction in scummvm even if i'm not touching it anymore. Driver is sdl2 or udev or x or linuxraw . It happens already in the main menu (and the games too). I think you have a bit of more work to do. Edit: although i was using a debug core, to try to debug this same bug with the author, so i'll redownload it and try again. edit: still happens. |
Ok, don't merge it yet. There's something still going on... |
Relative motion is working. But the cursor lock isn't. I'll have a play around and see if I can get it working. |
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.
This will allow the user to unlock the cursor.
Okay, I've figured it out, the main issue is that the This should make things work better: static void input_wl_grab_mouse(void *data, bool state)
{
input_ctx_wayland_data_t *wl = (input_ctx_wayland_data_t*)data;
|
Also a locked pointer has a listener which can notify retroarch when the pointer has succesfully locked / unlocked. |
Co-authored-by: Colin Kinloch <colin@kinlo.ch>
Co-authored-by: Colin Kinloch <colin@kinlo.ch>
@ColinKinloch This change:
leads to some compilation errors:
|
Yup, the |
I should spend some time making the wayland driver more readable. Not naming two separate objects |
@ColinKinloch I did the needed changes in this commit: However, I am still seeing the same pointer drifting / auto-moving. |
Okay, so it's successfully locking the pointer and delta_x is being set correctly. |
@ColinKinloch And how do I know if the pointer is locked at that point? |
You should add a listener with |
@ColinKinloch Ok, did what you said in commit 74913ea But the cursor is still drifting / auto-moving. |
Oh, I see, move the lines from |
@ColinKinloch Done so in commit f29a351 But the pointer is still auto-moving / drifting. |
Hmm, could you take a recording? |
@ColinKinloch Of course. Here it is: ishar-retroarch.mp4As you can see, it auto-moves after I manually move it: as if the pointer had inertia. |
In the touchpad here, if i press exactly in the center i can 'stop' the cursor after it starts moving even i wasn't pressing it anymore if i first counteract the movement. It's really is some kind of inertia. |
Ah, I was wrong about the |
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.
This change will fix a crash I'm having
Since RetroArch/input/drivers/wayland_input.c Lines 269 to 272 in 2a36245
something like int x = screen ? wl->mouse.x : wl->mouse.delta_x;
wl->mouse.delta_x = 0;
return x; |
@ColinKinloch Ok! Reset these deltas in commit e7ac2af, and everything seems to work well no, no more strange "inertia"! @i30817 Can you try in your touchpad configuration, please, and tell us if there's something else you notice? :) |
Everything working. Even myst 3, and versailles 1865 rotoscaped landscapes are working (these games have 360º viewports that rotate around with the mouse). |
From limited testing I see one more thing. RetroArch/input/drivers/x11_input.c Lines 543 to 554 in 3f485de
|
Are there any FPSs with mouse look on RetroArch? |
@ColinKinloch I thought TyrQuake would support mouselook, but it doesn't look like it, I have just tried and mouse doesn't seem to work with it. What would be the best place to do the coordinates clamping as in X11? |
I've figured out the FPS thing. You need to set "Port 1 Controls" to mouse and keyboard, works great :) |
In the x11 the clamping is done in the poll function when the input isn't grabbed, so I suppose it should be done in |
Did you do it with TyrQuake? Or did you use another core? |
TyrQuake, PrBoom, vitaQuakeII. |
@ColinKinloch I added the clamping as x11 does in commit fb47a49 How does it work for you? |
Co-authored-by: Colin Kinloch <colin@kinlo.ch>
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.
This fixes HiDPI displays getting clamped to a smaller area.
Co-authored-by: Colin Kinloch <colin@kinlo.ch>
@ColinKinloch
Rolling back to prior commit fixes the issue: 8d1e575 |
Which compositor are you using? KDE, Gnome? |
The log is saying that RetroArch/input/drivers/wayland_input.c Lines 431 to 432 in eeda1f6
|
@brooksytech what compositor does Jelos use? |
Weston in Kiosk shell mode. |
And looks like its been fixed already with the new commits you made. Thank You! |
Description
This implements mouse grab/lock in Wayland, needed for some cores like Dosbox-core to work correctly with mouse-driven games.
This was done with massive help from @ColinKinloch
Related Issues
This long-standing issue is now fixed:
realnc/dosbox-core#48
Mouse was misbehaving in Wayland because of the missing feature this PR adds: mouse grab/lock.