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