From 422b10b8e29199d8ad00c5c9fe9009a00f8b1628 Mon Sep 17 00:00:00 2001 From: Arti Zirk Date: Sun, 3 Jan 2021 20:17:06 +0200 Subject: [PATCH] fix window close --- surface.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/surface.c b/surface.c index 73cf1be..7ff5a6a 100644 --- a/surface.c +++ b/surface.c @@ -96,7 +96,7 @@ draw_frame(struct client_state *state) { wl_shm_pool_destroy(pool); close(fd); - fprintf(stderr, "Painting pixels\n"); + //fprintf(stderr, "Painting pixels\n"); // for (int n =0; n < WIDTH*HEIGHT; n++) { // *data++ = 0xffff; // } @@ -136,6 +136,7 @@ xdg_toplevel_close(void *data, struct xdg_toplevel *toplevel) { struct client_state *state = data; state->closed = true; + fprintf(stderr, "xdg_toplevel_close\n"); } static const struct xdg_toplevel_listener xdg_toplevel_listener = { @@ -253,6 +254,7 @@ int main(int argc, char **argv) { struct client_state state = { 0 }; state.width = 640; state.height = 480; + state.closed = false; state.wl_display = wl_display_connect(NULL); if (state.wl_display == NULL) { @@ -323,7 +325,7 @@ int main(int argc, char **argv) { wl_surface_commit(state.wl_surface); - while (wl_display_dispatch(state.wl_display)) { + while (wl_display_dispatch(state.wl_display) && state.closed == false) { ; }