fix window close
This commit is contained in:
parent
6bfbaf04ac
commit
422b10b8e2
@ -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) {
|
||||
;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user