Tracking Down Disappearing Cursors

Wilks, Dan Dan_Wilks@intuit.com
Wed May 12 15:22:00 GMT 2004


After a bit of sleuthing I think I understand why the cursor is
disappearing inside X windows after a remote desktop session.
Unfortunately I don't understand enough of the motive of the current
code in order to suggest a fix.  

It appears that there is some sort of misunderstanding between wincursor.c
and the various window procs.  One of the first acts that wincursor.c does
is to do a ShowCursor(TRUE) but not set the global variable g_fCursor.
The effect is that the cursor is now locked on.  The window procs
all attempt to hide the hardware cursor while it is in the client
area by calling ShowCursor(FALSE) when the mouse enters the client
area and then ShowCursor(TRUE) when it leaves, or when the window is
deactivated or various other events.  But it does this under the control
of the afore mentioned g_fCursor variable.  I assume that this is
to deal with the refcounted nature of the ShowCursor call.

Now, when remote desktop comes in, it just resets the global ShowCursor
refcount.  Both on the remote side and when control is restored to the
owning display.  This causes the window proc's desire for cursor control
to be honored, hiding the cursor when it comes into the client are and
then showing the cursor again when it leaves.  What's surprising is that
a cursor is visible while in the remote desktop, not always the right
cursor, but there is one.  Only when returning to the main display does the
cursor disappear for good.

So, what's the right fix?  I don't know.  I have a guess.  If XWin is now
really 100% hardware cursor based then we don't need to do any of this
cursor wrangling.  My guess is that we could even remove all the
MouseTrackEvent stuff as well since that only appears to matter to hiding
and showing the cursor over the client area.

I've given it a whirl and it appears to work ok.  My cursor is always 
visible and the proper shape.  Also a surprise is that the cursor
is better behaved while running on the remote desktop.  It still has
problems but it's much better than it was.  Unfortunately I put very 
little strain on X.  I run xterm, emacs, and occasionally IntelliJ.  
I always run XWin directly in multiwindow mode, no startx or .rc file 
mumbo jumbo here. So I don't feel confident enough to really suggest
a real patch, only a course of investigation to those who might have
a bit more knowledge or bravery that I.

Hope this helps,
Dan




More information about the Cygwin-xfree mailing list