[PATCH weston v4 08/20] input: Don't send wl_pointer.motion if position didn't change
Peter Hutterer
peter.hutterer at who-t.net
Wed Nov 18 18:23:21 PST 2015
On Tue, Nov 17, 2015 at 06:10:54PM +0800, Jonas Ådahl wrote:
> Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Cheers,
Peter
> ---
> src/input.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/src/input.c b/src/input.c
> index 0a567da..3fd4dae 100644
> --- a/src/input.c
> +++ b/src/input.c
> @@ -173,6 +173,8 @@ default_grab_pointer_motion(struct weston_pointer_grab *grab, uint32_t time,
> struct wl_list *resource_list;
> struct wl_resource *resource;
> wl_fixed_t x, y;
> + wl_fixed_t old_sx = pointer->sx;
> + wl_fixed_t old_sy = pointer->sy;
>
> if (pointer->focus) {
> weston_pointer_motion_to_abs(pointer, event, &x, &y);
> @@ -182,10 +184,12 @@ default_grab_pointer_motion(struct weston_pointer_grab *grab, uint32_t time,
>
> weston_pointer_move(pointer, event);
>
> - resource_list = &pointer->focus_resource_list;
> - wl_resource_for_each(resource, resource_list) {
> - wl_pointer_send_motion(resource, time,
> - pointer->sx, pointer->sy);
> + if (old_sx != pointer->sx || old_sy != pointer->sy) {
> + resource_list = &pointer->focus_resource_list;
> + wl_resource_for_each(resource, resource_list) {
> + wl_pointer_send_motion(resource, time,
> + pointer->sx, pointer->sy);
> + }
> }
> }
>
> --
> 2.4.3
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
More information about the wayland-devel
mailing list