From 122d8ce95484bd097bf3a15b8191213bd6969b41 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 21 Jun 2022 23:10:38 +0200 Subject: Remove access to wlr_input_device union References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3626 Closes: https://github.com/swaywm/sway/issues/7077 --- sway/ipc-json.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sway/ipc-json.c') diff --git a/sway/ipc-json.c b/sway/ipc-json.c index e682bc36..f52a5ecd 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c @@ -979,10 +979,11 @@ json_object *ipc_json_describe_input(struct sway_input_device *device) { input_device_get_type(device))); if (device->wlr_device->type == WLR_INPUT_DEVICE_KEYBOARD) { - struct wlr_keyboard *keyboard = device->wlr_device->keyboard; + struct wlr_keyboard *keyboard = + wlr_keyboard_from_input_device(device->wlr_device); struct xkb_keymap *keymap = keyboard->keymap; struct xkb_state *state = keyboard->xkb_state; - + json_object_object_add(object, "repeat_delay", json_object_new_int(keyboard->repeat_info.delay)); json_object_object_add(object, "repeat_rate", @@ -1012,11 +1013,11 @@ 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) && + 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_object_add(object, "scroll_factor", json_object_new_double(scroll_factor)); } -- cgit v1.2.3-54-g00ecf