add sensitivity to ipc

This commit is contained in:
kaiserschmarrn_ 2021-05-05 13:35:25 -07:00
parent 5d60ebf743
commit 1873b348ad
2 changed files with 15 additions and 3 deletions

View file

@ -1006,12 +1006,21 @@ json_object *ipc_json_describe_input(struct sway_input_device *device) {
if (device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) { if (device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) {
struct input_config *ic = input_device_get_config(device); struct input_config *ic = input_device_get_config(device);
float scroll_factor = 1.0f; float scroll_factor = 1.0f;
if (ic != NULL && !isnan(ic->scroll_factor) && float sensitivity = 1.0f;
ic->scroll_factor != FLT_MIN) { if (ic != NULL) {
if (!isnan(ic->scroll_factor) && ic->scroll_factor != FLT_MIN) {
scroll_factor = ic->scroll_factor; scroll_factor = ic->scroll_factor;
} }
if (!isnan(ic->sensitivity) && ic->sensitivity != FLT_MIN) {
sensitivity = ic->sensitivity;
}
}
json_object_object_add(object, "scroll_factor", json_object_object_add(object, "scroll_factor",
json_object_new_double(scroll_factor)); json_object_new_double(scroll_factor));
json_object_object_add(object, "sensitivity",
json_object_new_double(sensitivity));
} }
if (wlr_input_device_is_libinput(device->wlr_device)) { if (wlr_input_device_is_libinput(device->wlr_device)) {

View file

@ -1134,6 +1134,9 @@ following properties:
|- scroll_factor |- scroll_factor
: floating : floating
: (Only pointers) Multiplier applied on scroll event values. : (Only pointers) Multiplier applied on scroll event values.
|- sensitivity
: floating
: (Only pointers) Multiplier applied on relative pointer movements.
|- libinput |- libinput
: object : object
: (Only libinput devices) An object describing the current device settings. : (Only libinput devices) An object describing the current device settings.