summaryrefslogtreecommitdiffstats
path: root/sway/ipc-server.c
diff options
context:
space:
mode:
authorLibravatar Cole Mickens <cole.mickens@gmail.com>2016-01-17 02:53:37 -0800
committerLibravatar Cole Mickens <cole.mickens@gmail.com>2016-01-19 06:51:36 -0800
commit28081b76891ddbbb825dee6c202037d78aa8f164 (patch)
tree6b7412f626f5d9f10dba8920a2543dfd3c5a662e /sway/ipc-server.c
parentAdd ffmpeg/imagemagick to depenency list (diff)
downloadsway-28081b76891ddbbb825dee6c202037d78aa8f164.tar.gz
sway-28081b76891ddbbb825dee6c202037d78aa8f164.tar.zst
sway-28081b76891ddbbb825dee6c202037d78aa8f164.zip
libinput
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r--sway/ipc-server.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index 8d92b919..58a291cd 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -13,6 +13,7 @@
13#include <ctype.h> 13#include <ctype.h>
14#include <json-c/json.h> 14#include <json-c/json.h>
15#include <list.h> 15#include <list.h>
16#include <libinput.h>
16#include "ipc-server.h" 17#include "ipc-server.h"
17#include "log.h" 18#include "log.h"
18#include "config.h" 19#include "config.h"
@@ -20,6 +21,7 @@
20#include "list.h" 21#include "list.h"
21#include "stringop.h" 22#include "stringop.h"
22#include "util.h" 23#include "util.h"
24#include "input.h"
23 25
24static int ipc_socket = -1; 26static int ipc_socket = -1;
25static struct wlc_event_source *ipc_event_source = NULL; 27static struct wlc_event_source *ipc_event_source = NULL;
@@ -325,6 +327,24 @@ void ipc_client_handle_command(struct ipc_client *client) {
325 json_object_put(workspaces); // free 327 json_object_put(workspaces); // free
326 break; 328 break;
327 } 329 }
330 case IPC_GET_INPUTS:
331 {
332 json_object *inputs = json_object_new_array();
333 if (input_devices) {
334 for(int i=0; i<input_devices->length; i++) {
335 struct libinput_device *device = input_devices->items[i];
336 char* identifier = libinput_dev_unique_id(device);
337 json_object *device_object = json_object_new_object();
338 json_object_object_add(device_object, "identifier", json_object_new_string(identifier));
339 json_object_array_add(inputs, device_object);
340 free(identifier);
341 }
342 }
343 const char *json_string = json_object_to_json_string(inputs);
344 ipc_send_reply(client, json_string, (uint32_t) strlen(json_string));
345 json_object_put(inputs);
346 break;
347 }
328 case IPC_GET_OUTPUTS: 348 case IPC_GET_OUTPUTS:
329 { 349 {
330 json_object *outputs = json_object_new_array(); 350 json_object *outputs = json_object_new_array();