clients: Nested compositor example
authorKristian Høgsberg <krh@bitplanet.net>
Fri, 12 Apr 2013 01:47:41 +0000 (21:47 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 4 Jun 2013 06:47:12 +0000 (02:47 -0400)
commit1cc5ac34b5eaaa3398e6e2fc77ab9b1dc7878a25
tree4699cfec1cf289911e9838fa1c185bcd8acbe139
parent8ccb7cc258ff3161aee5a6c3717702131f8b7def
clients: Nested compositor example

A wayland compositor doesn't provide a mechanism for buffer sharing between
clients.  Under X, one client can render to a Pixmap and another can use it
as a source in a subsequent drawing operations.  Wayland doesn't have a
mechanims to share Pixmaps or textures between clients like that, but it's
possible for one client to act as a nested compositor to another client.

This less work than it sounds, since the nested compositor won't have to
provide input devices or even any kind of shell extension.  The nested
compositor and its client can be very tightly coupled and have very specific
expectations of what the other process should provide.

In this example, nested.c is a toytoolkit application that uses cairo-gl
for rendering and forks and execs nested-client.c.  As it execs the client,
it passes it one end of a socketpair that will be the clients connection
to the nested compositor.  The nested compositor doesn't even create a
listening socket.

The client is a minimal GLES2 application, which just renders a spinning
triangle in its frame callback.
clients/Makefile.am
clients/nested-client.c [new file with mode: 0644]
clients/nested.c [new file with mode: 0644]
clients/window.c
clients/window.h