diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-03-24 18:00:01 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-03-27 18:50:32 -0400 |
commit | d1c0e6fe2c21b4c7f651a82fb7342b54a4989c39 (patch) | |
tree | 2267e9a27e454f09c3145ddbffaa1ec91de9b556 /examples | |
parent | b73c4f48c10ae79a33d1611fb641d22b8b619c39 (diff) |
Add layer_surface.close
Diffstat (limited to 'examples')
-rw-r--r-- | examples/layer-shell.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/examples/layer-shell.c b/examples/layer-shell.c index f3b9d3a0..08826251 100644 --- a/examples/layer-shell.c +++ b/examples/layer-shell.c @@ -25,6 +25,7 @@ static uint32_t output = 0; static uint32_t layer = ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND; static uint32_t anchor = 0; static int32_t width = 256, height = 256; +static bool run_display = true; static struct { struct timespec last_frame; @@ -84,8 +85,18 @@ static void layer_surface_configure(void *data, zwlr_layer_surface_v1_ack_configure(surface, serial); } +static void layer_surface_closed(void *data, + struct zwlr_layer_surface_v1 *surface) { + eglDestroySurface(egl.display, egl_surface); + wl_egl_window_destroy(egl_window); + zwlr_layer_surface_v1_destroy(surface); + wl_surface_destroy(wl_surface); + run_display = false; +} + struct zwlr_layer_surface_v1_listener layer_surface_listener = { .configure = layer_surface_configure, + .closed = layer_surface_closed, }; static void handle_global(void *data, struct wl_registry *registry, @@ -235,7 +246,7 @@ int main(int argc, char **argv) { wl_display_roundtrip(display); draw(); - while (wl_display_dispatch(display) != -1) { + while (wl_display_dispatch(display) != -1 && run_display) { // This space intentionally left blank } return 0; |