-
-
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
Mouse is not grabbed on Wayland #15057
Comments
More information: the issue has been discussed here: ..And here: realnc/dosbox-core#48 (comment) The place to implement mouse grab in the Wayland driver would be: It seems that functions However, they are |
@Sunderland93 Might have a hint ? ;) |
@ColinKinloch Would you have any interest in looking into this? |
#15071 Adds the functions for the relevant wayland protocols. |
This has been merged now. @vanfanel Can you let us know what the current status is now? |
@LibretroAdmin Hi! This is on its way to be solved I guess, but it's still not. ...but as you can see, they still must be called in order to solve this. @ColinKinloch Do you have an idea on what should be done with these functions now? An example or something? |
@ColinKinloch Those links have the information I needed to start, thanks a lot! However, I am having serious trouble adapting relative_pointer_handle_relative_motion to RetroArch in To begin with: Where shoud relative_pointer_handle_relative_motion be implemented? In gfx/drivers_context/wayland_ctx.c maybe? That's where the wayland EGL stuff is accesible... |
I think you want to implement |
@ColinKinloch Oh, there's still something I don't understand. If I add, let's say, wl_pointer_handle_relative_motion along with the other listeners here: RetroArch/input/common/wayland_common.c Lines 931 to 937 in 92dfc80
...and proto-implement it like this:
...I get this compilation error:
So, any idea on how should this be done? Trying my best here, really, sorry if I sound a bit dumb. |
No problem at all. static void handle_relative_motion(void *data,
struct zwp_relative_pointer_v1 *zwp_relative_pointer_v1,
uint32_t utime_hi, uint32_t utime_lo,
wl_fixed_t dx, wl_fixed_t dy,
wl_fixed_t dx_unaccel, wl_fixed_t dy_unaccel)
{
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
} and I think the listener should be const struct zwp_relative_pointer_v1_listener relative_pointer_listener = {
.relative_motion = handle_relative_motion,
}; |
@ColinKinloch Thanks for your patience.
|
What's the code surrounding You get a relative pointer handle from a pointer handle like this. |
@ColinKinloch The sorrounding code is this:
So, I should not add relative_pointer_listener to wl_pointer_listener pointer_listener? Mind you, I don't have much idea on what am I doing here because I don't understand Wayland's architecture very well. Maybe you can simply send a PR for this? You seem to have a very good understanding of all this stuff. |
@ColinKinloch In case you still want me to do it:
|
If you're enjoying implementing it I'm happy to give pointers.
Do you know how retroarch triggers pointer lock? Does it send an event to the input or gfx driver? |
@ColinKinloch There's this callback function that gets called when pointer is grabbed: RetroArch/input/drivers/wayland_input.c Line 410 in 17c1962
I guess that's where the zwp_relative_pointer_v1 should be created for the wl_pointer ? Does that make any sense?
|
I'd say that is where you should call RetroArch/input/common/wayland_common.c Lines 459 to 463 in 17c1962
(I don't know if retroarch uses wl->mouse.delta_x for anything else) |
It's possible this may fix another similar bug to the dosbox one in the first post in scummvm. |
@ColinKinloch Ok, I am creating the relative pointer listener object like this:
...and I get this compiler warning:
That's because Should I cast the |
The headers for the protocol are generated in struct zwp_relative_pointer_v1 * zwp_relative_pointer_manager_v1_get_relative_pointer(struct zwp_relative_pointer_manager_v1 *zwp_relative_pointer_manager_v1, struct wl_pointer *pointer);
int zwp_relative_pointer_v1_add_listener(struct zwp_relative_pointer_v1 *zwp_relative_pointer_v1, const struct zwp_relative_pointer_v1_listener *listener, void *data);
When a pointer is locked all the callbacks in RetroArch/input/common/wayland_common.c Lines 931 to 937 in 17c1962
Since when the pointer is locked it doesn't have a meaningful position from the compositors point of view it's relative movements are reported via the |
To clarify RetroArch/input/common/wayland_common.c Lines 459 to 463 in 17c1962
followed by a with a call to |
@ColinKinloch Ok, everythig is done as you told me. However, I still see the same cursor problems. Any ideas on what could be missing? |
If you log the values of dx and dy are they changing as you'd expect? |
@ColinKinloch Ah, wait, I forgot to call What should I pass as |
SDL calls it with a |
@ColinKinloch Ok, so I am calling
...but it segfaults.
...So, what could be missing? Maybe I should guard the |
Does it segfault on start or when you trigger mouse grab?
|
@ColinKinloch That made it work, yes.
..But Y axis is still wrong. |
Assuming RetroArch/input/drivers/wayland_input.c Lines 75 to 76 in 17c1962
or perhaps change them to something like:
where |
@ColinKinloch PR sent! |
@ColinKinloch Ooops, there's still some problem ee00814 The cursor auto-moves sometimes.. Any idea on what could be wrong? |
Can be closed is fixed. |
Yep! Closing now! |
Description
-Moving the mouse cursor in RetroArch/RGUI in fullscreen mode with a 4:3 video configuration on a 16:9 display, without any core, the cursor is "sticky" on the four borders of the screen ("sticky" cursor on the borders is typically caused by the cursor confinement not working at all, so mouse coorditantes are not limited to the screen area, but the cursor is).
-Using cores that rely on mouse grabbing, like DosBOX-CORE, on Wayland, results on cursor being confinated in an sub-area of the screen until moving the mouse around the invisible limits allow full movement.
All this seems to be because of missing mouse grab feature on the Wayland backend.
Expected behavior
-Cursor should not be "sticky" in the boders in RetroArch/RGUI.
-Cursor should not be initially trapped in an invisible sub-area in the mouse-enabled cores.
Actual behavior
What I described already.
Steps to reproduce the bug
OR:
Bisect Results
Has always happened. It's a missing feature of the Wayland backend.
Version/Commit
Environment information
The text was updated successfully, but these errors were encountered: