From af6fb2a702fe3a7675b243dea7a210d635403cc2 Mon Sep 17 00:00:00 2001 From: Quytelda Kahja Date: Wed, 27 Oct 2021 23:15:50 -0700 Subject: [PATCH] clutter: Fix event axes array indices in axis broadcasts A clutter event's axes array is indexed by `ClutterInputAxis`. However, a few lines accidentally use `ClutterInputAxisFlags` as indices, reading incorrect values from elsewhere in memory. As a result, broadcasted axis values for the tilt, rotation, and wheel axes don't reflect actual event data. Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1982 Part-of: --- src/wayland/meta-wayland-tablet-tool.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wayland/meta-wayland-tablet-tool.c b/src/wayland/meta-wayland-tablet-tool.c index a8de868bc..51e4e7d5d 100644 --- a/src/wayland/meta-wayland-tablet-tool.c +++ b/src/wayland/meta-wayland-tablet-tool.c @@ -702,8 +702,8 @@ broadcast_tilt (MetaWaylandTabletTool *tool, struct wl_resource *resource; gdouble xtilt, ytilt; - xtilt = event->motion.axes[CLUTTER_INPUT_AXIS_FLAG_XTILT]; - ytilt = event->motion.axes[CLUTTER_INPUT_AXIS_FLAG_YTILT]; + xtilt = event->motion.axes[CLUTTER_INPUT_AXIS_XTILT]; + ytilt = event->motion.axes[CLUTTER_INPUT_AXIS_YTILT]; wl_resource_for_each (resource, &tool->focus_resource_list) { @@ -720,7 +720,7 @@ broadcast_rotation (MetaWaylandTabletTool *tool, struct wl_resource *resource; gdouble rotation; - rotation = event->motion.axes[CLUTTER_INPUT_AXIS_FLAG_ROTATION]; + rotation = event->motion.axes[CLUTTER_INPUT_AXIS_ROTATION]; wl_resource_for_each (resource, &tool->focus_resource_list) { @@ -737,7 +737,7 @@ broadcast_wheel (MetaWaylandTabletTool *tool, gdouble angle; gint32 clicks = 0; - angle = event->motion.axes[CLUTTER_INPUT_AXIS_FLAG_WHEEL]; + angle = event->motion.axes[CLUTTER_INPUT_AXIS_WHEEL]; /* FIXME: Perform proper angle-to-clicks accumulation elsewhere */ if (angle > 0.01)