wayland_protocols/wp.rs
1//! Generic wayland protocols
2
3#![cfg_attr(rustfmt, rustfmt_skip)]
4
5#[cfg(feature = "staging")]
6pub mod content_type {
7 //! This protocol allows a client to describe the kind of content a surface
8 //! will display, to allow the compositor to optimize its behavior for it.
9
10 #[allow(missing_docs)]
11 pub mod v1 {
12 wayland_protocol!(
13 "./protocols/staging/content-type/content-type-v1.xml",
14 []
15 );
16 }
17}
18
19#[cfg(feature = "staging")]
20pub mod color_management {
21 //! The aim of the color management extension is to allow clients to know
22 //! the color properties of outputs, and to tell the compositor about the color
23 //! properties of their content on surfaces. Doing this enables a compositor
24 //! to perform automatic color management of content for different outputs
25 //! according to how content is intended to look like.
26 //!
27 //! The color properties are represented as an image description object which
28 //! is immutable after it has been created. A wl_output always has an
29 //! associated image description that clients can observe. A wl_surface
30 //! always has an associated preferred image description as a hint chosen by
31 //! the compositor that clients can also observe. Clients can set an image
32 //! description on a wl_surface to denote the color characteristics of the
33 //! surface contents.
34 //!
35 //! An image description includes SDR and HDR colorimetry and encoding, HDR
36 //! metadata, and viewing environment parameters. An image description does
37 //! not include the properties set through color-representation extension.
38 //! It is expected that the color-representation extension is used in
39 //! conjunction with the color management extension when necessary,
40 //! particularly with the YUV family of pixel formats.
41 //!
42 //! Recommendation ITU-T H.273
43 //! "Coding-independent code points for video signal type identification"
44 //! shall be referred to as simply H.273 here.
45 //!
46 //! The color-and-hdr repository
47 //! (<https://gitlab.freedesktop.org/pq/color-and-hdr>) contains
48 //! background information on the protocol design and legacy color management.
49 //! It also contains a glossary, learning resources for digital color, tools,
50 //! samples and more.
51 //!
52 //! The terminology used in this protocol is based on common color science and
53 //! color encoding terminology where possible. The glossary in the color-and-hdr
54 //! repository shall be the authority on the definition of terms in this
55 //! protocol.
56 //!
57 //! Warning! The protocol described in this file is currently in the testing
58 //! phase. Backward compatible changes may be added together with the
59 //! corresponding interface version bump. Backward incompatible changes can
60 //! only be done by creating a new major version of the extension.
61
62 #[allow(missing_docs)]
63 pub mod v1 {
64 wayland_protocol!(
65 "./protocols/staging/color-management/color-management-v1.xml",
66 []
67 );
68 }
69}
70
71#[cfg(feature = "staging")]
72pub mod drm_lease {
73 //! This protocol is used by Wayland compositors which act as Direct
74 //! Renderering Manager (DRM) masters to lease DRM resources to Wayland
75 //! clients.
76 //!
77 //! The compositor will advertise one wp_drm_lease_device_v1 global for each
78 //! DRM node. Some time after a client binds to the wp_drm_lease_device_v1
79 //! global, the compositor will send a drm_fd event followed by zero, one or
80 //! more connector events. After all currently available connectors have been
81 //! sent, the compositor will send a wp_drm_lease_device_v1.done event.
82 //!
83 //! When the list of connectors available for lease changes the compositor
84 //! will send wp_drm_lease_device_v1.connector events for added connectors and
85 //! wp_drm_lease_connector_v1.withdrawn events for removed connectors,
86 //! followed by a wp_drm_lease_device_v1.done event.
87 //!
88 //! The compositor will indicate when a device is gone by removing the global
89 //! via a wl_registry.global_remove event. Upon receiving this event, the
90 //! client should destroy any matching wp_drm_lease_device_v1 object.
91 //!
92 //! To destroy a wp_drm_lease_device_v1 object, the client must first issue
93 //! a release request. Upon receiving this request, the compositor will
94 //! immediately send a released event and destroy the object. The client must
95 //! continue to process and discard drm_fd and connector events until it
96 //! receives the released event. Upon receiving the released event, the
97 //! client can safely cleanup any client-side resources.
98
99 #[allow(missing_docs)]
100 pub mod v1 {
101 wayland_protocol!(
102 "./protocols/staging/drm-lease/drm-lease-v1.xml",
103 []
104 );
105 }
106}
107
108#[cfg(feature = "staging")]
109pub mod tearing_control {
110 //! This protocol provides a way for clients to indicate whether
111 //! or not their content is suitable for this kind of presentation.
112 //!
113 //! For some use cases like games or drawing tablets it can make sense to reduce
114 //! latency by accepting tearing with the use of asynchronous page flips.
115
116 #[allow(missing_docs)]
117 pub mod v1 {
118 wayland_protocol!(
119 "./protocols/staging/tearing-control/tearing-control-v1.xml",
120 []
121 );
122 }
123}
124
125#[cfg(feature = "staging")]
126pub mod fractional_scale {
127 //! This protocol allows a compositor to suggest for surfaces to render at
128 //! fractional scales.
129 //!
130 //! A client can submit scaled content by utilizing wp_viewport. This is done by
131 //! creating a wp_viewport object for the surface and setting the destination
132 //! rectangle to the surface size before the scale factor is applied.
133 //!
134 //! The buffer size is calculated by multiplying the surface size by the
135 //! intended scale.
136 //!
137 //! The wl_surface buffer scale should remain set to 1.
138 //!
139 //! If a surface has a surface-local size of 100 px by 50 px and wishes to
140 //! submit buffers with a scale of 1.5, then a buffer of 150px by 75 px should
141 //! be used and the wp_viewport destination rectangle should be 100 px by 50 px.
142 //!
143 //! For toplevel surfaces, the size is rounded halfway away from zero. The
144 //! rounding algorithm for subsurface position and size is not defined.
145
146 #[allow(missing_docs)]
147 pub mod v1 {
148 wayland_protocol!(
149 "./protocols/staging/fractional-scale/fractional-scale-v1.xml",
150 []
151 );
152 }
153}
154
155#[cfg(feature = "unstable")]
156pub mod fullscreen_shell {
157 //! Fullscreen shell protocol
158
159 /// Unstable version 1
160 pub mod zv1 {
161 wayland_protocol!(
162 "./protocols/unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml",
163 []
164 );
165 }
166}
167
168#[cfg(feature = "unstable")]
169pub mod idle_inhibit {
170 //! Screensaver inhibition protocol
171
172 /// Unstable version 1
173 pub mod zv1 {
174 wayland_protocol!(
175 "./protocols/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml",
176 []
177 );
178 }
179}
180
181#[cfg(feature = "unstable")]
182pub mod input_method {
183 //! Input method protocol
184
185 /// Unstable version 1
186 pub mod zv1 {
187 wayland_protocol!(
188 "./protocols/unstable/input-method/input-method-unstable-v1.xml",
189 []
190 );
191 }
192}
193
194#[cfg(feature = "unstable")]
195pub mod input_timestamps {
196 //! Input timestamps protocol
197
198 /// Unstable version 1
199 pub mod zv1 {
200 wayland_protocol!(
201 "./protocols/unstable/input-timestamps/input-timestamps-unstable-v1.xml",
202 []
203 );
204 }
205}
206
207#[cfg(feature = "unstable")]
208pub mod keyboard_shortcuts_inhibit {
209 //! Protocol for inhibiting the compositor keyboard shortcuts
210 //!
211 //! This protocol specifies a way for a client to request the compositor
212 //! to ignore its own keyboard shortcuts for a given seat, so that all
213 //! key events from that seat get forwarded to a surface.
214
215 /// Unstable version 1
216 pub mod zv1 {
217 wayland_protocol!(
218 "./protocols/unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml",
219 []
220 );
221 }
222}
223
224pub mod linux_dmabuf {
225 //! Linux DMA-BUF protocol
226
227 /// Unstable version 1
228 pub mod zv1 {
229 wayland_protocol!(
230 "./protocols/stable/linux-dmabuf/linux-dmabuf-v1.xml",
231 []
232 );
233 }
234}
235
236#[cfg(feature = "unstable")]
237pub mod linux_explicit_synchronization {
238 //! Linux explicit synchronization protocol
239
240 /// Unstable version 1
241 pub mod zv1 {
242 wayland_protocol!(
243 "./protocols/unstable/linux-explicit-synchronization/linux-explicit-synchronization-unstable-v1.xml",
244 []
245 );
246 }
247}
248
249#[cfg(feature = "staging")]
250pub mod linux_drm_syncobj {
251 //! This protocol allows clients to request explicit synchronization for
252 //! buffers. It is tied to the Linux DRM synchronization object framework.
253 //!
254 //! Synchronization refers to co-ordination of pipelined operations performed
255 //! on buffers. Most GPU clients will schedule an asynchronous operation to
256 //! render to the buffer, then immediately send the buffer to the compositor
257 //! to be attached to a surface.
258 //!
259 //! With implicit synchronization, ensuring that the rendering operation is
260 //! complete before the compositor displays the buffer is an implementation
261 //! detail handled by either the kernel or userspace graphics driver.
262 //!
263 //! By contrast, with explicit synchronization, DRM synchronization object
264 //! timeline points mark when the asynchronous operations are complete. When
265 //! submitting a buffer, the client provides a timeline point which will be
266 //! waited on before the compositor accesses the buffer, and another timeline
267 //! point that the compositor will signal when it no longer needs to access the
268 //! buffer contents for the purposes of the surface commit.
269 //!
270 //! Linux DRM synchronization objects are documented at:
271 //! <https://dri.freedesktop.org/docs/drm/gpu/drm-mm.html#drm-sync-objects>
272
273 /// Version 1
274 pub mod v1 {
275 wayland_protocol!(
276 "./protocols/staging/linux-drm-syncobj/linux-drm-syncobj-v1.xml",
277 []
278 );
279 }
280}
281
282#[cfg(feature = "unstable")]
283pub mod pointer_constraints {
284 //! protocol for constraining pointer motions
285 //!
286 //! This protocol specifies a set of interfaces used for adding constraints to
287 //! the motion of a pointer. Possible constraints include confining pointer
288 //! motions to a given region, or locking it to its current position.
289 //!
290 //! In order to constrain the pointer, a client must first bind the global
291 //! interface "wp_pointer_constraints" which, if a compositor supports pointer
292 //! constraints, is exposed by the registry. Using the bound global object, the
293 //! client uses the request that corresponds to the type of constraint it wants
294 //! to make. See wp_pointer_constraints for more details.
295
296 /// Unstable version 1
297 pub mod zv1 {
298 wayland_protocol!(
299 "./protocols/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml",
300 []
301 );
302 }
303}
304
305#[cfg(feature = "unstable")]
306pub mod pointer_gestures {
307 //! Pointer gestures protocol
308
309 /// Unstable version 1
310 pub mod zv1 {
311 wayland_protocol!(
312 "./protocols/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml",
313 []
314 );
315 }
316}
317
318pub mod presentation_time {
319 //! Presentation time protocol
320 //!
321 //! Allows precise feedback on presentation timing, for example for smooth video playback.
322
323 wayland_protocol!(
324 "./protocols/stable/presentation-time/presentation-time.xml",
325 []
326 );
327}
328
329#[cfg(feature = "unstable")]
330pub mod primary_selection {
331 //! Primary selection protocol
332
333 /// Unstable version 1
334 pub mod zv1 {
335 wayland_protocol!(
336 "./protocols/unstable/primary-selection/primary-selection-unstable-v1.xml",
337 []
338 );
339 }
340}
341
342#[cfg(feature = "unstable")]
343pub mod relative_pointer {
344 //! protocol for relative pointer motion events
345 //!
346 //! This protocol specifies a set of interfaces used for making clients able to
347 //! receive relative pointer events not obstructed by barriers (such as the
348 //! monitor edge or other pointer barriers).
349 //!
350 //! To start receiving relative pointer events, a client must first bind the
351 //! global interface "wp_relative_pointer_manager" which, if a compositor
352 //! supports relative pointer motion events, is exposed by the registry. After
353 //! having created the relative pointer manager proxy object, the client uses
354 //! it to create the actual relative pointer object using the
355 //! "get_relative_pointer" request given a wl_pointer. The relative pointer
356 //! motion events will then, when applicable, be transmitted via the proxy of
357 //! the newly created relative pointer object. See the documentation of the
358 //! relative pointer interface for more details.
359
360 /// Unstable version 1
361 pub mod zv1 {
362 wayland_protocol!(
363 "./protocols/unstable/relative-pointer/relative-pointer-unstable-v1.xml",
364 []
365 );
366 }
367}
368
369#[cfg(feature = "staging")]
370pub mod single_pixel_buffer {
371 //! This protocol extension allows clients to create single-pixel buffers.
372 //!
373 //! Compositors supporting this protocol extension should also support the
374 //! viewporter protocol extension. Clients may use viewporter to scale a
375 //! single-pixel buffer to a desired size.
376
377 /// Version 1
378 pub mod v1 {
379 wayland_protocol!(
380 "./protocols/staging/single-pixel-buffer/single-pixel-buffer-v1.xml",
381 []
382 );
383 }
384}
385
386#[cfg(all(feature = "staging", feature = "unstable"))]
387pub mod cursor_shape {
388 //! This protocol extension offers a simpler way for clients to set a cursor.
389
390 /// Version 1
391 pub mod v1 {
392 wayland_protocol!(
393 "./protocols/staging/cursor-shape/cursor-shape-v1.xml",
394 [crate::wp::tablet::zv2]
395 );
396 }
397}
398
399pub mod tablet {
400 //! Wayland protocol for graphics tablets
401 //!
402 //! This description provides a high-level overview of the interplay between
403 //! the interfaces defined this protocol. For details, see the protocol
404 //! specification.
405 //!
406 //! More than one tablet may exist, and device-specifics matter. Tablets are
407 //! not represented by a single virtual device like wl_pointer. A client
408 //! binds to the tablet manager object which is just a proxy object. From
409 //! that, the client requests wp_tablet_manager.get_tablet_seat(wl_seat)
410 //! and that returns the actual interface that has all the tablets. With
411 //! this indirection, we can avoid merging wp_tablet into the actual Wayland
412 //! protocol, a long-term benefit.
413 //!
414 //! The wp_tablet_seat sends a "tablet added" event for each tablet
415 //! connected. That event is followed by descriptive events about the
416 //! hardware; currently that includes events for name, vid/pid and
417 //! a wp_tablet.path event that describes a local path. This path can be
418 //! used to uniquely identify a tablet or get more information through
419 //! libwacom. Emulated or nested tablets can skip any of those, e.g. a
420 //! virtual tablet may not have a vid/pid. The sequence of descriptive
421 //! events is terminated by a wp_tablet.done event to signal that a client
422 //! may now finalize any initialization for that tablet.
423 //!
424 //! Events from tablets require a tool in proximity. Tools are also managed
425 //! by the tablet seat; a "tool added" event is sent whenever a tool is new
426 //! to the compositor. That event is followed by a number of descriptive
427 //! events about the hardware; currently that includes capabilities,
428 //! hardware id and serial number, and tool type. Similar to the tablet
429 //! interface, a wp_tablet_tool.done event is sent to terminate that initial
430 //! sequence.
431 //!
432 //! Any event from a tool happens on the wp_tablet_tool interface. When the
433 //! tool gets into proximity of the tablet, a proximity_in event is sent on
434 //! the wp_tablet_tool interface, listing the tablet and the surface. That
435 //! event is followed by a motion event with the coordinates. After that,
436 //! it's the usual motion, axis, button, etc. events. The protocol's
437 //! serialisation means events are grouped by wp_tablet_tool.frame events.
438 //!
439 //! Two special events (that don't exist in X) are down and up. They signal
440 //! "tip touching the surface". For tablets without real proximity
441 //! detection, the sequence is: proximity_in, motion, down, frame.
442 //!
443 //! When the tool leaves proximity, a proximity_out event is sent. If any
444 //! button is still down, a button release event is sent before this
445 //! proximity event. These button events are sent in the same frame as the
446 //! proximity event to signal to the client that the buttons were held when
447 //! the tool left proximity.
448 //!
449 //! If the tool moves out of the surface but stays in proximity (i.e.
450 //! between windows), compositor-specific grab policies apply. This usually
451 //! means that the proximity-out is delayed until all buttons are released.
452 //!
453 //! Moving a tool physically from one tablet to the other has no real effect
454 //! on the protocol, since we already have the tool object from the "tool
455 //! added" event. All the information is already there and the proximity
456 //! events on both tablets are all a client needs to reconstruct what
457 //! happened.
458 //!
459 //! Some extra axes are normalized, i.e. the client knows the range as
460 //! specified in the protocol (e.g. [0, 65535]), the granularity however is
461 //! unknown. The current normalized axes are pressure, distance, and slider.
462 //!
463 //! Other extra axes are in physical units as specified in the protocol.
464 //! The current extra axes with physical units are tilt, rotation and
465 //! wheel rotation.
466 //!
467 //! Since tablets work independently of the pointer controlled by the mouse,
468 //! the focus handling is independent too and controlled by proximity.
469 //! The wp_tablet_tool.set_cursor request sets a tool-specific cursor.
470 //! This cursor surface may be the same as the mouse cursor, and it may be
471 //! the same across tools but it is possible to be more fine-grained. For
472 //! example, a client may set different cursors for the pen and eraser.
473 //!
474 //! Tools are generally independent of tablets and it is
475 //! compositor-specific policy when a tool can be removed. Common approaches
476 //! will likely include some form of removing a tool when all tablets the
477 //! tool was used on are removed.
478
479 /// Unstable version 1
480 pub mod zv1 {
481 wayland_protocol!(
482 "./protocols/unstable/tablet/tablet-unstable-v1.xml",
483 []
484 );
485 }
486
487 /// Unstable version 2
488 pub mod zv2 {
489 wayland_protocol!(
490 "./protocols/unstable/tablet/tablet-unstable-v2.xml",
491 []
492 );
493 }
494}
495
496#[cfg(feature = "unstable")]
497pub mod text_input {
498 //! Text input protocol
499
500 /// Unstable version 1
501 pub mod zv1 {
502 wayland_protocol!(
503 "./protocols/unstable/text-input/text-input-unstable-v1.xml",
504 []
505 );
506 }
507
508 /// Unstable version 3
509 pub mod zv3 {
510 wayland_protocol!(
511 "./protocols/unstable/text-input/text-input-unstable-v3.xml",
512 []
513 );
514 }
515}
516
517pub mod viewporter {
518 //! Viewporter protocol
519 //!
520 //! Provides the capability of scaling and cropping surfaces, decorrelating the surface
521 //! dimensions from the size of the buffer.
522
523 wayland_protocol!("./protocols/stable/viewporter/viewporter.xml", []);
524}
525
526#[cfg(feature = "staging")]
527pub mod security_context {
528 //! This interface allows a client to register a new Wayland connection to
529 //! the compositor and attach a security context to it.
530 //!
531 //! This is intended to be used by sandboxes. Sandbox engines attach a
532 //! security context to all connections coming from inside the sandbox. The
533 //! compositor can then restrict the features that the sandboxed connections
534 //! can use.
535 //!
536 //! Compositors should forbid nesting multiple security contexts by not
537 //! exposing wp_security_context_manager_v1 global to clients with a security
538 //! context attached, or by sending the nested protocol error. Nested
539 //! security contexts are dangerous because they can potentially allow
540 //! privilege escalation of a sandboxed client.
541
542 #[allow(missing_docs)]
543 pub mod v1 {
544 wayland_protocol!(
545 "./protocols/staging/security-context/security-context-v1.xml",
546 []
547 );
548 }
549}
550
551#[cfg(feature = "staging")]
552pub mod alpha_modifier {
553 //! This interface allows a client to set a factor for the alpha values on a
554 //! surface, which can be used to offload such operations to the compositor,
555 //! which can in turn for example offload them to KMS.
556
557 #[allow(missing_docs)]
558 pub mod v1 {
559 wayland_protocol!(
560 "./protocols/staging/alpha-modifier/alpha-modifier-v1.xml",
561 []
562 );
563 }
564}
565
566#[cfg(feature = "staging")]
567pub mod fifo {
568 //! When a Wayland compositor considers applying a content update,
569 //! it must ensure all the update's readiness constraints (fences, etc)
570 //! are met.
571 //!
572 //! This protocol provides a way to use the completion of a display refresh
573 //! cycle as an additional readiness constraint.
574
575 #[allow(missing_docs)]
576 pub mod v1 {
577 wayland_protocol!(
578 "./protocols/staging/fifo/fifo-v1.xml",
579 []
580 );
581 }
582}
583
584#[cfg(feature = "staging")]
585pub mod commit_timing {
586 //! When a compositor latches on to new content updates it will check for
587 //! any number of requirements of the available content updates (such as
588 //! fences of all buffers being signalled) to consider the update ready.
589 //!
590 //! This protocol provides a method for adding a time constraint to surface
591 //! content. This constraint indicates to the compositor that a content
592 //! update should be presented as closely as possible to, but not before,
593 //! a specified time.
594 //!
595 //! This protocol does not change the Wayland property that content
596 //! updates are applied in the order they are received, even when some
597 //! content updates contain timestamps and others do not.
598 //!
599 //! To provide timestamps, this global factory interface must be used to
600 //! acquire a `wp_commit_timing_v1` object for a surface, which may then be
601 //! used to provide timestamp information for commits.
602
603 #[allow(missing_docs)]
604 pub mod v1 {
605 wayland_protocol!(
606 "./protocols/staging/commit-timing/commit-timing-v1.xml",
607 []
608 );
609 }
610}