aboutsummaryrefslogtreecommitdiffstats
path: root/sway/ipc-server.c
diff options
context:
space:
mode:
authorLibravatar Tony Crisci <tony@dubstepdish.com>2018-04-05 22:50:10 -0400
committerLibravatar Tony Crisci <tony@dubstepdish.com>2018-04-05 22:50:10 -0400
commit6b308dbeb7a1f2b26279481c001c15434d2468cb (patch)
tree2ea7f5de363a900f415c9e0ef2e18880f1fc10cc /sway/ipc-server.c
parentdont send ipc events when there are no listeners (diff)
downloadsway-6b308dbeb7a1f2b26279481c001c15434d2468cb.tar.gz
sway-6b308dbeb7a1f2b26279481c001c15434d2468cb.tar.zst
sway-6b308dbeb7a1f2b26279481c001c15434d2468cb.zip
address feedback
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r--sway/ipc-server.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index 5fe5c755..045802e1 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -242,19 +242,13 @@ int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data) {
242} 242}
243 243
244static bool ipc_has_event_listeners(enum ipc_command_type event) { 244static bool ipc_has_event_listeners(enum ipc_command_type event) {
245 bool has_listeners = false;
246
247 struct ipc_client *client;
248 for (int i = 0; i < ipc_client_list->length; i++) { 245 for (int i = 0; i < ipc_client_list->length; i++) {
249 client = ipc_client_list->items[i]; 246 struct ipc_client *client = ipc_client_list->items[i];
250 if ((client->subscribed_events & event_mask(event)) == 0) { 247 if ((client->subscribed_events & event_mask(event)) == 0) {
251 continue; 248 return true;
252 } 249 }
253 has_listeners = true;
254 break;
255 } 250 }
256 251 return false;
257 return has_listeners;
258} 252}
259 253
260static void ipc_send_event(const char *json_string, enum ipc_command_type event) { 254static void ipc_send_event(const char *json_string, enum ipc_command_type event) {