On one hand, getopt (in particular the -o suboption syntax) sucks on the
server side, and on the client side we would like to avoid the glib
dependency. We can roll out own option parser and solve both problems
and save a few lines of code total.
The new map_toplevel() request no longer specifies a position and takes
the size from the attached buffer. The attach request now takes a
position relative to the top-left corner of the old buffer to let
clients specify the relative position of the new buffer.
This lets the compositor directly provide the implementation of the RMI
objects for the surface object and a new compositor object. We avoid the
manual forwarding of requests into the compositor and the clumsy compositor
interface struct.
This implements the commit/ack/frame protocol that let clients batch up
a series of requests and then commit them atomically using the commit request.
The commit requests generats two following events: the acknowledge event,
which lets the client know that the server has received the request and
which frame the rendering has been scheduled for. At this point the client
can start rendering the next frame or free up temporary buffers. Then when
the compositor finally makes the newly composited frame visible on screen
the server sends a frame event, which contains the number of the frame that
was presented and the time when it happened.
The window and flower clients have been updated to use these two events in
their main loops and everything now updates per frame. The EGL compositor
repaint loop has been tweaked to delay the compositing of the screen to
10ms after last swapbuffer completed so as to allow processing as many
requests as possible before blocking on the next vertical retrace.
Receiving events breaks out of the poll and resets the time out.
Effectively, this blocks the animation when the client receives events.
As a quick fix, use timerfd for timing the animation.