compositor, clients: apply wl_surface.frame on commit

Apply wl_surface.frame request only on the next wl_surface.commit
according to the new protocol.

This makes it explicit, which repaint actually triggered the frame
callback, since commit schedules a repaint. Otherwise, something causing
a repaint before a commit could trigger the frame callback too early.

Ensure all demo clients send commit after wl_surface.frame. Note, that
GL apps rely on eglSwapBuffers() sending commit. In toytoolkit, it is
assumed that window_flush() always does a commit.

compositor-wayland assumes renderer->repaint_output does a commit.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 805137d..eed9d5c 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -307,12 +307,10 @@
 	struct weston_compositor *ec = output->base.compositor;
 	struct wl_callback *callback;
 
-	ec->renderer->repaint_output(&output->base, damage);
-
 	callback = wl_surface_frame(output->parent.surface);
 	wl_callback_add_listener(callback, &frame_listener, output);
 
-	return;
+	ec->renderer->repaint_output(&output->base, damage);
 }
 
 static void