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>
This commit is contained in:
committed by
Kristian Høgsberg
parent
6c71ee1ba2
commit
bc10638cd9
@@ -410,10 +410,10 @@ redraw(void *data, struct wl_callback *callback, uint32_t time)
|
||||
wl_region_destroy(region);
|
||||
}
|
||||
|
||||
eglSwapBuffers(window->display->egl.dpy, window->egl_surface);
|
||||
|
||||
window->callback = wl_surface_frame(window->surface);
|
||||
wl_callback_add_listener(window->callback, &frame_listener, window);
|
||||
|
||||
eglSwapBuffers(window->display->egl.dpy, window->egl_surface);
|
||||
}
|
||||
|
||||
static const struct wl_callback_listener frame_listener = {
|
||||
|
||||
@@ -217,13 +217,13 @@ redraw(void *data, struct wl_callback *callback, uint32_t time)
|
||||
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 = {
|
||||
|
||||
+8
-8
@@ -2670,14 +2670,14 @@ pointer_surface_frame_callback(void *data, struct wl_callback *callback,
|
||||
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 @@ idle_redraw(struct task *task, uint32_t events)
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user