Add a weston_pointer_axis_event
Use an event struct to pass axis events around. This helps dealing with the
upcoming axis discrete changes.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index 26e387e..93018da 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -1047,6 +1047,7 @@
(xcb_button_press_event_t *) event;
uint32_t button;
struct x11_output *output;
+ struct weston_pointer_axis_event weston_event;
output = x11_backend_find_output(b, button_event->event);
if (!output)
@@ -1082,32 +1083,44 @@
case 4:
/* Axis are measured in pixels, but the xcb events are discrete
* steps. Therefore move the axis by some pixels every step. */
- if (state)
+ if (state) {
+ weston_event.value = -DEFAULT_AXIS_STEP_DISTANCE;
+ weston_event.axis =
+ WL_POINTER_AXIS_VERTICAL_SCROLL;
notify_axis(&b->core_seat,
weston_compositor_get_time(),
- WL_POINTER_AXIS_VERTICAL_SCROLL,
- -DEFAULT_AXIS_STEP_DISTANCE);
+ &weston_event);
+ }
return;
case 5:
- if (state)
+ if (state) {
+ weston_event.value = DEFAULT_AXIS_STEP_DISTANCE;
+ weston_event.axis =
+ WL_POINTER_AXIS_VERTICAL_SCROLL;
notify_axis(&b->core_seat,
weston_compositor_get_time(),
- WL_POINTER_AXIS_VERTICAL_SCROLL,
- DEFAULT_AXIS_STEP_DISTANCE);
+ &weston_event);
+ }
return;
case 6:
- if (state)
+ if (state) {
+ weston_event.value = -DEFAULT_AXIS_STEP_DISTANCE;
+ weston_event.axis =
+ WL_POINTER_AXIS_HORIZONTAL_SCROLL;
notify_axis(&b->core_seat,
weston_compositor_get_time(),
- WL_POINTER_AXIS_HORIZONTAL_SCROLL,
- -DEFAULT_AXIS_STEP_DISTANCE);
+ &weston_event);
+ }
return;
case 7:
- if (state)
+ if (state) {
+ weston_event.value = DEFAULT_AXIS_STEP_DISTANCE;
+ weston_event.axis =
+ WL_POINTER_AXIS_HORIZONTAL_SCROLL;
notify_axis(&b->core_seat,
weston_compositor_get_time(),
- WL_POINTER_AXIS_HORIZONTAL_SCROLL,
- DEFAULT_AXIS_STEP_DISTANCE);
+ &weston_event);
+ }
return;
default:
button = button_event->detail + BTN_SIDE - 8;