From b407024ea18fe225f6db7ae01400f57abd7cf850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 18 Mar 2015 15:08:03 +0800 Subject: [PATCH] input: Make setting the same pointer cursor state again a no-op MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the client calls wl_pointer.set_cursor with the same surface and hot spot coordinate 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. Signed-off-by: Jonas Ã…dahl Reviewed-By: Derek Foreman --- src/input.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/input.c b/src/input.c index 3867de229..469d5cee8 100644 --- a/src/input.c +++ b/src/input.c @@ -1655,6 +1655,10 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource, return; } + if (pointer->sprite && pointer->sprite->surface == surface && + pointer->hotspot_x == x && pointer->hotspot_y == y) + return; + if (pointer->sprite) pointer_unmap_sprite(pointer);