Hiding the X cursor?

Tyler McClung mcclunty at onid.orst.edu
Thu Jul 16 13:30:39 PDT 2009


I am unaware of the issues with animated cursors, but it works great  
for normal ones.  I noticed a bug where calling the hide cursor  
multiple times causes a stacking effect.  In order to make the cursor  
visible, you have to call show cursor that many times before the  
effect is noticed.  Also, if show cursor was called when the cursor  
wasn't hidden, a Bad Match error was thrown.

Both to prevent this and to add a toggle functionality, I modded the  
Wm struct to keep track of whether the cursor is visible (I know that  
it already has this attribute stored in w->config->cursor_not_visible  
(or something similar to this), but I thought that I'd add my own  
attribute to prevent any unforeseen bugs from occurring (plus having a  
"not" in a bool makes things messy).  The attribute I added can be  
accessed like so:  w->cursor_is_visible.

I added the cursor toggle event call to the wm and matchbox-remote as well:
matchbox-remote -cursor-toggle

Also, here's a little desktop entry file and image in case anyone  
wants to plop it into an embedded system for easy mouse toggling with  
the click of an icon.

-- 
Tyler McClung
mcclunty at onid.orst.edu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: matchbox.diff
Type: text/x-diff
Size: 6752 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20090716/0075f887/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cursor_toggle.xpm
Type: image/x-xpixmap
Size: 6272 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20090716/0075f887/attachment.xpm>
-------------- next part --------------
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=cursor_toggle
Comment=Toggle the cursor's visibility
Exec=matchbox-remote -cursor-toggle
Icon=cursor_toggle.xpm


More information about the xorg mailing list