[SDL] SDL_WaitEvent in 1.3

Pierre Phaneuf pphaneuf at gmail.com
Wed Jan 14 16:18:09 PST 2009


On Wed, Jan 14, 2009 at 6:35 PM, Bob Pendleton <bob at pendleton.com> wrote:

> Well, from what I remember... I did something like 5 X server ports
> but the last one was between '91 and '93... so really, from what I
> remember... The servers I worked on always put a motion event on the
> queue if the top item on the queue wasn't already a motion event. If
> the top item was a mouse motion event  and the mouse buttons hadn't
> changed, then you coalesced the motion and updated the time stamp.
> Because the raw mouse motion events were coming out of a device queue
> that did not have time stamps, the time stamps were never accurate,
> only approximate. In fact, the time stamps were often generated by
> just adding 1 to the previous time stamp. The correct time was queried
> often enough to make sure there was some correspondence between the
> time stamps and real time.

The timestamps don't have to be strictly accurate (well, it's always
better!), but the important is that if you keep the timestamp of the
last MotionNotify event you got, you can use it with the timestamp of
the MotionNotify event right after as the start/stop time for
XGetMotionEvents, and you'll get whatever happened between those two
events in detail.

> As for XGetMotionEvents, does anyone actually implement that API? I
> always implemented the query for the buffer size to return 0 (zero).
> The lack of accurate time stamps for motion events made it impossible
> to provide correct information and the extra space was a problem back
> then. Remember, back in the late '80s technology had just gotten to
> where you could get 1 million transistors on a chip. Today, we just
> passed the point where we can get 1 billion transistors on a chip so
> resource "cost" 1/1000 of what they did back then.

Here, xdpyinfo tells me that I have a motion buffer size of 256
entries. I never did anything with it, though, so for all I know, you
might never actually get anything. :-)

-- 
http://pphaneuf.livejournal.com/



More information about the SDL mailing list