summaryrefslogtreecommitdiff
path: root/sway/main.c
diff options
context:
space:
mode:
authorminus <[email protected]>2015-08-20 15:12:34 +0200
committerminus <[email protected]>2015-08-20 15:27:56 +0200
commitf26ed32e460f3007e623c529d28562f4a0b261cd (patch)
tree20194ff714e5351a435746b89aab17a9944dc934 /sway/main.c
parent70f046c87a1fc03c3b3132bf3b05d2e4c4495805 (diff)
added sway_terminate to exit cleanly
Diffstat (limited to 'sway/main.c')
-rw-r--r--sway/main.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sway/main.c b/sway/main.c
index a42fbcb7..f37f086d 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -10,6 +10,14 @@
#include "log.h"
#include "handlers.h"
#include "ipc.h"
+#include "sway.h"
+
+static bool terminate_request = false;
+
+void sway_terminate(void) {
+ terminate_request = true;
+ wlc_terminate();
+}
static void sigchld_handle(int signal);
@@ -102,12 +110,15 @@ int main(int argc, char **argv) {
ipc_init();
- wlc_run();
+ if (!terminate_request) {
+ wlc_run();
+ }
+
if (devnull) {
fclose(devnull);
}
- ipc_shutdown();
+ ipc_terminate();
return 0;
}