[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cursor location
> Also, I've tried to look at the 'simpleEventHandler'. [...]
> but lots of the methods have an argument 'event'. Where does this come from,
> and what is it?
There are 3 main objects involved here. The window object; an
eventWatcher object; and an eventHandler object. The eventWatcher
object waits on "display nextEvent", which is essentially Xlib's
XNextEvent. This figures out which event happened, and sends the
message to the eventHandler, passing along the event object for
further dissection (the event object is a proxy for an XEvent). All
this code is in the xlib object--granted, a pretty large object, but
then again, it is encapsulating much of Xlib.
> 'ui window cursor location' (or should it be 'mywin cursor location'?)
> the cursor's location only seems to be 'updated' very infrequently.
> ie. it often doesn't hold the current value, but the value some time in the
> past.
>
> What can I do to find the cursor's (up-to-date) location?
The cursor object is not updated automatically--your eventHandler must
send updateCursor: to the window object when it is handling an event
that should update the cursor. (Ie, buttonPress:, buttonRelease:,
keyPress:, keyRelease:, motionNotify:.)
> I'm trying to write a little
> program which makes a 'man' follow the cursor around a window,
I don't believe that the default simpleEventHandler catches
motionNotify events when no mouse button is pressed. Change the
eventsToCatch mask if you need that.
--
If you have more questions along this line, send mail to me directly.
Bay