summaryrefslogtreecommitdiffstats
path: root/sway/ipc-server.c
diff options
context:
space:
mode:
authorLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-01-08 14:41:09 +0100
committerLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-01-08 15:03:25 +0100
commit15cbc53a771f35e5510b643193c4ba99e9f820a2 (patch)
tree37391772505203dd0ac0b533e89359b0d5d6e040 /sway/ipc-server.c
parentReduce duplicate code (diff)
downloadsway-15cbc53a771f35e5510b643193c4ba99e9f820a2.tar.gz
sway-15cbc53a771f35e5510b643193c4ba99e9f820a2.tar.zst
sway-15cbc53a771f35e5510b643193c4ba99e9f820a2.zip
Make IPC binding event support a compile time opt.
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r--sway/ipc-server.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index d8d8434c..bde20931 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -298,8 +298,10 @@ void ipc_client_handle_command(struct ipc_client *client) {
298 client->subscribed_events |= IPC_EVENT_MODE; 298 client->subscribed_events |= IPC_EVENT_MODE;
299 } else if (strcmp(event_type, "modifier") == 0) { 299 } else if (strcmp(event_type, "modifier") == 0) {
300 client->subscribed_events |= IPC_EVENT_MODIFIER; 300 client->subscribed_events |= IPC_EVENT_MODIFIER;
301#if SWAY_BINDING_EVENT
301 } else if (strcmp(event_type, "binding") == 0) { 302 } else if (strcmp(event_type, "binding") == 0) {
302 client->subscribed_events |= IPC_EVENT_BINDING; 303 client->subscribed_events |= IPC_EVENT_BINDING;
304#endif
303 } else { 305 } else {
304 ipc_send_reply(client, "{\"success\": false}", 18); 306 ipc_send_reply(client, "{\"success\": false}", 18);
305 ipc_client_disconnect(client); 307 ipc_client_disconnect(client);
@@ -636,6 +638,7 @@ void ipc_event_modifier(uint32_t modifier, const char *state) {
636 json_object_put(obj); // free 638 json_object_put(obj); // free
637} 639}
638 640
641#if SWAY_BINDING_EVENT
639static void ipc_event_binding(json_object *sb_obj) { 642static void ipc_event_binding(json_object *sb_obj) {
640 json_object *obj = json_object_new_object(); 643 json_object *obj = json_object_new_object();
641 json_object_object_add(obj, "change", json_object_new_string("run")); 644 json_object_object_add(obj, "change", json_object_new_string("run"));
@@ -646,8 +649,10 @@ static void ipc_event_binding(json_object *sb_obj) {
646 649
647 json_object_put(obj); // free 650 json_object_put(obj); // free
648} 651}
652#endif
649 653
650void ipc_event_binding_keyboard(struct sway_binding *sb) { 654void ipc_event_binding_keyboard(struct sway_binding *sb) {
655#if SWAY_BINDING_EVENT
651 json_object *sb_obj = json_object_new_object(); 656 json_object *sb_obj = json_object_new_object();
652 json_object_object_add(sb_obj, "command", json_object_new_string(sb->command)); 657 json_object_object_add(sb_obj, "command", json_object_new_string(sb->command));
653 658
@@ -679,4 +684,5 @@ void ipc_event_binding_keyboard(struct sway_binding *sb) {
679 json_object_object_add(sb_obj, "input_type", json_object_new_string("keyboard")); 684 json_object_object_add(sb_obj, "input_type", json_object_new_string("keyboard"));
680 685
681 ipc_event_binding(sb_obj); 686 ipc_event_binding(sb_obj);
687#endif
682} 688}