@@ 488,7 488,14 @@ static void on_process(void *userdata) {
ctx->last_val = ctx->val;
ctx->last_peak = ctx->peak;
ctx->dirty = true;
- draw(ctx);
+
+ if (!ctx->pending) {
+ ctx->pending = true;
+ struct wl_callback *callback = wl_surface_frame(ctx->surface);
+ wl_callback_add_listener(callback, &frame_listener, ctx);
+ wl_surface_commit(ctx->surface);
+ wl_display_flush(ctx->display);
+ }
}
static const struct pw_stream_events stream_events = {
@@ 626,8 633,8 @@ static int display_dispatch(struct pollfd *pfd, int polln, struct wl_display *di
}
pfd[EVENT_LOOP_WAYLAND].events = POLLOUT;
- while (wl_display_flush(display) == -1) {
- if (errno != EAGAIN && errno != EPIPE) {
+ while (wl_display_flush(display) == -1 && errno != EPIPE) {
+ if (errno != EAGAIN) {
wl_display_cancel_read(display);
return -1;
}