summaryrefslogtreecommitdiffstats
path: root/sway/ipc-json.c
diff options
context:
space:
mode:
authorLibravatar Benjamin Cheng <ben@bcheng.cf>2019-03-12 13:17:47 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-04-14 19:31:36 -0400
commit6737b90cb93d0231bbbc6045adf8a2443bc4e21c (patch)
tree1b9c4f75ec160e85a2ffe9018c3564f105bd6678 /sway/ipc-json.c
parentSpawn swaynag as a wayland client (diff)
downloadsway-6737b90cb93d0231bbbc6045adf8a2443bc4e21c.tar.gz
sway-6737b90cb93d0231bbbc6045adf8a2443bc4e21c.tar.zst
sway-6737b90cb93d0231bbbc6045adf8a2443bc4e21c.zip
Add heuristics to differentiate touchpads
Use libinput_device_config_tap_get_finger_count to determine whether a pointer is a touchpad. swaymsg is also updated to reflect the new touchpad type.
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r--sway/ipc-json.c20
1 files changed, 1 insertions, 19 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index c320d958..4ccf6dfd 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -85,24 +85,6 @@ static const char *ipc_json_output_transform_description(enum wl_output_transfor
85 return NULL; 85 return NULL;
86} 86}
87 87
88static const char *ipc_json_device_type_description(struct sway_input_device *device) {
89 switch (device->wlr_device->type) {
90 case WLR_INPUT_DEVICE_POINTER:
91 return "pointer";
92 case WLR_INPUT_DEVICE_KEYBOARD:
93 return "keyboard";
94 case WLR_INPUT_DEVICE_SWITCH:
95 return "switch";
96 case WLR_INPUT_DEVICE_TOUCH:
97 return "touch";
98 case WLR_INPUT_DEVICE_TABLET_TOOL:
99 return "tablet_tool";
100 case WLR_INPUT_DEVICE_TABLET_PAD:
101 return "tablet_pad";
102 }
103 return "unknown";
104}
105
106json_object *ipc_json_get_version(void) { 88json_object *ipc_json_get_version(void) {
107 int major = 0, minor = 0, patch = 0; 89 int major = 0, minor = 0, patch = 0;
108 json_object *version = json_object_new_object(); 90 json_object *version = json_object_new_object();
@@ -819,7 +801,7 @@ json_object *ipc_json_describe_input(struct sway_input_device *device) {
819 json_object_new_int(device->wlr_device->product)); 801 json_object_new_int(device->wlr_device->product));
820 json_object_object_add(object, "type", 802 json_object_object_add(object, "type",
821 json_object_new_string( 803 json_object_new_string(
822 ipc_json_device_type_description(device))); 804 input_device_get_type(device)));
823 805
824 if (device->wlr_device->type == WLR_INPUT_DEVICE_KEYBOARD) { 806 if (device->wlr_device->type == WLR_INPUT_DEVICE_KEYBOARD) {
825 struct wlr_keyboard *keyboard = device->wlr_device->keyboard; 807 struct wlr_keyboard *keyboard = device->wlr_device->keyboard;