Kristian Lyngstøl's Blog

XFixes - the problem and the dirty workaround

Posted on 2007-08-25

Summer of code is over, and by and large, things are working. I've gotten some text-caret stuff working through python, but on the POC level, and this would be the only missing part of my project, which I personally believe have exceeded the original goal in other areas. We WILL have text-caret tracking.

But, this post is about XFixes.

With Ezoom, there is an option to hide the original mouse pointer, and this is done through XFixes, and it triggers a bugged behavior. Basically, animated cursors will be reported as having width==height==1, and they'll be invisible. What is worse, they will even be invisible after you unhide the cursor.

However, you need this for some of the best tricks ezoom can pull off. I consider the bug worth it in my daily use, because I use default cursors, so the only animated cursor I have, is the Firefox "page loading" one.

I recently applied a tiny patch that somewhat helps, it's so simple, you can probably understand it with zero C knowledge, this is inside the "zoomUpdateCursor" function which is called when XFixes tells us a cursor change occurred, and we try to fetch the new one:

+    if (ci->width height

This means that if the new cursor has a width and height equal to or less than 1, we ignore it. Simple ass that. The result is that, when you are zoomed in and the cursor would otherwise go invisible, you won't see a change at all. It's a bit awkward, it's an ugly workaround, but it's so simple and I figure that it's better to have this than have no cursor at all.

The animated cursors will still be invisible when ezoom is NOT zoomed in, however, because X draws the pointer, not compiz, when we're not zoomed in.

I am interested in any feedback on the result of this hack, drawbacks you experience, success stories, anything.