Custom cursors?

Fredrik Höglund fredrik at
Sat Jul 8 22:58:30 BST 2006

On Saturday 08 July 2006 19:50, Thomas Zander wrote:
> In KOffice we have various apps that have over time implemented a 
> rotate-cursor.  A rounded cursor with arrows on both sides.
> We are in the process of consolidating that and I'm wondering if we should 
> do that in KOffice libraries or in KDELibs.  I guess that adding a rotate 
> and/or skew cursor to KCursor would be in everybodies interrest.
> The idea KCursor seems to be to provide KDE-like configurability to 
> cursors. The funny thing is that it only does that for one cursor 
> nowadays :)  The rest comes from Qt.
> And that one cursor is read from an XPM one.

We actually have support for themeable cursors on the X11 platform
by means of the Xcursor library. Its cursor themes work the same
way icon themes do. If you look at the QCursor documentation, you'll
find a list of Xcursor filenames corresponding to each cursor.

We also have a UI for configuring the theme, but we don't have an
API for loading cursors (which sort of makes sense, since kdelibs
doesn't have any cursors QCursor doesn't have at the moment).

I think it makes sense to change KCursor in the following ways in KDE4:
1) Get rid of the one-function-per-cursor, and use an enum instead.
2) Add a function that accepts a filename, so you can load an
arbitrary cursor from the cursor theme.

For the function that accepts an enum value, it probably makes sense
to still provide a bitmap image for each cursor in case loading the cursor
from the theme fails, or in case Xcursor isn't available on the platform.

The bad news is that there's no naming standard for cursors used in
both GNOME and KDE. You'll find an early attempt at creating such a
standard on
but there hasn't been much interest from developers in actually
finishing it.

> I want to ask if we care about themable cursors and if anyone else things 
> its a good idea to have the rotate and/or skew cursors in kdelibs.
> On themable cursors; is there a kde-standard dir for it? If not; where 
> should I install the png file?

By default, Xcursor looks for cursors in
/usr/share/icons/<theme>/cursors and ~/.icons/<theme>/cursors,
but you can change the default search path by setting an
environment variable.

Cursors can't be stored in PNG files, since the format has no support
for specifying a cursor hotspot. Xcursor uses a custom format called
XCUR, which supports animated cursors, and multiple sizes for each
cursor. I'm not sure how we should deal with other platforms though.

I think it would be nice if we could ship KDE 4 with a complete cursor
theme to match the default icon theme.


More information about the kde-core-devel mailing list