1<?xml version="1.0" encoding="UTF-8"?>
2<protocol name="stylus_unstable_v2">
3
4  <copyright>
5    Copyright 2016 The Chromium Authors.
6
7    Permission is hereby granted, free of charge, to any person obtaining a
8    copy of this software and associated documentation files (the "Software"),
9    to deal in the Software without restriction, including without limitation
10    the rights to use, copy, modify, merge, publish, distribute, sublicense,
11    and/or sell copies of the Software, and to permit persons to whom the
12    Software is furnished to do so, subject to the following conditions:
13
14    The above copyright notice and this permission notice (including the next
15    paragraph) shall be included in all copies or substantial portions of the
16    Software.
17
18    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24    DEALINGS IN THE SOFTWARE.
25  </copyright>
26
27  <interface name="zcr_stylus_v2" version="2">
28    <description summary="extends wl_touch and wl_pointer for styli">
29      Allows a wl_touch or a wl_pointer to report stylus specific information.
30      The client can use this protocol to obtain detail information about the
31      type of stylus, as well as the force and tilt of the tool.
32
33      Warning! The protocol described in this file is experimental and
34      backward incompatible changes may be made. Backward compatible changes
35      may be added together with the corresponding uinterface version bump.
36      Backward incompatible changes are done by bumping the version number in
37      the protocol and uinterface names and resetting the interface version.
38      Once the protocol is to be declared stable, the 'z' prefix and the
39      version number in the protocol and interface names are removed and the
40      interface version number is reset.
41    </description>
42
43    <enum name="error">
44      <entry name="touch_stylus_exists" value="0"
45             summary="the touch already has a touch_stylus object associated"/>
46
47      <!-- Version 2 Additions -->
48      <entry name="pointer_stylus_exists" value="1" since="2"
49             summary="the pointer already has a pointer_stylus object associated"/>
50    </enum>
51
52    <request name="get_touch_stylus">
53      <description summary="get stylus interface for touch">
54        Create touch_stylus object. See zcr_touch_stylus_v2 interface for
55        details. If the given wl_touch already has a touch_stylus object
56        associated, the touch_stylus_exists protocol error is raised.
57      </description>
58      <arg name="id" type="new_id" interface="zcr_touch_stylus_v2"/>
59      <arg name="touch" type="object" interface="wl_touch"/>
60    </request>
61
62    <!-- Version 2 Additions -->
63    <request name="get_pointer_stylus" since="2">
64      <description summary="get stylus interface for pointer">
65        Create pointer_stylus object. See zcr_pointer_stylus_v2 interface for
66        details. If the given wl_pointer already has a pointer_stylus object
67        associated, the pointer_stylus_exists protocol error is raised.
68      </description>
69      <arg name="id" type="new_id" interface="zcr_pointer_stylus_v2"/>
70      <arg name="pointer" type="object" interface="wl_pointer"/>
71    </request>
72  </interface>
73
74  <interface name="zcr_touch_stylus_v2" version="1">
75    <description summary="stylus extension for touch">
76      The zcr_touch_stylus_v2 interface extends the wl_touch interface with
77      events to describe details about a stylus. A stylus that reports events
78      through this interface is likely an on-screen stylus, where the user
79      interacts with the stylus directly on a display.
80
81      These events are to be fired by the server within the same frame as other
82      wl_touch events.
83    </description>
84
85    <request name="destroy" type="destructor">
86      <description summary="destroy stylus object"/>
87    </request>
88
89    <enum name="tool_type">
90      <description summary="tool type of device."/>
91      <entry name="touch" value="1" summary="Touch"/>
92      <entry name="pen" value="2" summary="Pen"/>
93      <entry name="eraser" value="3" summary="Eraser"/>
94    </enum>
95
96    <event name="tool">
97      <description summary="sets tool type of touch">
98        Notification that the user is using a tool type other than touch. There
99        can only be one tool in use at a time.
100        This event is sent in the same frame as the wl_touch.down event. The
101        tool type cannot change while a touch is being reported.
102      </description>
103      <arg name="id" type="uint" summary="touch id"/>
104      <arg name="type" type="uint" enum="tool_type" summary="type of tool in use"/>
105    </event>
106
107    <event name="force">
108      <description summary="force change event">
109        Notification of a change in physical force on the surface of the screen.
110        The force is calibrated and normalized to the 0 to 1 range.
111      </description>
112      <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
113      <arg name="id" type="uint" summary="touch id"/>
114      <arg name="force" type="fixed" summary="new value of force"/>
115    </event>
116
117    <event name="tilt">
118      <description summary="tilt change event">
119        Notification of a change in tilt of a stylus.
120
121        Measured from surface normal as plane angle in degrees, values lie in
122        [-90,90]. A positive x is to the right and a positive y is towards the
123        user.
124      </description>
125      <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
126      <arg name="id" type="uint" summary="touch id"/>
127      <arg name="tilt_x" type="fixed" summary="tilt in x direction"/>
128      <arg name="tilt_y" type="fixed" summary="tilt in y direction"/>
129    </event>
130  </interface>
131
132  <!-- Version 2 Additions -->
133
134  <interface name="zcr_pointer_stylus_v2" version="2">
135    <description summary="stylus extension for touch">
136      The zcr_pointer_stylus_v2 interface extends the wl_pointer interface with
137      events to describe details about a stylus. A stylus that reports events
138      through this interface also moves the mouse cursor. The type of the
139      device reporting values through this interface is described by the
140      tool_type. When the tool changes, the values previously reported through
141      this interface are assumed to be reset.
142
143      These events are to be fired by the server within the same frame as other
144      wl_pointer events.
145    </description>
146
147    <request name="destroy" type="destructor">
148      <description summary="destroy stylus object"/>
149    </request>
150
151    <enum name="tool_type">
152      <description summary="the tool type of the device"/>
153      <entry name="none" value="0" summary="Default pointer device"/>
154      <entry name="touch" value="1" summary="Touch"/>
155      <entry name="pen" value="2" summary="Pen"/>
156      <entry name="eraser" value="3" summary="Eraser"/>
157    </enum>
158
159    <event name="tool">
160      <description summary="tool change event">
161        Notification that the user is using a tool type other than touch. There
162        can only be one tool in use at a time.
163      </description>
164      <arg name="type" type="uint" enum="tool_type" summary="type of tool in use"/>
165    </event>
166
167    <event name="force">
168      <description summary="force change event">
169        Notification of the physical force of the stylus on the surface.
170        The force is calibrated and normalized to the 0 to 1 range.
171
172        The client should assume that the force value is reset when the
173        tool changes, and that the tool does not support force detection
174        until the first force event is sent. That force value will persist
175        until the next force update or tool change.
176      </description>
177      <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
178      <arg name="force" type="fixed" summary="new value of force"/>
179    </event>
180
181    <event name="tilt">
182      <description summary="tilt change event">
183        Notification of a change in tilt of a stylus.
184
185        Measured from surface normal as plane angle in degrees, values lie in
186        [-90,90]. A positive x is to the right and a positive y is towards the
187        user.
188
189        The client should assume that the tilt value is reset when the
190        tool changes, and that the tool does not support tilt detection
191        until the first tilt event is sent. That value will persist
192        until the next tilt update or tool change.
193      </description>
194      <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
195      <arg name="tilt_x" type="fixed" summary="tilt in x direction"/>
196      <arg name="tilt_y" type="fixed" summary="tilt in y direction"/>
197    </event>
198  </interface>
199
200</protocol>
201
202