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>
This commit is contained in:
@@ -247,6 +247,8 @@ struct weston_pointer_grab_interface {
|
||||
wl_fixed_t x, wl_fixed_t y);
|
||||
void (*button)(struct weston_pointer_grab *grab,
|
||||
uint32_t time, uint32_t button, uint32_t state);
|
||||
void (*axis)(struct weston_pointer_grab *grab,
|
||||
uint32_t time, uint32_t axis, wl_fixed_t value);
|
||||
void (*cancel)(struct weston_pointer_grab *grab);
|
||||
};
|
||||
|
||||
@@ -369,6 +371,9 @@ weston_pointer_create(struct weston_seat *seat);
|
||||
void
|
||||
weston_pointer_destroy(struct weston_pointer *pointer);
|
||||
void
|
||||
weston_pointer_send_axis(struct weston_pointer *pointer,
|
||||
uint32_t time, uint32_t axis, wl_fixed_t value);
|
||||
void
|
||||
weston_pointer_set_focus(struct weston_pointer *pointer,
|
||||
struct weston_view *view,
|
||||
wl_fixed_t sx, wl_fixed_t sy);
|
||||
|
||||
@@ -410,6 +410,12 @@ drag_grab_button(struct weston_pointer_grab *grab,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
drag_grab_axis(struct weston_pointer_grab *grab,
|
||||
uint32_t time, uint32_t axis, wl_fixed_t value)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
drag_grab_cancel(struct weston_pointer_grab *grab)
|
||||
{
|
||||
@@ -426,6 +432,7 @@ static const struct weston_pointer_grab_interface pointer_drag_grab_interface =
|
||||
drag_grab_focus,
|
||||
drag_grab_motion,
|
||||
drag_grab_button,
|
||||
drag_grab_axis,
|
||||
drag_grab_cancel,
|
||||
};
|
||||
|
||||
|
||||
+32
-6
@@ -221,6 +221,36 @@ default_grab_pointer_button(struct weston_pointer_grab *grab,
|
||||
}
|
||||
}
|
||||
|
||||
/** 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 @@ static const struct weston_pointer_grab_interface
|
||||
default_grab_pointer_focus,
|
||||
default_grab_pointer_motion,
|
||||
default_grab_pointer_button,
|
||||
default_grab_pointer_axis,
|
||||
default_grab_pointer_cancel,
|
||||
};
|
||||
|
||||
@@ -1084,8 +1115,6 @@ notify_axis(struct weston_seat *seat, uint32_t time, uint32_t axis,
|
||||
{
|
||||
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 @@ notify_axis(struct weston_seat *seat, uint32_t time, uint32_t axis,
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user