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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2065>
This commit is contained in:
Quytelda Kahja 2021-10-27 23:15:50 -07:00 committed by Marge Bot
parent 5125f66afa
commit af6fb2a702

View File

@ -702,8 +702,8 @@ broadcast_tilt (MetaWaylandTabletTool *tool,
struct wl_resource *resource; struct wl_resource *resource;
gdouble xtilt, ytilt; gdouble xtilt, ytilt;
xtilt = event->motion.axes[CLUTTER_INPUT_AXIS_FLAG_XTILT]; xtilt = event->motion.axes[CLUTTER_INPUT_AXIS_XTILT];
ytilt = event->motion.axes[CLUTTER_INPUT_AXIS_FLAG_YTILT]; ytilt = event->motion.axes[CLUTTER_INPUT_AXIS_YTILT];
wl_resource_for_each (resource, &tool->focus_resource_list) wl_resource_for_each (resource, &tool->focus_resource_list)
{ {
@ -720,7 +720,7 @@ broadcast_rotation (MetaWaylandTabletTool *tool,
struct wl_resource *resource; struct wl_resource *resource;
gdouble rotation; 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) wl_resource_for_each (resource, &tool->focus_resource_list)
{ {
@ -737,7 +737,7 @@ broadcast_wheel (MetaWaylandTabletTool *tool,
gdouble angle; gdouble angle;
gint32 clicks = 0; 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 */ /* FIXME: Perform proper angle-to-clicks accumulation elsewhere */
if (angle > 0.01) if (angle > 0.01)