input: Pass axis events through pointer grab interfaces
Don't only send motions and buttons but also axis events through the
pointer grab interface.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
diff --git a/src/input.c b/src/input.c
index 500c39a..09d12de 100644
--- a/src/input.c
+++ b/src/input.c
@@ -221,6 +221,36 @@
}
}
+/** Send wl_pointer.axis events to focused resources.
+ *
+ * \param pointer The pointer where the axis events originates from.
+ * \param time The timestamp of the event
+ * \param axis The axis enum value of the event
+ * \param value The axis value of the event
+ *
+ * For every resource that is currently in focus, send a wl_pointer.axis event
+ * with the passed parameters. The focused resources are the wl_pointer
+ * resources of the client which currently has the surface with pointer focus.
+ */
+WL_EXPORT void
+weston_pointer_send_axis(struct weston_pointer *pointer,
+ uint32_t time, uint32_t axis, wl_fixed_t value)
+{
+ struct wl_resource *resource;
+ struct wl_list *resource_list;
+
+ resource_list = &pointer->focus_resource_list;
+ wl_resource_for_each(resource, resource_list)
+ wl_pointer_send_axis(resource, time, axis, value);
+}
+
+static void
+default_grab_pointer_axis(struct weston_pointer_grab *grab,
+ uint32_t time, uint32_t axis, wl_fixed_t value)
+{
+ weston_pointer_send_axis(grab->pointer, time, axis, value);
+}
+
static void
default_grab_pointer_cancel(struct weston_pointer_grab *grab)
{
@@ -231,6 +261,7 @@
default_grab_pointer_focus,
default_grab_pointer_motion,
default_grab_pointer_button,
+ default_grab_pointer_axis,
default_grab_pointer_cancel,
};
@@ -1084,8 +1115,6 @@
{
struct weston_compositor *compositor = seat->compositor;
struct weston_pointer *pointer = weston_seat_get_pointer(seat);
- struct wl_resource *resource;
- struct wl_list *resource_list;
weston_compositor_wake(compositor);
@@ -1096,10 +1125,7 @@
time, axis, value))
return;
- resource_list = &pointer->focus_resource_list;
- wl_resource_for_each(resource, resource_list)
- wl_pointer_send_axis(resource, time, axis,
- value);
+ pointer->grab->interface->axis(pointer->grab, time, axis, value);
}
WL_EXPORT int