Possible Wayland Extension to publish Mouse Pointer Size
contact at emersion.fr
Fri Oct 12 14:06:28 UTC 2018
We've had a chat about cursor images on IRC yesterday. I'll try to sum up what
we said. I've published the original logs too for reference .
First, it's clear that a protocol is needed. As we discussed earlier, this would
* Consistent cursors across all clients
* Per-seat configuration
* Not cluttering the environment
* Live cursor theme changes
I originally wanted to push forward a "compositor-side cursors" approach where
the compositor loads the cursor theme and allows clients to create wl_buffers
using this loaded theme. Some people (from KDE, GLFW if I recall correctly) said
there's some overhead in loading cursors on the client-side (a few megabytes,
I/O when loading images) and that could be saved. I assumed most compositors
loaded cursor themes. However, it seems that this design could get in the way of
protocol adoption because some compositors may not load cursor themes at all
(and still want cursor configuration) and some compositors use a client helper
to load cursor themes (e.g. Weston). This would make it more difficult (and
maybe less effective) to implement such a protocol. Additionally, this protocol
would be more complex to implement for compositors.
In the end, Pekka and Jonas said we should have two protocols: a simple one used
to configure xcursor (basically just sending the theme name and size to the
client) and maybe a more complicated one (creating wl_buffers). The former would
be easy to implement for all compositors while the latter could be implemented
by a subset of compositors willing to support it.
We also discussed how the new protocol should integrate with libwayland-cursor.
It would be nice to have libwayland-cursor automatically use the new protocol if
available. Currently the API looks like this:
theme = wl_cursor_theme_load(theme_name, size, shm);
cursor = wl_cursor_theme_get_cursor(theme, cursor_name);
buffer = wl_cursor_image_get_buffer(cursor->images[frame_num])
It's clear that this API is not suitable for this new protocol. We'd like to
extend it to allow the xcursor configuration protocol to be used, and if
possible allow in the future a compositor-side cursor extension to be used. This
could roughly look like something like this:
manager = wl_cursor_manager_create(display, seat, scale, default_theme_name,
buffer = wl_cursor_manager_get_cursor(manager, cursor_name, frame_num)
(This is just a draft -- all of this still needs to be discussed and is
I think that's about it. Please reply to this email if you think I forgot
something, got something wrong or if something's unclear.
I plan to work on a protocol proposal, and then on a libwayland-cursor API
extension. Let me know if you're interested in helping out!
More information about the wayland-devel