[mutter] clutter: Fix event axes array indices in axis broadcasts



commit af6fb2a702fe3a7675b243dea7a210d635403cc2
Author: Quytelda Kahja <quytelda tamalin org>
Date:   Wed Oct 27 23:15:50 2021 -0700

    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>

 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 a8de868bc5..51e4e7d5d4 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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]