Switch protocol to using serial numbers for ordering events and requests
authorKristian Høgsberg <krh@bitplanet.net>
Thu, 12 Apr 2012 02:25:51 +0000 (22:25 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 12 Apr 2012 02:27:26 +0000 (22:27 -0400)
commit5535f155d8567a07596660a18b6d38a46acfe987
tree32d141fd57b93e8ea0923256d9cf5017a596be67
parenta13aab4e15f7defe8207dfc18277321166577d7a
Switch protocol to using serial numbers for ordering events and requests

The wayland protocol, as X, uses timestamps to match up certain
requests with input events.  The problem is that sometimes we need to
send out an event that doesn't have a corresponding timestamped input
event.  For example, the pointer focus surface goes away and new
surface needs to receive a pointer enter event.  These events are
normally timestamped with the evdev event timestamp, but in this case,
we don't have a evdev timestamp.  So we have to go to gettimeofday (or
clock_gettime()) and then we don't know if it's coming from the same
time source etc.

However for all these cases we don't need a real time timestamp, we
just need a serial number that encodes the order of events inside the
server.  So we introduce a serial number mechanism that we can use to
order events.  We still need real-time timestamps for actual input
device events (motion, buttons, keys, touch), to be able to reason
about double-click speed and movement speed so events that correspond to user input carry both a serial number and a timestamp.

The serial number also give us a mechanism to key together events that
are "logically the same" such as a unicode event and a keycode event,
or a motion event and a relative event from a raw device.
protocol/wayland.xml
src/data-device.c
src/wayland-client.c
src/wayland-server.c
src/wayland-server.h
src/wayland-shm.c