From b0420b41eb9bbff87777cbe48bf2e93e0a460184 Mon Sep 17 00:00:00 2001 From: Rakarake Date: Tue, 27 Jan 2026 16:46:30 +0100 Subject: [PATCH] one screens layer working --- glonkers.c | 3 ++- wayland.c | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/glonkers.c b/glonkers.c index 3ad6a1a..baa70ab 100644 --- a/glonkers.c +++ b/glonkers.c @@ -62,11 +62,12 @@ int main(int argc, char *argv[]) { struct event event = wait_for_event(&state); if (event.type == EVENT_DRAW) { - printf("drawing!!!!\n"); + printf("drawing!!!! %p\n", event.data.draw.surface); int width = event.data.draw.width; int height = event.data.draw.height; render(&renderer, width, height, time, shader_path, 0); swap_buffers(&state, event.data.draw.surface); + printf("🦬🦬🦬 swaping a buffalo\n"); } if (event.type == EVENT_NONE) { printf("nothing, absolutely nothing\n"); diff --git a/wayland.c b/wayland.c index 345c2aa..34a2e65 100644 --- a/wayland.c +++ b/wayland.c @@ -80,7 +80,7 @@ static void zwlr_layer_surface_v1_configure(void *data, struct zwlr_layer_surfac next->data.height = height; 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"); + printf("🐍🐍🐍🐍, setting layer to dirty: %p\n", &next->data); // draw new frame! next->data.dirty = true; } @@ -107,11 +107,6 @@ wl_surface_frame_done(void *data, struct wl_callback *cb, uint32_t time) { struct surface *surface = data; surface->dirty = true; //struct client_state *state = surface->state; - - /* Request another frame */ - // 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 = { @@ -219,6 +214,7 @@ static void registry_handle_global( // frame callback struct wl_callback *cb = wl_surface_frame(wl_surface); wl_callback_add_listener(cb, &wl_surface_frame_listener, surface_location); + printf("zwlr layer callback configured 🐯🐯🐯🐯🐯🐯🐯\n"); } } @@ -405,6 +401,13 @@ void swap_buffers(struct client_state *state, struct surface *surface) { while (next != NULL) { if (&next->data == surface) { eglSwapBuffers(state->egl_display, next->data.egl_surface); + // maybe unecessary + wl_display_dispatch(state->wl_display); + + /* Request another frame */ + // TODO make sure this is done after the frame has been handled, maybe + struct wl_callback *cb = wl_surface_frame(surface->wl_surface); + wl_callback_add_listener(cb, &wl_surface_frame_listener, surface); return; } }