From 8123c92b6f03912bbc95051af75a4eb81c335bd1 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 11 Jul 2016 17:13:35 +0200 Subject: tablet: restrict the cursor surface to one per tool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Jason Gerecke Reviewed-by: Carlos Garnacho Reviewed-by: Bryce Harrington Reviewed-by: Jonas Ã…dahl --- 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. -- cgit v1.2.3