x11rb/protocol/
present.rs

1// This file contains generated code. Do not edit directly.
2// To regenerate this, run 'make'.
3
4//! Bindings to the `Present` 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;
25#[allow(unused_imports)]
26use super::dri3;
27#[allow(unused_imports)]
28use super::randr;
29#[allow(unused_imports)]
30use super::sync;
31#[allow(unused_imports)]
32use super::xfixes;
33#[allow(unused_imports)]
34use super::xproto;
35
36pub use x11rb_protocol::protocol::present::*;
37
38/// Get the major opcode of this extension
39fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
40    let info = conn.extension_information(X11_EXTENSION_NAME)?;
41    let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
42    Ok(info.major_opcode)
43}
44
45pub fn query_version<Conn>(conn: &Conn, major_version: u32, minor_version: u32) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
46where
47    Conn: RequestConnection + ?Sized,
48{
49    let request0 = QueryVersionRequest {
50        major_version,
51        minor_version,
52    };
53    let (bytes, fds) = request0.serialize(major_opcode(conn)?);
54    let slices = [IoSlice::new(&bytes[0])];
55    assert_eq!(slices.len(), bytes.len());
56    conn.send_request_with_reply(&slices, fds)
57}
58
59pub fn pixmap<'c, 'input, Conn>(conn: &'c Conn, window: xproto::Window, pixmap: xproto::Pixmap, serial: u32, valid: xfixes::Region, update: xfixes::Region, x_off: i16, y_off: i16, target_crtc: randr::Crtc, wait_fence: sync::Fence, idle_fence: sync::Fence, options: u32, target_msc: u64, divisor: u64, remainder: u64, notifies: &'input [Notify]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
60where
61    Conn: RequestConnection + ?Sized,
62{
63    let request0 = PixmapRequest {
64        window,
65        pixmap,
66        serial,
67        valid,
68        update,
69        x_off,
70        y_off,
71        target_crtc,
72        wait_fence,
73        idle_fence,
74        options,
75        target_msc,
76        divisor,
77        remainder,
78        notifies: Cow::Borrowed(notifies),
79    };
80    let (bytes, fds) = request0.serialize(major_opcode(conn)?);
81    let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
82    assert_eq!(slices.len(), bytes.len());
83    conn.send_request_without_reply(&slices, fds)
84}
85
86pub fn notify_msc<Conn>(conn: &Conn, window: xproto::Window, serial: u32, target_msc: u64, divisor: u64, remainder: u64) -> Result<VoidCookie<'_, Conn>, ConnectionError>
87where
88    Conn: RequestConnection + ?Sized,
89{
90    let request0 = NotifyMSCRequest {
91        window,
92        serial,
93        target_msc,
94        divisor,
95        remainder,
96    };
97    let (bytes, fds) = request0.serialize(major_opcode(conn)?);
98    let slices = [IoSlice::new(&bytes[0])];
99    assert_eq!(slices.len(), bytes.len());
100    conn.send_request_without_reply(&slices, fds)
101}
102
103pub fn select_input<Conn>(conn: &Conn, eid: Event, window: xproto::Window, event_mask: EventMask) -> Result<VoidCookie<'_, Conn>, ConnectionError>
104where
105    Conn: RequestConnection + ?Sized,
106{
107    let request0 = SelectInputRequest {
108        eid,
109        window,
110        event_mask,
111    };
112    let (bytes, fds) = request0.serialize(major_opcode(conn)?);
113    let slices = [IoSlice::new(&bytes[0])];
114    assert_eq!(slices.len(), bytes.len());
115    conn.send_request_without_reply(&slices, fds)
116}
117
118pub fn query_capabilities<Conn>(conn: &Conn, target: u32) -> Result<Cookie<'_, Conn, QueryCapabilitiesReply>, ConnectionError>
119where
120    Conn: RequestConnection + ?Sized,
121{
122    let request0 = QueryCapabilitiesRequest {
123        target,
124    };
125    let (bytes, fds) = request0.serialize(major_opcode(conn)?);
126    let slices = [IoSlice::new(&bytes[0])];
127    assert_eq!(slices.len(), bytes.len());
128    conn.send_request_with_reply(&slices, fds)
129}
130
131pub fn pixmap_synced<'c, 'input, Conn>(conn: &'c Conn, window: xproto::Window, pixmap: xproto::Pixmap, serial: u32, valid: xfixes::Region, update: xfixes::Region, x_off: i16, y_off: i16, target_crtc: randr::Crtc, acquire_syncobj: dri3::Syncobj, release_syncobj: dri3::Syncobj, acquire_point: u64, release_point: u64, options: u32, target_msc: u64, divisor: u64, remainder: u64, notifies: &'input [Notify]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
132where
133    Conn: RequestConnection + ?Sized,
134{
135    let request0 = PixmapSyncedRequest {
136        window,
137        pixmap,
138        serial,
139        valid,
140        update,
141        x_off,
142        y_off,
143        target_crtc,
144        acquire_syncobj,
145        release_syncobj,
146        acquire_point,
147        release_point,
148        options,
149        target_msc,
150        divisor,
151        remainder,
152        notifies: Cow::Borrowed(notifies),
153    };
154    let (bytes, fds) = request0.serialize(major_opcode(conn)?);
155    let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
156    assert_eq!(slices.len(), bytes.len());
157    conn.send_request_without_reply(&slices, fds)
158}
159
160/// Extension trait defining the requests of this extension.
161pub trait ConnectionExt: RequestConnection {
162    fn present_query_version(&self, major_version: u32, minor_version: u32) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
163    {
164        query_version(self, major_version, minor_version)
165    }
166    fn present_pixmap<'c, 'input>(&'c self, window: xproto::Window, pixmap: xproto::Pixmap, serial: u32, valid: xfixes::Region, update: xfixes::Region, x_off: i16, y_off: i16, target_crtc: randr::Crtc, wait_fence: sync::Fence, idle_fence: sync::Fence, options: u32, target_msc: u64, divisor: u64, remainder: u64, notifies: &'input [Notify]) -> Result<VoidCookie<'c, Self>, ConnectionError>
167    {
168        self::pixmap(self, window, pixmap, serial, valid, update, x_off, y_off, target_crtc, wait_fence, idle_fence, options, target_msc, divisor, remainder, notifies)
169    }
170    fn present_notify_msc(&self, window: xproto::Window, serial: u32, target_msc: u64, divisor: u64, remainder: u64) -> Result<VoidCookie<'_, Self>, ConnectionError>
171    {
172        notify_msc(self, window, serial, target_msc, divisor, remainder)
173    }
174    fn present_select_input(&self, eid: Event, window: xproto::Window, event_mask: EventMask) -> Result<VoidCookie<'_, Self>, ConnectionError>
175    {
176        select_input(self, eid, window, event_mask)
177    }
178    fn present_query_capabilities(&self, target: u32) -> Result<Cookie<'_, Self, QueryCapabilitiesReply>, ConnectionError>
179    {
180        query_capabilities(self, target)
181    }
182    fn present_pixmap_synced<'c, 'input>(&'c self, window: xproto::Window, pixmap: xproto::Pixmap, serial: u32, valid: xfixes::Region, update: xfixes::Region, x_off: i16, y_off: i16, target_crtc: randr::Crtc, acquire_syncobj: dri3::Syncobj, release_syncobj: dri3::Syncobj, acquire_point: u64, release_point: u64, options: u32, target_msc: u64, divisor: u64, remainder: u64, notifies: &'input [Notify]) -> Result<VoidCookie<'c, Self>, ConnectionError>
183    {
184        pixmap_synced(self, window, pixmap, serial, valid, update, x_off, y_off, target_crtc, acquire_syncobj, release_syncobj, acquire_point, release_point, options, target_msc, divisor, remainder, notifies)
185    }
186}
187
188impl<C: RequestConnection + ?Sized> ConnectionExt for C {}