[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Serial # in events



In C, Xlib event structures contain a slot containing the serial number of
the last request processed by the server when that event was generated.  I
use this slot in some code I have that warps the pointer, then attempts to
ignore the event generated by the warping.  All this works fine in C.

My algorithm goes like this:

1. remember next event # with (xlib::display-request-number)
2. warp pointer
3. get and ignore motion events until one has a request serial # greater
   than the remembered one.

I'm using this to track an external cursor with the X cursor, making the X
cursor simulate a trackball.

My problem consists of the fact that there's no CLX event slot for serial
number.  I could possibly substitute timestamps, but I'd have to do a
round-trip between #2 and #3 above to get the server time (how do I even do
that??), and I'd end up throwing out even more events than I'm throwing out
now, since I'd have to throw out all the mouse events that occur between
the warp and the asking for the time.

Does anyone have any ideas on how I can:
1) get the serial number of the last processed request given an event?
or
2) find another method for doing what I need to do?


Thanks in advance,

Gary Oberbrunner
Thinking Machines Corporation
245 First St.
Cambridge, MA 02142
(617) 876-1111
garyo@think.com