[PATCH weston] input: Make setting the same pointer cursor surface again a no-op

Derek Foreman derekf at osg.samsung.com
Wed Mar 18 14:11:06 PDT 2015


On 18/03/15 02:16 AM, Jonas Ådahl wrote:
> If the client calls wl_pointer.set_cursor with the same surface that is
> already set, don't do anything as no state was changed.
> 
> This avoids an issue where a client setting the same cursor surface
> multiple times would receive wl_surface.leave/enter on that surface
> every time.

This breaks hot-spot updates when the cursor changes.

Otherwise I like it - with an animated cursor we set the same surface
over and over constantly...

> Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
> ---
>  src/input.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/input.c b/src/input.c
> index 3867de2..4119027 100644
> --- a/src/input.c
> +++ b/src/input.c
> @@ -1655,6 +1655,9 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource,
>  			return;
>  	}
>  
> +	if (pointer->sprite && pointer->sprite->surface == surface)
> +		return;
> +
>  	if (pointer->sprite)
>  		pointer_unmap_sprite(pointer);
>  
> 



More information about the wayland-devel mailing list