diff options
author | Markus Ongyerth <ongy@ongy.net> | 2018-02-17 15:17:19 +0100 |
---|---|---|
committer | Markus Ongyerth <ongy@ongy.net> | 2018-02-17 15:17:19 +0100 |
commit | bab8c73d3cc57b2cf6b6c6685ea7ebf62772749c (patch) | |
tree | fb81081f05670f89e6542970f44706a2729dd181 | |
parent | a0bce86006788432601b60ff1cb7a373310c7253 (diff) |
handle xdg close event in idle-inhibit example
Fixes a crash when the idle-inhibit example application is closed by the
compositor, instead of Ctr+C on the spawning terminal, by actualy
handling the close request.
-rw-r--r-- | examples/idle-inhibit.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/examples/idle-inhibit.c b/examples/idle-inhibit.c index f33fffc9..74a2e9f1 100644 --- a/examples/idle-inhibit.c +++ b/examples/idle-inhibit.c @@ -96,8 +96,15 @@ static void xdg_toplevel_handle_configure(void *data, height = h; } +static void xdg_toplevel_handle_close(void *data, + struct xdg_toplevel *xdg_toplevel) { + exit(EXIT_SUCCESS); +} + + static const struct xdg_toplevel_listener xdg_toplevel_listener = { .configure = xdg_toplevel_handle_configure, + .close = xdg_toplevel_handle_close, }; // static const struct zxdg_toplevel_decoration_v1_listener decoration_listener = { |