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/window.c b/clients/window.c
index 2d0efc5..13363f8 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -2670,14 +2670,14 @@
else
i = wl_cursor_frame(cursor, time - input->cursor_anim_start);
+ if (cursor->image_count > 1) {
+ input->cursor_frame_cb =
+ wl_surface_frame(input->pointer_surface);
+ wl_callback_add_listener(input->cursor_frame_cb,
+ &pointer_surface_listener, input);
+ }
+
input_set_pointer_image_index(input, i);
-
- if (cursor->image_count == 1)
- return;
-
- input->cursor_frame_cb = wl_surface_frame(input->pointer_surface);
- wl_callback_add_listener(input->cursor_frame_cb,
- &pointer_surface_listener, input);
}
static const struct wl_callback_listener pointer_surface_listener = {
@@ -2973,12 +2973,12 @@
window_create_surface(window);
widget_redraw(window->widget);
- window_flush(window);
window->redraw_needed = 0;
wl_list_init(&window->redraw_task.link);
window->frame_cb = wl_surface_frame(window->surface);
wl_callback_add_listener(window->frame_cb, &listener, window);
+ window_flush(window);
}
void