1 | //! Generic wayland protocols |
2 | |
3 | #![cfg_attr (rustfmt, rustfmt_skip)] |
4 | |
5 | #[cfg (feature = "staging" )] |
6 | pub 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" )] |
20 | pub mod drm_lease { |
21 | //! This protocol is used by Wayland compositors which act as Direct |
22 | //! Renderering Manager (DRM) masters to lease DRM resources to Wayland |
23 | //! clients. |
24 | //! |
25 | //! The compositor will advertise one wp_drm_lease_device_v1 global for each |
26 | //! DRM node. Some time after a client binds to the wp_drm_lease_device_v1 |
27 | //! global, the compositor will send a drm_fd event followed by zero, one or |
28 | //! more connector events. After all currently available connectors have been |
29 | //! sent, the compositor will send a wp_drm_lease_device_v1.done event. |
30 | //! |
31 | //! When the list of connectors available for lease changes the compositor |
32 | //! will send wp_drm_lease_device_v1.connector events for added connectors and |
33 | //! wp_drm_lease_connector_v1.withdrawn events for removed connectors, |
34 | //! followed by a wp_drm_lease_device_v1.done event. |
35 | //! |
36 | //! The compositor will indicate when a device is gone by removing the global |
37 | //! via a wl_registry.global_remove event. Upon receiving this event, the |
38 | //! client should destroy any matching wp_drm_lease_device_v1 object. |
39 | //! |
40 | //! To destroy a wp_drm_lease_device_v1 object, the client must first issue |
41 | //! a release request. Upon receiving this request, the compositor will |
42 | //! immediately send a released event and destroy the object. The client must |
43 | //! continue to process and discard drm_fd and connector events until it |
44 | //! receives the released event. Upon receiving the released event, the |
45 | //! client can safely cleanup any client-side resources. |
46 | |
47 | #[allow (missing_docs)] |
48 | pub mod v1 { |
49 | wayland_protocol!( |
50 | "./protocols/staging/drm-lease/drm-lease-v1.xml" , |
51 | [] |
52 | ); |
53 | } |
54 | } |
55 | |
56 | #[cfg (feature = "staging" )] |
57 | pub mod tearing_control { |
58 | //! This protocol provides a way for clients to indicate whether |
59 | //! or not their content is suitable for this kind of presentation. |
60 | //! |
61 | //! For some use cases like games or drawing tablets it can make sense to reduce |
62 | //! latency by accepting tearing with the use of asynchronous page flips. |
63 | |
64 | #[allow (missing_docs)] |
65 | pub mod v1 { |
66 | wayland_protocol!( |
67 | "./protocols/staging/tearing-control/tearing-control-v1.xml" , |
68 | [] |
69 | ); |
70 | } |
71 | } |
72 | |
73 | #[cfg (feature = "staging" )] |
74 | pub mod fractional_scale { |
75 | //! This protocol allows a compositor to suggest for surfaces to render at |
76 | //! fractional scales. |
77 | //! |
78 | //! A client can submit scaled content by utilizing wp_viewport. This is done by |
79 | //! creating a wp_viewport object for the surface and setting the destination |
80 | //! rectangle to the surface size before the scale factor is applied. |
81 | //! |
82 | //! The buffer size is calculated by multiplying the surface size by the |
83 | //! intended scale. |
84 | //! |
85 | //! The wl_surface buffer scale should remain set to 1. |
86 | //! |
87 | //! If a surface has a surface-local size of 100 px by 50 px and wishes to |
88 | //! submit buffers with a scale of 1.5, then a buffer of 150px by 75 px should |
89 | //! be used and the wp_viewport destination rectangle should be 100 px by 50 px. |
90 | //! |
91 | //! For toplevel surfaces, the size is rounded halfway away from zero. The |
92 | //! rounding algorithm for subsurface position and size is not defined. |
93 | |
94 | #[allow (missing_docs)] |
95 | pub mod v1 { |
96 | wayland_protocol!( |
97 | "./protocols/staging/fractional-scale/fractional-scale-v1.xml" , |
98 | [] |
99 | ); |
100 | } |
101 | } |
102 | |
103 | #[cfg (feature = "unstable" )] |
104 | pub mod fullscreen_shell { |
105 | //! Fullscreen shell protocol |
106 | |
107 | /// Unstable version 1 |
108 | pub mod zv1 { |
109 | wayland_protocol!( |
110 | "./protocols/unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml" , |
111 | [] |
112 | ); |
113 | } |
114 | } |
115 | |
116 | #[cfg (feature = "unstable" )] |
117 | pub mod idle_inhibit { |
118 | //! Screensaver inhibition protocol |
119 | |
120 | /// Unstable version 1 |
121 | pub mod zv1 { |
122 | wayland_protocol!( |
123 | "./protocols/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml" , |
124 | [] |
125 | ); |
126 | } |
127 | } |
128 | |
129 | #[cfg (feature = "unstable" )] |
130 | pub mod input_method { |
131 | //! Input method protocol |
132 | |
133 | /// Unstable version 1 |
134 | pub mod zv1 { |
135 | wayland_protocol!( |
136 | "./protocols/unstable/input-method/input-method-unstable-v1.xml" , |
137 | [] |
138 | ); |
139 | } |
140 | } |
141 | |
142 | #[cfg (feature = "unstable" )] |
143 | pub mod input_timestamps { |
144 | //! Input timestamps protocol |
145 | |
146 | /// Unstable version 1 |
147 | pub mod zv1 { |
148 | wayland_protocol!( |
149 | "./protocols/unstable/input-timestamps/input-timestamps-unstable-v1.xml" , |
150 | [] |
151 | ); |
152 | } |
153 | } |
154 | |
155 | #[cfg (feature = "unstable" )] |
156 | pub mod keyboard_shortcuts_inhibit { |
157 | //! Protocol for inhibiting the compositor keyboard shortcuts |
158 | //! |
159 | //! This protocol specifies a way for a client to request the compositor |
160 | //! to ignore its own keyboard shortcuts for a given seat, so that all |
161 | //! key events from that seat get forwarded to a surface. |
162 | |
163 | /// Unstable version 1 |
164 | pub mod zv1 { |
165 | wayland_protocol!( |
166 | "./protocols/unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml" , |
167 | [] |
168 | ); |
169 | } |
170 | } |
171 | |
172 | pub mod linux_dmabuf { |
173 | //! Linux DMA-BUF protocol |
174 | |
175 | /// Unstable version 1 |
176 | pub mod zv1 { |
177 | wayland_protocol!( |
178 | "./protocols/stable/linux-dmabuf/linux-dmabuf-v1.xml" , |
179 | [] |
180 | ); |
181 | } |
182 | } |
183 | |
184 | #[cfg (feature = "unstable" )] |
185 | pub mod linux_explicit_synchronization { |
186 | //! Linux explicit synchronization protocol |
187 | |
188 | /// Unstable version 1 |
189 | pub mod zv1 { |
190 | wayland_protocol!( |
191 | "./protocols/unstable/linux-explicit-synchronization/linux-explicit-synchronization-unstable-v1.xml" , |
192 | [] |
193 | ); |
194 | } |
195 | } |
196 | |
197 | #[cfg (feature = "unstable" )] |
198 | pub mod pointer_constraints { |
199 | //! protocol for constraining pointer motions |
200 | //! |
201 | //! This protocol specifies a set of interfaces used for adding constraints to |
202 | //! the motion of a pointer. Possible constraints include confining pointer |
203 | //! motions to a given region, or locking it to its current position. |
204 | //! |
205 | //! In order to constrain the pointer, a client must first bind the global |
206 | //! interface "wp_pointer_constraints" which, if a compositor supports pointer |
207 | //! constraints, is exposed by the registry. Using the bound global object, the |
208 | //! client uses the request that corresponds to the type of constraint it wants |
209 | //! to make. See wp_pointer_constraints for more details. |
210 | |
211 | /// Unstable version 1 |
212 | pub mod zv1 { |
213 | wayland_protocol!( |
214 | "./protocols/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml" , |
215 | [] |
216 | ); |
217 | } |
218 | } |
219 | |
220 | #[cfg (feature = "unstable" )] |
221 | pub mod pointer_gestures { |
222 | //! Pointer gestures protocol |
223 | |
224 | /// Unstable version 1 |
225 | pub mod zv1 { |
226 | wayland_protocol!( |
227 | "./protocols/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml" , |
228 | [] |
229 | ); |
230 | } |
231 | } |
232 | |
233 | pub mod presentation_time { |
234 | //! Presentation time protocol |
235 | //! |
236 | //! Allows precise feedback on presentation timing, for example for smooth video playback. |
237 | |
238 | wayland_protocol!( |
239 | "./protocols/stable/presentation-time/presentation-time.xml" , |
240 | [] |
241 | ); |
242 | } |
243 | |
244 | #[cfg (feature = "unstable" )] |
245 | pub mod primary_selection { |
246 | //! Primary selection protocol |
247 | |
248 | /// Unstable version 1 |
249 | pub mod zv1 { |
250 | wayland_protocol!( |
251 | "./protocols/unstable/primary-selection/primary-selection-unstable-v1.xml" , |
252 | [] |
253 | ); |
254 | } |
255 | } |
256 | |
257 | #[cfg (feature = "unstable" )] |
258 | pub mod relative_pointer { |
259 | //! protocol for relative pointer motion events |
260 | //! |
261 | //! This protocol specifies a set of interfaces used for making clients able to |
262 | //! receive relative pointer events not obstructed by barriers (such as the |
263 | //! monitor edge or other pointer barriers). |
264 | //! |
265 | //! To start receiving relative pointer events, a client must first bind the |
266 | //! global interface "wp_relative_pointer_manager" which, if a compositor |
267 | //! supports relative pointer motion events, is exposed by the registry. After |
268 | //! having created the relative pointer manager proxy object, the client uses |
269 | //! it to create the actual relative pointer object using the |
270 | //! "get_relative_pointer" request given a wl_pointer. The relative pointer |
271 | //! motion events will then, when applicable, be transmitted via the proxy of |
272 | //! the newly created relative pointer object. See the documentation of the |
273 | //! relative pointer interface for more details. |
274 | |
275 | /// Unstable version 1 |
276 | pub mod zv1 { |
277 | wayland_protocol!( |
278 | "./protocols/unstable/relative-pointer/relative-pointer-unstable-v1.xml" , |
279 | [] |
280 | ); |
281 | } |
282 | } |
283 | |
284 | #[cfg (feature = "staging" )] |
285 | pub mod single_pixel_buffer { |
286 | //! This protocol extension allows clients to create single-pixel buffers. |
287 | //! |
288 | //! Compositors supporting this protocol extension should also support the |
289 | //! viewporter protocol extension. Clients may use viewporter to scale a |
290 | //! single-pixel buffer to a desired size. |
291 | |
292 | /// Version 1 |
293 | pub mod v1 { |
294 | wayland_protocol!( |
295 | "./protocols/staging/single-pixel-buffer/single-pixel-buffer-v1.xml" , |
296 | [] |
297 | ); |
298 | } |
299 | } |
300 | |
301 | #[cfg (all(feature = "staging" , feature = "unstable" ))] |
302 | pub mod cursor_shape { |
303 | //! This protocol extension offers a simpler way for clients to set a cursor. |
304 | |
305 | /// Version 1 |
306 | pub mod v1 { |
307 | wayland_protocol!( |
308 | "./protocols/staging/cursor-shape/cursor-shape-v1.xml" , |
309 | [crate::wp::tablet::zv2] |
310 | ); |
311 | } |
312 | } |
313 | |
314 | #[cfg (feature = "unstable" )] |
315 | pub mod tablet { |
316 | //! Wayland protocol for graphics tablets |
317 | //! |
318 | //! This description provides a high-level overview of the interplay between |
319 | //! the interfaces defined this protocol. For details, see the protocol |
320 | //! specification. |
321 | //! |
322 | //! More than one tablet may exist, and device-specifics matter. Tablets are |
323 | //! not represented by a single virtual device like wl_pointer. A client |
324 | //! binds to the tablet manager object which is just a proxy object. From |
325 | //! that, the client requests wp_tablet_manager.get_tablet_seat(wl_seat) |
326 | //! and that returns the actual interface that has all the tablets. With |
327 | //! this indirection, we can avoid merging wp_tablet into the actual Wayland |
328 | //! protocol, a long-term benefit. |
329 | //! |
330 | //! The wp_tablet_seat sends a "tablet added" event for each tablet |
331 | //! connected. That event is followed by descriptive events about the |
332 | //! hardware; currently that includes events for name, vid/pid and |
333 | //! a wp_tablet.path event that describes a local path. This path can be |
334 | //! used to uniquely identify a tablet or get more information through |
335 | //! libwacom. Emulated or nested tablets can skip any of those, e.g. a |
336 | //! virtual tablet may not have a vid/pid. The sequence of descriptive |
337 | //! events is terminated by a wp_tablet.done event to signal that a client |
338 | //! may now finalize any initialization for that tablet. |
339 | //! |
340 | //! Events from tablets require a tool in proximity. Tools are also managed |
341 | //! by the tablet seat; a "tool added" event is sent whenever a tool is new |
342 | //! to the compositor. That event is followed by a number of descriptive |
343 | //! events about the hardware; currently that includes capabilities, |
344 | //! hardware id and serial number, and tool type. Similar to the tablet |
345 | //! interface, a wp_tablet_tool.done event is sent to terminate that initial |
346 | //! sequence. |
347 | //! |
348 | //! Any event from a tool happens on the wp_tablet_tool interface. When the |
349 | //! tool gets into proximity of the tablet, a proximity_in event is sent on |
350 | //! the wp_tablet_tool interface, listing the tablet and the surface. That |
351 | //! event is followed by a motion event with the coordinates. After that, |
352 | //! it's the usual motion, axis, button, etc. events. The protocol's |
353 | //! serialisation means events are grouped by wp_tablet_tool.frame events. |
354 | //! |
355 | //! Two special events (that don't exist in X) are down and up. They signal |
356 | //! "tip touching the surface". For tablets without real proximity |
357 | //! detection, the sequence is: proximity_in, motion, down, frame. |
358 | //! |
359 | //! When the tool leaves proximity, a proximity_out event is sent. If any |
360 | //! button is still down, a button release event is sent before this |
361 | //! proximity event. These button events are sent in the same frame as the |
362 | //! proximity event to signal to the client that the buttons were held when |
363 | //! the tool left proximity. |
364 | //! |
365 | //! If the tool moves out of the surface but stays in proximity (i.e. |
366 | //! between windows), compositor-specific grab policies apply. This usually |
367 | //! means that the proximity-out is delayed until all buttons are released. |
368 | //! |
369 | //! Moving a tool physically from one tablet to the other has no real effect |
370 | //! on the protocol, since we already have the tool object from the "tool |
371 | //! added" event. All the information is already there and the proximity |
372 | //! events on both tablets are all a client needs to reconstruct what |
373 | //! happened. |
374 | //! |
375 | //! Some extra axes are normalized, i.e. the client knows the range as |
376 | //! specified in the protocol (e.g. [0, 65535]), the granularity however is |
377 | //! unknown. The current normalized axes are pressure, distance, and slider. |
378 | //! |
379 | //! Other extra axes are in physical units as specified in the protocol. |
380 | //! The current extra axes with physical units are tilt, rotation and |
381 | //! wheel rotation. |
382 | //! |
383 | //! Since tablets work independently of the pointer controlled by the mouse, |
384 | //! the focus handling is independent too and controlled by proximity. |
385 | //! The wp_tablet_tool.set_cursor request sets a tool-specific cursor. |
386 | //! This cursor surface may be the same as the mouse cursor, and it may be |
387 | //! the same across tools but it is possible to be more fine-grained. For |
388 | //! example, a client may set different cursors for the pen and eraser. |
389 | //! |
390 | //! Tools are generally independent of tablets and it is |
391 | //! compositor-specific policy when a tool can be removed. Common approaches |
392 | //! will likely include some form of removing a tool when all tablets the |
393 | //! tool was used on are removed. |
394 | |
395 | /// Unstable version 1 |
396 | pub mod zv1 { |
397 | wayland_protocol!( |
398 | "./protocols/unstable/tablet/tablet-unstable-v1.xml" , |
399 | [] |
400 | ); |
401 | } |
402 | |
403 | /// Unstable version 2 |
404 | pub mod zv2 { |
405 | wayland_protocol!( |
406 | "./protocols/unstable/tablet/tablet-unstable-v2.xml" , |
407 | [] |
408 | ); |
409 | } |
410 | } |
411 | |
412 | #[cfg (feature = "unstable" )] |
413 | pub mod text_input { |
414 | //! Text input protocol |
415 | |
416 | /// Unstable version 1 |
417 | pub mod zv1 { |
418 | wayland_protocol!( |
419 | "./protocols/unstable/text-input/text-input-unstable-v1.xml" , |
420 | [] |
421 | ); |
422 | } |
423 | |
424 | /// Unstable version 3 |
425 | pub mod zv3 { |
426 | wayland_protocol!( |
427 | "./protocols/unstable/text-input/text-input-unstable-v3.xml" , |
428 | [] |
429 | ); |
430 | } |
431 | } |
432 | |
433 | pub mod viewporter { |
434 | //! Viewporter protocol |
435 | //! |
436 | //! Provides the capability of scaling and cropping surfaces, decorrelating the surface |
437 | //! dimensions from the size of the buffer. |
438 | |
439 | wayland_protocol!("./protocols/stable/viewporter/viewporter.xml" , []); |
440 | } |
441 | |
442 | #[cfg (feature = "staging" )] |
443 | pub mod security_context { |
444 | //! This interface allows a client to register a new Wayland connection to |
445 | //! the compositor and attach a security context to it. |
446 | //! |
447 | //! This is intended to be used by sandboxes. Sandbox engines attach a |
448 | //! security context to all connections coming from inside the sandbox. The |
449 | //! compositor can then restrict the features that the sandboxed connections |
450 | //! can use. |
451 | //! |
452 | //! Compositors should forbid nesting multiple security contexts by not |
453 | //! exposing wp_security_context_manager_v1 global to clients with a security |
454 | //! context attached, or by sending the nested protocol error. Nested |
455 | //! security contexts are dangerous because they can potentially allow |
456 | //! privilege escalation of a sandboxed client. |
457 | |
458 | |
459 | #[allow (missing_docs)] |
460 | pub mod v1 { |
461 | wayland_protocol!( |
462 | "./protocols/staging/security-context/security-context-v1.xml" , |
463 | [] |
464 | ); |
465 | } |
466 | } |
467 | |