aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2019-01-15 14:54:26 -0500
committeremersion <contact@emersion.fr>2019-01-15 22:41:54 +0100
commit686b85304730a7287e5ed9d44290b35495910ddb (patch)
treea27a3c61a0a016a835180ff960b78fff674e965e /sway
parentf7309778a700972f7f4cdd529670ff3430da42dd (diff)
Do not send ipc_event_shutdown from ipc client
In `sway_terminate`, `ipc_event_shutdown` was being sent regardless which mode sway was running in. When running as an ipc client, `sway_terminate` should just exit
Diffstat (limited to 'sway')
-rw-r--r--sway/main.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sway/main.c b/sway/main.c
index 6e3f6b67..6e2f16db 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -31,10 +31,16 @@ static int exit_value = 0;
struct sway_server server = {0};
void sway_terminate(int exit_code) {
- terminate_request = true;
- exit_value = exit_code;
- ipc_event_shutdown("exit");
- wl_display_terminate(server.wl_display);
+ if (!server.wl_display) {
+ // Running as IPC client
+ exit(exit_code);
+ } else {
+ // Running as server
+ terminate_request = true;
+ exit_value = exit_code;
+ ipc_event_shutdown("exit");
+ wl_display_terminate(server.wl_display);
+ }
}
void sig_handler(int signal) {