1#![allow(clippy::too_many_arguments)]
7
8#[allow(unused_imports)]
9use std::borrow::Cow;
10#[allow(unused_imports)]
11use std::convert::TryInto;
12#[allow(unused_imports)]
13use crate::utils::RawFdContainer;
14#[allow(unused_imports)]
15use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
16use std::io::IoSlice;
17use crate::connection::RequestConnection;
18#[allow(unused_imports)]
19use crate::connection::Connection as X11Connection;
20#[allow(unused_imports)]
21use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
22use crate::errors::ConnectionError;
23#[allow(unused_imports)]
24use crate::errors::ReplyOrIdError;
25use std::future::Future;
26use std::pin::Pin;
27#[allow(unused_imports)]
28use super::render;
29#[allow(unused_imports)]
30use super::xproto;
31
32pub use x11rb_protocol::protocol::randr::*;
33
34async fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
36 let info = conn.extension_information(X11_EXTENSION_NAME).await?;
37 let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
38 Ok(info.major_opcode)
39}
40
41pub async fn query_version<Conn>(conn: &Conn, major_version: u32, minor_version: u32) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
42where
43 Conn: RequestConnection + ?Sized,
44{
45 let request0 = QueryVersionRequest {
46 major_version,
47 minor_version,
48 };
49 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
50 let slices = [IoSlice::new(&bytes[0])];
51 assert_eq!(slices.len(), bytes.len());
52 conn.send_request_with_reply(&slices, fds).await
53}
54pub async fn set_screen_config<Conn>(conn: &Conn, window: xproto::Window, timestamp: xproto::Timestamp, config_timestamp: xproto::Timestamp, size_id: u16, rotation: Rotation, rate: u16) -> Result<Cookie<'_, Conn, SetScreenConfigReply>, ConnectionError>
55where
56 Conn: RequestConnection + ?Sized,
57{
58 let request0 = SetScreenConfigRequest {
59 window,
60 timestamp,
61 config_timestamp,
62 size_id,
63 rotation,
64 rate,
65 };
66 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
67 let slices = [IoSlice::new(&bytes[0])];
68 assert_eq!(slices.len(), bytes.len());
69 conn.send_request_with_reply(&slices, fds).await
70}
71pub async fn select_input<Conn>(conn: &Conn, window: xproto::Window, enable: NotifyMask) -> Result<VoidCookie<'_, Conn>, ConnectionError>
72where
73 Conn: RequestConnection + ?Sized,
74{
75 let request0 = SelectInputRequest {
76 window,
77 enable,
78 };
79 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
80 let slices = [IoSlice::new(&bytes[0])];
81 assert_eq!(slices.len(), bytes.len());
82 conn.send_request_without_reply(&slices, fds).await
83}
84pub async fn get_screen_info<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetScreenInfoReply>, ConnectionError>
85where
86 Conn: RequestConnection + ?Sized,
87{
88 let request0 = GetScreenInfoRequest {
89 window,
90 };
91 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
92 let slices = [IoSlice::new(&bytes[0])];
93 assert_eq!(slices.len(), bytes.len());
94 conn.send_request_with_reply(&slices, fds).await
95}
96pub async fn get_screen_size_range<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetScreenSizeRangeReply>, ConnectionError>
97where
98 Conn: RequestConnection + ?Sized,
99{
100 let request0 = GetScreenSizeRangeRequest {
101 window,
102 };
103 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
104 let slices = [IoSlice::new(&bytes[0])];
105 assert_eq!(slices.len(), bytes.len());
106 conn.send_request_with_reply(&slices, fds).await
107}
108pub async fn set_screen_size<Conn>(conn: &Conn, window: xproto::Window, width: u16, height: u16, mm_width: u32, mm_height: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
109where
110 Conn: RequestConnection + ?Sized,
111{
112 let request0 = SetScreenSizeRequest {
113 window,
114 width,
115 height,
116 mm_width,
117 mm_height,
118 };
119 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
120 let slices = [IoSlice::new(&bytes[0])];
121 assert_eq!(slices.len(), bytes.len());
122 conn.send_request_without_reply(&slices, fds).await
123}
124pub async fn get_screen_resources<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetScreenResourcesReply>, ConnectionError>
125where
126 Conn: RequestConnection + ?Sized,
127{
128 let request0 = GetScreenResourcesRequest {
129 window,
130 };
131 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
132 let slices = [IoSlice::new(&bytes[0])];
133 assert_eq!(slices.len(), bytes.len());
134 conn.send_request_with_reply(&slices, fds).await
135}
136pub async fn get_output_info<Conn>(conn: &Conn, output: Output, config_timestamp: xproto::Timestamp) -> Result<Cookie<'_, Conn, GetOutputInfoReply>, ConnectionError>
137where
138 Conn: RequestConnection + ?Sized,
139{
140 let request0 = GetOutputInfoRequest {
141 output,
142 config_timestamp,
143 };
144 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
145 let slices = [IoSlice::new(&bytes[0])];
146 assert_eq!(slices.len(), bytes.len());
147 conn.send_request_with_reply(&slices, fds).await
148}
149pub async fn list_output_properties<Conn>(conn: &Conn, output: Output) -> Result<Cookie<'_, Conn, ListOutputPropertiesReply>, ConnectionError>
150where
151 Conn: RequestConnection + ?Sized,
152{
153 let request0 = ListOutputPropertiesRequest {
154 output,
155 };
156 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
157 let slices = [IoSlice::new(&bytes[0])];
158 assert_eq!(slices.len(), bytes.len());
159 conn.send_request_with_reply(&slices, fds).await
160}
161pub async fn query_output_property<Conn>(conn: &Conn, output: Output, property: xproto::Atom) -> Result<Cookie<'_, Conn, QueryOutputPropertyReply>, ConnectionError>
162where
163 Conn: RequestConnection + ?Sized,
164{
165 let request0 = QueryOutputPropertyRequest {
166 output,
167 property,
168 };
169 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
170 let slices = [IoSlice::new(&bytes[0])];
171 assert_eq!(slices.len(), bytes.len());
172 conn.send_request_with_reply(&slices, fds).await
173}
174pub async fn configure_output_property<'c, 'input, Conn>(conn: &'c Conn, output: Output, property: xproto::Atom, pending: bool, range: bool, values: &'input [i32]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
175where
176 Conn: RequestConnection + ?Sized,
177{
178 let request0 = ConfigureOutputPropertyRequest {
179 output,
180 property,
181 pending,
182 range,
183 values: Cow::Borrowed(values),
184 };
185 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
186 let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
187 assert_eq!(slices.len(), bytes.len());
188 conn.send_request_without_reply(&slices, fds).await
189}
190pub async fn change_output_property<'c, 'input, Conn>(conn: &'c Conn, output: Output, property: xproto::Atom, type_: xproto::Atom, format: u8, mode: xproto::PropMode, num_units: u32, data: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
191where
192 Conn: RequestConnection + ?Sized,
193{
194 let request0 = ChangeOutputPropertyRequest {
195 output,
196 property,
197 type_,
198 format,
199 mode,
200 num_units,
201 data: Cow::Borrowed(data),
202 };
203 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
204 let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
205 assert_eq!(slices.len(), bytes.len());
206 conn.send_request_without_reply(&slices, fds).await
207}
208pub async fn delete_output_property<Conn>(conn: &Conn, output: Output, property: xproto::Atom) -> Result<VoidCookie<'_, Conn>, ConnectionError>
209where
210 Conn: RequestConnection + ?Sized,
211{
212 let request0 = DeleteOutputPropertyRequest {
213 output,
214 property,
215 };
216 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
217 let slices = [IoSlice::new(&bytes[0])];
218 assert_eq!(slices.len(), bytes.len());
219 conn.send_request_without_reply(&slices, fds).await
220}
221pub async fn get_output_property<Conn, A>(conn: &Conn, output: Output, property: xproto::Atom, type_: A, long_offset: u32, long_length: u32, delete: bool, pending: bool) -> Result<Cookie<'_, Conn, GetOutputPropertyReply>, ConnectionError>
222where
223 Conn: RequestConnection + ?Sized,
224 A: Into<xproto::Atom> + Send,
225{
226 let type_: xproto::Atom = type_.into();
227 let request0 = GetOutputPropertyRequest {
228 output,
229 property,
230 type_,
231 long_offset,
232 long_length,
233 delete,
234 pending,
235 };
236 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
237 let slices = [IoSlice::new(&bytes[0])];
238 assert_eq!(slices.len(), bytes.len());
239 conn.send_request_with_reply(&slices, fds).await
240}
241pub async fn create_mode<'c, 'input, Conn>(conn: &'c Conn, window: xproto::Window, mode_info: ModeInfo, name: &'input [u8]) -> Result<Cookie<'c, Conn, CreateModeReply>, ConnectionError>
242where
243 Conn: RequestConnection + ?Sized,
244{
245 let request0 = CreateModeRequest {
246 window,
247 mode_info,
248 name: Cow::Borrowed(name),
249 };
250 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
251 let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
252 assert_eq!(slices.len(), bytes.len());
253 conn.send_request_with_reply(&slices, fds).await
254}
255pub async fn destroy_mode<Conn>(conn: &Conn, mode: Mode) -> Result<VoidCookie<'_, Conn>, ConnectionError>
256where
257 Conn: RequestConnection + ?Sized,
258{
259 let request0 = DestroyModeRequest {
260 mode,
261 };
262 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
263 let slices = [IoSlice::new(&bytes[0])];
264 assert_eq!(slices.len(), bytes.len());
265 conn.send_request_without_reply(&slices, fds).await
266}
267pub async fn add_output_mode<Conn>(conn: &Conn, output: Output, mode: Mode) -> Result<VoidCookie<'_, Conn>, ConnectionError>
268where
269 Conn: RequestConnection + ?Sized,
270{
271 let request0 = AddOutputModeRequest {
272 output,
273 mode,
274 };
275 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
276 let slices = [IoSlice::new(&bytes[0])];
277 assert_eq!(slices.len(), bytes.len());
278 conn.send_request_without_reply(&slices, fds).await
279}
280pub async fn delete_output_mode<Conn>(conn: &Conn, output: Output, mode: Mode) -> Result<VoidCookie<'_, Conn>, ConnectionError>
281where
282 Conn: RequestConnection + ?Sized,
283{
284 let request0 = DeleteOutputModeRequest {
285 output,
286 mode,
287 };
288 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
289 let slices = [IoSlice::new(&bytes[0])];
290 assert_eq!(slices.len(), bytes.len());
291 conn.send_request_without_reply(&slices, fds).await
292}
293pub async fn get_crtc_info<Conn>(conn: &Conn, crtc: Crtc, config_timestamp: xproto::Timestamp) -> Result<Cookie<'_, Conn, GetCrtcInfoReply>, ConnectionError>
294where
295 Conn: RequestConnection + ?Sized,
296{
297 let request0 = GetCrtcInfoRequest {
298 crtc,
299 config_timestamp,
300 };
301 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
302 let slices = [IoSlice::new(&bytes[0])];
303 assert_eq!(slices.len(), bytes.len());
304 conn.send_request_with_reply(&slices, fds).await
305}
306pub async fn set_crtc_config<'c, 'input, Conn>(conn: &'c Conn, crtc: Crtc, timestamp: xproto::Timestamp, config_timestamp: xproto::Timestamp, x: i16, y: i16, mode: Mode, rotation: Rotation, outputs: &'input [Output]) -> Result<Cookie<'c, Conn, SetCrtcConfigReply>, ConnectionError>
307where
308 Conn: RequestConnection + ?Sized,
309{
310 let request0 = SetCrtcConfigRequest {
311 crtc,
312 timestamp,
313 config_timestamp,
314 x,
315 y,
316 mode,
317 rotation,
318 outputs: Cow::Borrowed(outputs),
319 };
320 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
321 let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
322 assert_eq!(slices.len(), bytes.len());
323 conn.send_request_with_reply(&slices, fds).await
324}
325pub async fn get_crtc_gamma_size<Conn>(conn: &Conn, crtc: Crtc) -> Result<Cookie<'_, Conn, GetCrtcGammaSizeReply>, ConnectionError>
326where
327 Conn: RequestConnection + ?Sized,
328{
329 let request0 = GetCrtcGammaSizeRequest {
330 crtc,
331 };
332 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
333 let slices = [IoSlice::new(&bytes[0])];
334 assert_eq!(slices.len(), bytes.len());
335 conn.send_request_with_reply(&slices, fds).await
336}
337pub async fn get_crtc_gamma<Conn>(conn: &Conn, crtc: Crtc) -> Result<Cookie<'_, Conn, GetCrtcGammaReply>, ConnectionError>
338where
339 Conn: RequestConnection + ?Sized,
340{
341 let request0 = GetCrtcGammaRequest {
342 crtc,
343 };
344 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
345 let slices = [IoSlice::new(&bytes[0])];
346 assert_eq!(slices.len(), bytes.len());
347 conn.send_request_with_reply(&slices, fds).await
348}
349pub async fn set_crtc_gamma<'c, 'input, Conn>(conn: &'c Conn, crtc: Crtc, red: &'input [u16], green: &'input [u16], blue: &'input [u16]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
350where
351 Conn: RequestConnection + ?Sized,
352{
353 let request0 = SetCrtcGammaRequest {
354 crtc,
355 red: Cow::Borrowed(red),
356 green: Cow::Borrowed(green),
357 blue: Cow::Borrowed(blue),
358 };
359 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
360 let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3]), IoSlice::new(&bytes[4])];
361 assert_eq!(slices.len(), bytes.len());
362 conn.send_request_without_reply(&slices, fds).await
363}
364pub async fn get_screen_resources_current<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetScreenResourcesCurrentReply>, ConnectionError>
365where
366 Conn: RequestConnection + ?Sized,
367{
368 let request0 = GetScreenResourcesCurrentRequest {
369 window,
370 };
371 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
372 let slices = [IoSlice::new(&bytes[0])];
373 assert_eq!(slices.len(), bytes.len());
374 conn.send_request_with_reply(&slices, fds).await
375}
376pub async fn set_crtc_transform<'c, 'input, Conn>(conn: &'c Conn, crtc: Crtc, transform: render::Transform, filter_name: &'input [u8], filter_params: &'input [render::Fixed]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
377where
378 Conn: RequestConnection + ?Sized,
379{
380 let request0 = SetCrtcTransformRequest {
381 crtc,
382 transform,
383 filter_name: Cow::Borrowed(filter_name),
384 filter_params: Cow::Borrowed(filter_params),
385 };
386 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
387 let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3]), IoSlice::new(&bytes[4])];
388 assert_eq!(slices.len(), bytes.len());
389 conn.send_request_without_reply(&slices, fds).await
390}
391pub async fn get_crtc_transform<Conn>(conn: &Conn, crtc: Crtc) -> Result<Cookie<'_, Conn, GetCrtcTransformReply>, ConnectionError>
392where
393 Conn: RequestConnection + ?Sized,
394{
395 let request0 = GetCrtcTransformRequest {
396 crtc,
397 };
398 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
399 let slices = [IoSlice::new(&bytes[0])];
400 assert_eq!(slices.len(), bytes.len());
401 conn.send_request_with_reply(&slices, fds).await
402}
403pub async fn get_panning<Conn>(conn: &Conn, crtc: Crtc) -> Result<Cookie<'_, Conn, GetPanningReply>, ConnectionError>
404where
405 Conn: RequestConnection + ?Sized,
406{
407 let request0 = GetPanningRequest {
408 crtc,
409 };
410 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
411 let slices = [IoSlice::new(&bytes[0])];
412 assert_eq!(slices.len(), bytes.len());
413 conn.send_request_with_reply(&slices, fds).await
414}
415pub async fn set_panning<Conn>(conn: &Conn, crtc: Crtc, timestamp: xproto::Timestamp, left: u16, top: u16, width: u16, height: u16, track_left: u16, track_top: u16, track_width: u16, track_height: u16, border_left: i16, border_top: i16, border_right: i16, border_bottom: i16) -> Result<Cookie<'_, Conn, SetPanningReply>, ConnectionError>
416where
417 Conn: RequestConnection + ?Sized,
418{
419 let request0 = SetPanningRequest {
420 crtc,
421 timestamp,
422 left,
423 top,
424 width,
425 height,
426 track_left,
427 track_top,
428 track_width,
429 track_height,
430 border_left,
431 border_top,
432 border_right,
433 border_bottom,
434 };
435 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
436 let slices = [IoSlice::new(&bytes[0])];
437 assert_eq!(slices.len(), bytes.len());
438 conn.send_request_with_reply(&slices, fds).await
439}
440pub async fn set_output_primary<Conn>(conn: &Conn, window: xproto::Window, output: Output) -> Result<VoidCookie<'_, Conn>, ConnectionError>
441where
442 Conn: RequestConnection + ?Sized,
443{
444 let request0 = SetOutputPrimaryRequest {
445 window,
446 output,
447 };
448 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
449 let slices = [IoSlice::new(&bytes[0])];
450 assert_eq!(slices.len(), bytes.len());
451 conn.send_request_without_reply(&slices, fds).await
452}
453pub async fn get_output_primary<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetOutputPrimaryReply>, ConnectionError>
454where
455 Conn: RequestConnection + ?Sized,
456{
457 let request0 = GetOutputPrimaryRequest {
458 window,
459 };
460 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
461 let slices = [IoSlice::new(&bytes[0])];
462 assert_eq!(slices.len(), bytes.len());
463 conn.send_request_with_reply(&slices, fds).await
464}
465pub async fn get_providers<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetProvidersReply>, ConnectionError>
466where
467 Conn: RequestConnection + ?Sized,
468{
469 let request0 = GetProvidersRequest {
470 window,
471 };
472 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
473 let slices = [IoSlice::new(&bytes[0])];
474 assert_eq!(slices.len(), bytes.len());
475 conn.send_request_with_reply(&slices, fds).await
476}
477pub async fn get_provider_info<Conn>(conn: &Conn, provider: Provider, config_timestamp: xproto::Timestamp) -> Result<Cookie<'_, Conn, GetProviderInfoReply>, ConnectionError>
478where
479 Conn: RequestConnection + ?Sized,
480{
481 let request0 = GetProviderInfoRequest {
482 provider,
483 config_timestamp,
484 };
485 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
486 let slices = [IoSlice::new(&bytes[0])];
487 assert_eq!(slices.len(), bytes.len());
488 conn.send_request_with_reply(&slices, fds).await
489}
490pub async fn set_provider_offload_sink<Conn>(conn: &Conn, provider: Provider, sink_provider: Provider, config_timestamp: xproto::Timestamp) -> Result<VoidCookie<'_, Conn>, ConnectionError>
491where
492 Conn: RequestConnection + ?Sized,
493{
494 let request0 = SetProviderOffloadSinkRequest {
495 provider,
496 sink_provider,
497 config_timestamp,
498 };
499 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
500 let slices = [IoSlice::new(&bytes[0])];
501 assert_eq!(slices.len(), bytes.len());
502 conn.send_request_without_reply(&slices, fds).await
503}
504pub async fn set_provider_output_source<Conn>(conn: &Conn, provider: Provider, source_provider: Provider, config_timestamp: xproto::Timestamp) -> Result<VoidCookie<'_, Conn>, ConnectionError>
505where
506 Conn: RequestConnection + ?Sized,
507{
508 let request0 = SetProviderOutputSourceRequest {
509 provider,
510 source_provider,
511 config_timestamp,
512 };
513 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
514 let slices = [IoSlice::new(&bytes[0])];
515 assert_eq!(slices.len(), bytes.len());
516 conn.send_request_without_reply(&slices, fds).await
517}
518pub async fn list_provider_properties<Conn>(conn: &Conn, provider: Provider) -> Result<Cookie<'_, Conn, ListProviderPropertiesReply>, ConnectionError>
519where
520 Conn: RequestConnection + ?Sized,
521{
522 let request0 = ListProviderPropertiesRequest {
523 provider,
524 };
525 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
526 let slices = [IoSlice::new(&bytes[0])];
527 assert_eq!(slices.len(), bytes.len());
528 conn.send_request_with_reply(&slices, fds).await
529}
530pub async fn query_provider_property<Conn>(conn: &Conn, provider: Provider, property: xproto::Atom) -> Result<Cookie<'_, Conn, QueryProviderPropertyReply>, ConnectionError>
531where
532 Conn: RequestConnection + ?Sized,
533{
534 let request0 = QueryProviderPropertyRequest {
535 provider,
536 property,
537 };
538 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
539 let slices = [IoSlice::new(&bytes[0])];
540 assert_eq!(slices.len(), bytes.len());
541 conn.send_request_with_reply(&slices, fds).await
542}
543pub async fn configure_provider_property<'c, 'input, Conn>(conn: &'c Conn, provider: Provider, property: xproto::Atom, pending: bool, range: bool, values: &'input [i32]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
544where
545 Conn: RequestConnection + ?Sized,
546{
547 let request0 = ConfigureProviderPropertyRequest {
548 provider,
549 property,
550 pending,
551 range,
552 values: Cow::Borrowed(values),
553 };
554 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
555 let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
556 assert_eq!(slices.len(), bytes.len());
557 conn.send_request_without_reply(&slices, fds).await
558}
559pub async fn change_provider_property<'c, 'input, Conn>(conn: &'c Conn, provider: Provider, property: xproto::Atom, type_: xproto::Atom, format: u8, mode: u8, num_items: u32, data: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
560where
561 Conn: RequestConnection + ?Sized,
562{
563 let request0 = ChangeProviderPropertyRequest {
564 provider,
565 property,
566 type_,
567 format,
568 mode,
569 num_items,
570 data: Cow::Borrowed(data),
571 };
572 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
573 let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
574 assert_eq!(slices.len(), bytes.len());
575 conn.send_request_without_reply(&slices, fds).await
576}
577pub async fn delete_provider_property<Conn>(conn: &Conn, provider: Provider, property: xproto::Atom) -> Result<VoidCookie<'_, Conn>, ConnectionError>
578where
579 Conn: RequestConnection + ?Sized,
580{
581 let request0 = DeleteProviderPropertyRequest {
582 provider,
583 property,
584 };
585 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
586 let slices = [IoSlice::new(&bytes[0])];
587 assert_eq!(slices.len(), bytes.len());
588 conn.send_request_without_reply(&slices, fds).await
589}
590pub async fn get_provider_property<Conn>(conn: &Conn, provider: Provider, property: xproto::Atom, type_: xproto::Atom, long_offset: u32, long_length: u32, delete: bool, pending: bool) -> Result<Cookie<'_, Conn, GetProviderPropertyReply>, ConnectionError>
591where
592 Conn: RequestConnection + ?Sized,
593{
594 let request0 = GetProviderPropertyRequest {
595 provider,
596 property,
597 type_,
598 long_offset,
599 long_length,
600 delete,
601 pending,
602 };
603 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
604 let slices = [IoSlice::new(&bytes[0])];
605 assert_eq!(slices.len(), bytes.len());
606 conn.send_request_with_reply(&slices, fds).await
607}
608pub async fn get_monitors<Conn>(conn: &Conn, window: xproto::Window, get_active: bool) -> Result<Cookie<'_, Conn, GetMonitorsReply>, ConnectionError>
609where
610 Conn: RequestConnection + ?Sized,
611{
612 let request0 = GetMonitorsRequest {
613 window,
614 get_active,
615 };
616 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
617 let slices = [IoSlice::new(&bytes[0])];
618 assert_eq!(slices.len(), bytes.len());
619 conn.send_request_with_reply(&slices, fds).await
620}
621pub async fn set_monitor<Conn>(conn: &Conn, window: xproto::Window, monitorinfo: MonitorInfo) -> Result<VoidCookie<'_, Conn>, ConnectionError>
622where
623 Conn: RequestConnection + ?Sized,
624{
625 let request0 = SetMonitorRequest {
626 window,
627 monitorinfo,
628 };
629 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
630 let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
631 assert_eq!(slices.len(), bytes.len());
632 conn.send_request_without_reply(&slices, fds).await
633}
634pub async fn delete_monitor<Conn>(conn: &Conn, window: xproto::Window, name: xproto::Atom) -> Result<VoidCookie<'_, Conn>, ConnectionError>
635where
636 Conn: RequestConnection + ?Sized,
637{
638 let request0 = DeleteMonitorRequest {
639 window,
640 name,
641 };
642 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
643 let slices = [IoSlice::new(&bytes[0])];
644 assert_eq!(slices.len(), bytes.len());
645 conn.send_request_without_reply(&slices, fds).await
646}
647pub async fn create_lease<'c, 'input, Conn>(conn: &'c Conn, window: xproto::Window, lid: Lease, crtcs: &'input [Crtc], outputs: &'input [Output]) -> Result<CookieWithFds<'c, Conn, CreateLeaseReply>, ConnectionError>
648where
649 Conn: RequestConnection + ?Sized,
650{
651 let request0 = CreateLeaseRequest {
652 window,
653 lid,
654 crtcs: Cow::Borrowed(crtcs),
655 outputs: Cow::Borrowed(outputs),
656 };
657 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
658 let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3])];
659 assert_eq!(slices.len(), bytes.len());
660 conn.send_request_with_reply_with_fds(&slices, fds).await
661}
662pub async fn free_lease<Conn>(conn: &Conn, lid: Lease, terminate: u8) -> Result<VoidCookie<'_, Conn>, ConnectionError>
663where
664 Conn: RequestConnection + ?Sized,
665{
666 let request0 = FreeLeaseRequest {
667 lid,
668 terminate,
669 };
670 let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
671 let slices = [IoSlice::new(&bytes[0])];
672 assert_eq!(slices.len(), bytes.len());
673 conn.send_request_without_reply(&slices, fds).await
674}
675pub trait ConnectionExt: RequestConnection {
677 fn randr_query_version(&self, major_version: u32, minor_version: u32) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>> + Send + '_>>
678 {
679 Box::pin(query_version(self, major_version, minor_version))
680 }
681 fn randr_set_screen_config(&self, window: xproto::Window, timestamp: xproto::Timestamp, config_timestamp: xproto::Timestamp, size_id: u16, rotation: Rotation, rate: u16) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, SetScreenConfigReply>, ConnectionError>> + Send + '_>>
682 {
683 Box::pin(set_screen_config(self, window, timestamp, config_timestamp, size_id, rotation, rate))
684 }
685 fn randr_select_input(&self, window: xproto::Window, enable: NotifyMask) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
686 {
687 Box::pin(select_input(self, window, enable))
688 }
689 fn randr_get_screen_info(&self, window: xproto::Window) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetScreenInfoReply>, ConnectionError>> + Send + '_>>
690 {
691 Box::pin(get_screen_info(self, window))
692 }
693 fn randr_get_screen_size_range(&self, window: xproto::Window) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetScreenSizeRangeReply>, ConnectionError>> + Send + '_>>
694 {
695 Box::pin(get_screen_size_range(self, window))
696 }
697 fn randr_set_screen_size(&self, window: xproto::Window, width: u16, height: u16, mm_width: u32, mm_height: u32) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
698 {
699 Box::pin(set_screen_size(self, window, width, height, mm_width, mm_height))
700 }
701 fn randr_get_screen_resources(&self, window: xproto::Window) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetScreenResourcesReply>, ConnectionError>> + Send + '_>>
702 {
703 Box::pin(get_screen_resources(self, window))
704 }
705 fn randr_get_output_info(&self, output: Output, config_timestamp: xproto::Timestamp) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetOutputInfoReply>, ConnectionError>> + Send + '_>>
706 {
707 Box::pin(get_output_info(self, output, config_timestamp))
708 }
709 fn randr_list_output_properties(&self, output: Output) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, ListOutputPropertiesReply>, ConnectionError>> + Send + '_>>
710 {
711 Box::pin(list_output_properties(self, output))
712 }
713 fn randr_query_output_property(&self, output: Output, property: xproto::Atom) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, QueryOutputPropertyReply>, ConnectionError>> + Send + '_>>
714 {
715 Box::pin(query_output_property(self, output, property))
716 }
717 fn randr_configure_output_property<'c, 'input, 'future>(&'c self, output: Output, property: xproto::Atom, pending: bool, range: bool, values: &'input [i32]) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'c, Self>, ConnectionError>> + Send + 'future>>
718 where
719 'c: 'future,
720 'input: 'future,
721 {
722 Box::pin(configure_output_property(self, output, property, pending, range, values))
723 }
724 fn randr_change_output_property<'c, 'input, 'future>(&'c self, output: Output, property: xproto::Atom, type_: xproto::Atom, format: u8, mode: xproto::PropMode, num_units: u32, data: &'input [u8]) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'c, Self>, ConnectionError>> + Send + 'future>>
725 where
726 'c: 'future,
727 'input: 'future,
728 {
729 Box::pin(change_output_property(self, output, property, type_, format, mode, num_units, data))
730 }
731 fn randr_delete_output_property(&self, output: Output, property: xproto::Atom) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
732 {
733 Box::pin(delete_output_property(self, output, property))
734 }
735 fn randr_get_output_property<A>(&self, output: Output, property: xproto::Atom, type_: A, long_offset: u32, long_length: u32, delete: bool, pending: bool) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetOutputPropertyReply>, ConnectionError>> + Send + '_>>
736 where
737 A: Into<xproto::Atom> + Send + 'static,
738 {
739 Box::pin(get_output_property(self, output, property, type_, long_offset, long_length, delete, pending))
740 }
741 fn randr_create_mode<'c, 'input, 'future>(&'c self, window: xproto::Window, mode_info: ModeInfo, name: &'input [u8]) -> Pin<Box<dyn Future<Output = Result<Cookie<'c, Self, CreateModeReply>, ConnectionError>> + Send + 'future>>
742 where
743 'c: 'future,
744 'input: 'future,
745 {
746 Box::pin(create_mode(self, window, mode_info, name))
747 }
748 fn randr_destroy_mode(&self, mode: Mode) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
749 {
750 Box::pin(destroy_mode(self, mode))
751 }
752 fn randr_add_output_mode(&self, output: Output, mode: Mode) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
753 {
754 Box::pin(add_output_mode(self, output, mode))
755 }
756 fn randr_delete_output_mode(&self, output: Output, mode: Mode) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
757 {
758 Box::pin(delete_output_mode(self, output, mode))
759 }
760 fn randr_get_crtc_info(&self, crtc: Crtc, config_timestamp: xproto::Timestamp) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetCrtcInfoReply>, ConnectionError>> + Send + '_>>
761 {
762 Box::pin(get_crtc_info(self, crtc, config_timestamp))
763 }
764 fn randr_set_crtc_config<'c, 'input, 'future>(&'c self, crtc: Crtc, timestamp: xproto::Timestamp, config_timestamp: xproto::Timestamp, x: i16, y: i16, mode: Mode, rotation: Rotation, outputs: &'input [Output]) -> Pin<Box<dyn Future<Output = Result<Cookie<'c, Self, SetCrtcConfigReply>, ConnectionError>> + Send + 'future>>
765 where
766 'c: 'future,
767 'input: 'future,
768 {
769 Box::pin(set_crtc_config(self, crtc, timestamp, config_timestamp, x, y, mode, rotation, outputs))
770 }
771 fn randr_get_crtc_gamma_size(&self, crtc: Crtc) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetCrtcGammaSizeReply>, ConnectionError>> + Send + '_>>
772 {
773 Box::pin(get_crtc_gamma_size(self, crtc))
774 }
775 fn randr_get_crtc_gamma(&self, crtc: Crtc) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetCrtcGammaReply>, ConnectionError>> + Send + '_>>
776 {
777 Box::pin(get_crtc_gamma(self, crtc))
778 }
779 fn randr_set_crtc_gamma<'c, 'input, 'future>(&'c self, crtc: Crtc, red: &'input [u16], green: &'input [u16], blue: &'input [u16]) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'c, Self>, ConnectionError>> + Send + 'future>>
780 where
781 'c: 'future,
782 'input: 'future,
783 {
784 Box::pin(set_crtc_gamma(self, crtc, red, green, blue))
785 }
786 fn randr_get_screen_resources_current(&self, window: xproto::Window) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetScreenResourcesCurrentReply>, ConnectionError>> + Send + '_>>
787 {
788 Box::pin(get_screen_resources_current(self, window))
789 }
790 fn randr_set_crtc_transform<'c, 'input, 'future>(&'c self, crtc: Crtc, transform: render::Transform, filter_name: &'input [u8], filter_params: &'input [render::Fixed]) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'c, Self>, ConnectionError>> + Send + 'future>>
791 where
792 'c: 'future,
793 'input: 'future,
794 {
795 Box::pin(set_crtc_transform(self, crtc, transform, filter_name, filter_params))
796 }
797 fn randr_get_crtc_transform(&self, crtc: Crtc) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetCrtcTransformReply>, ConnectionError>> + Send + '_>>
798 {
799 Box::pin(get_crtc_transform(self, crtc))
800 }
801 fn randr_get_panning(&self, crtc: Crtc) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetPanningReply>, ConnectionError>> + Send + '_>>
802 {
803 Box::pin(get_panning(self, crtc))
804 }
805 fn randr_set_panning(&self, crtc: Crtc, timestamp: xproto::Timestamp, left: u16, top: u16, width: u16, height: u16, track_left: u16, track_top: u16, track_width: u16, track_height: u16, border_left: i16, border_top: i16, border_right: i16, border_bottom: i16) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, SetPanningReply>, ConnectionError>> + Send + '_>>
806 {
807 Box::pin(set_panning(self, crtc, timestamp, left, top, width, height, track_left, track_top, track_width, track_height, border_left, border_top, border_right, border_bottom))
808 }
809 fn randr_set_output_primary(&self, window: xproto::Window, output: Output) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
810 {
811 Box::pin(set_output_primary(self, window, output))
812 }
813 fn randr_get_output_primary(&self, window: xproto::Window) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetOutputPrimaryReply>, ConnectionError>> + Send + '_>>
814 {
815 Box::pin(get_output_primary(self, window))
816 }
817 fn randr_get_providers(&self, window: xproto::Window) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetProvidersReply>, ConnectionError>> + Send + '_>>
818 {
819 Box::pin(get_providers(self, window))
820 }
821 fn randr_get_provider_info(&self, provider: Provider, config_timestamp: xproto::Timestamp) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetProviderInfoReply>, ConnectionError>> + Send + '_>>
822 {
823 Box::pin(get_provider_info(self, provider, config_timestamp))
824 }
825 fn randr_set_provider_offload_sink(&self, provider: Provider, sink_provider: Provider, config_timestamp: xproto::Timestamp) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
826 {
827 Box::pin(set_provider_offload_sink(self, provider, sink_provider, config_timestamp))
828 }
829 fn randr_set_provider_output_source(&self, provider: Provider, source_provider: Provider, config_timestamp: xproto::Timestamp) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
830 {
831 Box::pin(set_provider_output_source(self, provider, source_provider, config_timestamp))
832 }
833 fn randr_list_provider_properties(&self, provider: Provider) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, ListProviderPropertiesReply>, ConnectionError>> + Send + '_>>
834 {
835 Box::pin(list_provider_properties(self, provider))
836 }
837 fn randr_query_provider_property(&self, provider: Provider, property: xproto::Atom) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, QueryProviderPropertyReply>, ConnectionError>> + Send + '_>>
838 {
839 Box::pin(query_provider_property(self, provider, property))
840 }
841 fn randr_configure_provider_property<'c, 'input, 'future>(&'c self, provider: Provider, property: xproto::Atom, pending: bool, range: bool, values: &'input [i32]) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'c, Self>, ConnectionError>> + Send + 'future>>
842 where
843 'c: 'future,
844 'input: 'future,
845 {
846 Box::pin(configure_provider_property(self, provider, property, pending, range, values))
847 }
848 fn randr_change_provider_property<'c, 'input, 'future>(&'c self, provider: Provider, property: xproto::Atom, type_: xproto::Atom, format: u8, mode: u8, num_items: u32, data: &'input [u8]) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'c, Self>, ConnectionError>> + Send + 'future>>
849 where
850 'c: 'future,
851 'input: 'future,
852 {
853 Box::pin(change_provider_property(self, provider, property, type_, format, mode, num_items, data))
854 }
855 fn randr_delete_provider_property(&self, provider: Provider, property: xproto::Atom) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
856 {
857 Box::pin(delete_provider_property(self, provider, property))
858 }
859 fn randr_get_provider_property(&self, provider: Provider, property: xproto::Atom, type_: xproto::Atom, long_offset: u32, long_length: u32, delete: bool, pending: bool) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetProviderPropertyReply>, ConnectionError>> + Send + '_>>
860 {
861 Box::pin(get_provider_property(self, provider, property, type_, long_offset, long_length, delete, pending))
862 }
863 fn randr_get_monitors(&self, window: xproto::Window, get_active: bool) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetMonitorsReply>, ConnectionError>> + Send + '_>>
864 {
865 Box::pin(get_monitors(self, window, get_active))
866 }
867 fn randr_set_monitor(&self, window: xproto::Window, monitorinfo: MonitorInfo) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
868 {
869 Box::pin(set_monitor(self, window, monitorinfo))
870 }
871 fn randr_delete_monitor(&self, window: xproto::Window, name: xproto::Atom) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
872 {
873 Box::pin(delete_monitor(self, window, name))
874 }
875 fn randr_create_lease<'c, 'input, 'future>(&'c self, window: xproto::Window, lid: Lease, crtcs: &'input [Crtc], outputs: &'input [Output]) -> Pin<Box<dyn Future<Output = Result<CookieWithFds<'c, Self, CreateLeaseReply>, ConnectionError>> + Send + 'future>>
876 where
877 'c: 'future,
878 'input: 'future,
879 {
880 Box::pin(create_lease(self, window, lid, crtcs, outputs))
881 }
882 fn randr_free_lease(&self, lid: Lease, terminate: u8) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
883 {
884 Box::pin(free_lease(self, lid, terminate))
885 }
886}
887
888impl<C: RequestConnection + ?Sized> ConnectionExt for C {}