aboutsummaryrefslogtreecommitdiffstats
path: root/sway/ipc-server.c
diff options
context:
space:
mode:
authorLibravatar Tony Crisci <tony@dubstepdish.com>2017-12-18 14:27:38 -0500
committerLibravatar Tony Crisci <tony@dubstepdish.com>2017-12-18 14:27:38 -0500
commitf2985000f364693fbeb832df1c4fd468c608e40f (patch)
treef84600bdc02e4239fd93f203eb020a90fc7a5f48 /sway/ipc-server.c
parentMerge branch 'wlroots' into feature/input (diff)
downloadsway-f2985000f364693fbeb832df1c4fd468c608e40f.tar.gz
sway-f2985000f364693fbeb832df1c4fd468c608e40f.tar.zst
sway-f2985000f364693fbeb832df1c4fd468c608e40f.zip
ipc get_inputs
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r--sway/ipc-server.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index b7cd2d76..046e40a8 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -20,6 +20,7 @@
20#include "sway/ipc-json.h" 20#include "sway/ipc-json.h"
21#include "sway/ipc-server.h" 21#include "sway/ipc-server.h"
22#include "sway/server.h" 22#include "sway/server.h"
23#include "sway/input/input-manager.h"
23#include "list.h" 24#include "list.h"
24#include "log.h" 25#include "log.h"
25 26
@@ -359,6 +360,19 @@ void ipc_client_handle_command(struct ipc_client *client) {
359 goto exit_cleanup; 360 goto exit_cleanup;
360 } 361 }
361 362
363 case IPC_GET_INPUTS:
364 {
365 json_object *inputs = json_object_new_array();
366 struct sway_input_device *device = NULL;
367 wl_list_for_each(device, &input_manager->devices, link) {
368 json_object_array_add(inputs, ipc_json_describe_input(device));
369 }
370 const char *json_string = json_object_to_json_string(inputs);
371 ipc_send_reply(client, json_string, (uint32_t)strlen(json_string));
372 json_object_put(inputs); // free
373 goto exit_cleanup;
374 }
375
362 case IPC_GET_TREE: 376 case IPC_GET_TREE:
363 { 377 {
364 json_object *tree = 378 json_object *tree =