[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Serial # in events
I wrote:
Yes, but I'm trying to do this from CLX, which doesn't allow access
to the request sequence number in the returned events.
Bob Scheifler wrote back:
Huh? It's certainly spec'd to.
Well you're absolutely right. It's not mentioned in the (just-published)
doc, but if I poke around in the source code, sure enough there it is:
"sequence" is the keyword for the request sequence number.
It now works great.
Just for your info, my delta-mouse algorithm is this:
----------------------------------------------------------------------
In grab-mouse:
-> Map the previously created input-only full-screen window
-> Grab the pointer, confined to that window.
In handle-mouse-event:
-> Get next event (compress motion here if desired)
--> When the pointer hits the edge of the window, remember SEQ#, set
warp-pending flag and warp to the middle of the screen.
--> If flag set and event seq # < SEQ#, throw event away (mouse is pinned
to edge of window).
--> If flag set and event seq# >= SEQ#, throw event away (it's the warp),
store mouse pos as 'last pos', and clear warp-pending flag.
--> Otherwise compute delta from last pos and this pos.
In release-mouse:
-> Ungrab pointer
-> Unmap IO window
----------------------------------------------------------------------
I tried all the simpler algorithms before, and this is the simplest case
that provides reasonably smooth tracking on the remote device.
Simpler algorithms usually lose because of coalescing mouse events in the
server, missed request numbers, or large mouse motions.
Thanks for your help!
- Gary Oberbrunner
Thinking Machines Corporation
245 First St
Cambridge, MA 02142
garyo@think.com