diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 53e0e3353..199303196 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c @@ -11,6 +11,7 @@ #include "sway/output.h" #include "sway/input/input-manager.h" #include "sway/input/seat.h" +#include #include #include #include @@ -598,6 +599,26 @@ json_object *ipc_json_describe_input(struct sway_input_device *device) { } } + if (wlr_input_device_is_libinput(device->wlr_device)) { + struct libinput_device *libinput_dev; + libinput_dev = wlr_libinput_get_device_handle(device->wlr_device); + + const char *events = "unknown"; + switch (libinput_device_config_send_events_get_mode(libinput_dev)) { + case LIBINPUT_CONFIG_SEND_EVENTS_ENABLED: + events = "enabled"; + break; + case LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE: + events = "disabled_on_external_mouse"; + break; + case LIBINPUT_CONFIG_SEND_EVENTS_DISABLED: + events = "disabled"; + break; + } + json_object_object_add(object, "libinput_send_events", + json_object_new_string(events)); + } + return object; } diff --git a/swaymsg/main.c b/swaymsg/main.c index f1bb5e3ea..e5eee6318 100644 --- a/swaymsg/main.c +++ b/swaymsg/main.c @@ -113,7 +113,7 @@ static const char *pretty_type_name(const char *name) { } static void pretty_print_input(json_object *i) { - json_object *id, *name, *type, *product, *vendor, *kbdlayout; + json_object *id, *name, *type, *product, *vendor, *kbdlayout, *events; json_object_object_get_ex(i, "identifier", &id); json_object_object_get_ex(i, "name", &name); json_object_object_get_ex(i, "type", &type); @@ -139,6 +139,10 @@ static void pretty_print_input(json_object *i) { json_object_get_string(kbdlayout)); } + if (json_object_object_get_ex(i, "libinput_send_events", &events)) { + printf(" Libinput Send Events: %s\n", json_object_get_string(events)); + } + printf("\n"); }