[RFC] [PATCH 0/3] libwayland-cursor

Ander Conselvan de Oliveira conselvan2 at gmail.com
Wed May 23 06:19:34 PDT 2012

On 05/22/2012 06:25 PM, Kristian Høgsberg wrote:
> On Tue, May 22, 2012 at 03:39:39PM +0300, Ander Conselvan de Oliveira wrote:
>> Hi,
>> In order to get rid of the X11 dependency that libXcursor brings,
>> Kristian suggested that a libwayland-cursor be created. This library
>> handles the X cursor theme format, loading the image content straight
>> into an shm pool so that the users need just one function call for
>> getting a buffer for a cursor image.
>> The code for handling the cursor theme is just a stripped down version
>> of libXcursor, that is contained on the files cursor/xcursor.[ch].
>> The library API is quite similar to the cursor code in libtoytoolkit.
> Looks great Ander.  It's a good start, and I want to start using it so
> I've committed it all now.  There are a couple of things that we need
> to tweak thoguh: I'm not sure we can do enum wl_cursor_type, I think
> we should just stick to only loading by name.

My thinking when I added enum wl_cursor_type was to make lookup faster, 
but I guess we can just cache the struct wl_cursor for each type on 

> Also, in the shm resize code we should use mremap.

I sent a patch for that. I looked for a way to do a remap but for some 
reason I didn't see mremap existed.

> I'd also like to see the wl_cursor_theme
> object cache a bit more of the theme and patch lookup libXcursor does
> over and over again.

Could you be more specific on what to cache on wl_cursor_theme?

> Finally, I was wondering if we should just scan
> the cursor dir and load all cursors into a shm object instead of
> preloading just that small subset.

I'm working on that. This actually makes it easier to avoid the 
unnecessary lookups. My idea is to make XcursorScanTheme open all the 
cursors and callback the wl_cursor_theme with all the XcursorImages 
objects. This adds an extra loop between the parts, but I don't want to 
fiddle too much with the Xcursor code.


More information about the wayland-devel mailing list