| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<protocol name="pointer_constraints_unstable_v1"> |
| 3 |
|
| 4 |
<copyright> |
| 5 |
Copyright © 2014 Jonas Ådahl |
| 6 |
Copyright © 2015 Red Hat Inc. |
| 7 |
|
| 8 |
Permission is hereby granted, free of charge, to any person obtaining a |
| 9 |
copy of this software and associated documentation files (the "Software"), |
| 10 |
to deal in the Software without restriction, including without limitation |
| 11 |
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 12 |
and/or sell copies of the Software, and to permit persons to whom the |
| 13 |
Software is furnished to do so, subject to the following conditions: |
| 14 |
|
| 15 |
The above copyright notice and this permission notice (including the next |
| 16 |
paragraph) shall be included in all copies or substantial portions of the |
| 17 |
Software. |
| 18 |
|
| 19 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 20 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 21 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 22 |
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 23 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 24 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 25 |
DEALINGS IN THE SOFTWARE. |
| 26 |
</copyright> |
| 27 |
|
| 28 |
<description summary="protocol for constraining pointer motions"> |
| 29 |
This protocol specifies a set of interfaces used for adding constraints to |
| 30 |
the motion of a pointer. Possible constraints include confining pointer |
| 31 |
motions to a given region, or locking it to its current position. |
| 32 |
|
| 33 |
In order to constrain the pointer, a client must first bind the global |
| 34 |
interface "wp_pointer_constraints" which, if a compositor supports pointer |
| 35 |
constraints, is exposed by the registry. Using the bound global object, the |
| 36 |
client uses the request that corresponds to the type of constraint it wants |
| 37 |
to make. See wp_pointer_constraints for more details. |
| 38 |
|
| 39 |
Warning! The protocol described in this file is experimental and backward |
| 40 |
incompatible changes may be made. Backward compatible changes may be added |
| 41 |
together with the corresponding interface version bump. Backward |
| 42 |
incompatible changes are done by bumping the version number in the protocol |
| 43 |
and interface names and resetting the interface version. Once the protocol |
| 44 |
is to be declared stable, the 'z' prefix and the version number in the |
| 45 |
protocol and interface names are removed and the interface version number is |
| 46 |
reset. |
| 47 |
</description> |
| 48 |
|
| 49 |
<interface name="zwp_pointer_constraints_v1" version="1"> |
| 50 |
<description summary="constrain the movement of a pointer"> |
| 51 |
The global interface exposing pointer constraining functionality. It |
| 52 |
exposes two requests: lock_pointer for locking the pointer to its |
| 53 |
position, and confine_pointer for locking the pointer to a region. |
| 54 |
|
| 55 |
The lock_pointer and confine_pointer requests create the objects |
| 56 |
wp_locked_pointer and wp_confined_pointer respectively, and the client can |
| 57 |
use these objects to interact with the lock. |
| 58 |
|
| 59 |
For any surface, only one lock or confinement may be active across all |
| 60 |
wl_pointer objects of the same seat. If a lock or confinement is requested |
| 61 |
when another lock or confinement is active or requested on the same surface |
| 62 |
and with any of the wl_pointer objects of the same seat, an |
| 63 |
'already_constrained' error will be raised. |
| 64 |
</description> |
| 65 |
|
| 66 |
<enum name="error"> |
| 67 |
<description summary="wp_pointer_constraints error values"> |
| 68 |
These errors can be emitted in response to wp_pointer_constraints |
| 69 |
requests. |
| 70 |
</description> |
| 71 |
<entry name="already_constrained" value="1" |
| 72 |
summary="pointer constraint already requested on that surface"/> |
| 73 |
</enum> |
| 74 |
|
| 75 |
<enum name="lifetime"> |
| 76 |
<description summary="constraint lifetime"> |
| 77 |
These values represent different lifetime semantics. They are passed |
| 78 |
as arguments to the factory requests to specify how the constraint |
| 79 |
lifetimes should be managed. |
| 80 |
</description> |
| 81 |
<entry name="oneshot" value="1"> |
| 82 |
<description summary="the pointer constraint is defunct once deactivated"> |
| 83 |
A oneshot pointer constraint will never reactivate once it has been |
| 84 |
deactivated. See the corresponding deactivation event |
| 85 |
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for |
| 86 |
details. |
| 87 |
</description> |
| 88 |
</entry> |
| 89 |
<entry name="persistent" value="2"> |
| 90 |
<description summary="the pointer constraint may reactivate"> |
| 91 |
A persistent pointer constraint may again reactivate once it has |
| 92 |
been deactivated. See the corresponding deactivation event |
| 93 |
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for |
| 94 |
details. |
| 95 |
</description> |
| 96 |
</entry> |
| 97 |
</enum> |
| 98 |
|
| 99 |
<request name="destroy" type="destructor"> |
| 100 |
<description summary="destroy the pointer constraints manager object"> |
| 101 |
Used by the client to notify the server that it will no longer use this |
| 102 |
pointer constraints object. |
| 103 |
</description> |
| 104 |
</request> |
| 105 |
|
| 106 |
<request name="lock_pointer"> |
| 107 |
<description summary="lock pointer to a position"> |
| 108 |
The lock_pointer request lets the client request to disable movements of |
| 109 |
the virtual pointer (i.e. the cursor), effectively locking the pointer |
| 110 |
to a position. This request may not take effect immediately; in the |
| 111 |
future, when the compositor deems implementation-specific constraints |
| 112 |
are satisfied, the pointer lock will be activated and the compositor |
| 113 |
sends a locked event. |
| 114 |
|
| 115 |
The protocol provides no guarantee that the constraints are ever |
| 116 |
satisfied, and does not require the compositor to send an error if the |
| 117 |
constraints cannot ever be satisfied. It is thus possible to request a |
| 118 |
lock that will never activate. |
| 119 |
|
| 120 |
There may not be another pointer constraint of any kind requested or |
| 121 |
active on the surface for any of the wl_pointer objects of the seat of |
| 122 |
the passed pointer when requesting a lock. If there is, an error will be |
| 123 |
raised. See general pointer lock documentation for more details. |
| 124 |
|
| 125 |
The intersection of the region passed with this request and the input |
| 126 |
region of the surface is used to determine where the pointer must be |
| 127 |
in order for the lock to activate. It is up to the compositor whether to |
| 128 |
warp the pointer or require some kind of user interaction for the lock |
| 129 |
to activate. If the region is null the surface input region is used. |
| 130 |
|
| 131 |
A surface may receive pointer focus without the lock being activated. |
| 132 |
|
| 133 |
The request creates a new object wp_locked_pointer which is used to |
| 134 |
interact with the lock as well as receive updates about its state. See |
| 135 |
the the description of wp_locked_pointer for further information. |
| 136 |
|
| 137 |
Note that while a pointer is locked, the wl_pointer objects of the |
| 138 |
corresponding seat will not emit any wl_pointer.motion events, but |
| 139 |
relative motion events will still be emitted via wp_relative_pointer |
| 140 |
objects of the same seat. wl_pointer.axis and wl_pointer.button events |
| 141 |
are unaffected. |
| 142 |
</description> |
| 143 |
<arg name="id" type="new_id" interface="zwp_locked_pointer_v1"/> |
| 144 |
<arg name="surface" type="object" interface="wl_surface" |
| 145 |
summary="surface to lock pointer to"/> |
| 146 |
<arg name="pointer" type="object" interface="wl_pointer" |
| 147 |
summary="the pointer that should be locked"/> |
| 148 |
<arg name="region" type="object" interface="wl_region" allow-null="true" |
| 149 |
summary="region of surface"/> |
| 150 |
<arg name="lifetime" type="uint" enum="lifetime" summary="lock lifetime"/> |
| 151 |
</request> |
| 152 |
|
| 153 |
<request name="confine_pointer"> |
| 154 |
<description summary="confine pointer to a region"> |
| 155 |
The confine_pointer request lets the client request to confine the |
| 156 |
pointer cursor to a given region. This request may not take effect |
| 157 |
immediately; in the future, when the compositor deems implementation- |
| 158 |
specific constraints are satisfied, the pointer confinement will be |
| 159 |
activated and the compositor sends a confined event. |
| 160 |
|
| 161 |
The intersection of the region passed with this request and the input |
| 162 |
region of the surface is used to determine where the pointer must be |
| 163 |
in order for the confinement to activate. It is up to the compositor |
| 164 |
whether to warp the pointer or require some kind of user interaction for |
| 165 |
the confinement to activate. If the region is null the surface input |
| 166 |
region is used. |
| 167 |
|
| 168 |
The request will create a new object wp_confined_pointer which is used |
| 169 |
to interact with the confinement as well as receive updates about its |
| 170 |
state. See the the description of wp_confined_pointer for further |
| 171 |
information. |
| 172 |
</description> |
| 173 |
<arg name="id" type="new_id" interface="zwp_confined_pointer_v1"/> |
| 174 |
<arg name="surface" type="object" interface="wl_surface" |
| 175 |
summary="surface to lock pointer to"/> |
| 176 |
<arg name="pointer" type="object" interface="wl_pointer" |
| 177 |
summary="the pointer that should be confined"/> |
| 178 |
<arg name="region" type="object" interface="wl_region" allow-null="true" |
| 179 |
summary="region of surface"/> |
| 180 |
<arg name="lifetime" type="uint" enum="lifetime" summary="confinement lifetime"/> |
| 181 |
</request> |
| 182 |
</interface> |
| 183 |
|
| 184 |
<interface name="zwp_locked_pointer_v1" version="1"> |
| 185 |
<description summary="receive relative pointer motion events"> |
| 186 |
The wp_locked_pointer interface represents a locked pointer state. |
| 187 |
|
| 188 |
While the lock of this object is active, the wl_pointer objects of the |
| 189 |
associated seat will not emit any wl_pointer.motion events. |
| 190 |
|
| 191 |
This object will send the event 'locked' when the lock is activated. |
| 192 |
Whenever the lock is activated, it is guaranteed that the locked surface |
| 193 |
will already have received pointer focus and that the pointer will be |
| 194 |
within the region passed to the request creating this object. |
| 195 |
|
| 196 |
To unlock the pointer, send the destroy request. This will also destroy |
| 197 |
the wp_locked_pointer object. |
| 198 |
|
| 199 |
If the compositor decides to unlock the pointer the unlocked event is |
| 200 |
sent. See wp_locked_pointer.unlock for details. |
| 201 |
|
| 202 |
When unlocking, the compositor may warp the cursor position to the set |
| 203 |
cursor position hint. If it does, it will not result in any relative |
| 204 |
motion events emitted via wp_relative_pointer. |
| 205 |
|
| 206 |
If the surface the lock was requested on is destroyed and the lock is not |
| 207 |
yet activated, the wp_locked_pointer object is now defunct and must be |
| 208 |
destroyed. |
| 209 |
</description> |
| 210 |
|
| 211 |
<request name="destroy" type="destructor"> |
| 212 |
<description summary="destroy the locked pointer object"> |
| 213 |
Destroy the locked pointer object. If applicable, the compositor will |
| 214 |
unlock the pointer. |
| 215 |
</description> |
| 216 |
</request> |
| 217 |
|
| 218 |
<request name="set_cursor_position_hint"> |
| 219 |
<description summary="set the pointer cursor position hint"> |
| 220 |
Set the cursor position hint relative to the top left corner of the |
| 221 |
surface. |
| 222 |
|
| 223 |
If the client is drawing its own cursor, it should update the position |
| 224 |
hint to the position of its own cursor. A compositor may use this |
| 225 |
information to warp the pointer upon unlock in order to avoid pointer |
| 226 |
jumps. |
| 227 |
|
| 228 |
The cursor position hint is double-buffered state, see |
| 229 |
wl_surface.commit. |
| 230 |
</description> |
| 231 |
<arg name="surface_x" type="fixed" |
| 232 |
summary="surface-local x coordinate"/> |
| 233 |
<arg name="surface_y" type="fixed" |
| 234 |
summary="surface-local y coordinate"/> |
| 235 |
</request> |
| 236 |
|
| 237 |
<request name="set_region"> |
| 238 |
<description summary="set a new lock region"> |
| 239 |
Set a new region used to lock the pointer. |
| 240 |
|
| 241 |
The new lock region is double-buffered, see wl_surface.commit. |
| 242 |
|
| 243 |
For details about the lock region, see wp_locked_pointer. |
| 244 |
</description> |
| 245 |
<arg name="region" type="object" interface="wl_region" allow-null="true" |
| 246 |
summary="region of surface"/> |
| 247 |
</request> |
| 248 |
|
| 249 |
<event name="locked"> |
| 250 |
<description summary="lock activation event"> |
| 251 |
Notification that the pointer lock of the seat's pointer is activated. |
| 252 |
</description> |
| 253 |
</event> |
| 254 |
|
| 255 |
<event name="unlocked"> |
| 256 |
<description summary="lock deactivation event"> |
| 257 |
Notification that the pointer lock of the seat's pointer is no longer |
| 258 |
active. If this is a oneshot pointer lock (see |
| 259 |
wp_pointer_constraints.lifetime) this object is now defunct and should |
| 260 |
be destroyed. If this is a persistent pointer lock (see |
| 261 |
wp_pointer_constraints.lifetime) this pointer lock may again |
| 262 |
reactivate in the future. |
| 263 |
</description> |
| 264 |
</event> |
| 265 |
</interface> |
| 266 |
|
| 267 |
<interface name="zwp_confined_pointer_v1" version="1"> |
| 268 |
<description summary="confined pointer object"> |
| 269 |
The wp_confined_pointer interface represents a confined pointer state. |
| 270 |
|
| 271 |
This object will send the event 'confined' when the confinement is |
| 272 |
activated. Whenever the confinement is activated, it is guaranteed that |
| 273 |
the surface the pointer is confined to will already have received pointer |
| 274 |
focus and that the pointer will be within the region passed to the request |
| 275 |
creating this object. It is up to the compositor to decide whether this |
| 276 |
requires some user interaction and if the pointer will warp to within the |
| 277 |
passed region if outside. |
| 278 |
|
| 279 |
To unconfine the pointer, send the destroy request. This will also destroy |
| 280 |
the wp_confined_pointer object. |
| 281 |
|
| 282 |
If the compositor decides to unconfine the pointer the unconfined event is |
| 283 |
sent. The wp_confined_pointer object is at this point defunct and should |
| 284 |
be destroyed. |
| 285 |
</description> |
| 286 |
|
| 287 |
<request name="destroy" type="destructor"> |
| 288 |
<description summary="destroy the confined pointer object"> |
| 289 |
Destroy the confined pointer object. If applicable, the compositor will |
| 290 |
unconfine the pointer. |
| 291 |
</description> |
| 292 |
</request> |
| 293 |
|
| 294 |
<request name="set_region"> |
| 295 |
<description summary="set a new confine region"> |
| 296 |
Set a new region used to confine the pointer. |
| 297 |
|
| 298 |
The new confine region is double-buffered, see wl_surface.commit. |
| 299 |
|
| 300 |
If the confinement is active when the new confinement region is applied |
| 301 |
and the pointer ends up outside of newly applied region, the pointer may |
| 302 |
warped to a position within the new confinement region. If warped, a |
| 303 |
wl_pointer.motion event will be emitted, but no |
| 304 |
wp_relative_pointer.relative_motion event. |
| 305 |
|
| 306 |
The compositor may also, instead of using the new region, unconfine the |
| 307 |
pointer. |
| 308 |
|
| 309 |
For details about the confine region, see wp_confined_pointer. |
| 310 |
</description> |
| 311 |
<arg name="region" type="object" interface="wl_region" allow-null="true" |
| 312 |
summary="region of surface"/> |
| 313 |
</request> |
| 314 |
|
| 315 |
<event name="confined"> |
| 316 |
<description summary="pointer confined"> |
| 317 |
Notification that the pointer confinement of the seat's pointer is |
| 318 |
activated. |
| 319 |
</description> |
| 320 |
</event> |
| 321 |
|
| 322 |
<event name="unconfined"> |
| 323 |
<description summary="pointer unconfined"> |
| 324 |
Notification that the pointer confinement of the seat's pointer is no |
| 325 |
longer active. If this is a oneshot pointer confinement (see |
| 326 |
wp_pointer_constraints.lifetime) this object is now defunct and should |
| 327 |
be destroyed. If this is a persistent pointer confinement (see |
| 328 |
wp_pointer_constraints.lifetime) this pointer confinement may again |
| 329 |
reactivate in the future. |
| 330 |
</description> |
| 331 |
</event> |
| 332 |
</interface> |
| 333 |
|
| 334 |
</protocol> |