x11rb_async/protocol/
composite.rs

1// This file contains generated code. Do not edit directly.
2// To regenerate this, run 'make'.
3
4//! Bindings to the `Composite` X11 extension.
5
6#![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::xfixes;
29#[allow(unused_imports)]
30use super::xproto;
31
32pub use x11rb_protocol::protocol::composite::*;
33
34/// Get the major opcode of this extension
35async 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
41/// Negotiate the version of Composite.
42///
43/// This negotiates the version of the Composite extension.  It must be precede all
44/// other requests using Composite.  Failure to do so will cause a BadRequest error.
45///
46/// # Fields
47///
48/// * `client_major_version` - The major version supported by the client.
49/// * `client_minor_version` - The minor version supported by the client.
50pub async fn query_version<Conn>(conn: &Conn, client_major_version: u32, client_minor_version: u32) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
51where
52    Conn: RequestConnection + ?Sized,
53{
54    let request0 = QueryVersionRequest {
55        client_major_version,
56        client_minor_version,
57    };
58    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
59    let slices = [IoSlice::new(&bytes[0])];
60    assert_eq!(slices.len(), bytes.len());
61    conn.send_request_with_reply(&slices, fds).await
62}
63/// Redirect the hierarchy starting at "window" to off-screen storage..
64///
65/// The hierarchy starting at 'window' is directed to off-screen
66/// storage.  When all clients enabling redirection terminate,
67/// the redirection will automatically be disabled.
68///
69/// The root window may not be redirected. Doing so results in a Match
70/// error.
71///
72/// # Fields
73///
74/// * `window` - The root of the hierarchy to redirect to off-screen storage.
75/// * `update` - Whether contents are automatically mirrored to the parent window.  If one client
76/// already specifies an update type of Manual, any attempt by another to specify a
77/// mode of Manual so will result in an Access error.
78pub async fn redirect_window<Conn>(conn: &Conn, window: xproto::Window, update: Redirect) -> Result<VoidCookie<'_, Conn>, ConnectionError>
79where
80    Conn: RequestConnection + ?Sized,
81{
82    let request0 = RedirectWindowRequest {
83        window,
84        update,
85    };
86    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
87    let slices = [IoSlice::new(&bytes[0])];
88    assert_eq!(slices.len(), bytes.len());
89    conn.send_request_without_reply(&slices, fds).await
90}
91/// Redirect all current and future children of ‘window’.
92///
93/// Hierarchies starting at all current and future children of window
94/// will be redirected as in RedirectWindow. If update is Manual,
95/// then painting of the window background during window manipulation
96/// and ClearArea requests is inhibited.
97///
98/// # Fields
99///
100/// * `window` - The root of the hierarchy to redirect to off-screen storage.
101/// * `update` - Whether contents are automatically mirrored to the parent window.  If one client
102/// already specifies an update type of Manual, any attempt by another to specify a
103/// mode of Manual so will result in an Access error.
104pub async fn redirect_subwindows<Conn>(conn: &Conn, window: xproto::Window, update: Redirect) -> Result<VoidCookie<'_, Conn>, ConnectionError>
105where
106    Conn: RequestConnection + ?Sized,
107{
108    let request0 = RedirectSubwindowsRequest {
109        window,
110        update,
111    };
112    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
113    let slices = [IoSlice::new(&bytes[0])];
114    assert_eq!(slices.len(), bytes.len());
115    conn.send_request_without_reply(&slices, fds).await
116}
117/// Terminate redirection of the specified window..
118///
119/// Redirection of the specified window will be terminated.  This cannot be
120/// used if the window was redirected with RedirectSubwindows.
121///
122/// # Fields
123///
124/// * `window` - The window to terminate redirection of.  Must be redirected by the
125/// current client, or a Value error results.
126/// * `update` - The update type passed to RedirectWindows.  If this does not match the
127/// previously requested update type, a Value error results.
128pub async fn unredirect_window<Conn>(conn: &Conn, window: xproto::Window, update: Redirect) -> Result<VoidCookie<'_, Conn>, ConnectionError>
129where
130    Conn: RequestConnection + ?Sized,
131{
132    let request0 = UnredirectWindowRequest {
133        window,
134        update,
135    };
136    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
137    let slices = [IoSlice::new(&bytes[0])];
138    assert_eq!(slices.len(), bytes.len());
139    conn.send_request_without_reply(&slices, fds).await
140}
141/// Terminate redirection of the specified window’s children.
142///
143/// Redirection of all children of window will be terminated.
144///
145/// # Fields
146///
147/// * `window` - The window to terminate redirection of.  Must have previously been
148/// selected for sub-redirection by the current client, or a Value error
149/// results.
150/// * `update` - The update type passed to RedirectSubWindows.  If this does not match
151/// the previously requested update type, a Value error results.
152pub async fn unredirect_subwindows<Conn>(conn: &Conn, window: xproto::Window, update: Redirect) -> Result<VoidCookie<'_, Conn>, ConnectionError>
153where
154    Conn: RequestConnection + ?Sized,
155{
156    let request0 = UnredirectSubwindowsRequest {
157        window,
158        update,
159    };
160    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
161    let slices = [IoSlice::new(&bytes[0])];
162    assert_eq!(slices.len(), bytes.len());
163    conn.send_request_without_reply(&slices, fds).await
164}
165pub async fn create_region_from_border_clip<Conn>(conn: &Conn, region: xfixes::Region, window: xproto::Window) -> Result<VoidCookie<'_, Conn>, ConnectionError>
166where
167    Conn: RequestConnection + ?Sized,
168{
169    let request0 = CreateRegionFromBorderClipRequest {
170        region,
171        window,
172    };
173    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
174    let slices = [IoSlice::new(&bytes[0])];
175    assert_eq!(slices.len(), bytes.len());
176    conn.send_request_without_reply(&slices, fds).await
177}
178pub async fn name_window_pixmap<Conn>(conn: &Conn, window: xproto::Window, pixmap: xproto::Pixmap) -> Result<VoidCookie<'_, Conn>, ConnectionError>
179where
180    Conn: RequestConnection + ?Sized,
181{
182    let request0 = NameWindowPixmapRequest {
183        window,
184        pixmap,
185    };
186    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
187    let slices = [IoSlice::new(&bytes[0])];
188    assert_eq!(slices.len(), bytes.len());
189    conn.send_request_without_reply(&slices, fds).await
190}
191pub async fn get_overlay_window<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetOverlayWindowReply>, ConnectionError>
192where
193    Conn: RequestConnection + ?Sized,
194{
195    let request0 = GetOverlayWindowRequest {
196        window,
197    };
198    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
199    let slices = [IoSlice::new(&bytes[0])];
200    assert_eq!(slices.len(), bytes.len());
201    conn.send_request_with_reply(&slices, fds).await
202}
203pub async fn release_overlay_window<Conn>(conn: &Conn, window: xproto::Window) -> Result<VoidCookie<'_, Conn>, ConnectionError>
204where
205    Conn: RequestConnection + ?Sized,
206{
207    let request0 = ReleaseOverlayWindowRequest {
208        window,
209    };
210    let (bytes, fds) = request0.serialize(major_opcode(conn).await?);
211    let slices = [IoSlice::new(&bytes[0])];
212    assert_eq!(slices.len(), bytes.len());
213    conn.send_request_without_reply(&slices, fds).await
214}
215/// Extension trait defining the requests of this extension.
216pub trait ConnectionExt: RequestConnection {
217    /// Negotiate the version of Composite.
218    ///
219    /// This negotiates the version of the Composite extension.  It must be precede all
220    /// other requests using Composite.  Failure to do so will cause a BadRequest error.
221    ///
222    /// # Fields
223    ///
224    /// * `client_major_version` - The major version supported by the client.
225    /// * `client_minor_version` - The minor version supported by the client.
226    fn composite_query_version(&self, client_major_version: u32, client_minor_version: u32) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>> + Send + '_>>
227    {
228        Box::pin(query_version(self, client_major_version, client_minor_version))
229    }
230    /// Redirect the hierarchy starting at "window" to off-screen storage..
231    ///
232    /// The hierarchy starting at 'window' is directed to off-screen
233    /// storage.  When all clients enabling redirection terminate,
234    /// the redirection will automatically be disabled.
235    ///
236    /// The root window may not be redirected. Doing so results in a Match
237    /// error.
238    ///
239    /// # Fields
240    ///
241    /// * `window` - The root of the hierarchy to redirect to off-screen storage.
242    /// * `update` - Whether contents are automatically mirrored to the parent window.  If one client
243    /// already specifies an update type of Manual, any attempt by another to specify a
244    /// mode of Manual so will result in an Access error.
245    fn composite_redirect_window(&self, window: xproto::Window, update: Redirect) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
246    {
247        Box::pin(redirect_window(self, window, update))
248    }
249    /// Redirect all current and future children of ‘window’.
250    ///
251    /// Hierarchies starting at all current and future children of window
252    /// will be redirected as in RedirectWindow. If update is Manual,
253    /// then painting of the window background during window manipulation
254    /// and ClearArea requests is inhibited.
255    ///
256    /// # Fields
257    ///
258    /// * `window` - The root of the hierarchy to redirect to off-screen storage.
259    /// * `update` - Whether contents are automatically mirrored to the parent window.  If one client
260    /// already specifies an update type of Manual, any attempt by another to specify a
261    /// mode of Manual so will result in an Access error.
262    fn composite_redirect_subwindows(&self, window: xproto::Window, update: Redirect) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
263    {
264        Box::pin(redirect_subwindows(self, window, update))
265    }
266    /// Terminate redirection of the specified window..
267    ///
268    /// Redirection of the specified window will be terminated.  This cannot be
269    /// used if the window was redirected with RedirectSubwindows.
270    ///
271    /// # Fields
272    ///
273    /// * `window` - The window to terminate redirection of.  Must be redirected by the
274    /// current client, or a Value error results.
275    /// * `update` - The update type passed to RedirectWindows.  If this does not match the
276    /// previously requested update type, a Value error results.
277    fn composite_unredirect_window(&self, window: xproto::Window, update: Redirect) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
278    {
279        Box::pin(unredirect_window(self, window, update))
280    }
281    /// Terminate redirection of the specified window’s children.
282    ///
283    /// Redirection of all children of window will be terminated.
284    ///
285    /// # Fields
286    ///
287    /// * `window` - The window to terminate redirection of.  Must have previously been
288    /// selected for sub-redirection by the current client, or a Value error
289    /// results.
290    /// * `update` - The update type passed to RedirectSubWindows.  If this does not match
291    /// the previously requested update type, a Value error results.
292    fn composite_unredirect_subwindows(&self, window: xproto::Window, update: Redirect) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
293    {
294        Box::pin(unredirect_subwindows(self, window, update))
295    }
296    fn composite_create_region_from_border_clip(&self, region: xfixes::Region, window: xproto::Window) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
297    {
298        Box::pin(create_region_from_border_clip(self, region, window))
299    }
300    fn composite_name_window_pixmap(&self, window: xproto::Window, pixmap: xproto::Pixmap) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
301    {
302        Box::pin(name_window_pixmap(self, window, pixmap))
303    }
304    fn composite_get_overlay_window(&self, window: xproto::Window) -> Pin<Box<dyn Future<Output = Result<Cookie<'_, Self, GetOverlayWindowReply>, ConnectionError>> + Send + '_>>
305    {
306        Box::pin(get_overlay_window(self, window))
307    }
308    fn composite_release_overlay_window(&self, window: xproto::Window) -> Pin<Box<dyn Future<Output = Result<VoidCookie<'_, Self>, ConnectionError>> + Send + '_>>
309    {
310        Box::pin(release_overlay_window(self, window))
311    }
312}
313
314impl<C: RequestConnection + ?Sized> ConnectionExt for C {}