[PATCH wayland-protocols v5 3/4] tablet: restrict the cursor surface to one per tool

Bryce Harrington bryce at osg.samsung.com
Wed Jul 13 22:00:26 UTC 2016

On Mon, Jul 11, 2016 at 05:13:35PM +0200, Carlos Garnacho wrote:
> From: Peter Hutterer <peter.hutterer at who-t.net>
> The initial approach was to allow one surface to be re-used between tools,
> seats and even used together as wl_pointer cursor surface. This has a few
> drawbacks, most of which are related to managing the surface correctly in the
> compositor. For example, the same cursor surface could have two different
> hotspots. Animated cursors should animate independently rather than update at
> the same time.
> Furthermore: a client cannot know when a surface will cease being used as a
> cursor surface. The basic assumption of "after focus out" is an implementation
> detail in the compositor and unless the client unsets the cursor it is not
> guaranteed that the surface is released. This again makes sharing a surface
> less obvious - you cannot know if the wl_pointer surface is still in use when
> you set it for a new wp_tablet_tool.
> Avoid these headaches (and push some of them to the client) by simply
> restricting a wl_surface to be assigned to a single tool. For the 99% use case
> where we have one tablet with two tools (pen + eraser) this means we merely
> get two extra surfaces, and the two don't usually share the same cursor shape
> anyway. If sharing is absolutely necessary, a client may still opt to share
> the underlying wl_buffer.
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> Reviewed-by: Jason Gerecke <jason.gerecke at wacom.com>
> Reviewed-by: Carlos Garnacho <carlosg at gnome.org>

Makes sense; overloading behaviors and trying to do too many things at
once often leads to oddball corner cases.

Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>

> ---
>  unstable/tablet/tablet-unstable-v2.xml | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> diff --git a/unstable/tablet/tablet-unstable-v2.xml b/unstable/tablet/tablet-unstable-v2.xml
> index de9217b..77b185c 100644
> --- a/unstable/tablet/tablet-unstable-v2.xml
> +++ b/unstable/tablet/tablet-unstable-v2.xml
> @@ -225,13 +225,11 @@
>  	and pending input regions become undefined, and the wl_surface is
>  	unmapped.
> -	This request gives the surface the role of a cursor. The role
> -	assigned by this request is the same as assigned by
> -	wl_pointer.set_cursor meaning the same surface can be
> -	used both as a wl_pointer cursor and a wp_tablet cursor. If the
> -	surface already has another role, it raises a protocol error.
> -	The surface may be used on multiple tablets and across multiple
> -	seats.
> +	This request gives the surface the role of a wp_tablet_tool cursor. A
> +	surface may only ever be used as the cursor surface for one
> +	wp_tablet_tool. If the surface already has another role or has
> +	previously been used as cursor surface for a different tool, a
> +	protocol error is raised.
>        </description>
>        <arg name="serial" type="uint" summary="serial of the enter event"/>
>        <arg name="surface" type="object" interface="wl_surface" allow-null="true"/>
> -- 
> 2.7.4
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel

More information about the wayland-devel mailing list