XCursor patch

Fredrik Höglund fredrik at kde.org
Sat Nov 23 13:05:10 GMT 2002


On Saturday 23 November 2002 03:20, Zack Rusin wrote:
> Hi guys,
>
> this is a rather elementary hack for Qt to _not_ use its default cursors
> but XCursor cursors. It touches on the configure script adding -xcursor
> option to define QT_USE_APPROXIMATE_CURSORS in qconfig.h. XFree86 will
> be in feature freeze for 4.3 starting next week therefore I figured
> that more people will be trying it and the fact that Qt uses its
> default cursors is a little pain and makes KDE look weird.

[snip]

You don't need this patch to get themed cursors with Qt and KDE.
Xcursor has a backwards compatibility mechanism that enables it
to detect when pixmap cursors created by Qt are in fact themable
cursors.

When an application creates a 64x64 or smaller 1bpp pixmap Xlib
puts that pixmap in a client side LRU cache that can hold up to 8
pixmaps. If one of the pixmap handles in the cache is passed to
XCreatePixmapCursor(), Xcursor computes a hash value from the
pixmap and then tries to load that value as a file from the current
cursor theme directory. If that fails it falls back to creating
the cursor from the pixmaps passed to XCreatePixmapCursor().

This means is that you can theme pixmap cursors by creating
symlinks to cursor files in the cursor theme directories. You
might have noticed that the XFree86 build system already creates
some symlinks for Mozilla when installing the themes.

I talked to Keith Packard about what should be done about the
non-standard cursors used by KDE and Qt back when he initially
committed Xcursor to XFree86 CVS. He said that we can extend
the cursor standard to include those cursors. Some of them are
already more or less standardized on as they're also used by
other toolkits/applications.

I've been planning to ask the KDE artists to create redglass
versions of the missing cursors once the artwork for KDE 3.1
is finished, and then send them to Keith along with a patch
that adds the necessary symlinks for KDE and Qt.

Regards,
Fredrik






More information about the kde-core-devel mailing list