diff options
Diffstat (limited to 'sway/main.c')
-rw-r--r-- | sway/main.c | 15 |
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 @@ | |||
10 | #include "log.h" | 10 | #include "log.h" |
11 | #include "handlers.h" | 11 | #include "handlers.h" |
12 | #include "ipc.h" | 12 | #include "ipc.h" |
13 | #include "sway.h" | ||
14 | |||
15 | static bool terminate_request = false; | ||
16 | |||
17 | void sway_terminate(void) { | ||
18 | terminate_request = true; | ||
19 | wlc_terminate(); | ||
20 | } | ||
13 | 21 | ||
14 | static void sigchld_handle(int signal); | 22 | static void sigchld_handle(int signal); |
15 | 23 | ||
@@ -102,12 +110,15 @@ int main(int argc, char **argv) { | |||
102 | 110 | ||
103 | ipc_init(); | 111 | ipc_init(); |
104 | 112 | ||
105 | wlc_run(); | 113 | if (!terminate_request) { |
114 | wlc_run(); | ||
115 | } | ||
116 | |||
106 | if (devnull) { | 117 | if (devnull) { |
107 | fclose(devnull); | 118 | fclose(devnull); |
108 | } | 119 | } |
109 | 120 | ||
110 | ipc_shutdown(); | 121 | ipc_terminate(); |
111 | 122 | ||
112 | return 0; | 123 | return 0; |
113 | } | 124 | } |