Added scroll_factor input variable to ipc output

master
Erik Reider 4 years ago committed by Simon Ser
parent d7ec66d563
commit d65e67face

@ -1,3 +1,4 @@
#include <float.h>
#include <json.h> #include <json.h>
#include <libevdev/libevdev.h> #include <libevdev/libevdev.h>
#include <stdio.h> #include <stdio.h>
@ -1002,6 +1003,17 @@ json_object *ipc_json_describe_input(struct sway_input_device *device) {
} }
} }
if (device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) {
struct input_config *ic = input_device_get_config(device);
float scroll_factor = 1.0f;
if (ic != NULL && !isnan(ic->scroll_factor) &&
ic->scroll_factor != FLT_MIN) {
scroll_factor = ic->scroll_factor;
}
json_object_object_add(object, "scroll_factor",
json_object_new_double(scroll_factor));
}
if (wlr_input_device_is_libinput(device->wlr_device)) { if (wlr_input_device_is_libinput(device->wlr_device)) {
struct libinput_device *libinput_dev; struct libinput_device *libinput_dev;
libinput_dev = wlr_libinput_get_device_handle(device->wlr_device); libinput_dev = wlr_libinput_get_device_handle(device->wlr_device);

@ -1131,6 +1131,9 @@ following properties:
|- xkb_active_layout_index |- xkb_active_layout_index
: integer : integer
: (Only keyboards) The index of the active keyboard layout in use : (Only keyboards) The index of the active keyboard layout in use
|- scroll_factor
: floating
: (Only pointers) Multiplier applied on scroll event values.
|- libinput |- libinput
: object : object
: (Only libinput devices) An object describing the current device settings. : (Only libinput devices) An object describing the current device settings.

Loading…
Cancel
Save