diff options
author | emersion <contact@emersion.fr> | 2018-11-28 17:58:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-28 17:58:36 +0100 |
commit | 67c7cc53ae1d652a1ccb6375e243e3cfca37aa4e (patch) | |
tree | c0e7249c44ff12c6cadee181405058fedfc3c90b /sway | |
parent | 2c31e826755c74e530cfc9b70e3e028cfaa85918 (diff) | |
parent | bf9a52bab0f8ae9b4ace43c7d9c75ece0c76b562 (diff) | |
download | sway-67c7cc53ae1d652a1ccb6375e243e3cfca37aa4e.tar.xz |
Merge pull request #3206 from RedSoxFan/ipc-subscribe
Implement support for swaymsg -t SUBSCRIBE [-m]
Diffstat (limited to 'sway')
-rw-r--r-- | sway/ipc-server.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index 95433d97..e3d73522 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c @@ -668,7 +668,8 @@ void ipc_client_handle_command(struct ipc_client *client) { // TODO: Check if they're permitted to use these events struct json_object *request = json_tokener_parse(buf); if (request == NULL) { - client_valid = ipc_send_reply(client, "{\"success\": false}", 18); + const char msg[] = "[{\"success\": false}]"; + client_valid = ipc_send_reply(client, msg, strlen(msg)); wlr_log(WLR_INFO, "Failed to parse subscribe request"); goto exit_cleanup; } @@ -695,8 +696,8 @@ void ipc_client_handle_command(struct ipc_client *client) { client->subscribed_events |= event_mask(IPC_EVENT_TICK); is_tick = true; } else { - client_valid = - ipc_send_reply(client, "{\"success\": false}", 18); + const char msg[] = "[{\"success\": false}]"; + client_valid = ipc_send_reply(client, msg, strlen(msg)); json_object_put(request); wlr_log(WLR_INFO, "Unsupported event type in subscribe request"); goto exit_cleanup; @@ -704,10 +705,12 @@ void ipc_client_handle_command(struct ipc_client *client) { } json_object_put(request); - client_valid = ipc_send_reply(client, "{\"success\": true}", 17); + const char msg[] = "[{\"success\": true}]"; + client_valid = ipc_send_reply(client, msg, strlen(msg)); if (is_tick) { client->current_command = IPC_EVENT_TICK; - ipc_send_reply(client, "{\"first\": true, \"payload\": \"\"}", 30); + const char tickmsg[] = "{\"first\": true, \"payload\": \"\"}"; + ipc_send_reply(client, tickmsg, strlen(tickmsg)); } goto exit_cleanup; } |