diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c index 08b86a3e..eb4070e2 100644 --- a/desktop-shell/exposay.c +++ b/desktop-shell/exposay.c @@ -385,6 +385,12 @@ exposay_button(struct weston_pointer_grab *grab, uint32_t time, uint32_t button, shell->exposay.clicked = NULL; } +static void +exposay_axis(struct weston_pointer_grab *grab, + uint32_t time, uint32_t axis, wl_fixed_t value) +{ +} + static void exposay_pointer_grab_cancel(struct weston_pointer_grab *grab) { @@ -398,6 +404,7 @@ static const struct weston_pointer_grab_interface exposay_ptr_grab = { exposay_focus, exposay_motion, exposay_button, + exposay_axis, exposay_pointer_grab_cancel, }; diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index d507d189..52d1195d 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -1700,6 +1700,12 @@ noop_grab_focus(struct weston_pointer_grab *grab) { } +static void +noop_grab_axis(struct weston_pointer_grab *grab, + uint32_t time, uint32_t axis, wl_fixed_t value) +{ +} + static void constrain_position(struct weston_move_grab *move, int *cx, int *cy) { @@ -1782,6 +1788,7 @@ static const struct weston_pointer_grab_interface move_grab_interface = { noop_grab_focus, move_grab_motion, move_grab_button, + noop_grab_axis, move_grab_cancel, }; @@ -1945,6 +1952,7 @@ static const struct weston_pointer_grab_interface resize_grab_interface = { noop_grab_focus, resize_grab_motion, resize_grab_button, + noop_grab_axis, resize_grab_cancel, }; @@ -2109,6 +2117,7 @@ static const struct weston_pointer_grab_interface busy_cursor_grab_interface = { busy_cursor_grab_focus, busy_cursor_grab_motion, busy_cursor_grab_button, + noop_grab_axis, busy_cursor_grab_cancel, }; @@ -3290,6 +3299,19 @@ popup_grab_button(struct weston_pointer_grab *grab, shseat->popup_grab.initial_up = 1; } +static void +popup_grab_axis(struct weston_pointer_grab *grab, + uint32_t time, uint32_t axis, wl_fixed_t value) +{ + struct weston_pointer *pointer = grab->pointer; + 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 popup_grab_cancel(struct weston_pointer_grab *grab) { @@ -3300,6 +3322,7 @@ static const struct weston_pointer_grab_interface popup_grab_interface = { popup_grab_focus, popup_grab_motion, popup_grab_button, + popup_grab_axis, popup_grab_cancel, }; @@ -5000,6 +5023,7 @@ static const struct weston_pointer_grab_interface rotate_grab_interface = { noop_grab_focus, rotate_grab_motion, rotate_grab_button, + noop_grab_axis, rotate_grab_cancel, }; diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c index d1ed872c..633ea19f 100644 --- a/ivi-shell/hmi-controller.c +++ b/ivi-shell/hmi-controller.c @@ -1322,6 +1322,13 @@ pointer_noop_grab_focus(struct weston_pointer_grab *grab) { } +static void +pointer_default_grab_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 move_grab_update(struct move_grab *move, wl_fixed_t pointer[2]) { @@ -1466,6 +1473,7 @@ static const struct weston_pointer_grab_interface pointer_move_grab_workspace_in pointer_noop_grab_focus, pointer_move_grab_motion, pointer_move_workspace_grab_button, + pointer_default_grab_axis, pointer_move_workspace_grab_cancel }; diff --git a/src/compositor.h b/src/compositor.h index 4443c724..f3e00759 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -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); diff --git a/src/data-device.c b/src/data-device.c index 1612091a..66c4c7a3 100644 --- a/src/data-device.c +++ b/src/data-device.c @@ -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, }; diff --git a/src/input.c b/src/input.c index 500c39ae..09d12def 100644 --- a/src/input.c +++ b/src/input.c @@ -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