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/clients/simple-shm.c b/clients/simple-shm.c
index 66b3772..92286fb 100644
--- a/clients/simple-shm.c
+++ b/clients/simple-shm.c
@@ -217,13 +217,13 @@
paint_pixels(window->shm_data, 20, window->width, window->height, time);
wl_surface_damage(window->surface,
20, 20, window->width - 40, window->height - 40);
- wl_surface_commit(window->surface);
if (callback)
wl_callback_destroy(callback);
window->callback = wl_surface_frame(window->surface);
wl_callback_add_listener(window->callback, &frame_listener, window);
+ wl_surface_commit(window->surface);
}
static const struct wl_callback_listener frame_listener = {