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

Support Cursor Shape #116

Open
bbb651 opened this issue Mar 9, 2025 · 4 comments
Open

Support Cursor Shape #116

bbb651 opened this issue Mar 9, 2025 · 4 comments

Comments

@bbb651
Copy link

bbb651 commented Mar 9, 2025

I tested listening to CursorNotifyEvents, and for each one requesting GetCursorImageAndName and printing the cursor name (the CursorNotifyEvent::name atom or GetCursorName seem a lot better but I couldn't figure out how to use either of them).
It seems to work pretty well, testing the cursors gtk4-demo, it doesn't seem to work in some sizes and animated cursors seem to only report the cursor name on the first frame and then keep updating the cursor without a name, but for most situations it seems like it can work.
And we can HideCursor/ShowCursor as needed to hide and fallback to client provided cursors. Actually this is not even necessary, we can just ignore the cursor Xwayland sets while we have a cursor shape.

P.S. it would be nice to have a matrix room (or discord) for xwayland-satellite

@bbb651
Copy link
Author

bbb651 commented Mar 9, 2025

I got a PoC working, I'm forcing the cursor shape to crosshair otherwise it's indistinguishable:
Image

I'm destroying the cursor shape device when an unknown cursors which I think is correct? I find the documentation for [wp_cursor_shape_device_v1::destroy](https://wayland.app/protocols/cursor-shape-v1#wp_cursor_shape_device_v1:request:destroy) a bit weird:

Destroy the cursor shape device.

The device cursor shape remains unchanged.

There's also no shape for none so I think that requires calling wl_pointer::set_cursor with null.

@Supreeeme
Copy link
Owner

What exactly is not working without this?

@bbb651
Copy link
Author

bbb651 commented Mar 9, 2025

This solves cursor mismatch and scaling issue e.g. #83, even ones that are the fault of clients, and it enables things like svg cursors (that support any size and don't take much disk space like Xcursor) for compositors.
I mostly just nerd snipped myself because I found that request in xfixes and it seemed cool to implement, if you think it's too much effort to maintain that's totally reasonable.

@Supreeeme
Copy link
Owner

Oh, okay. That's fine. I just didn't know what the actual issue was.

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

No branches or pull requests

2 participants