[PATCH xserver v2] xwayland: Update axis notifications to follow protocol

Scott Moreau oreaus at gmail.com
Mon Feb 25 10:14:37 PST 2013


This fixes scrolling in xwayland. It also adds support for horizontal scrolling.
---
 hw/xfree86/xwayland/xwayland-input.c |   26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/hw/xfree86/xwayland/xwayland-input.c b/hw/xfree86/xwayland/xwayland-input.c
index 39a487d..8f52c3e 100644
--- a/hw/xfree86/xwayland/xwayland-input.c
+++ b/hw/xfree86/xwayland/xwayland-input.c
@@ -381,12 +381,26 @@ pointer_handle_axis(void *data, struct wl_pointer *pointer,
     int val = wl_fixed_to_int(value);
 
     /* FIXME: Need to do proper smooth scrolling here! */
-    if (val == 1)
-        index = 4;
-    else if (val == -1)
-        index = 5;
-    else
-        return;
+    switch (axis) {
+    case WL_POINTER_AXIS_VERTICAL_SCROLL:
+	if (val <= -1)
+            index = 4;
+	else if (val >= 1)
+            index = 5;
+	else
+            return;
+	break;
+    case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
+	if (val <= -1)
+            index = 6;
+	else if (val >= 1)
+            index = 7;
+	else
+            return;
+	break;
+    default:
+	return;
+    }
 
     xf86PostButtonEvent(xwl_seat->pointer, TRUE, index, 1, 0, 0);
     xf86PostButtonEvent(xwl_seat->pointer, TRUE, index, 0, 0, 0);
-- 
1.7.10.4



More information about the wayland-devel mailing list