input: Don't recreate the cursor sprite when only the hotspot changes
Currently we unmap and re-map the cursor when the hotspot changes which causes spurious enter/leave events. This changes the pointer_set_cursor() logic to avoid this. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
committed by
Pekka Paalanen
parent
abff883d2c
commit
4e53c53fe7
+11
-7
@@ -1648,10 +1648,9 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource,
|
|||||||
if (pointer->focus_serial - serial > UINT32_MAX / 2)
|
if (pointer->focus_serial - serial > UINT32_MAX / 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (surface) {
|
if (!surface) {
|
||||||
if (weston_surface_set_role(surface, "wl_pointer-cursor",
|
if (pointer->sprite)
|
||||||
resource,
|
pointer_unmap_sprite(pointer);
|
||||||
WL_POINTER_ERROR_ROLE) < 0)
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1659,12 +1658,15 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource,
|
|||||||
pointer->hotspot_x == x && pointer->hotspot_y == y)
|
pointer->hotspot_x == x && pointer->hotspot_y == y)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!pointer->sprite || pointer->sprite->surface != surface) {
|
||||||
|
if (weston_surface_set_role(surface, "wl_pointer-cursor",
|
||||||
|
resource,
|
||||||
|
WL_POINTER_ERROR_ROLE) < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (pointer->sprite)
|
if (pointer->sprite)
|
||||||
pointer_unmap_sprite(pointer);
|
pointer_unmap_sprite(pointer);
|
||||||
|
|
||||||
if (!surface)
|
|
||||||
return;
|
|
||||||
|
|
||||||
wl_signal_add(&surface->destroy_signal,
|
wl_signal_add(&surface->destroy_signal,
|
||||||
&pointer->sprite_destroy_listener);
|
&pointer->sprite_destroy_listener);
|
||||||
|
|
||||||
@@ -1673,6 +1675,8 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource,
|
|||||||
weston_surface_set_label_func(surface,
|
weston_surface_set_label_func(surface,
|
||||||
pointer_cursor_surface_get_label);
|
pointer_cursor_surface_get_label);
|
||||||
pointer->sprite = weston_view_create(surface);
|
pointer->sprite = weston_view_create(surface);
|
||||||
|
}
|
||||||
|
|
||||||
pointer->hotspot_x = x;
|
pointer->hotspot_x = x;
|
||||||
pointer->hotspot_y = y;
|
pointer->hotspot_y = y;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user