michaelforney / swc

a library for making a simple Wayland compositor
MIT License
614 stars 52 forks source link

Allow applications to capture mouse pointer #69

Open fbushstone opened 3 years ago

fbushstone commented 3 years ago

This is mostly a gaming-related issue; a lot of games expect to have control over the mouse pointer. For example, Velox does not allow Minecraft to capture the mouse pointer which in turn makes turning the camera nearly impossible.

michaelforney commented 3 years ago

I assume this is done with some protocol extension that swc does not implement. Maybe something in wayland-protocols? You could try to implement it in swc if it's simple enough.

fbushstone commented 3 years ago

Sure, I could try my hand at this.

fbushstone commented 3 years ago

After looking through the protocols and the libswc code, I've come to the conclusion that mouse pointer capture is something that needs either the relative pointer protocol, the pointer constraint protocol, or both. libswc seems to already have implemented something related to relative pointers (https://github.com/michaelforney/swc/blob/master/libswc/pointer.c#L425) but I'm not sure if this is what xwayland expects. I also haven't found much information on whether the pointer constraints protocol is needed.

Relevant protocols: https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml and https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/relative-pointer/relative-pointer-unstable-v1.xml

fbushstone commented 3 years ago

It looks like swc supports these operations through pointer_set_region and pointer_hadnle_relative_motion. I assume I may have to hack around with seats but I don't know.

Libreh commented 1 year ago

Any progress on this?

Libreh commented 1 year ago

This along with subsurface support are the only 2 things that stop me from daily driving velox with swc, I'd love to have these implemented, is there any way I can help or contribute?

ErnestNoga commented 3 months ago

Hey, is this ever going to be done? This is also stopping me from daily driving velox and I don't have enough skill in C to help out, myself.