diff options
author | Erik Reider <35975961+erikreider@users.noreply.github.com> | 2021-05-05 19:23:15 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-05-05 19:50:15 +0200 |
commit | d65e67face1f826ea7dec06a9d56b1a0c46c22b8 (patch) | |
tree | 8ecc1206d930b56521cc2ffc88da17394637d00a | |
parent | build: remove sd-bus status item (diff) | |
download | sway-d65e67face1f826ea7dec06a9d56b1a0c46c22b8.tar.gz sway-d65e67face1f826ea7dec06a9d56b1a0c46c22b8.tar.zst sway-d65e67face1f826ea7dec06a9d56b1a0c46c22b8.zip |
Added scroll_factor input variable to ipc output
-rw-r--r-- | sway/ipc-json.c | 12 | ||||
-rw-r--r-- | sway/sway-ipc.7.scd | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 2c4c52a3..34adfc74 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <float.h> | ||
1 | #include <json.h> | 2 | #include <json.h> |
2 | #include <libevdev/libevdev.h> | 3 | #include <libevdev/libevdev.h> |
3 | #include <stdio.h> | 4 | #include <stdio.h> |
@@ -1002,6 +1003,17 @@ json_object *ipc_json_describe_input(struct sway_input_device *device) { | |||
1002 | } | 1003 | } |
1003 | } | 1004 | } |
1004 | 1005 | ||
1006 | if (device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) { | ||
1007 | struct input_config *ic = input_device_get_config(device); | ||
1008 | float scroll_factor = 1.0f; | ||
1009 | if (ic != NULL && !isnan(ic->scroll_factor) && | ||
1010 | ic->scroll_factor != FLT_MIN) { | ||
1011 | scroll_factor = ic->scroll_factor; | ||
1012 | } | ||
1013 | json_object_object_add(object, "scroll_factor", | ||
1014 | json_object_new_double(scroll_factor)); | ||
1015 | } | ||
1016 | |||
1005 | if (wlr_input_device_is_libinput(device->wlr_device)) { | 1017 | if (wlr_input_device_is_libinput(device->wlr_device)) { |
1006 | struct libinput_device *libinput_dev; | 1018 | struct libinput_device *libinput_dev; |
1007 | libinput_dev = wlr_libinput_get_device_handle(device->wlr_device); | 1019 | libinput_dev = wlr_libinput_get_device_handle(device->wlr_device); |
diff --git a/sway/sway-ipc.7.scd b/sway/sway-ipc.7.scd index 1b855959..373e9dce 100644 --- a/sway/sway-ipc.7.scd +++ b/sway/sway-ipc.7.scd | |||
@@ -1131,6 +1131,9 @@ following properties: | |||
1131 | |- xkb_active_layout_index | 1131 | |- xkb_active_layout_index |
1132 | : integer | 1132 | : integer |
1133 | : (Only keyboards) The index of the active keyboard layout in use | 1133 | : (Only keyboards) The index of the active keyboard layout in use |
1134 | |- scroll_factor | ||
1135 | : floating | ||
1136 | : (Only pointers) Multiplier applied on scroll event values. | ||
1134 | |- libinput | 1137 | |- libinput |
1135 | : object | 1138 | : object |
1136 | : (Only libinput devices) An object describing the current device settings. | 1139 | : (Only libinput devices) An object describing the current device settings. |