aboutsummaryrefslogtreecommitdiffstats
path: root/sway/ipc-json.c
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2022-06-21 23:10:38 +0200
committerLibravatar Simon Zeni <simon@bl4ckb0ne.ca>2022-06-22 12:44:15 -0400
commit122d8ce95484bd097bf3a15b8191213bd6969b41 (patch)
treeb97bb88c4bf7b566747bed4cce84f51842cd21a5 /sway/ipc-json.c
parentAllocate enough space for `cmd_results->error` (diff)
downloadsway-122d8ce95484bd097bf3a15b8191213bd6969b41.tar.gz
sway-122d8ce95484bd097bf3a15b8191213bd6969b41.tar.zst
sway-122d8ce95484bd097bf3a15b8191213bd6969b41.zip
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
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r--sway/ipc-json.c9
1 files changed, 5 insertions, 4 deletions
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) {
979 input_device_get_type(device))); 979 input_device_get_type(device)));
980 980
981 if (device->wlr_device->type == WLR_INPUT_DEVICE_KEYBOARD) { 981 if (device->wlr_device->type == WLR_INPUT_DEVICE_KEYBOARD) {
982 struct wlr_keyboard *keyboard = device->wlr_device->keyboard; 982 struct wlr_keyboard *keyboard =
983 wlr_keyboard_from_input_device(device->wlr_device);
983 struct xkb_keymap *keymap = keyboard->keymap; 984 struct xkb_keymap *keymap = keyboard->keymap;
984 struct xkb_state *state = keyboard->xkb_state; 985 struct xkb_state *state = keyboard->xkb_state;
985 986
986 json_object_object_add(object, "repeat_delay", 987 json_object_object_add(object, "repeat_delay",
987 json_object_new_int(keyboard->repeat_info.delay)); 988 json_object_new_int(keyboard->repeat_info.delay));
988 json_object_object_add(object, "repeat_rate", 989 json_object_object_add(object, "repeat_rate",
@@ -1012,11 +1013,11 @@ json_object *ipc_json_describe_input(struct sway_input_device *device) {
1012 if (device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) { 1013 if (device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) {
1013 struct input_config *ic = input_device_get_config(device); 1014 struct input_config *ic = input_device_get_config(device);
1014 float scroll_factor = 1.0f; 1015 float scroll_factor = 1.0f;
1015 if (ic != NULL && !isnan(ic->scroll_factor) && 1016 if (ic != NULL && !isnan(ic->scroll_factor) &&
1016 ic->scroll_factor != FLT_MIN) { 1017 ic->scroll_factor != FLT_MIN) {
1017 scroll_factor = ic->scroll_factor; 1018 scroll_factor = ic->scroll_factor;
1018 } 1019 }
1019 json_object_object_add(object, "scroll_factor", 1020 json_object_object_add(object, "scroll_factor",
1020 json_object_new_double(scroll_factor)); 1021 json_object_new_double(scroll_factor));
1021 } 1022 }
1022 1023