summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2021-02-11 15:32:34 +0100
committerOlivier Fourdan <ofourdan@redhat.com>2021-02-15 09:42:00 +0100
commit1abab61dc23d585860bc847bcecb1b0315977c27 (patch)
tree89cbee7cf0f8b36769196b99c247d35ca9006b11
parent71817928247971566903d56c0571db61b7933747 (diff)
xwayland: Add wheel axis to relative pointer
The relative pointer only has 2 axis, if we want to route the mouse wheel events to that device, we need to add the axis definition, similar to what is done for the absolute pointer. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Related: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1130
-rw-r--r--hw/xwayland/xwayland-input.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 5fe290b3c..b1413b11f 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -177,7 +177,7 @@ xwl_pointer_proc(DeviceIntPtr device, int what)
static int
xwl_pointer_proc_relative(DeviceIntPtr device, int what)
{
-#define NAXES 2
+#define NAXES 4
Atom axes_labels[NAXES] = { 0 };
switch (what) {
@@ -186,6 +186,8 @@ xwl_pointer_proc_relative(DeviceIntPtr device, int what)
axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+ axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HWHEEL);
+ axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_WHEEL);
/*
* We'll never send buttons, but XGetPointerMapping might in certain
@@ -203,6 +205,13 @@ xwl_pointer_proc_relative(DeviceIntPtr device, int what)
NO_AXIS_LIMITS, NO_AXIS_LIMITS, 0, 0, 0, Relative);
InitValuatorAxisStruct(device, 1, axes_labels[1],
NO_AXIS_LIMITS, NO_AXIS_LIMITS, 0, 0, 0, Relative);
+ InitValuatorAxisStruct(device, 2, axes_labels[2],
+ NO_AXIS_LIMITS, NO_AXIS_LIMITS, 0, 0, 0, Relative);
+ InitValuatorAxisStruct(device, 3, axes_labels[3],
+ NO_AXIS_LIMITS, NO_AXIS_LIMITS, 0, 0, 0, Relative);
+
+ SetScrollValuator(device, 2, SCROLL_TYPE_HORIZONTAL, 1.0, SCROLL_FLAG_NONE);
+ SetScrollValuator(device, 3, SCROLL_TYPE_VERTICAL, 1.0, SCROLL_FLAG_PREFERRED);
if (!InitPtrFeedbackClassDeviceStruct(device, xwl_pointer_control))
return BadValue;