diff --git a/wayland.c b/wayland.c index 9500847..345c2aa 100644 --- a/wayland.c +++ b/wayland.c @@ -81,6 +81,8 @@ static void zwlr_layer_surface_v1_configure(void *data, struct zwlr_layer_surfac wl_egl_window_resize(next->data.egl_window, width, height, 0, 0); zwlr_layer_surface_v1_ack_configure(zwlr_layer_surface_v1, serial); printf("🐍🐍🐍🐍\n"); + // draw new frame! + next->data.dirty = true; } static void zwlr_layer_surface_v1_closed(void *data, struct zwlr_layer_surface_v1 * zwlr_layer_surface_v1) { @@ -107,23 +109,9 @@ wl_surface_frame_done(void *data, struct wl_callback *cb, uint32_t time) { //struct client_state *state = surface->state; /* Request another frame */ - // TODO make sure this is done after the frame has been handled. - //cb = wl_surface_frame(surface->wl_surface); - //wl_callback_add_listener(cb, &wl_surface_frame_listener, surface); - - ///* Update scroll amount at 24 pixels per second */ - //if (state->last_frame != 0) { - // int elapsed = time - state->last_frame; - // state->offset += elapsed / 1000.0 * 24; - //} - - ///* Submit a frame for this event */ - //struct wl_buffer *buffer = draw_frame(state); - //wl_surface_attach(state->wl_surface, buffer, 0, 0); - //wl_surface_damage_buffer(state->wl_surface, 0, 0, INT32_MAX, INT32_MAX); - //wl_surface_commit(state->wl_surface); - - //state->last_frame = time; + // TODO make sure this is done after the frame has been handled, maybe + cb = wl_surface_frame(surface->wl_surface); + wl_callback_add_listener(cb, &wl_surface_frame_listener, surface); } static const struct wl_callback_listener wl_surface_frame_listener = { @@ -386,11 +374,11 @@ struct event wait_for_event(struct client_state *state) { printf("checking for events\n"); while (next != NULL) { if (next->data.dirty) { + next->data.dirty = false; printf("dirty\n"); if (eglMakeCurrent(state->egl_display, next->data.egl_surface, next->data.egl_surface, state->egl_context)) { - fprintf(stderr, "Made current\n"); } else { fprintf(stderr, "Made current failed\n"); }