summaryrefslogtreecommitdiffstats
path: root/sway/ipc-server.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r--sway/ipc-server.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index b560b930..e10445cf 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -15,7 +15,6 @@
15#include <stdlib.h> 15#include <stdlib.h>
16#include <sys/ioctl.h> 16#include <sys/ioctl.h>
17#include <fcntl.h> 17#include <fcntl.h>
18#include <json-c/json.h>
19#include <list.h> 18#include <list.h>
20#include <libinput.h> 19#include <libinput.h>
21#ifdef __linux__ 20#ifdef __linux__
@@ -25,6 +24,7 @@ struct ucred {
25 gid_t gid; 24 gid_t gid;
26}; 25};
27#endif 26#endif
27#include "sway_json_helper.h"
28#include "sway/ipc-json.h" 28#include "sway/ipc-json.h"
29#include "sway/ipc-server.h" 29#include "sway/ipc-server.h"
30#include "sway/security.h" 30#include "sway/security.h"
@@ -724,7 +724,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
724 } 724 }
725 725
726 // parse requested event types 726 // parse requested event types
727 for (int i = 0; i < json_object_array_length(request); i++) { 727 for (json_ar_len_t i = 0; i < json_object_array_length(request); i++) {
728 const char *event_type = json_object_get_string(json_object_array_get_idx(request, i)); 728 const char *event_type = json_object_get_string(json_object_array_get_idx(request, i));
729 if (strcmp(event_type, "workspace") == 0) { 729 if (strcmp(event_type, "workspace") == 0) {
730 client->subscribed_events |= event_mask(IPC_EVENT_WORKSPACE); 730 client->subscribed_events |= event_mask(IPC_EVENT_WORKSPACE);
@@ -1126,7 +1126,8 @@ static void ipc_event_binding(json_object *sb_obj) {
1126 sway_log(L_DEBUG, "Sending binding::run event"); 1126 sway_log(L_DEBUG, "Sending binding::run event");
1127 json_object *obj = json_object_new_object(); 1127 json_object *obj = json_object_new_object();
1128 json_object_object_add(obj, "change", json_object_new_string("run")); 1128 json_object_object_add(obj, "change", json_object_new_string("run"));
1129 json_object_object_add(obj, "binding", sb_obj); 1129 // sb_obj gets owned by the temporary json_object, too.
1130 json_object_object_add(obj, "binding", json_object_get(sb_obj));
1130 1131
1131 const char *json_string = json_object_to_json_string(obj); 1132 const char *json_string = json_object_to_json_string(obj);
1132 ipc_send_event(json_string, IPC_EVENT_BINDING); 1133 ipc_send_event(json_string, IPC_EVENT_BINDING);