diff options
author | Simon Ser <contact@emersion.fr> | 2022-11-26 20:18:43 +0100 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2022-11-28 13:28:15 -0500 |
commit | e62299daa45de139b912325eb5800796586e57c7 (patch) | |
tree | 5a1972d97bd65000f8e328667f2a772c8622e9e8 /sway/ipc-json.c | |
parent | Make session optional (diff) | |
download | sway-e62299daa45de139b912325eb5800796586e57c7.tar.gz sway-e62299daa45de139b912325eb5800796586e57c7.tar.zst sway-e62299daa45de139b912325eb5800796586e57c7.zip |
Make libinput backend optional
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r-- | sway/ipc-json.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 73a3d376..8aa9557e 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -3,7 +3,7 @@ | |||
3 | #include <json.h> | 3 | #include <json.h> |
4 | #include <libevdev/libevdev.h> | 4 | #include <libevdev/libevdev.h> |
5 | #include <stdio.h> | 5 | #include <stdio.h> |
6 | #include <wlr/backend/libinput.h> | 6 | #include <wlr/config.h> |
7 | #include <wlr/types/wlr_content_type_v1.h> | 7 | #include <wlr/types/wlr_content_type_v1.h> |
8 | #include <wlr/types/wlr_output.h> | 8 | #include <wlr/types/wlr_output.h> |
9 | #include <xkbcommon/xkbcommon.h> | 9 | #include <xkbcommon/xkbcommon.h> |
@@ -21,6 +21,10 @@ | |||
21 | #include "wlr-layer-shell-unstable-v1-protocol.h" | 21 | #include "wlr-layer-shell-unstable-v1-protocol.h" |
22 | #include "sway/desktop/idle_inhibit_v1.h" | 22 | #include "sway/desktop/idle_inhibit_v1.h" |
23 | 23 | ||
24 | #if WLR_HAS_LIBINPUT_BACKEND | ||
25 | #include <wlr/backend/libinput.h> | ||
26 | #endif | ||
27 | |||
24 | static const int i3_output_id = INT32_MAX; | 28 | static const int i3_output_id = INT32_MAX; |
25 | static const int i3_scratch_id = INT32_MAX - 1; | 29 | static const int i3_scratch_id = INT32_MAX - 1; |
26 | 30 | ||
@@ -847,6 +851,7 @@ json_object *ipc_json_describe_node_recursive(struct sway_node *node) { | |||
847 | return object; | 851 | return object; |
848 | } | 852 | } |
849 | 853 | ||
854 | #if WLR_HAS_LIBINPUT_BACKEND | ||
850 | static json_object *describe_libinput_device(struct libinput_device *device) { | 855 | static json_object *describe_libinput_device(struct libinput_device *device) { |
851 | json_object *object = json_object_new_object(); | 856 | json_object *object = json_object_new_object(); |
852 | 857 | ||
@@ -1052,6 +1057,7 @@ static json_object *describe_libinput_device(struct libinput_device *device) { | |||
1052 | 1057 | ||
1053 | return object; | 1058 | return object; |
1054 | } | 1059 | } |
1060 | #endif | ||
1055 | 1061 | ||
1056 | json_object *ipc_json_describe_input(struct sway_input_device *device) { | 1062 | json_object *ipc_json_describe_input(struct sway_input_device *device) { |
1057 | if (!(sway_assert(device, "Device must not be null"))) { | 1063 | if (!(sway_assert(device, "Device must not be null"))) { |
@@ -1115,12 +1121,14 @@ json_object *ipc_json_describe_input(struct sway_input_device *device) { | |||
1115 | json_object_new_double(scroll_factor)); | 1121 | json_object_new_double(scroll_factor)); |
1116 | } | 1122 | } |
1117 | 1123 | ||
1124 | #if WLR_HAS_LIBINPUT_BACKEND | ||
1118 | if (wlr_input_device_is_libinput(device->wlr_device)) { | 1125 | if (wlr_input_device_is_libinput(device->wlr_device)) { |
1119 | struct libinput_device *libinput_dev; | 1126 | struct libinput_device *libinput_dev; |
1120 | libinput_dev = wlr_libinput_get_device_handle(device->wlr_device); | 1127 | libinput_dev = wlr_libinput_get_device_handle(device->wlr_device); |
1121 | json_object_object_add(object, "libinput", | 1128 | json_object_object_add(object, "libinput", |
1122 | describe_libinput_device(libinput_dev)); | 1129 | describe_libinput_device(libinput_dev)); |
1123 | } | 1130 | } |
1131 | #endif | ||
1124 | 1132 | ||
1125 | return object; | 1133 | return object; |
1126 | } | 1134 | } |