zcr_stylus_v2: Add pointer_stylus interface am: 022e363d0b am: 8cd348884a am: 704551387c

Original change: https://android-review.googlesource.com/c/platform/external/wayland-protocols/+/1439432

Change-Id: I831630a17710c599c8cb121c98ca4b6380df8600
diff --git a/chromium.org/unstable/stylus/stylus-unstable-v2.xml b/chromium.org/unstable/stylus/stylus-unstable-v2.xml
index 8465f07..9bb5022 100644
--- a/chromium.org/unstable/stylus/stylus-unstable-v2.xml
+++ b/chromium.org/unstable/stylus/stylus-unstable-v2.xml
@@ -24,15 +24,11 @@
     DEALINGS IN THE SOFTWARE.
   </copyright>
 
-  <interface name="zcr_stylus_v2" version="1">
-    <description summary="extends wl_touch with events for on-screen stylus">
-      Allows a wl_touch to report stylus specific information. The client can
-      interpret the on-screen stylus like any other touch event, and use
-      this protocol to obtain detail information about the type of stylus,
-      as well as the force and tilt of the tool.
-
-      These events are to be fired by the server within the same frame as other
-      wl_touch events.
+  <interface name="zcr_stylus_v2" version="2">
+    <description summary="extends wl_touch and wl_pointer for styli">
+      Allows a wl_touch or a wl_pointer to report stylus specific information.
+      The client can use this protocol to obtain detail information about the
+      type of stylus, as well as the force and tilt of the tool.
 
       Warning! The protocol described in this file is experimental and
       backward incompatible changes may be made. Backward compatible changes
@@ -47,23 +43,43 @@
     <enum name="error">
       <entry name="touch_stylus_exists" value="0"
              summary="the touch already has a touch_stylus object associated"/>
+
+      <!-- Version 2 Additions -->
+      <entry name="pointer_stylus_exists" value="1" since="2"
+             summary="the pointer already has a pointer_stylus object associated"/>
     </enum>
 
     <request name="get_touch_stylus">
       <description summary="get stylus interface for touch">
-        Create touch_stylus object. See zcr_touch_stylus_v1 interface for
+        Create touch_stylus object. See zcr_touch_stylus_v2 interface for
         details. If the given wl_touch already has a touch_stylus object
         associated, the touch_stylus_exists protocol error is raised.
       </description>
       <arg name="id" type="new_id" interface="zcr_touch_stylus_v2"/>
       <arg name="touch" type="object" interface="wl_touch"/>
     </request>
+
+    <!-- Version 2 Additions -->
+    <request name="get_pointer_stylus" since="2">
+      <description summary="get stylus interface for pointer">
+        Create pointer_stylus object. See zcr_pointer_stylus_v2 interface for
+        details. If the given wl_pointer already has a pointer_stylus object
+        associated, the pointer_stylus_exists protocol error is raised.
+      </description>
+      <arg name="id" type="new_id" interface="zcr_pointer_stylus_v2"/>
+      <arg name="pointer" type="object" interface="wl_pointer"/>
+    </request>
   </interface>
 
   <interface name="zcr_touch_stylus_v2" version="1">
     <description summary="stylus extension for touch">
-      The zcr_touch_stylus_v1 interface extends the wl_touch interface with
-      events to describe details about a stylus.
+      The zcr_touch_stylus_v2 interface extends the wl_touch interface with
+      events to describe details about a stylus. A stylus that reports events
+      through this interface is likely an on-screen stylus, where the user
+      interacts with the stylus directly on a display.
+
+      These events are to be fired by the server within the same frame as other
+      wl_touch events.
     </description>
 
     <request name="destroy" type="destructor">
@@ -113,4 +129,73 @@
     </event>
   </interface>
 
+  <!-- Version 2 Additions -->
+
+  <interface name="zcr_pointer_stylus_v2" version="2">
+    <description summary="stylus extension for touch">
+      The zcr_pointer_stylus_v2 interface extends the wl_pointer interface with
+      events to describe details about a stylus. A stylus that reports events
+      through this interface also moves the mouse cursor. The type of the
+      device reporting values through this interface is described by the
+      tool_type. When the tool changes, the values previously reported through
+      this interface are assumed to be reset.
+
+      These events are to be fired by the server within the same frame as other
+      wl_pointer events.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy stylus object"/>
+    </request>
+
+    <enum name="tool_type">
+      <description summary="the tool type of the device"/>
+      <entry name="none" value="0" summary="Default pointer device"/>
+      <entry name="touch" value="1" summary="Touch"/>
+      <entry name="pen" value="2" summary="Pen"/>
+      <entry name="eraser" value="3" summary="Eraser"/>
+    </enum>
+
+    <event name="tool">
+      <description summary="tool change event">
+        Notification that the user is using a tool type other than touch. There
+        can only be one tool in use at a time.
+      </description>
+      <arg name="type" type="uint" enum="tool_type" summary="type of tool in use"/>
+    </event>
+
+    <event name="force">
+      <description summary="force change event">
+        Notification of the physical force of the stylus on the surface.
+        The force is calibrated and normalized to the 0 to 1 range.
+
+        The client should assume that the force value is reset when the
+        tool changes, and that the tool does not support force detection
+        until the first force event is sent. That force value will persist
+        until the next force update or tool change.
+      </description>
+      <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+      <arg name="force" type="fixed" summary="new value of force"/>
+    </event>
+
+    <event name="tilt">
+      <description summary="tilt change event">
+        Notification of a change in tilt of a stylus.
+
+        Measured from surface normal as plane angle in degrees, values lie in
+        [-90,90]. A positive x is to the right and a positive y is towards the
+        user.
+
+        The client should assume that the tilt value is reset when the
+        tool changes, and that the tool does not support tilt detection
+        until the first tilt event is sent. That value will persist
+        until the next tilt update or tool change.
+      </description>
+      <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+      <arg name="tilt_x" type="fixed" summary="tilt in x direction"/>
+      <arg name="tilt_y" type="fixed" summary="tilt in y direction"/>
+    </event>
+  </interface>
+
 </protocol>
+