one screens layer working

This commit is contained in:
Rakarake 2026-01-27 16:46:30 +01:00
parent 400137930a
commit b0420b41eb
2 changed files with 11 additions and 7 deletions

View file

@ -62,11 +62,12 @@ int main(int argc, char *argv[]) {
struct event event = wait_for_event(&state); struct event event = wait_for_event(&state);
if (event.type == EVENT_DRAW) { if (event.type == EVENT_DRAW) {
printf("drawing!!!!\n"); printf("drawing!!!! %p\n", event.data.draw.surface);
int width = event.data.draw.width; int width = event.data.draw.width;
int height = event.data.draw.height; int height = event.data.draw.height;
render(&renderer, width, height, time, shader_path, 0); render(&renderer, width, height, time, shader_path, 0);
swap_buffers(&state, event.data.draw.surface); swap_buffers(&state, event.data.draw.surface);
printf("🦬🦬🦬 swaping a buffalo\n");
} }
if (event.type == EVENT_NONE) { if (event.type == EVENT_NONE) {
printf("nothing, absolutely nothing\n"); printf("nothing, absolutely nothing\n");

View file

@ -80,7 +80,7 @@ static void zwlr_layer_surface_v1_configure(void *data, struct zwlr_layer_surfac
next->data.height = height; next->data.height = height;
wl_egl_window_resize(next->data.egl_window, width, height, 0, 0); wl_egl_window_resize(next->data.egl_window, width, height, 0, 0);
zwlr_layer_surface_v1_ack_configure(zwlr_layer_surface_v1, serial); 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! // draw new frame!
next->data.dirty = true; 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; struct surface *surface = data;
surface->dirty = true; surface->dirty = true;
//struct client_state *state = surface->state; //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 = { static const struct wl_callback_listener wl_surface_frame_listener = {
@ -219,6 +214,7 @@ static void registry_handle_global(
// frame callback // frame callback
struct wl_callback *cb = wl_surface_frame(wl_surface); struct wl_callback *cb = wl_surface_frame(wl_surface);
wl_callback_add_listener(cb, &wl_surface_frame_listener, surface_location); 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) { while (next != NULL) {
if (&next->data == surface) { if (&next->data == surface) {
eglSwapBuffers(state->egl_display, next->data.egl_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; return;
} }
} }