Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

66
vendor/x11rb/src/protocol/bigreq.rs vendored Normal file
View File

@@ -0,0 +1,66 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `BigRequests` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
pub use x11rb_protocol::protocol::bigreq::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
/// Enable the BIG-REQUESTS extension.
///
/// This enables the BIG-REQUESTS extension, which allows for requests larger than
/// 262140 bytes in length. When enabled, if the 16-bit length field is zero, it
/// is immediately followed by a 32-bit length field specifying the length of the
/// request in 4-byte units.
pub fn enable<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, EnableReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = EnableRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
/// Enable the BIG-REQUESTS extension.
///
/// This enables the BIG-REQUESTS extension, which allows for requests larger than
/// 262140 bytes in length. When enabled, if the 16-bit length field is zero, it
/// is immediately followed by a 32-bit length field specifying the length of the
/// request in 4-byte units.
fn bigreq_enable(&self) -> Result<Cookie<'_, Self, EnableReply>, ConnectionError>
{
enable(self)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

321
vendor/x11rb/src/protocol/composite.rs vendored Normal file
View File

@@ -0,0 +1,321 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `Composite` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xfixes;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::composite::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
/// Negotiate the version of Composite.
///
/// This negotiates the version of the Composite extension. It must be precede all
/// other requests using Composite. Failure to do so will cause a BadRequest error.
///
/// # Fields
///
/// * `client_major_version` - The major version supported by the client.
/// * `client_minor_version` - The minor version supported by the client.
pub fn query_version<Conn>(conn: &Conn, client_major_version: u32, client_minor_version: u32) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest {
client_major_version,
client_minor_version,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Redirect the hierarchy starting at "window" to off-screen storage..
///
/// The hierarchy starting at 'window' is directed to off-screen
/// storage. When all clients enabling redirection terminate,
/// the redirection will automatically be disabled.
///
/// The root window may not be redirected. Doing so results in a Match
/// error.
///
/// # Fields
///
/// * `window` - The root of the hierarchy to redirect to off-screen storage.
/// * `update` - Whether contents are automatically mirrored to the parent window. If one client
/// already specifies an update type of Manual, any attempt by another to specify a
/// mode of Manual so will result in an Access error.
pub fn redirect_window<Conn>(conn: &Conn, window: xproto::Window, update: Redirect) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = RedirectWindowRequest {
window,
update,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Redirect all current and future children of window.
///
/// Hierarchies starting at all current and future children of window
/// will be redirected as in RedirectWindow. If update is Manual,
/// then painting of the window background during window manipulation
/// and ClearArea requests is inhibited.
///
/// # Fields
///
/// * `window` - The root of the hierarchy to redirect to off-screen storage.
/// * `update` - Whether contents are automatically mirrored to the parent window. If one client
/// already specifies an update type of Manual, any attempt by another to specify a
/// mode of Manual so will result in an Access error.
pub fn redirect_subwindows<Conn>(conn: &Conn, window: xproto::Window, update: Redirect) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = RedirectSubwindowsRequest {
window,
update,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Terminate redirection of the specified window..
///
/// Redirection of the specified window will be terminated. This cannot be
/// used if the window was redirected with RedirectSubwindows.
///
/// # Fields
///
/// * `window` - The window to terminate redirection of. Must be redirected by the
/// current client, or a Value error results.
/// * `update` - The update type passed to RedirectWindows. If this does not match the
/// previously requested update type, a Value error results.
pub fn unredirect_window<Conn>(conn: &Conn, window: xproto::Window, update: Redirect) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = UnredirectWindowRequest {
window,
update,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Terminate redirection of the specified windows children.
///
/// Redirection of all children of window will be terminated.
///
/// # Fields
///
/// * `window` - The window to terminate redirection of. Must have previously been
/// selected for sub-redirection by the current client, or a Value error
/// results.
/// * `update` - The update type passed to RedirectSubWindows. If this does not match
/// the previously requested update type, a Value error results.
pub fn unredirect_subwindows<Conn>(conn: &Conn, window: xproto::Window, update: Redirect) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = UnredirectSubwindowsRequest {
window,
update,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_region_from_border_clip<Conn>(conn: &Conn, region: xfixes::Region, window: xproto::Window) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateRegionFromBorderClipRequest {
region,
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn name_window_pixmap<Conn>(conn: &Conn, window: xproto::Window, pixmap: xproto::Pixmap) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = NameWindowPixmapRequest {
window,
pixmap,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_overlay_window<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetOverlayWindowReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetOverlayWindowRequest {
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn release_overlay_window<Conn>(conn: &Conn, window: xproto::Window) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ReleaseOverlayWindowRequest {
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
/// Negotiate the version of Composite.
///
/// This negotiates the version of the Composite extension. It must be precede all
/// other requests using Composite. Failure to do so will cause a BadRequest error.
///
/// # Fields
///
/// * `client_major_version` - The major version supported by the client.
/// * `client_minor_version` - The minor version supported by the client.
fn composite_query_version(&self, client_major_version: u32, client_minor_version: u32) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self, client_major_version, client_minor_version)
}
/// Redirect the hierarchy starting at "window" to off-screen storage..
///
/// The hierarchy starting at 'window' is directed to off-screen
/// storage. When all clients enabling redirection terminate,
/// the redirection will automatically be disabled.
///
/// The root window may not be redirected. Doing so results in a Match
/// error.
///
/// # Fields
///
/// * `window` - The root of the hierarchy to redirect to off-screen storage.
/// * `update` - Whether contents are automatically mirrored to the parent window. If one client
/// already specifies an update type of Manual, any attempt by another to specify a
/// mode of Manual so will result in an Access error.
fn composite_redirect_window(&self, window: xproto::Window, update: Redirect) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
redirect_window(self, window, update)
}
/// Redirect all current and future children of window.
///
/// Hierarchies starting at all current and future children of window
/// will be redirected as in RedirectWindow. If update is Manual,
/// then painting of the window background during window manipulation
/// and ClearArea requests is inhibited.
///
/// # Fields
///
/// * `window` - The root of the hierarchy to redirect to off-screen storage.
/// * `update` - Whether contents are automatically mirrored to the parent window. If one client
/// already specifies an update type of Manual, any attempt by another to specify a
/// mode of Manual so will result in an Access error.
fn composite_redirect_subwindows(&self, window: xproto::Window, update: Redirect) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
redirect_subwindows(self, window, update)
}
/// Terminate redirection of the specified window..
///
/// Redirection of the specified window will be terminated. This cannot be
/// used if the window was redirected with RedirectSubwindows.
///
/// # Fields
///
/// * `window` - The window to terminate redirection of. Must be redirected by the
/// current client, or a Value error results.
/// * `update` - The update type passed to RedirectWindows. If this does not match the
/// previously requested update type, a Value error results.
fn composite_unredirect_window(&self, window: xproto::Window, update: Redirect) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
unredirect_window(self, window, update)
}
/// Terminate redirection of the specified windows children.
///
/// Redirection of all children of window will be terminated.
///
/// # Fields
///
/// * `window` - The window to terminate redirection of. Must have previously been
/// selected for sub-redirection by the current client, or a Value error
/// results.
/// * `update` - The update type passed to RedirectSubWindows. If this does not match
/// the previously requested update type, a Value error results.
fn composite_unredirect_subwindows(&self, window: xproto::Window, update: Redirect) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
unredirect_subwindows(self, window, update)
}
fn composite_create_region_from_border_clip(&self, region: xfixes::Region, window: xproto::Window) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
create_region_from_border_clip(self, region, window)
}
fn composite_name_window_pixmap(&self, window: xproto::Window, pixmap: xproto::Pixmap) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
name_window_pixmap(self, window, pixmap)
}
fn composite_get_overlay_window(&self, window: xproto::Window) -> Result<Cookie<'_, Self, GetOverlayWindowReply>, ConnectionError>
{
get_overlay_window(self, window)
}
fn composite_release_overlay_window(&self, window: xproto::Window) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
release_overlay_window(self, window)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

356
vendor/x11rb/src/protocol/damage.rs vendored Normal file
View File

@@ -0,0 +1,356 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `Damage` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xfixes;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::damage::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
/// Negotiate the version of the DAMAGE extension.
///
/// This negotiates the version of the DAMAGE extension. It must precede any other
/// request using the DAMAGE extension. Failure to do so will cause a BadRequest
/// error for those requests.
///
/// # Fields
///
/// * `client_major_version` - The major version supported by the client.
/// * `client_minor_version` - The minor version supported by the client.
pub fn query_version<Conn>(conn: &Conn, client_major_version: u32, client_minor_version: u32) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest {
client_major_version,
client_minor_version,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Creates a Damage object to monitor changes to a drawable..
///
/// This creates a Damage object to monitor changes to a drawable, and specifies
/// the level of detail to be reported for changes.
///
/// We call changes made to pixel contents of windows and pixmaps 'damage'
/// throughout this extension.
///
/// Damage accumulates as drawing occurs in the drawable. Each drawing operation
/// 'damages' one or more rectangular areas within the drawable. The rectangles
/// are guaranteed to include the set of pixels modified by each operation, but
/// may include significantly more than just those pixels. The desire is for
/// the damage to strike a balance between the number of rectangles reported and
/// the extraneous area included. A reasonable goal is for each primitive
/// object drawn (line, string, rectangle) to be represented as a single
/// rectangle and for the damage area of the operation to be the union of these
/// rectangles.
///
/// The DAMAGE extension allows applications to either receive the raw
/// rectangles as a stream of events, or to have them partially processed within
/// the X server to reduce the amount of data transmitted as well as reduce the
/// processing latency once the repaint operation has started.
///
/// The Damage object holds any accumulated damage region and reflects the
/// relationship between the drawable selected for damage notification and the
/// drawable for which damage is tracked.
///
/// # Fields
///
/// * `damage` - The ID with which you will refer to the new Damage object, created by
/// `xcb_generate_id`.
/// * `drawable` - The ID of the drawable to be monitored.
/// * `level` - The level of detail to be provided in Damage events.
pub fn create<Conn>(conn: &Conn, damage: Damage, drawable: xproto::Drawable, level: ReportLevel) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateRequest {
damage,
drawable,
level,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Destroys a previously created Damage object..
///
/// This destroys a Damage object and requests the X server stop reporting
/// the changes it was tracking.
///
/// # Fields
///
/// * `damage` - The ID you provided to `xcb_create_damage`.
pub fn destroy<Conn>(conn: &Conn, damage: Damage) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DestroyRequest {
damage,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Remove regions from a previously created Damage object..
///
/// This updates the regions of damage recorded in a a Damage object.
/// See <https://www.x.org/releases/current/doc/damageproto/damageproto.txt>
/// for details.
///
/// # Fields
///
/// * `damage` - The ID you provided to `xcb_create_damage`.
pub fn subtract<Conn, A, B>(conn: &Conn, damage: Damage, repair: A, parts: B) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
A: Into<xfixes::Region>,
B: Into<xfixes::Region>,
{
let repair: xfixes::Region = repair.into();
let parts: xfixes::Region = parts.into();
let request0 = SubtractRequest {
damage,
repair,
parts,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Add a region to a previously created Damage object..
///
/// This updates the regions of damage recorded in a a Damage object.
/// See <https://www.x.org/releases/current/doc/damageproto/damageproto.txt>
/// for details.
///
/// # Fields
///
/// * `damage` - The ID you provided to `xcb_create_damage`.
pub fn add<Conn>(conn: &Conn, drawable: xproto::Drawable, region: xfixes::Region) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = AddRequest {
drawable,
region,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
/// Negotiate the version of the DAMAGE extension.
///
/// This negotiates the version of the DAMAGE extension. It must precede any other
/// request using the DAMAGE extension. Failure to do so will cause a BadRequest
/// error for those requests.
///
/// # Fields
///
/// * `client_major_version` - The major version supported by the client.
/// * `client_minor_version` - The minor version supported by the client.
fn damage_query_version(&self, client_major_version: u32, client_minor_version: u32) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self, client_major_version, client_minor_version)
}
/// Creates a Damage object to monitor changes to a drawable..
///
/// This creates a Damage object to monitor changes to a drawable, and specifies
/// the level of detail to be reported for changes.
///
/// We call changes made to pixel contents of windows and pixmaps 'damage'
/// throughout this extension.
///
/// Damage accumulates as drawing occurs in the drawable. Each drawing operation
/// 'damages' one or more rectangular areas within the drawable. The rectangles
/// are guaranteed to include the set of pixels modified by each operation, but
/// may include significantly more than just those pixels. The desire is for
/// the damage to strike a balance between the number of rectangles reported and
/// the extraneous area included. A reasonable goal is for each primitive
/// object drawn (line, string, rectangle) to be represented as a single
/// rectangle and for the damage area of the operation to be the union of these
/// rectangles.
///
/// The DAMAGE extension allows applications to either receive the raw
/// rectangles as a stream of events, or to have them partially processed within
/// the X server to reduce the amount of data transmitted as well as reduce the
/// processing latency once the repaint operation has started.
///
/// The Damage object holds any accumulated damage region and reflects the
/// relationship between the drawable selected for damage notification and the
/// drawable for which damage is tracked.
///
/// # Fields
///
/// * `damage` - The ID with which you will refer to the new Damage object, created by
/// `xcb_generate_id`.
/// * `drawable` - The ID of the drawable to be monitored.
/// * `level` - The level of detail to be provided in Damage events.
fn damage_create(&self, damage: Damage, drawable: xproto::Drawable, level: ReportLevel) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
create(self, damage, drawable, level)
}
/// Destroys a previously created Damage object..
///
/// This destroys a Damage object and requests the X server stop reporting
/// the changes it was tracking.
///
/// # Fields
///
/// * `damage` - The ID you provided to `xcb_create_damage`.
fn damage_destroy(&self, damage: Damage) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
destroy(self, damage)
}
/// Remove regions from a previously created Damage object..
///
/// This updates the regions of damage recorded in a a Damage object.
/// See <https://www.x.org/releases/current/doc/damageproto/damageproto.txt>
/// for details.
///
/// # Fields
///
/// * `damage` - The ID you provided to `xcb_create_damage`.
fn damage_subtract<A, B>(&self, damage: Damage, repair: A, parts: B) -> Result<VoidCookie<'_, Self>, ConnectionError>
where
A: Into<xfixes::Region>,
B: Into<xfixes::Region>,
{
subtract(self, damage, repair, parts)
}
/// Add a region to a previously created Damage object..
///
/// This updates the regions of damage recorded in a a Damage object.
/// See <https://www.x.org/releases/current/doc/damageproto/damageproto.txt>
/// for details.
///
/// # Fields
///
/// * `damage` - The ID you provided to `xcb_create_damage`.
fn damage_add(&self, drawable: xproto::Drawable, region: xfixes::Region) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
add(self, drawable, region)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}
/// A RAII-like wrapper around a [Damage].
///
/// Instances of this struct represent a Damage that is freed in `Drop`.
///
/// Any errors during `Drop` are silently ignored. Most likely an error here means that your
/// X11 connection is broken and later requests will also fail.
#[derive(Debug)]
pub struct DamageWrapper<C: RequestConnection>(C, Damage);
impl<C: RequestConnection> DamageWrapper<C>
{
/// Assume ownership of the given resource and destroy it in `Drop`.
pub fn for_damage(conn: C, id: Damage) -> Self {
DamageWrapper(conn, id)
}
/// Get the XID of the wrapped resource
pub fn damage(&self) -> Damage {
self.1
}
/// Assume ownership of the XID of the wrapped resource
///
/// This function destroys this wrapper without freeing the underlying resource.
pub fn into_damage(self) -> Damage {
let id = self.1;
std::mem::forget(self);
id
}
}
impl<'c, C: X11Connection> DamageWrapper<&'c C>
{
/// Create a new Damage and return a Damage wrapper and a cookie.
///
/// This is a thin wrapper around [create] that allocates an id for the Damage.
/// This function returns the resulting `DamageWrapper` that owns the created Damage and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [create].
///
/// Errors can come from the call to [X11Connection::generate_id] or [create].
pub fn create_and_get_cookie(conn: &'c C, drawable: xproto::Drawable, level: ReportLevel) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let damage = conn.generate_id()?;
let cookie = create(conn, damage, drawable, level)?;
Ok((Self::for_damage(conn, damage), cookie))
}
}
impl<C: X11Connection> DamageWrapper<C>
{
/// Create a new Damage and return a Damage wrapper
///
/// This is a thin wrapper around [create] that allocates an id for the Damage.
/// This function returns the resulting `DamageWrapper` that owns the created Damage and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [create].
pub fn create(conn: C, drawable: xproto::Drawable, level: ReportLevel) -> Result<Self, ReplyOrIdError>
{
let damage = conn.generate_id()?;
let _ = create(&conn, damage, drawable, level)?;
Ok(Self::for_damage(conn, damage))
}
}
impl<C: RequestConnection> From<&DamageWrapper<C>> for Damage {
fn from(from: &DamageWrapper<C>) -> Self {
from.1
}
}
impl<C: RequestConnection> Drop for DamageWrapper<C> {
fn drop(&mut self) {
let _ = destroy(&self.0, self.1);
}
}

266
vendor/x11rb/src/protocol/dbe.rs vendored Normal file
View File

@@ -0,0 +1,266 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `Dbe` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::dbe::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
/// Queries the version of this extension.
///
/// Queries the version of this extension. You must do this before using any functionality it provides.
///
/// # Fields
///
/// * `major_version` - The major version of the extension. Check that it is compatible with the XCB_DBE_MAJOR_VERSION that your code is compiled with.
/// * `minor_version` - The minor version of the extension. Check that it is compatible with the XCB_DBE_MINOR_VERSION that your code is compiled with.
pub fn query_version<Conn>(conn: &Conn, major_version: u8, minor_version: u8) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest {
major_version,
minor_version,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Allocates a back buffer.
///
/// Associates `buffer` with the back buffer of `window`. Multiple ids may be associated with the back buffer, which is created by the first allocate call and destroyed by the last deallocate.
///
/// # Fields
///
/// * `window` - The window to which to add the back buffer.
/// * `buffer` - The buffer id to associate with the back buffer.
/// * `swap_action` - The swap action most likely to be used to present this back buffer. This is only a hint, and does not preclude the use of other swap actions.
pub fn allocate_back_buffer<Conn>(conn: &Conn, window: xproto::Window, buffer: BackBuffer, swap_action: u8) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = AllocateBackBufferRequest {
window,
buffer,
swap_action,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Deallocates a back buffer.
///
/// Deallocates the given `buffer`. If `buffer` is an invalid id, a `BadBuffer` error is returned. Because a window may have allocated multiple back buffer ids, the back buffer itself is not deleted until all these ids are deallocated by this call.
///
/// # Fields
///
/// * `buffer` - The back buffer to deallocate.
pub fn deallocate_back_buffer<Conn>(conn: &Conn, buffer: BackBuffer) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DeallocateBackBufferRequest {
buffer,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Swaps front and back buffers.
///
/// Swaps the front and back buffers on the specified windows. The front and back buffers retain their ids, so that the window id continues to refer to the front buffer, while the back buffer id created by this extension continues to refer to the back buffer. Back buffer contents is moved to the front buffer. Back buffer contents after the operation depends on the given swap action. The optimal swap action depends on how each frame is rendered. For example, if the buffer is cleared and fully overwritten on every frame, the "untouched" action, which throws away the buffer contents, would provide the best performance. To eliminate visual artifacts, the swap will occure during the monitor VSync, if the X server supports detecting it.
///
/// # Fields
///
/// * `n_actions` - Number of swap actions in `actions`.
/// * `actions` - List of windows on which to swap buffers.
pub fn swap_buffers<'c, 'input, Conn>(conn: &'c Conn, actions: &'input [SwapInfo]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SwapBuffersRequest {
actions: Cow::Borrowed(actions),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Begins a logical swap block.
///
/// Creates a block of operations intended to occur together. This may be needed if window presentation requires changing buffers unknown to this extension, such as depth or stencil buffers.
pub fn begin_idiom<Conn>(conn: &Conn) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = BeginIdiomRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Ends a logical swap block.
pub fn end_idiom<Conn>(conn: &Conn) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = EndIdiomRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Requests visuals that support double buffering.
pub fn get_visual_info<'c, 'input, Conn>(conn: &'c Conn, drawables: &'input [xproto::Drawable]) -> Result<Cookie<'c, Conn, GetVisualInfoReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetVisualInfoRequest {
drawables: Cow::Borrowed(drawables),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Gets back buffer attributes.
///
/// Returns the attributes of the specified `buffer`.
///
/// # Fields
///
/// * `buffer` - The back buffer to query.
/// * `attributes` - The attributes of `buffer`.
pub fn get_back_buffer_attributes<Conn>(conn: &Conn, buffer: BackBuffer) -> Result<Cookie<'_, Conn, GetBackBufferAttributesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetBackBufferAttributesRequest {
buffer,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
/// Queries the version of this extension.
///
/// Queries the version of this extension. You must do this before using any functionality it provides.
///
/// # Fields
///
/// * `major_version` - The major version of the extension. Check that it is compatible with the XCB_DBE_MAJOR_VERSION that your code is compiled with.
/// * `minor_version` - The minor version of the extension. Check that it is compatible with the XCB_DBE_MINOR_VERSION that your code is compiled with.
fn dbe_query_version(&self, major_version: u8, minor_version: u8) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self, major_version, minor_version)
}
/// Allocates a back buffer.
///
/// Associates `buffer` with the back buffer of `window`. Multiple ids may be associated with the back buffer, which is created by the first allocate call and destroyed by the last deallocate.
///
/// # Fields
///
/// * `window` - The window to which to add the back buffer.
/// * `buffer` - The buffer id to associate with the back buffer.
/// * `swap_action` - The swap action most likely to be used to present this back buffer. This is only a hint, and does not preclude the use of other swap actions.
fn dbe_allocate_back_buffer(&self, window: xproto::Window, buffer: BackBuffer, swap_action: u8) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
allocate_back_buffer(self, window, buffer, swap_action)
}
/// Deallocates a back buffer.
///
/// Deallocates the given `buffer`. If `buffer` is an invalid id, a `BadBuffer` error is returned. Because a window may have allocated multiple back buffer ids, the back buffer itself is not deleted until all these ids are deallocated by this call.
///
/// # Fields
///
/// * `buffer` - The back buffer to deallocate.
fn dbe_deallocate_back_buffer(&self, buffer: BackBuffer) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
deallocate_back_buffer(self, buffer)
}
/// Swaps front and back buffers.
///
/// Swaps the front and back buffers on the specified windows. The front and back buffers retain their ids, so that the window id continues to refer to the front buffer, while the back buffer id created by this extension continues to refer to the back buffer. Back buffer contents is moved to the front buffer. Back buffer contents after the operation depends on the given swap action. The optimal swap action depends on how each frame is rendered. For example, if the buffer is cleared and fully overwritten on every frame, the "untouched" action, which throws away the buffer contents, would provide the best performance. To eliminate visual artifacts, the swap will occure during the monitor VSync, if the X server supports detecting it.
///
/// # Fields
///
/// * `n_actions` - Number of swap actions in `actions`.
/// * `actions` - List of windows on which to swap buffers.
fn dbe_swap_buffers<'c, 'input>(&'c self, actions: &'input [SwapInfo]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
swap_buffers(self, actions)
}
/// Begins a logical swap block.
///
/// Creates a block of operations intended to occur together. This may be needed if window presentation requires changing buffers unknown to this extension, such as depth or stencil buffers.
fn dbe_begin_idiom(&self) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
begin_idiom(self)
}
/// Ends a logical swap block.
fn dbe_end_idiom(&self) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
end_idiom(self)
}
/// Requests visuals that support double buffering.
fn dbe_get_visual_info<'c, 'input>(&'c self, drawables: &'input [xproto::Drawable]) -> Result<Cookie<'c, Self, GetVisualInfoReply>, ConnectionError>
{
get_visual_info(self, drawables)
}
/// Gets back buffer attributes.
///
/// Returns the attributes of the specified `buffer`.
///
/// # Fields
///
/// * `buffer` - The back buffer to query.
/// * `attributes` - The attributes of `buffer`.
fn dbe_get_back_buffer_attributes(&self, buffer: BackBuffer) -> Result<Cookie<'_, Self, GetBackBufferAttributesReply>, ConnectionError>
{
get_back_buffer_attributes(self, buffer)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

187
vendor/x11rb/src/protocol/dpms.rs vendored Normal file
View File

@@ -0,0 +1,187 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `DPMS` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::dpms::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn get_version<Conn>(conn: &Conn, client_major_version: u16, client_minor_version: u16) -> Result<Cookie<'_, Conn, GetVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetVersionRequest {
client_major_version,
client_minor_version,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn capable<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, CapableReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CapableRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_timeouts<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, GetTimeoutsReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetTimeoutsRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_timeouts<Conn>(conn: &Conn, standby_timeout: u16, suspend_timeout: u16, off_timeout: u16) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetTimeoutsRequest {
standby_timeout,
suspend_timeout,
off_timeout,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn enable<Conn>(conn: &Conn) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = EnableRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn disable<Conn>(conn: &Conn) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DisableRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn force_level<Conn>(conn: &Conn, power_level: DPMSMode) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ForceLevelRequest {
power_level,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn info<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, InfoReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = InfoRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn select_input<Conn>(conn: &Conn, event_mask: EventMask) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SelectInputRequest {
event_mask,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn dpms_get_version(&self, client_major_version: u16, client_minor_version: u16) -> Result<Cookie<'_, Self, GetVersionReply>, ConnectionError>
{
get_version(self, client_major_version, client_minor_version)
}
fn dpms_capable(&self) -> Result<Cookie<'_, Self, CapableReply>, ConnectionError>
{
capable(self)
}
fn dpms_get_timeouts(&self) -> Result<Cookie<'_, Self, GetTimeoutsReply>, ConnectionError>
{
get_timeouts(self)
}
fn dpms_set_timeouts(&self, standby_timeout: u16, suspend_timeout: u16, off_timeout: u16) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
set_timeouts(self, standby_timeout, suspend_timeout, off_timeout)
}
fn dpms_enable(&self) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
enable(self)
}
fn dpms_disable(&self) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
disable(self)
}
fn dpms_force_level(&self, power_level: DPMSMode) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
force_level(self, power_level)
}
fn dpms_info(&self) -> Result<Cookie<'_, Self, InfoReply>, ConnectionError>
{
info(self)
}
fn dpms_select_input(&self, event_mask: EventMask) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
select_input(self, event_mask)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

305
vendor/x11rb/src/protocol/dri2.rs vendored Normal file
View File

@@ -0,0 +1,305 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `DRI2` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::dri2::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_version<Conn>(conn: &Conn, major_version: u32, minor_version: u32) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest {
major_version,
minor_version,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn connect<Conn>(conn: &Conn, window: xproto::Window, driver_type: DriverType) -> Result<Cookie<'_, Conn, ConnectReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ConnectRequest {
window,
driver_type,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn authenticate<Conn>(conn: &Conn, window: xproto::Window, magic: u32) -> Result<Cookie<'_, Conn, AuthenticateReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = AuthenticateRequest {
window,
magic,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn create_drawable<Conn>(conn: &Conn, drawable: xproto::Drawable) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateDrawableRequest {
drawable,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn destroy_drawable<Conn>(conn: &Conn, drawable: xproto::Drawable) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DestroyDrawableRequest {
drawable,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_buffers<'c, 'input, Conn>(conn: &'c Conn, drawable: xproto::Drawable, count: u32, attachments: &'input [u32]) -> Result<Cookie<'c, Conn, GetBuffersReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetBuffersRequest {
drawable,
count,
attachments: Cow::Borrowed(attachments),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn copy_region<Conn>(conn: &Conn, drawable: xproto::Drawable, region: u32, dest: u32, src: u32) -> Result<Cookie<'_, Conn, CopyRegionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CopyRegionRequest {
drawable,
region,
dest,
src,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_buffers_with_format<'c, 'input, Conn>(conn: &'c Conn, drawable: xproto::Drawable, count: u32, attachments: &'input [AttachFormat]) -> Result<Cookie<'c, Conn, GetBuffersWithFormatReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetBuffersWithFormatRequest {
drawable,
count,
attachments: Cow::Borrowed(attachments),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn swap_buffers<Conn>(conn: &Conn, drawable: xproto::Drawable, target_msc_hi: u32, target_msc_lo: u32, divisor_hi: u32, divisor_lo: u32, remainder_hi: u32, remainder_lo: u32) -> Result<Cookie<'_, Conn, SwapBuffersReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SwapBuffersRequest {
drawable,
target_msc_hi,
target_msc_lo,
divisor_hi,
divisor_lo,
remainder_hi,
remainder_lo,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_msc<Conn>(conn: &Conn, drawable: xproto::Drawable) -> Result<Cookie<'_, Conn, GetMSCReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetMSCRequest {
drawable,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn wait_msc<Conn>(conn: &Conn, drawable: xproto::Drawable, target_msc_hi: u32, target_msc_lo: u32, divisor_hi: u32, divisor_lo: u32, remainder_hi: u32, remainder_lo: u32) -> Result<Cookie<'_, Conn, WaitMSCReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = WaitMSCRequest {
drawable,
target_msc_hi,
target_msc_lo,
divisor_hi,
divisor_lo,
remainder_hi,
remainder_lo,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn wait_sbc<Conn>(conn: &Conn, drawable: xproto::Drawable, target_sbc_hi: u32, target_sbc_lo: u32) -> Result<Cookie<'_, Conn, WaitSBCReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = WaitSBCRequest {
drawable,
target_sbc_hi,
target_sbc_lo,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn swap_interval<Conn>(conn: &Conn, drawable: xproto::Drawable, interval: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SwapIntervalRequest {
drawable,
interval,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_param<Conn>(conn: &Conn, drawable: xproto::Drawable, param: u32) -> Result<Cookie<'_, Conn, GetParamReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetParamRequest {
drawable,
param,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn dri2_query_version(&self, major_version: u32, minor_version: u32) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self, major_version, minor_version)
}
fn dri2_connect(&self, window: xproto::Window, driver_type: DriverType) -> Result<Cookie<'_, Self, ConnectReply>, ConnectionError>
{
connect(self, window, driver_type)
}
fn dri2_authenticate(&self, window: xproto::Window, magic: u32) -> Result<Cookie<'_, Self, AuthenticateReply>, ConnectionError>
{
authenticate(self, window, magic)
}
fn dri2_create_drawable(&self, drawable: xproto::Drawable) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
create_drawable(self, drawable)
}
fn dri2_destroy_drawable(&self, drawable: xproto::Drawable) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
destroy_drawable(self, drawable)
}
fn dri2_get_buffers<'c, 'input>(&'c self, drawable: xproto::Drawable, count: u32, attachments: &'input [u32]) -> Result<Cookie<'c, Self, GetBuffersReply>, ConnectionError>
{
get_buffers(self, drawable, count, attachments)
}
fn dri2_copy_region(&self, drawable: xproto::Drawable, region: u32, dest: u32, src: u32) -> Result<Cookie<'_, Self, CopyRegionReply>, ConnectionError>
{
copy_region(self, drawable, region, dest, src)
}
fn dri2_get_buffers_with_format<'c, 'input>(&'c self, drawable: xproto::Drawable, count: u32, attachments: &'input [AttachFormat]) -> Result<Cookie<'c, Self, GetBuffersWithFormatReply>, ConnectionError>
{
get_buffers_with_format(self, drawable, count, attachments)
}
fn dri2_swap_buffers(&self, drawable: xproto::Drawable, target_msc_hi: u32, target_msc_lo: u32, divisor_hi: u32, divisor_lo: u32, remainder_hi: u32, remainder_lo: u32) -> Result<Cookie<'_, Self, SwapBuffersReply>, ConnectionError>
{
swap_buffers(self, drawable, target_msc_hi, target_msc_lo, divisor_hi, divisor_lo, remainder_hi, remainder_lo)
}
fn dri2_get_msc(&self, drawable: xproto::Drawable) -> Result<Cookie<'_, Self, GetMSCReply>, ConnectionError>
{
get_msc(self, drawable)
}
fn dri2_wait_msc(&self, drawable: xproto::Drawable, target_msc_hi: u32, target_msc_lo: u32, divisor_hi: u32, divisor_lo: u32, remainder_hi: u32, remainder_lo: u32) -> Result<Cookie<'_, Self, WaitMSCReply>, ConnectionError>
{
wait_msc(self, drawable, target_msc_hi, target_msc_lo, divisor_hi, divisor_lo, remainder_hi, remainder_lo)
}
fn dri2_wait_sbc(&self, drawable: xproto::Drawable, target_sbc_hi: u32, target_sbc_lo: u32) -> Result<Cookie<'_, Self, WaitSBCReply>, ConnectionError>
{
wait_sbc(self, drawable, target_sbc_hi, target_sbc_lo)
}
fn dri2_swap_interval(&self, drawable: xproto::Drawable, interval: u32) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
swap_interval(self, drawable, interval)
}
fn dri2_get_param(&self, drawable: xproto::Drawable, param: u32) -> Result<Cookie<'_, Self, GetParamReply>, ConnectionError>
{
get_param(self, drawable, param)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

292
vendor/x11rb/src/protocol/dri3.rs vendored Normal file
View File

@@ -0,0 +1,292 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `DRI3` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::dri3::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_version<Conn>(conn: &Conn, major_version: u32, minor_version: u32) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest {
major_version,
minor_version,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn open<Conn>(conn: &Conn, drawable: xproto::Drawable, provider: u32) -> Result<CookieWithFds<'_, Conn, OpenReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = OpenRequest {
drawable,
provider,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply_with_fds(&slices, fds)
}
pub fn pixmap_from_buffer<Conn, A>(conn: &Conn, pixmap: xproto::Pixmap, drawable: xproto::Drawable, size: u32, width: u16, height: u16, stride: u16, depth: u8, bpp: u8, pixmap_fd: A) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
A: Into<RawFdContainer>,
{
let pixmap_fd: RawFdContainer = pixmap_fd.into();
let request0 = PixmapFromBufferRequest {
pixmap,
drawable,
size,
width,
height,
stride,
depth,
bpp,
pixmap_fd,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn buffer_from_pixmap<Conn>(conn: &Conn, pixmap: xproto::Pixmap) -> Result<CookieWithFds<'_, Conn, BufferFromPixmapReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = BufferFromPixmapRequest {
pixmap,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply_with_fds(&slices, fds)
}
pub fn fence_from_fd<Conn, A>(conn: &Conn, drawable: xproto::Drawable, fence: u32, initially_triggered: bool, fence_fd: A) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
A: Into<RawFdContainer>,
{
let fence_fd: RawFdContainer = fence_fd.into();
let request0 = FenceFromFDRequest {
drawable,
fence,
initially_triggered,
fence_fd,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn fd_from_fence<Conn>(conn: &Conn, drawable: xproto::Drawable, fence: u32) -> Result<CookieWithFds<'_, Conn, FDFromFenceReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = FDFromFenceRequest {
drawable,
fence,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply_with_fds(&slices, fds)
}
pub fn get_supported_modifiers<Conn>(conn: &Conn, window: u32, depth: u8, bpp: u8) -> Result<Cookie<'_, Conn, GetSupportedModifiersReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetSupportedModifiersRequest {
window,
depth,
bpp,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn pixmap_from_buffers<Conn>(conn: &Conn, pixmap: xproto::Pixmap, window: xproto::Window, width: u16, height: u16, stride0: u32, offset0: u32, stride1: u32, offset1: u32, stride2: u32, offset2: u32, stride3: u32, offset3: u32, depth: u8, bpp: u8, modifier: u64, buffers: Vec<RawFdContainer>) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PixmapFromBuffersRequest {
pixmap,
window,
width,
height,
stride0,
offset0,
stride1,
offset1,
stride2,
offset2,
stride3,
offset3,
depth,
bpp,
modifier,
buffers,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn buffers_from_pixmap<Conn>(conn: &Conn, pixmap: xproto::Pixmap) -> Result<CookieWithFds<'_, Conn, BuffersFromPixmapReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = BuffersFromPixmapRequest {
pixmap,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply_with_fds(&slices, fds)
}
pub fn set_drm_device_in_use<Conn>(conn: &Conn, window: xproto::Window, drm_major: u32, drm_minor: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetDRMDeviceInUseRequest {
window,
drm_major,
drm_minor,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn import_syncobj<Conn, A>(conn: &Conn, syncobj: Syncobj, drawable: xproto::Drawable, syncobj_fd: A) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
A: Into<RawFdContainer>,
{
let syncobj_fd: RawFdContainer = syncobj_fd.into();
let request0 = ImportSyncobjRequest {
syncobj,
drawable,
syncobj_fd,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn free_syncobj<Conn>(conn: &Conn, syncobj: Syncobj) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = FreeSyncobjRequest {
syncobj,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn dri3_query_version(&self, major_version: u32, minor_version: u32) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self, major_version, minor_version)
}
fn dri3_open(&self, drawable: xproto::Drawable, provider: u32) -> Result<CookieWithFds<'_, Self, OpenReply>, ConnectionError>
{
open(self, drawable, provider)
}
fn dri3_pixmap_from_buffer<A>(&self, pixmap: xproto::Pixmap, drawable: xproto::Drawable, size: u32, width: u16, height: u16, stride: u16, depth: u8, bpp: u8, pixmap_fd: A) -> Result<VoidCookie<'_, Self>, ConnectionError>
where
A: Into<RawFdContainer>,
{
pixmap_from_buffer(self, pixmap, drawable, size, width, height, stride, depth, bpp, pixmap_fd)
}
fn dri3_buffer_from_pixmap(&self, pixmap: xproto::Pixmap) -> Result<CookieWithFds<'_, Self, BufferFromPixmapReply>, ConnectionError>
{
buffer_from_pixmap(self, pixmap)
}
fn dri3_fence_from_fd<A>(&self, drawable: xproto::Drawable, fence: u32, initially_triggered: bool, fence_fd: A) -> Result<VoidCookie<'_, Self>, ConnectionError>
where
A: Into<RawFdContainer>,
{
fence_from_fd(self, drawable, fence, initially_triggered, fence_fd)
}
fn dri3_fd_from_fence(&self, drawable: xproto::Drawable, fence: u32) -> Result<CookieWithFds<'_, Self, FDFromFenceReply>, ConnectionError>
{
fd_from_fence(self, drawable, fence)
}
fn dri3_get_supported_modifiers(&self, window: u32, depth: u8, bpp: u8) -> Result<Cookie<'_, Self, GetSupportedModifiersReply>, ConnectionError>
{
get_supported_modifiers(self, window, depth, bpp)
}
fn dri3_pixmap_from_buffers(&self, pixmap: xproto::Pixmap, window: xproto::Window, width: u16, height: u16, stride0: u32, offset0: u32, stride1: u32, offset1: u32, stride2: u32, offset2: u32, stride3: u32, offset3: u32, depth: u8, bpp: u8, modifier: u64, buffers: Vec<RawFdContainer>) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
pixmap_from_buffers(self, pixmap, window, width, height, stride0, offset0, stride1, offset1, stride2, offset2, stride3, offset3, depth, bpp, modifier, buffers)
}
fn dri3_buffers_from_pixmap(&self, pixmap: xproto::Pixmap) -> Result<CookieWithFds<'_, Self, BuffersFromPixmapReply>, ConnectionError>
{
buffers_from_pixmap(self, pixmap)
}
fn dri3_set_drm_device_in_use(&self, window: xproto::Window, drm_major: u32, drm_minor: u32) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
set_drm_device_in_use(self, window, drm_major, drm_minor)
}
fn dri3_import_syncobj<A>(&self, syncobj: Syncobj, drawable: xproto::Drawable, syncobj_fd: A) -> Result<VoidCookie<'_, Self>, ConnectionError>
where
A: Into<RawFdContainer>,
{
import_syncobj(self, syncobj, drawable, syncobj_fd)
}
fn dri3_free_syncobj(&self, syncobj: Syncobj) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
free_syncobj(self, syncobj)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

57
vendor/x11rb/src/protocol/ge.rs vendored Normal file
View File

@@ -0,0 +1,57 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `GenericEvent` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
pub use x11rb_protocol::protocol::ge::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_version<Conn>(conn: &Conn, client_major_version: u16, client_minor_version: u16) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest {
client_major_version,
client_minor_version,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn ge_query_version(&self, client_major_version: u16, client_minor_version: u16) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self, client_major_version, client_minor_version)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

1945
vendor/x11rb/src/protocol/glx.rs vendored Normal file

File diff suppressed because it is too large Load Diff

77
vendor/x11rb/src/protocol/mod.rs vendored Normal file
View File

@@ -0,0 +1,77 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the X11 protocol.
//!
//! Each sub-module of this module corresponds to one X11 extension. It contains all the
//! definitions from that extension. The core X11 protocol is in [`xproto`](xproto/index.html).
// Clippy does not like some names from the XML.
#![allow(clippy::upper_case_acronyms)]
// This is not easy to fix, so ignore it.
#![allow(clippy::needless_borrow, clippy::needless_lifetimes)]
pub mod xproto;
pub mod bigreq;
#[cfg(feature = "composite")]
pub mod composite;
#[cfg(feature = "damage")]
pub mod damage;
#[cfg(feature = "dbe")]
pub mod dbe;
#[cfg(feature = "dpms")]
pub mod dpms;
#[cfg(feature = "dri2")]
pub mod dri2;
#[cfg(feature = "dri3")]
pub mod dri3;
pub mod ge;
#[cfg(feature = "glx")]
pub mod glx;
#[cfg(feature = "present")]
pub mod present;
#[cfg(feature = "randr")]
pub mod randr;
#[cfg(feature = "record")]
pub mod record;
#[cfg(feature = "render")]
pub mod render;
#[cfg(feature = "res")]
pub mod res;
#[cfg(feature = "screensaver")]
pub mod screensaver;
#[cfg(feature = "shape")]
pub mod shape;
#[cfg(feature = "shm")]
pub mod shm;
#[cfg(feature = "sync")]
pub mod sync;
pub mod xc_misc;
#[cfg(feature = "xevie")]
pub mod xevie;
#[cfg(feature = "xf86dri")]
pub mod xf86dri;
#[cfg(feature = "xf86vidmode")]
pub mod xf86vidmode;
#[cfg(feature = "xfixes")]
pub mod xfixes;
#[cfg(feature = "xinerama")]
pub mod xinerama;
#[cfg(feature = "xinput")]
pub mod xinput;
#[cfg(feature = "xkb")]
pub mod xkb;
#[cfg(feature = "xprint")]
pub mod xprint;
#[cfg(feature = "xselinux")]
pub mod xselinux;
#[cfg(feature = "xtest")]
pub mod xtest;
#[cfg(feature = "xv")]
pub mod xv;
#[cfg(feature = "xvmc")]
pub mod xvmc;
pub use x11rb_protocol::protocol::Request;
pub use x11rb_protocol::protocol::Reply;
pub use x11rb_protocol::protocol::ErrorKind;
pub use x11rb_protocol::protocol::Event;

188
vendor/x11rb/src/protocol/present.rs vendored Normal file
View File

@@ -0,0 +1,188 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `Present` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::dri3;
#[allow(unused_imports)]
use super::randr;
#[allow(unused_imports)]
use super::sync;
#[allow(unused_imports)]
use super::xfixes;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::present::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_version<Conn>(conn: &Conn, major_version: u32, minor_version: u32) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest {
major_version,
minor_version,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub 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>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PixmapRequest {
window,
pixmap,
serial,
valid,
update,
x_off,
y_off,
target_crtc,
wait_fence,
idle_fence,
options,
target_msc,
divisor,
remainder,
notifies: Cow::Borrowed(notifies),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn notify_msc<Conn>(conn: &Conn, window: xproto::Window, serial: u32, target_msc: u64, divisor: u64, remainder: u64) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = NotifyMSCRequest {
window,
serial,
target_msc,
divisor,
remainder,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn select_input<Conn>(conn: &Conn, eid: Event, window: xproto::Window, event_mask: EventMask) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SelectInputRequest {
eid,
window,
event_mask,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn query_capabilities<Conn>(conn: &Conn, target: u32) -> Result<Cookie<'_, Conn, QueryCapabilitiesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryCapabilitiesRequest {
target,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub 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>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PixmapSyncedRequest {
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: Cow::Borrowed(notifies),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn present_query_version(&self, major_version: u32, minor_version: u32) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self, major_version, minor_version)
}
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>
{
self::pixmap(self, window, pixmap, serial, valid, update, x_off, y_off, target_crtc, wait_fence, idle_fence, options, target_msc, divisor, remainder, notifies)
}
fn present_notify_msc(&self, window: xproto::Window, serial: u32, target_msc: u64, divisor: u64, remainder: u64) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
notify_msc(self, window, serial, target_msc, divisor, remainder)
}
fn present_select_input(&self, eid: Event, window: xproto::Window, event_mask: EventMask) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
select_input(self, eid, window, event_mask)
}
fn present_query_capabilities(&self, target: u32) -> Result<Cookie<'_, Self, QueryCapabilitiesReply>, ConnectionError>
{
query_capabilities(self, target)
}
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>
{
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)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

904
vendor/x11rb/src/protocol/randr.rs vendored Normal file
View File

@@ -0,0 +1,904 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `RandR` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::render;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::randr::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_version<Conn>(conn: &Conn, major_version: u32, minor_version: u32) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest {
major_version,
minor_version,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub 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>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetScreenConfigRequest {
window,
timestamp,
config_timestamp,
size_id,
rotation,
rate,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn select_input<Conn>(conn: &Conn, window: xproto::Window, enable: NotifyMask) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SelectInputRequest {
window,
enable,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_screen_info<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetScreenInfoReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetScreenInfoRequest {
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_screen_size_range<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetScreenSizeRangeReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetScreenSizeRangeRequest {
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_screen_size<Conn>(conn: &Conn, window: xproto::Window, width: u16, height: u16, mm_width: u32, mm_height: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetScreenSizeRequest {
window,
width,
height,
mm_width,
mm_height,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_screen_resources<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetScreenResourcesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetScreenResourcesRequest {
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_output_info<Conn>(conn: &Conn, output: Output, config_timestamp: xproto::Timestamp) -> Result<Cookie<'_, Conn, GetOutputInfoReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetOutputInfoRequest {
output,
config_timestamp,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn list_output_properties<Conn>(conn: &Conn, output: Output) -> Result<Cookie<'_, Conn, ListOutputPropertiesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ListOutputPropertiesRequest {
output,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn query_output_property<Conn>(conn: &Conn, output: Output, property: xproto::Atom) -> Result<Cookie<'_, Conn, QueryOutputPropertyReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryOutputPropertyRequest {
output,
property,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub 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>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ConfigureOutputPropertyRequest {
output,
property,
pending,
range,
values: Cow::Borrowed(values),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub 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>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ChangeOutputPropertyRequest {
output,
property,
type_,
format,
mode,
num_units,
data: Cow::Borrowed(data),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn delete_output_property<Conn>(conn: &Conn, output: Output, property: xproto::Atom) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DeleteOutputPropertyRequest {
output,
property,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub 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>
where
Conn: RequestConnection + ?Sized,
A: Into<xproto::Atom>,
{
let type_: xproto::Atom = type_.into();
let request0 = GetOutputPropertyRequest {
output,
property,
type_,
long_offset,
long_length,
delete,
pending,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn create_mode<'c, 'input, Conn>(conn: &'c Conn, window: xproto::Window, mode_info: ModeInfo, name: &'input [u8]) -> Result<Cookie<'c, Conn, CreateModeReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateModeRequest {
window,
mode_info,
name: Cow::Borrowed(name),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn destroy_mode<Conn>(conn: &Conn, mode: Mode) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DestroyModeRequest {
mode,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn add_output_mode<Conn>(conn: &Conn, output: Output, mode: Mode) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = AddOutputModeRequest {
output,
mode,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn delete_output_mode<Conn>(conn: &Conn, output: Output, mode: Mode) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DeleteOutputModeRequest {
output,
mode,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_crtc_info<Conn>(conn: &Conn, crtc: Crtc, config_timestamp: xproto::Timestamp) -> Result<Cookie<'_, Conn, GetCrtcInfoReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetCrtcInfoRequest {
crtc,
config_timestamp,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub 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>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetCrtcConfigRequest {
crtc,
timestamp,
config_timestamp,
x,
y,
mode,
rotation,
outputs: Cow::Borrowed(outputs),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_crtc_gamma_size<Conn>(conn: &Conn, crtc: Crtc) -> Result<Cookie<'_, Conn, GetCrtcGammaSizeReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetCrtcGammaSizeRequest {
crtc,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_crtc_gamma<Conn>(conn: &Conn, crtc: Crtc) -> Result<Cookie<'_, Conn, GetCrtcGammaReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetCrtcGammaRequest {
crtc,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub 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>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetCrtcGammaRequest {
crtc,
red: Cow::Borrowed(red),
green: Cow::Borrowed(green),
blue: Cow::Borrowed(blue),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3]), IoSlice::new(&bytes[4])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_screen_resources_current<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetScreenResourcesCurrentReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetScreenResourcesCurrentRequest {
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub 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>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetCrtcTransformRequest {
crtc,
transform,
filter_name: Cow::Borrowed(filter_name),
filter_params: Cow::Borrowed(filter_params),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3]), IoSlice::new(&bytes[4])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_crtc_transform<Conn>(conn: &Conn, crtc: Crtc) -> Result<Cookie<'_, Conn, GetCrtcTransformReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetCrtcTransformRequest {
crtc,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_panning<Conn>(conn: &Conn, crtc: Crtc) -> Result<Cookie<'_, Conn, GetPanningReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetPanningRequest {
crtc,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub 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>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetPanningRequest {
crtc,
timestamp,
left,
top,
width,
height,
track_left,
track_top,
track_width,
track_height,
border_left,
border_top,
border_right,
border_bottom,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_output_primary<Conn>(conn: &Conn, window: xproto::Window, output: Output) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetOutputPrimaryRequest {
window,
output,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_output_primary<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetOutputPrimaryReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetOutputPrimaryRequest {
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_providers<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetProvidersReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetProvidersRequest {
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_provider_info<Conn>(conn: &Conn, provider: Provider, config_timestamp: xproto::Timestamp) -> Result<Cookie<'_, Conn, GetProviderInfoReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetProviderInfoRequest {
provider,
config_timestamp,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_provider_offload_sink<Conn>(conn: &Conn, provider: Provider, sink_provider: Provider, config_timestamp: xproto::Timestamp) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetProviderOffloadSinkRequest {
provider,
sink_provider,
config_timestamp,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn set_provider_output_source<Conn>(conn: &Conn, provider: Provider, source_provider: Provider, config_timestamp: xproto::Timestamp) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetProviderOutputSourceRequest {
provider,
source_provider,
config_timestamp,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn list_provider_properties<Conn>(conn: &Conn, provider: Provider) -> Result<Cookie<'_, Conn, ListProviderPropertiesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ListProviderPropertiesRequest {
provider,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn query_provider_property<Conn>(conn: &Conn, provider: Provider, property: xproto::Atom) -> Result<Cookie<'_, Conn, QueryProviderPropertyReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryProviderPropertyRequest {
provider,
property,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub 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>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ConfigureProviderPropertyRequest {
provider,
property,
pending,
range,
values: Cow::Borrowed(values),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub 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>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ChangeProviderPropertyRequest {
provider,
property,
type_,
format,
mode,
num_items,
data: Cow::Borrowed(data),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn delete_provider_property<Conn>(conn: &Conn, provider: Provider, property: xproto::Atom) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DeleteProviderPropertyRequest {
provider,
property,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub 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>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetProviderPropertyRequest {
provider,
property,
type_,
long_offset,
long_length,
delete,
pending,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_monitors<Conn>(conn: &Conn, window: xproto::Window, get_active: bool) -> Result<Cookie<'_, Conn, GetMonitorsReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetMonitorsRequest {
window,
get_active,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_monitor<Conn>(conn: &Conn, window: xproto::Window, monitorinfo: MonitorInfo) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetMonitorRequest {
window,
monitorinfo,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn delete_monitor<Conn>(conn: &Conn, window: xproto::Window, name: xproto::Atom) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DeleteMonitorRequest {
window,
name,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub 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>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateLeaseRequest {
window,
lid,
crtcs: Cow::Borrowed(crtcs),
outputs: Cow::Borrowed(outputs),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply_with_fds(&slices, fds)
}
pub fn free_lease<Conn>(conn: &Conn, lid: Lease, terminate: u8) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = FreeLeaseRequest {
lid,
terminate,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn randr_query_version(&self, major_version: u32, minor_version: u32) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self, major_version, minor_version)
}
fn randr_set_screen_config(&self, window: xproto::Window, timestamp: xproto::Timestamp, config_timestamp: xproto::Timestamp, size_id: u16, rotation: Rotation, rate: u16) -> Result<Cookie<'_, Self, SetScreenConfigReply>, ConnectionError>
{
set_screen_config(self, window, timestamp, config_timestamp, size_id, rotation, rate)
}
fn randr_select_input(&self, window: xproto::Window, enable: NotifyMask) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
select_input(self, window, enable)
}
fn randr_get_screen_info(&self, window: xproto::Window) -> Result<Cookie<'_, Self, GetScreenInfoReply>, ConnectionError>
{
get_screen_info(self, window)
}
fn randr_get_screen_size_range(&self, window: xproto::Window) -> Result<Cookie<'_, Self, GetScreenSizeRangeReply>, ConnectionError>
{
get_screen_size_range(self, window)
}
fn randr_set_screen_size(&self, window: xproto::Window, width: u16, height: u16, mm_width: u32, mm_height: u32) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
set_screen_size(self, window, width, height, mm_width, mm_height)
}
fn randr_get_screen_resources(&self, window: xproto::Window) -> Result<Cookie<'_, Self, GetScreenResourcesReply>, ConnectionError>
{
get_screen_resources(self, window)
}
fn randr_get_output_info(&self, output: Output, config_timestamp: xproto::Timestamp) -> Result<Cookie<'_, Self, GetOutputInfoReply>, ConnectionError>
{
get_output_info(self, output, config_timestamp)
}
fn randr_list_output_properties(&self, output: Output) -> Result<Cookie<'_, Self, ListOutputPropertiesReply>, ConnectionError>
{
list_output_properties(self, output)
}
fn randr_query_output_property(&self, output: Output, property: xproto::Atom) -> Result<Cookie<'_, Self, QueryOutputPropertyReply>, ConnectionError>
{
query_output_property(self, output, property)
}
fn randr_configure_output_property<'c, 'input>(&'c self, output: Output, property: xproto::Atom, pending: bool, range: bool, values: &'input [i32]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
configure_output_property(self, output, property, pending, range, values)
}
fn randr_change_output_property<'c, 'input>(&'c self, output: Output, property: xproto::Atom, type_: xproto::Atom, format: u8, mode: xproto::PropMode, num_units: u32, data: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
change_output_property(self, output, property, type_, format, mode, num_units, data)
}
fn randr_delete_output_property(&self, output: Output, property: xproto::Atom) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
delete_output_property(self, output, property)
}
fn randr_get_output_property<A>(&self, output: Output, property: xproto::Atom, type_: A, long_offset: u32, long_length: u32, delete: bool, pending: bool) -> Result<Cookie<'_, Self, GetOutputPropertyReply>, ConnectionError>
where
A: Into<xproto::Atom>,
{
get_output_property(self, output, property, type_, long_offset, long_length, delete, pending)
}
fn randr_create_mode<'c, 'input>(&'c self, window: xproto::Window, mode_info: ModeInfo, name: &'input [u8]) -> Result<Cookie<'c, Self, CreateModeReply>, ConnectionError>
{
create_mode(self, window, mode_info, name)
}
fn randr_destroy_mode(&self, mode: Mode) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
destroy_mode(self, mode)
}
fn randr_add_output_mode(&self, output: Output, mode: Mode) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
add_output_mode(self, output, mode)
}
fn randr_delete_output_mode(&self, output: Output, mode: Mode) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
delete_output_mode(self, output, mode)
}
fn randr_get_crtc_info(&self, crtc: Crtc, config_timestamp: xproto::Timestamp) -> Result<Cookie<'_, Self, GetCrtcInfoReply>, ConnectionError>
{
get_crtc_info(self, crtc, config_timestamp)
}
fn randr_set_crtc_config<'c, 'input>(&'c self, crtc: Crtc, timestamp: xproto::Timestamp, config_timestamp: xproto::Timestamp, x: i16, y: i16, mode: Mode, rotation: Rotation, outputs: &'input [Output]) -> Result<Cookie<'c, Self, SetCrtcConfigReply>, ConnectionError>
{
set_crtc_config(self, crtc, timestamp, config_timestamp, x, y, mode, rotation, outputs)
}
fn randr_get_crtc_gamma_size(&self, crtc: Crtc) -> Result<Cookie<'_, Self, GetCrtcGammaSizeReply>, ConnectionError>
{
get_crtc_gamma_size(self, crtc)
}
fn randr_get_crtc_gamma(&self, crtc: Crtc) -> Result<Cookie<'_, Self, GetCrtcGammaReply>, ConnectionError>
{
get_crtc_gamma(self, crtc)
}
fn randr_set_crtc_gamma<'c, 'input>(&'c self, crtc: Crtc, red: &'input [u16], green: &'input [u16], blue: &'input [u16]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_crtc_gamma(self, crtc, red, green, blue)
}
fn randr_get_screen_resources_current(&self, window: xproto::Window) -> Result<Cookie<'_, Self, GetScreenResourcesCurrentReply>, ConnectionError>
{
get_screen_resources_current(self, window)
}
fn randr_set_crtc_transform<'c, 'input>(&'c self, crtc: Crtc, transform: render::Transform, filter_name: &'input [u8], filter_params: &'input [render::Fixed]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_crtc_transform(self, crtc, transform, filter_name, filter_params)
}
fn randr_get_crtc_transform(&self, crtc: Crtc) -> Result<Cookie<'_, Self, GetCrtcTransformReply>, ConnectionError>
{
get_crtc_transform(self, crtc)
}
fn randr_get_panning(&self, crtc: Crtc) -> Result<Cookie<'_, Self, GetPanningReply>, ConnectionError>
{
get_panning(self, crtc)
}
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) -> Result<Cookie<'_, Self, SetPanningReply>, ConnectionError>
{
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)
}
fn randr_set_output_primary(&self, window: xproto::Window, output: Output) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
set_output_primary(self, window, output)
}
fn randr_get_output_primary(&self, window: xproto::Window) -> Result<Cookie<'_, Self, GetOutputPrimaryReply>, ConnectionError>
{
get_output_primary(self, window)
}
fn randr_get_providers(&self, window: xproto::Window) -> Result<Cookie<'_, Self, GetProvidersReply>, ConnectionError>
{
get_providers(self, window)
}
fn randr_get_provider_info(&self, provider: Provider, config_timestamp: xproto::Timestamp) -> Result<Cookie<'_, Self, GetProviderInfoReply>, ConnectionError>
{
get_provider_info(self, provider, config_timestamp)
}
fn randr_set_provider_offload_sink(&self, provider: Provider, sink_provider: Provider, config_timestamp: xproto::Timestamp) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
set_provider_offload_sink(self, provider, sink_provider, config_timestamp)
}
fn randr_set_provider_output_source(&self, provider: Provider, source_provider: Provider, config_timestamp: xproto::Timestamp) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
set_provider_output_source(self, provider, source_provider, config_timestamp)
}
fn randr_list_provider_properties(&self, provider: Provider) -> Result<Cookie<'_, Self, ListProviderPropertiesReply>, ConnectionError>
{
list_provider_properties(self, provider)
}
fn randr_query_provider_property(&self, provider: Provider, property: xproto::Atom) -> Result<Cookie<'_, Self, QueryProviderPropertyReply>, ConnectionError>
{
query_provider_property(self, provider, property)
}
fn randr_configure_provider_property<'c, 'input>(&'c self, provider: Provider, property: xproto::Atom, pending: bool, range: bool, values: &'input [i32]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
configure_provider_property(self, provider, property, pending, range, values)
}
fn randr_change_provider_property<'c, 'input>(&'c self, provider: Provider, property: xproto::Atom, type_: xproto::Atom, format: u8, mode: u8, num_items: u32, data: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
change_provider_property(self, provider, property, type_, format, mode, num_items, data)
}
fn randr_delete_provider_property(&self, provider: Provider, property: xproto::Atom) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
delete_provider_property(self, provider, property)
}
fn randr_get_provider_property(&self, provider: Provider, property: xproto::Atom, type_: xproto::Atom, long_offset: u32, long_length: u32, delete: bool, pending: bool) -> Result<Cookie<'_, Self, GetProviderPropertyReply>, ConnectionError>
{
get_provider_property(self, provider, property, type_, long_offset, long_length, delete, pending)
}
fn randr_get_monitors(&self, window: xproto::Window, get_active: bool) -> Result<Cookie<'_, Self, GetMonitorsReply>, ConnectionError>
{
get_monitors(self, window, get_active)
}
fn randr_set_monitor(&self, window: xproto::Window, monitorinfo: MonitorInfo) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
set_monitor(self, window, monitorinfo)
}
fn randr_delete_monitor(&self, window: xproto::Window, name: xproto::Atom) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
delete_monitor(self, window, name)
}
fn randr_create_lease<'c, 'input>(&'c self, window: xproto::Window, lid: Lease, crtcs: &'input [Crtc], outputs: &'input [Output]) -> Result<CookieWithFds<'c, Self, CreateLeaseReply>, ConnectionError>
{
create_lease(self, window, lid, crtcs, outputs)
}
fn randr_free_lease(&self, lid: Lease, terminate: u8) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
free_lease(self, lid, terminate)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

261
vendor/x11rb/src/protocol/record.rs vendored Normal file
View File

@@ -0,0 +1,261 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `Record` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::cookie::RecordEnableContextCookie;
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
pub use x11rb_protocol::protocol::record::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_version<Conn>(conn: &Conn, major_version: u16, minor_version: u16) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest {
major_version,
minor_version,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn create_context<'c, 'input, Conn>(conn: &'c Conn, context: Context, element_header: ElementHeader, client_specs: &'input [ClientSpec], ranges: &'input [Range]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateContextRequest {
context,
element_header,
client_specs: Cow::Borrowed(client_specs),
ranges: Cow::Borrowed(ranges),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn register_clients<'c, 'input, Conn>(conn: &'c Conn, context: Context, element_header: ElementHeader, client_specs: &'input [ClientSpec], ranges: &'input [Range]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = RegisterClientsRequest {
context,
element_header,
client_specs: Cow::Borrowed(client_specs),
ranges: Cow::Borrowed(ranges),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn unregister_clients<'c, 'input, Conn>(conn: &'c Conn, context: Context, client_specs: &'input [ClientSpec]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = UnregisterClientsRequest {
context,
client_specs: Cow::Borrowed(client_specs),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_context<Conn>(conn: &Conn, context: Context) -> Result<Cookie<'_, Conn, GetContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetContextRequest {
context,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn enable_context<Conn>(conn: &Conn, context: Context) -> Result<RecordEnableContextCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = EnableContextRequest {
context,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
Ok(RecordEnableContextCookie::new(conn.send_request_with_reply(&slices, fds)?))
}
pub fn disable_context<Conn>(conn: &Conn, context: Context) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DisableContextRequest {
context,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn free_context<Conn>(conn: &Conn, context: Context) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = FreeContextRequest {
context,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn record_query_version(&self, major_version: u16, minor_version: u16) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self, major_version, minor_version)
}
fn record_create_context<'c, 'input>(&'c self, context: Context, element_header: ElementHeader, client_specs: &'input [ClientSpec], ranges: &'input [Range]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
create_context(self, context, element_header, client_specs, ranges)
}
fn record_register_clients<'c, 'input>(&'c self, context: Context, element_header: ElementHeader, client_specs: &'input [ClientSpec], ranges: &'input [Range]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
register_clients(self, context, element_header, client_specs, ranges)
}
fn record_unregister_clients<'c, 'input>(&'c self, context: Context, client_specs: &'input [ClientSpec]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
unregister_clients(self, context, client_specs)
}
fn record_get_context(&self, context: Context) -> Result<Cookie<'_, Self, GetContextReply>, ConnectionError>
{
get_context(self, context)
}
fn record_enable_context(&self, context: Context) -> Result<RecordEnableContextCookie<'_, Self>, ConnectionError>
{
enable_context(self, context)
}
fn record_disable_context(&self, context: Context) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
disable_context(self, context)
}
fn record_free_context(&self, context: Context) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
free_context(self, context)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}
/// A RAII-like wrapper around a [Context].
///
/// Instances of this struct represent a Context that is freed in `Drop`.
///
/// Any errors during `Drop` are silently ignored. Most likely an error here means that your
/// X11 connection is broken and later requests will also fail.
#[derive(Debug)]
pub struct ContextWrapper<C: RequestConnection>(C, Context);
impl<C: RequestConnection> ContextWrapper<C>
{
/// Assume ownership of the given resource and destroy it in `Drop`.
pub fn for_context(conn: C, id: Context) -> Self {
ContextWrapper(conn, id)
}
/// Get the XID of the wrapped resource
pub fn context(&self) -> Context {
self.1
}
/// Assume ownership of the XID of the wrapped resource
///
/// This function destroys this wrapper without freeing the underlying resource.
pub fn into_context(self) -> Context {
let id = self.1;
std::mem::forget(self);
id
}
}
impl<'c, C: X11Connection> ContextWrapper<&'c C>
{
/// Create a new Context and return a Context wrapper and a cookie.
///
/// This is a thin wrapper around [create_context] that allocates an id for the Context.
/// This function returns the resulting `ContextWrapper` that owns the created Context and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [create_context].
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_context].
pub fn create_context_and_get_cookie(conn: &'c C, element_header: ElementHeader, client_specs: &[ClientSpec], ranges: &[Range]) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let context = conn.generate_id()?;
let cookie = create_context(conn, context, element_header, client_specs, ranges)?;
Ok((Self::for_context(conn, context), cookie))
}
}
impl<C: X11Connection> ContextWrapper<C>
{
/// Create a new Context and return a Context wrapper
///
/// This is a thin wrapper around [create_context] that allocates an id for the Context.
/// This function returns the resulting `ContextWrapper` that owns the created Context and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_context].
pub fn create_context(conn: C, element_header: ElementHeader, client_specs: &[ClientSpec], ranges: &[Range]) -> Result<Self, ReplyOrIdError>
{
let context = conn.generate_id()?;
let _ = create_context(&conn, context, element_header, client_specs, ranges)?;
Ok(Self::for_context(conn, context))
}
}
impl<C: RequestConnection> From<&ContextWrapper<C>> for Context {
fn from(from: &ContextWrapper<C>) -> Self {
from.1
}
}
impl<C: RequestConnection> Drop for ContextWrapper<C> {
fn drop(&mut self) {
let _ = free_context(&self.0, self.1);
}
}

958
vendor/x11rb/src/protocol/render.rs vendored Normal file
View File

@@ -0,0 +1,958 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `Render` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::render::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_version<Conn>(conn: &Conn, client_major_version: u32, client_minor_version: u32) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest {
client_major_version,
client_minor_version,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn query_pict_formats<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, QueryPictFormatsReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryPictFormatsRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn query_pict_index_values<Conn>(conn: &Conn, format: Pictformat) -> Result<Cookie<'_, Conn, QueryPictIndexValuesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryPictIndexValuesRequest {
format,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn create_picture<'c, 'input, Conn>(conn: &'c Conn, pid: Picture, drawable: xproto::Drawable, format: Pictformat, value_list: &'input CreatePictureAux) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreatePictureRequest {
pid,
drawable,
format,
value_list: Cow::Borrowed(value_list),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn change_picture<'c, 'input, Conn>(conn: &'c Conn, picture: Picture, value_list: &'input ChangePictureAux) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ChangePictureRequest {
picture,
value_list: Cow::Borrowed(value_list),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn set_picture_clip_rectangles<'c, 'input, Conn>(conn: &'c Conn, picture: Picture, clip_x_origin: i16, clip_y_origin: i16, rectangles: &'input [xproto::Rectangle]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetPictureClipRectanglesRequest {
picture,
clip_x_origin,
clip_y_origin,
rectangles: Cow::Borrowed(rectangles),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn free_picture<Conn>(conn: &Conn, picture: Picture) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = FreePictureRequest {
picture,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn composite<Conn, A>(conn: &Conn, op: PictOp, src: Picture, mask: A, dst: Picture, src_x: i16, src_y: i16, mask_x: i16, mask_y: i16, dst_x: i16, dst_y: i16, width: u16, height: u16) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
A: Into<Picture>,
{
let mask: Picture = mask.into();
let request0 = CompositeRequest {
op,
src,
mask,
dst,
src_x,
src_y,
mask_x,
mask_y,
dst_x,
dst_y,
width,
height,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn trapezoids<'c, 'input, Conn>(conn: &'c Conn, op: PictOp, src: Picture, dst: Picture, mask_format: Pictformat, src_x: i16, src_y: i16, traps: &'input [Trapezoid]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = TrapezoidsRequest {
op,
src,
dst,
mask_format,
src_x,
src_y,
traps: Cow::Borrowed(traps),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn triangles<'c, 'input, Conn>(conn: &'c Conn, op: PictOp, src: Picture, dst: Picture, mask_format: Pictformat, src_x: i16, src_y: i16, triangles: &'input [Triangle]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = TrianglesRequest {
op,
src,
dst,
mask_format,
src_x,
src_y,
triangles: Cow::Borrowed(triangles),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn tri_strip<'c, 'input, Conn>(conn: &'c Conn, op: PictOp, src: Picture, dst: Picture, mask_format: Pictformat, src_x: i16, src_y: i16, points: &'input [Pointfix]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = TriStripRequest {
op,
src,
dst,
mask_format,
src_x,
src_y,
points: Cow::Borrowed(points),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn tri_fan<'c, 'input, Conn>(conn: &'c Conn, op: PictOp, src: Picture, dst: Picture, mask_format: Pictformat, src_x: i16, src_y: i16, points: &'input [Pointfix]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = TriFanRequest {
op,
src,
dst,
mask_format,
src_x,
src_y,
points: Cow::Borrowed(points),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_glyph_set<Conn>(conn: &Conn, gsid: Glyphset, format: Pictformat) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateGlyphSetRequest {
gsid,
format,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn reference_glyph_set<Conn>(conn: &Conn, gsid: Glyphset, existing: Glyphset) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ReferenceGlyphSetRequest {
gsid,
existing,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn free_glyph_set<Conn>(conn: &Conn, glyphset: Glyphset) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = FreeGlyphSetRequest {
glyphset,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn add_glyphs<'c, 'input, Conn>(conn: &'c Conn, glyphset: Glyphset, glyphids: &'input [u32], glyphs: &'input [Glyphinfo], data: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = AddGlyphsRequest {
glyphset,
glyphids: Cow::Borrowed(glyphids),
glyphs: Cow::Borrowed(glyphs),
data: Cow::Borrowed(data),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3]), IoSlice::new(&bytes[4])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn free_glyphs<'c, 'input, Conn>(conn: &'c Conn, glyphset: Glyphset, glyphs: &'input [Glyph]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = FreeGlyphsRequest {
glyphset,
glyphs: Cow::Borrowed(glyphs),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn composite_glyphs8<'c, 'input, Conn>(conn: &'c Conn, op: PictOp, src: Picture, dst: Picture, mask_format: Pictformat, glyphset: Glyphset, src_x: i16, src_y: i16, glyphcmds: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CompositeGlyphs8Request {
op,
src,
dst,
mask_format,
glyphset,
src_x,
src_y,
glyphcmds: Cow::Borrowed(glyphcmds),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn composite_glyphs16<'c, 'input, Conn>(conn: &'c Conn, op: PictOp, src: Picture, dst: Picture, mask_format: Pictformat, glyphset: Glyphset, src_x: i16, src_y: i16, glyphcmds: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CompositeGlyphs16Request {
op,
src,
dst,
mask_format,
glyphset,
src_x,
src_y,
glyphcmds: Cow::Borrowed(glyphcmds),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn composite_glyphs32<'c, 'input, Conn>(conn: &'c Conn, op: PictOp, src: Picture, dst: Picture, mask_format: Pictformat, glyphset: Glyphset, src_x: i16, src_y: i16, glyphcmds: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CompositeGlyphs32Request {
op,
src,
dst,
mask_format,
glyphset,
src_x,
src_y,
glyphcmds: Cow::Borrowed(glyphcmds),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn fill_rectangles<'c, 'input, Conn>(conn: &'c Conn, op: PictOp, dst: Picture, color: Color, rects: &'input [xproto::Rectangle]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = FillRectanglesRequest {
op,
dst,
color,
rects: Cow::Borrowed(rects),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_cursor<Conn>(conn: &Conn, cid: xproto::Cursor, source: Picture, x: u16, y: u16) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateCursorRequest {
cid,
source,
x,
y,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn set_picture_transform<Conn>(conn: &Conn, picture: Picture, transform: Transform) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetPictureTransformRequest {
picture,
transform,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn query_filters<Conn>(conn: &Conn, drawable: xproto::Drawable) -> Result<Cookie<'_, Conn, QueryFiltersReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryFiltersRequest {
drawable,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_picture_filter<'c, 'input, Conn>(conn: &'c Conn, picture: Picture, filter: &'input [u8], values: &'input [Fixed]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetPictureFilterRequest {
picture,
filter: Cow::Borrowed(filter),
values: Cow::Borrowed(values),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3]), IoSlice::new(&bytes[4])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_anim_cursor<'c, 'input, Conn>(conn: &'c Conn, cid: xproto::Cursor, cursors: &'input [Animcursorelt]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateAnimCursorRequest {
cid,
cursors: Cow::Borrowed(cursors),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn add_traps<'c, 'input, Conn>(conn: &'c Conn, picture: Picture, x_off: i16, y_off: i16, traps: &'input [Trap]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = AddTrapsRequest {
picture,
x_off,
y_off,
traps: Cow::Borrowed(traps),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_solid_fill<Conn>(conn: &Conn, picture: Picture, color: Color) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateSolidFillRequest {
picture,
color,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_linear_gradient<'c, 'input, Conn>(conn: &'c Conn, picture: Picture, p1: Pointfix, p2: Pointfix, stops: &'input [Fixed], colors: &'input [Color]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateLinearGradientRequest {
picture,
p1,
p2,
stops: Cow::Borrowed(stops),
colors: Cow::Borrowed(colors),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_radial_gradient<'c, 'input, Conn>(conn: &'c Conn, picture: Picture, inner: Pointfix, outer: Pointfix, inner_radius: Fixed, outer_radius: Fixed, stops: &'input [Fixed], colors: &'input [Color]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateRadialGradientRequest {
picture,
inner,
outer,
inner_radius,
outer_radius,
stops: Cow::Borrowed(stops),
colors: Cow::Borrowed(colors),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_conical_gradient<'c, 'input, Conn>(conn: &'c Conn, picture: Picture, center: Pointfix, angle: Fixed, stops: &'input [Fixed], colors: &'input [Color]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateConicalGradientRequest {
picture,
center,
angle,
stops: Cow::Borrowed(stops),
colors: Cow::Borrowed(colors),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn render_query_version(&self, client_major_version: u32, client_minor_version: u32) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self, client_major_version, client_minor_version)
}
fn render_query_pict_formats(&self) -> Result<Cookie<'_, Self, QueryPictFormatsReply>, ConnectionError>
{
query_pict_formats(self)
}
fn render_query_pict_index_values(&self, format: Pictformat) -> Result<Cookie<'_, Self, QueryPictIndexValuesReply>, ConnectionError>
{
query_pict_index_values(self, format)
}
fn render_create_picture<'c, 'input>(&'c self, pid: Picture, drawable: xproto::Drawable, format: Pictformat, value_list: &'input CreatePictureAux) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
create_picture(self, pid, drawable, format, value_list)
}
fn render_change_picture<'c, 'input>(&'c self, picture: Picture, value_list: &'input ChangePictureAux) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
change_picture(self, picture, value_list)
}
fn render_set_picture_clip_rectangles<'c, 'input>(&'c self, picture: Picture, clip_x_origin: i16, clip_y_origin: i16, rectangles: &'input [xproto::Rectangle]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_picture_clip_rectangles(self, picture, clip_x_origin, clip_y_origin, rectangles)
}
fn render_free_picture(&self, picture: Picture) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
free_picture(self, picture)
}
fn render_composite<A>(&self, op: PictOp, src: Picture, mask: A, dst: Picture, src_x: i16, src_y: i16, mask_x: i16, mask_y: i16, dst_x: i16, dst_y: i16, width: u16, height: u16) -> Result<VoidCookie<'_, Self>, ConnectionError>
where
A: Into<Picture>,
{
composite(self, op, src, mask, dst, src_x, src_y, mask_x, mask_y, dst_x, dst_y, width, height)
}
fn render_trapezoids<'c, 'input>(&'c self, op: PictOp, src: Picture, dst: Picture, mask_format: Pictformat, src_x: i16, src_y: i16, traps: &'input [Trapezoid]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
trapezoids(self, op, src, dst, mask_format, src_x, src_y, traps)
}
fn render_triangles<'c, 'input>(&'c self, op: PictOp, src: Picture, dst: Picture, mask_format: Pictformat, src_x: i16, src_y: i16, triangles: &'input [Triangle]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
self::triangles(self, op, src, dst, mask_format, src_x, src_y, triangles)
}
fn render_tri_strip<'c, 'input>(&'c self, op: PictOp, src: Picture, dst: Picture, mask_format: Pictformat, src_x: i16, src_y: i16, points: &'input [Pointfix]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
tri_strip(self, op, src, dst, mask_format, src_x, src_y, points)
}
fn render_tri_fan<'c, 'input>(&'c self, op: PictOp, src: Picture, dst: Picture, mask_format: Pictformat, src_x: i16, src_y: i16, points: &'input [Pointfix]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
tri_fan(self, op, src, dst, mask_format, src_x, src_y, points)
}
fn render_create_glyph_set(&self, gsid: Glyphset, format: Pictformat) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
create_glyph_set(self, gsid, format)
}
fn render_reference_glyph_set(&self, gsid: Glyphset, existing: Glyphset) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
reference_glyph_set(self, gsid, existing)
}
fn render_free_glyph_set(&self, glyphset: Glyphset) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
free_glyph_set(self, glyphset)
}
fn render_add_glyphs<'c, 'input>(&'c self, glyphset: Glyphset, glyphids: &'input [u32], glyphs: &'input [Glyphinfo], data: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
add_glyphs(self, glyphset, glyphids, glyphs, data)
}
fn render_free_glyphs<'c, 'input>(&'c self, glyphset: Glyphset, glyphs: &'input [Glyph]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
free_glyphs(self, glyphset, glyphs)
}
fn render_composite_glyphs8<'c, 'input>(&'c self, op: PictOp, src: Picture, dst: Picture, mask_format: Pictformat, glyphset: Glyphset, src_x: i16, src_y: i16, glyphcmds: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
composite_glyphs8(self, op, src, dst, mask_format, glyphset, src_x, src_y, glyphcmds)
}
fn render_composite_glyphs16<'c, 'input>(&'c self, op: PictOp, src: Picture, dst: Picture, mask_format: Pictformat, glyphset: Glyphset, src_x: i16, src_y: i16, glyphcmds: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
composite_glyphs16(self, op, src, dst, mask_format, glyphset, src_x, src_y, glyphcmds)
}
fn render_composite_glyphs32<'c, 'input>(&'c self, op: PictOp, src: Picture, dst: Picture, mask_format: Pictformat, glyphset: Glyphset, src_x: i16, src_y: i16, glyphcmds: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
composite_glyphs32(self, op, src, dst, mask_format, glyphset, src_x, src_y, glyphcmds)
}
fn render_fill_rectangles<'c, 'input>(&'c self, op: PictOp, dst: Picture, color: Color, rects: &'input [xproto::Rectangle]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
fill_rectangles(self, op, dst, color, rects)
}
fn render_create_cursor(&self, cid: xproto::Cursor, source: Picture, x: u16, y: u16) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
create_cursor(self, cid, source, x, y)
}
fn render_set_picture_transform(&self, picture: Picture, transform: Transform) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
set_picture_transform(self, picture, transform)
}
fn render_query_filters(&self, drawable: xproto::Drawable) -> Result<Cookie<'_, Self, QueryFiltersReply>, ConnectionError>
{
query_filters(self, drawable)
}
fn render_set_picture_filter<'c, 'input>(&'c self, picture: Picture, filter: &'input [u8], values: &'input [Fixed]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_picture_filter(self, picture, filter, values)
}
fn render_create_anim_cursor<'c, 'input>(&'c self, cid: xproto::Cursor, cursors: &'input [Animcursorelt]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
create_anim_cursor(self, cid, cursors)
}
fn render_add_traps<'c, 'input>(&'c self, picture: Picture, x_off: i16, y_off: i16, traps: &'input [Trap]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
add_traps(self, picture, x_off, y_off, traps)
}
fn render_create_solid_fill(&self, picture: Picture, color: Color) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
create_solid_fill(self, picture, color)
}
fn render_create_linear_gradient<'c, 'input>(&'c self, picture: Picture, p1: Pointfix, p2: Pointfix, stops: &'input [Fixed], colors: &'input [Color]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
create_linear_gradient(self, picture, p1, p2, stops, colors)
}
fn render_create_radial_gradient<'c, 'input>(&'c self, picture: Picture, inner: Pointfix, outer: Pointfix, inner_radius: Fixed, outer_radius: Fixed, stops: &'input [Fixed], colors: &'input [Color]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
create_radial_gradient(self, picture, inner, outer, inner_radius, outer_radius, stops, colors)
}
fn render_create_conical_gradient<'c, 'input>(&'c self, picture: Picture, center: Pointfix, angle: Fixed, stops: &'input [Fixed], colors: &'input [Color]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
create_conical_gradient(self, picture, center, angle, stops, colors)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}
/// A RAII-like wrapper around a [Picture].
///
/// Instances of this struct represent a Picture that is freed in `Drop`.
///
/// Any errors during `Drop` are silently ignored. Most likely an error here means that your
/// X11 connection is broken and later requests will also fail.
#[derive(Debug)]
pub struct PictureWrapper<C: RequestConnection>(C, Picture);
impl<C: RequestConnection> PictureWrapper<C>
{
/// Assume ownership of the given resource and destroy it in `Drop`.
pub fn for_picture(conn: C, id: Picture) -> Self {
PictureWrapper(conn, id)
}
/// Get the XID of the wrapped resource
pub fn picture(&self) -> Picture {
self.1
}
/// Assume ownership of the XID of the wrapped resource
///
/// This function destroys this wrapper without freeing the underlying resource.
pub fn into_picture(self) -> Picture {
let id = self.1;
std::mem::forget(self);
id
}
}
impl<'c, C: X11Connection> PictureWrapper<&'c C>
{
/// Create a new Picture and return a Picture wrapper and a cookie.
///
/// This is a thin wrapper around [create_picture] that allocates an id for the Picture.
/// This function returns the resulting `PictureWrapper` that owns the created Picture and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [create_picture].
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_picture].
pub fn create_picture_and_get_cookie(conn: &'c C, drawable: xproto::Drawable, format: Pictformat, value_list: &CreatePictureAux) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let pid = conn.generate_id()?;
let cookie = create_picture(conn, pid, drawable, format, value_list)?;
Ok((Self::for_picture(conn, pid), cookie))
}
}
impl<C: X11Connection> PictureWrapper<C>
{
/// Create a new Picture and return a Picture wrapper
///
/// This is a thin wrapper around [create_picture] that allocates an id for the Picture.
/// This function returns the resulting `PictureWrapper` that owns the created Picture and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_picture].
pub fn create_picture(conn: C, drawable: xproto::Drawable, format: Pictformat, value_list: &CreatePictureAux) -> Result<Self, ReplyOrIdError>
{
let pid = conn.generate_id()?;
let _ = create_picture(&conn, pid, drawable, format, value_list)?;
Ok(Self::for_picture(conn, pid))
}
}
impl<'c, C: X11Connection> PictureWrapper<&'c C>
{
/// Create a new Picture and return a Picture wrapper and a cookie.
///
/// This is a thin wrapper around [create_solid_fill] that allocates an id for the Picture.
/// This function returns the resulting `PictureWrapper` that owns the created Picture and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [create_solid_fill].
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_solid_fill].
pub fn create_solid_fill_and_get_cookie(conn: &'c C, color: Color) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let picture = conn.generate_id()?;
let cookie = create_solid_fill(conn, picture, color)?;
Ok((Self::for_picture(conn, picture), cookie))
}
}
impl<C: X11Connection> PictureWrapper<C>
{
/// Create a new Picture and return a Picture wrapper
///
/// This is a thin wrapper around [create_solid_fill] that allocates an id for the Picture.
/// This function returns the resulting `PictureWrapper` that owns the created Picture and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_solid_fill].
pub fn create_solid_fill(conn: C, color: Color) -> Result<Self, ReplyOrIdError>
{
let picture = conn.generate_id()?;
let _ = create_solid_fill(&conn, picture, color)?;
Ok(Self::for_picture(conn, picture))
}
}
impl<'c, C: X11Connection> PictureWrapper<&'c C>
{
/// Create a new Picture and return a Picture wrapper and a cookie.
///
/// This is a thin wrapper around [create_linear_gradient] that allocates an id for the Picture.
/// This function returns the resulting `PictureWrapper` that owns the created Picture and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [create_linear_gradient].
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_linear_gradient].
pub fn create_linear_gradient_and_get_cookie(conn: &'c C, p1: Pointfix, p2: Pointfix, stops: &[Fixed], colors: &[Color]) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let picture = conn.generate_id()?;
let cookie = create_linear_gradient(conn, picture, p1, p2, stops, colors)?;
Ok((Self::for_picture(conn, picture), cookie))
}
}
impl<C: X11Connection> PictureWrapper<C>
{
/// Create a new Picture and return a Picture wrapper
///
/// This is a thin wrapper around [create_linear_gradient] that allocates an id for the Picture.
/// This function returns the resulting `PictureWrapper` that owns the created Picture and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_linear_gradient].
pub fn create_linear_gradient(conn: C, p1: Pointfix, p2: Pointfix, stops: &[Fixed], colors: &[Color]) -> Result<Self, ReplyOrIdError>
{
let picture = conn.generate_id()?;
let _ = create_linear_gradient(&conn, picture, p1, p2, stops, colors)?;
Ok(Self::for_picture(conn, picture))
}
}
impl<'c, C: X11Connection> PictureWrapper<&'c C>
{
/// Create a new Picture and return a Picture wrapper and a cookie.
///
/// This is a thin wrapper around [create_radial_gradient] that allocates an id for the Picture.
/// This function returns the resulting `PictureWrapper` that owns the created Picture and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [create_radial_gradient].
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_radial_gradient].
pub fn create_radial_gradient_and_get_cookie(conn: &'c C, inner: Pointfix, outer: Pointfix, inner_radius: Fixed, outer_radius: Fixed, stops: &[Fixed], colors: &[Color]) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let picture = conn.generate_id()?;
let cookie = create_radial_gradient(conn, picture, inner, outer, inner_radius, outer_radius, stops, colors)?;
Ok((Self::for_picture(conn, picture), cookie))
}
}
impl<C: X11Connection> PictureWrapper<C>
{
/// Create a new Picture and return a Picture wrapper
///
/// This is a thin wrapper around [create_radial_gradient] that allocates an id for the Picture.
/// This function returns the resulting `PictureWrapper` that owns the created Picture and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_radial_gradient].
pub fn create_radial_gradient(conn: C, inner: Pointfix, outer: Pointfix, inner_radius: Fixed, outer_radius: Fixed, stops: &[Fixed], colors: &[Color]) -> Result<Self, ReplyOrIdError>
{
let picture = conn.generate_id()?;
let _ = create_radial_gradient(&conn, picture, inner, outer, inner_radius, outer_radius, stops, colors)?;
Ok(Self::for_picture(conn, picture))
}
}
impl<'c, C: X11Connection> PictureWrapper<&'c C>
{
/// Create a new Picture and return a Picture wrapper and a cookie.
///
/// This is a thin wrapper around [create_conical_gradient] that allocates an id for the Picture.
/// This function returns the resulting `PictureWrapper` that owns the created Picture and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [create_conical_gradient].
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_conical_gradient].
pub fn create_conical_gradient_and_get_cookie(conn: &'c C, center: Pointfix, angle: Fixed, stops: &[Fixed], colors: &[Color]) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let picture = conn.generate_id()?;
let cookie = create_conical_gradient(conn, picture, center, angle, stops, colors)?;
Ok((Self::for_picture(conn, picture), cookie))
}
}
impl<C: X11Connection> PictureWrapper<C>
{
/// Create a new Picture and return a Picture wrapper
///
/// This is a thin wrapper around [create_conical_gradient] that allocates an id for the Picture.
/// This function returns the resulting `PictureWrapper` that owns the created Picture and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_conical_gradient].
pub fn create_conical_gradient(conn: C, center: Pointfix, angle: Fixed, stops: &[Fixed], colors: &[Color]) -> Result<Self, ReplyOrIdError>
{
let picture = conn.generate_id()?;
let _ = create_conical_gradient(&conn, picture, center, angle, stops, colors)?;
Ok(Self::for_picture(conn, picture))
}
}
impl<C: RequestConnection> From<&PictureWrapper<C>> for Picture {
fn from(from: &PictureWrapper<C>) -> Self {
from.1
}
}
impl<C: RequestConnection> Drop for PictureWrapper<C> {
fn drop(&mut self) {
let _ = free_picture(&self.0, self.1);
}
}
/// A RAII-like wrapper around a [Glyphset].
///
/// Instances of this struct represent a Glyphset that is freed in `Drop`.
///
/// Any errors during `Drop` are silently ignored. Most likely an error here means that your
/// X11 connection is broken and later requests will also fail.
#[derive(Debug)]
pub struct GlyphsetWrapper<C: RequestConnection>(C, Glyphset);
impl<C: RequestConnection> GlyphsetWrapper<C>
{
/// Assume ownership of the given resource and destroy it in `Drop`.
pub fn for_glyphset(conn: C, id: Glyphset) -> Self {
GlyphsetWrapper(conn, id)
}
/// Get the XID of the wrapped resource
pub fn glyphset(&self) -> Glyphset {
self.1
}
/// Assume ownership of the XID of the wrapped resource
///
/// This function destroys this wrapper without freeing the underlying resource.
pub fn into_glyphset(self) -> Glyphset {
let id = self.1;
std::mem::forget(self);
id
}
}
impl<'c, C: X11Connection> GlyphsetWrapper<&'c C>
{
/// Create a new Glyphset and return a Glyphset wrapper and a cookie.
///
/// This is a thin wrapper around [create_glyph_set] that allocates an id for the Glyphset.
/// This function returns the resulting `GlyphsetWrapper` that owns the created Glyphset and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [create_glyph_set].
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_glyph_set].
pub fn create_glyph_set_and_get_cookie(conn: &'c C, format: Pictformat) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let gsid = conn.generate_id()?;
let cookie = create_glyph_set(conn, gsid, format)?;
Ok((Self::for_glyphset(conn, gsid), cookie))
}
}
impl<C: X11Connection> GlyphsetWrapper<C>
{
/// Create a new Glyphset and return a Glyphset wrapper
///
/// This is a thin wrapper around [create_glyph_set] that allocates an id for the Glyphset.
/// This function returns the resulting `GlyphsetWrapper` that owns the created Glyphset and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_glyph_set].
pub fn create_glyph_set(conn: C, format: Pictformat) -> Result<Self, ReplyOrIdError>
{
let gsid = conn.generate_id()?;
let _ = create_glyph_set(&conn, gsid, format)?;
Ok(Self::for_glyphset(conn, gsid))
}
}
impl<C: RequestConnection> From<&GlyphsetWrapper<C>> for Glyphset {
fn from(from: &GlyphsetWrapper<C>) -> Self {
from.1
}
}
impl<C: RequestConnection> Drop for GlyphsetWrapper<C> {
fn drop(&mut self) {
let _ = free_glyph_set(&self.0, self.1);
}
}

143
vendor/x11rb/src/protocol/res.rs vendored Normal file
View File

@@ -0,0 +1,143 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `Res` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::res::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_version<Conn>(conn: &Conn, client_major: u8, client_minor: u8) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest {
client_major,
client_minor,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn query_clients<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, QueryClientsReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryClientsRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn query_client_resources<Conn>(conn: &Conn, xid: u32) -> Result<Cookie<'_, Conn, QueryClientResourcesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryClientResourcesRequest {
xid,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn query_client_pixmap_bytes<Conn>(conn: &Conn, xid: u32) -> Result<Cookie<'_, Conn, QueryClientPixmapBytesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryClientPixmapBytesRequest {
xid,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn query_client_ids<'c, 'input, Conn>(conn: &'c Conn, specs: &'input [ClientIdSpec]) -> Result<Cookie<'c, Conn, QueryClientIdsReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryClientIdsRequest {
specs: Cow::Borrowed(specs),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn query_resource_bytes<'c, 'input, Conn>(conn: &'c Conn, client: u32, specs: &'input [ResourceIdSpec]) -> Result<Cookie<'c, Conn, QueryResourceBytesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryResourceBytesRequest {
client,
specs: Cow::Borrowed(specs),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn res_query_version(&self, client_major: u8, client_minor: u8) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self, client_major, client_minor)
}
fn res_query_clients(&self) -> Result<Cookie<'_, Self, QueryClientsReply>, ConnectionError>
{
query_clients(self)
}
fn res_query_client_resources(&self, xid: u32) -> Result<Cookie<'_, Self, QueryClientResourcesReply>, ConnectionError>
{
query_client_resources(self, xid)
}
fn res_query_client_pixmap_bytes(&self, xid: u32) -> Result<Cookie<'_, Self, QueryClientPixmapBytesReply>, ConnectionError>
{
query_client_pixmap_bytes(self, xid)
}
fn res_query_client_ids<'c, 'input>(&'c self, specs: &'input [ClientIdSpec]) -> Result<Cookie<'c, Self, QueryClientIdsReply>, ConnectionError>
{
query_client_ids(self, specs)
}
fn res_query_resource_bytes<'c, 'input>(&'c self, client: u32, specs: &'input [ResourceIdSpec]) -> Result<Cookie<'c, Self, QueryResourceBytesReply>, ConnectionError>
{
query_resource_bytes(self, client, specs)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

154
vendor/x11rb/src/protocol/screensaver.rs vendored Normal file
View File

@@ -0,0 +1,154 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `ScreenSaver` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::screensaver::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_version<Conn>(conn: &Conn, client_major_version: u8, client_minor_version: u8) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest {
client_major_version,
client_minor_version,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn query_info<Conn>(conn: &Conn, drawable: xproto::Drawable) -> Result<Cookie<'_, Conn, QueryInfoReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryInfoRequest {
drawable,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn select_input<Conn>(conn: &Conn, drawable: xproto::Drawable, event_mask: Event) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SelectInputRequest {
drawable,
event_mask,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn set_attributes<'c, 'input, Conn>(conn: &'c Conn, drawable: xproto::Drawable, x: i16, y: i16, width: u16, height: u16, border_width: u16, class: xproto::WindowClass, depth: u8, visual: xproto::Visualid, value_list: &'input SetAttributesAux) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetAttributesRequest {
drawable,
x,
y,
width,
height,
border_width,
class,
depth,
visual,
value_list: Cow::Borrowed(value_list),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn unset_attributes<Conn>(conn: &Conn, drawable: xproto::Drawable) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = UnsetAttributesRequest {
drawable,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn suspend<Conn>(conn: &Conn, suspend: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SuspendRequest {
suspend,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn screensaver_query_version(&self, client_major_version: u8, client_minor_version: u8) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self, client_major_version, client_minor_version)
}
fn screensaver_query_info(&self, drawable: xproto::Drawable) -> Result<Cookie<'_, Self, QueryInfoReply>, ConnectionError>
{
query_info(self, drawable)
}
fn screensaver_select_input(&self, drawable: xproto::Drawable, event_mask: Event) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
select_input(self, drawable, event_mask)
}
fn screensaver_set_attributes<'c, 'input>(&'c self, drawable: xproto::Drawable, x: i16, y: i16, width: u16, height: u16, border_width: u16, class: xproto::WindowClass, depth: u8, visual: xproto::Visualid, value_list: &'input SetAttributesAux) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_attributes(self, drawable, x, y, width, height, border_width, class, depth, visual, value_list)
}
fn screensaver_unset_attributes(&self, drawable: xproto::Drawable) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
unset_attributes(self, drawable)
}
fn screensaver_suspend(&self, suspend: u32) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
self::suspend(self, suspend)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

218
vendor/x11rb/src/protocol/shape.rs vendored Normal file
View File

@@ -0,0 +1,218 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `Shape` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::shape::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_version<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn rectangles<'c, 'input, Conn>(conn: &'c Conn, operation: SO, destination_kind: SK, ordering: xproto::ClipOrdering, destination_window: xproto::Window, x_offset: i16, y_offset: i16, rectangles: &'input [xproto::Rectangle]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = RectanglesRequest {
operation,
destination_kind,
ordering,
destination_window,
x_offset,
y_offset,
rectangles: Cow::Borrowed(rectangles),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn mask<Conn, A>(conn: &Conn, operation: SO, destination_kind: SK, destination_window: xproto::Window, x_offset: i16, y_offset: i16, source_bitmap: A) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
A: Into<xproto::Pixmap>,
{
let source_bitmap: xproto::Pixmap = source_bitmap.into();
let request0 = MaskRequest {
operation,
destination_kind,
destination_window,
x_offset,
y_offset,
source_bitmap,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn combine<Conn>(conn: &Conn, operation: SO, destination_kind: SK, source_kind: SK, destination_window: xproto::Window, x_offset: i16, y_offset: i16, source_window: xproto::Window) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CombineRequest {
operation,
destination_kind,
source_kind,
destination_window,
x_offset,
y_offset,
source_window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn offset<Conn>(conn: &Conn, destination_kind: SK, destination_window: xproto::Window, x_offset: i16, y_offset: i16) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = OffsetRequest {
destination_kind,
destination_window,
x_offset,
y_offset,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn query_extents<Conn>(conn: &Conn, destination_window: xproto::Window) -> Result<Cookie<'_, Conn, QueryExtentsReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryExtentsRequest {
destination_window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn select_input<Conn>(conn: &Conn, destination_window: xproto::Window, enable: bool) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SelectInputRequest {
destination_window,
enable,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn input_selected<Conn>(conn: &Conn, destination_window: xproto::Window) -> Result<Cookie<'_, Conn, InputSelectedReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = InputSelectedRequest {
destination_window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_rectangles<Conn>(conn: &Conn, window: xproto::Window, source_kind: SK) -> Result<Cookie<'_, Conn, GetRectanglesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetRectanglesRequest {
window,
source_kind,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn shape_query_version(&self) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self)
}
fn shape_rectangles<'c, 'input>(&'c self, operation: SO, destination_kind: SK, ordering: xproto::ClipOrdering, destination_window: xproto::Window, x_offset: i16, y_offset: i16, rectangles: &'input [xproto::Rectangle]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
self::rectangles(self, operation, destination_kind, ordering, destination_window, x_offset, y_offset, rectangles)
}
fn shape_mask<A>(&self, operation: SO, destination_kind: SK, destination_window: xproto::Window, x_offset: i16, y_offset: i16, source_bitmap: A) -> Result<VoidCookie<'_, Self>, ConnectionError>
where
A: Into<xproto::Pixmap>,
{
mask(self, operation, destination_kind, destination_window, x_offset, y_offset, source_bitmap)
}
fn shape_combine(&self, operation: SO, destination_kind: SK, source_kind: SK, destination_window: xproto::Window, x_offset: i16, y_offset: i16, source_window: xproto::Window) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
combine(self, operation, destination_kind, source_kind, destination_window, x_offset, y_offset, source_window)
}
fn shape_offset(&self, destination_kind: SK, destination_window: xproto::Window, x_offset: i16, y_offset: i16) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
offset(self, destination_kind, destination_window, x_offset, y_offset)
}
fn shape_query_extents(&self, destination_window: xproto::Window) -> Result<Cookie<'_, Self, QueryExtentsReply>, ConnectionError>
{
query_extents(self, destination_window)
}
fn shape_select_input(&self, destination_window: xproto::Window, enable: bool) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
select_input(self, destination_window, enable)
}
fn shape_input_selected(&self, destination_window: xproto::Window) -> Result<Cookie<'_, Self, InputSelectedReply>, ConnectionError>
{
input_selected(self, destination_window)
}
fn shape_get_rectangles(&self, window: xproto::Window, source_kind: SK) -> Result<Cookie<'_, Self, GetRectanglesReply>, ConnectionError>
{
get_rectangles(self, window, source_kind)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

546
vendor/x11rb/src/protocol/shm.rs vendored Normal file
View File

@@ -0,0 +1,546 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `Shm` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::shm::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
/// Query the version of the MIT-SHM extension..
///
/// This is used to determine the version of the MIT-SHM extension supported by the
/// X server. Clients MUST NOT make other requests in this extension until a reply
/// to this requests indicates the X server supports them.
pub fn query_version<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Attach a System V shared memory segment..
///
/// Attach a System V shared memory segment to the server. This will fail unless
/// the server has permission to map the segment. The client may destroy the segment
/// as soon as it receives a XCB_SHM_COMPLETION event with the shmseg value in this
/// request and with the appropriate serial number.
///
/// # Fields
///
/// * `shmseg` - A shared memory segment ID created with xcb_generate_id().
/// * `shmid` - The System V shared memory segment the server should map.
/// * `read_only` - True if the segment shall be mapped read only by the X11 server, otherwise false.
pub fn attach<Conn>(conn: &Conn, shmseg: Seg, shmid: u32, read_only: bool) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = AttachRequest {
shmseg,
shmid,
read_only,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Destroys the specified shared memory segment..
///
/// Destroys the specified shared memory segment. This will never fail unless the
/// segment number is incorrect.
///
/// # Fields
///
/// * `shmseg` - The segment to be destroyed.
pub fn detach<Conn>(conn: &Conn, shmseg: Seg) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DetachRequest {
shmseg,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Copy data from the shared memory to the specified drawable..
///
/// Copy data from the shared memory to the specified drawable. The amount of bytes
/// written to the destination image is always equal to the number of bytes read
/// from the shared memory segment.
///
/// # Fields
///
/// * `drawable` - The drawable to draw to.
/// * `gc` - The graphics context to use.
/// * `total_width` - The total width of the source image.
/// * `total_height` - The total height of the source image.
/// * `src_x` - The source X coordinate of the sub-image to copy.
/// * `src_y` - The source Y coordinate of the sub-image to copy.
/// * `src_width` - The width, in source image coordinates, of the data to copy from the source.
/// The X server will use this to determine the amount of data to copy. The amount
/// of the destination image that is overwritten is determined automatically.
/// * `src_height` - The height, in source image coordinates, of the data to copy from the source.
/// The X server will use this to determine the amount of data to copy. The amount
/// of the destination image that is overwritten is determined automatically.
/// * `dst_x` - The X coordinate on the destination drawable to copy to.
/// * `dst_y` - The Y coordinate on the destination drawable to copy to.
/// * `depth` - The depth to use.
/// * `format` - The format of the image being drawn. If it is XYBitmap, depth must be 1, or a
/// "BadMatch" error results. The foreground pixel in the GC determines the source
/// for the one bits in the image, and the background pixel determines the source
/// for the zero bits. For XYPixmap and ZPixmap, the depth must match the depth of
/// the drawable, or a "BadMatch" error results.
/// * `send_event` - True if the server should send an XCB_SHM_COMPLETION event when the blit
/// completes.
/// * `offset` - The offset that the source image starts at.
pub fn put_image<Conn>(conn: &Conn, drawable: xproto::Drawable, gc: xproto::Gcontext, total_width: u16, total_height: u16, src_x: u16, src_y: u16, src_width: u16, src_height: u16, dst_x: i16, dst_y: i16, depth: u8, format: u8, send_event: bool, shmseg: Seg, offset: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PutImageRequest {
drawable,
gc,
total_width,
total_height,
src_x,
src_y,
src_width,
src_height,
dst_x,
dst_y,
depth,
format,
send_event,
shmseg,
offset,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Copies data from the specified drawable to the shared memory segment..
///
/// Copy data from the specified drawable to the shared memory segment. The amount
/// of bytes written to the destination image is always equal to the number of bytes
/// read from the shared memory segment.
///
/// # Fields
///
/// * `drawable` - The drawable to copy the image out of.
/// * `x` - The X coordinate in the drawable to begin copying at.
/// * `y` - The Y coordinate in the drawable to begin copying at.
/// * `width` - The width of the image to copy.
/// * `height` - The height of the image to copy.
/// * `plane_mask` - A mask that determines which planes are used.
/// * `format` - The format to use for the copy (???).
/// * `shmseg` - The destination shared memory segment.
/// * `offset` - The offset in the shared memory segment to copy data to.
pub fn get_image<Conn>(conn: &Conn, drawable: xproto::Drawable, x: i16, y: i16, width: u16, height: u16, plane_mask: u32, format: u8, shmseg: Seg, offset: u32) -> Result<Cookie<'_, Conn, GetImageReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetImageRequest {
drawable,
x,
y,
width,
height,
plane_mask,
format,
shmseg,
offset,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Create a pixmap backed by shared memory..
///
/// Create a pixmap backed by shared memory. Writes to the shared memory will be
/// reflected in the contents of the pixmap, and writes to the pixmap will be
/// reflected in the contents of the shared memory.
///
/// # Fields
///
/// * `pid` - A pixmap ID created with xcb_generate_id().
/// * `drawable` - The drawable to create the pixmap in.
/// * `width` - The width of the pixmap to create. Must be nonzero, or a Value error results.
/// * `height` - The height of the pixmap to create. Must be nonzero, or a Value error results.
/// * `depth` - The depth of the pixmap to create. Must be nonzero, or a Value error results.
/// * `shmseg` - The shared memory segment to use to create the pixmap.
/// * `offset` - The offset in the segment to create the pixmap at.
pub fn create_pixmap<Conn>(conn: &Conn, pid: xproto::Pixmap, drawable: xproto::Drawable, width: u16, height: u16, depth: u8, shmseg: Seg, offset: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreatePixmapRequest {
pid,
drawable,
width,
height,
depth,
shmseg,
offset,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Create a shared memory segment.
///
/// Create a shared memory segment. The file descriptor will be mapped at offset
/// zero, and the size will be obtained using fstat(). A zero size will result in a
/// Value error.
///
/// # Fields
///
/// * `shmseg` - A shared memory segment ID created with xcb_generate_id().
/// * `shm_fd` - The file descriptor the server should mmap().
/// * `read_only` - True if the segment shall be mapped read only by the X11 server, otherwise false.
pub fn attach_fd<Conn, A>(conn: &Conn, shmseg: Seg, shm_fd: A, read_only: bool) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
A: Into<RawFdContainer>,
{
let shm_fd: RawFdContainer = shm_fd.into();
let request0 = AttachFdRequest {
shmseg,
shm_fd,
read_only,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Asks the server to allocate a shared memory segment..
///
/// Asks the server to allocate a shared memory segment. The servers reply will
/// include a file descriptor for the client to pass to mmap().
///
/// # Fields
///
/// * `shmseg` - A shared memory segment ID created with xcb_generate_id().
/// * `size` - The size of the segment to create.
/// * `read_only` - True if the server should map the segment read-only; otherwise false.
pub fn create_segment<Conn>(conn: &Conn, shmseg: Seg, size: u32, read_only: bool) -> Result<CookieWithFds<'_, Conn, CreateSegmentReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateSegmentRequest {
shmseg,
size,
read_only,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply_with_fds(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
/// Query the version of the MIT-SHM extension..
///
/// This is used to determine the version of the MIT-SHM extension supported by the
/// X server. Clients MUST NOT make other requests in this extension until a reply
/// to this requests indicates the X server supports them.
fn shm_query_version(&self) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self)
}
/// Attach a System V shared memory segment..
///
/// Attach a System V shared memory segment to the server. This will fail unless
/// the server has permission to map the segment. The client may destroy the segment
/// as soon as it receives a XCB_SHM_COMPLETION event with the shmseg value in this
/// request and with the appropriate serial number.
///
/// # Fields
///
/// * `shmseg` - A shared memory segment ID created with xcb_generate_id().
/// * `shmid` - The System V shared memory segment the server should map.
/// * `read_only` - True if the segment shall be mapped read only by the X11 server, otherwise false.
fn shm_attach(&self, shmseg: Seg, shmid: u32, read_only: bool) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
attach(self, shmseg, shmid, read_only)
}
/// Destroys the specified shared memory segment..
///
/// Destroys the specified shared memory segment. This will never fail unless the
/// segment number is incorrect.
///
/// # Fields
///
/// * `shmseg` - The segment to be destroyed.
fn shm_detach(&self, shmseg: Seg) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
detach(self, shmseg)
}
/// Copy data from the shared memory to the specified drawable..
///
/// Copy data from the shared memory to the specified drawable. The amount of bytes
/// written to the destination image is always equal to the number of bytes read
/// from the shared memory segment.
///
/// # Fields
///
/// * `drawable` - The drawable to draw to.
/// * `gc` - The graphics context to use.
/// * `total_width` - The total width of the source image.
/// * `total_height` - The total height of the source image.
/// * `src_x` - The source X coordinate of the sub-image to copy.
/// * `src_y` - The source Y coordinate of the sub-image to copy.
/// * `src_width` - The width, in source image coordinates, of the data to copy from the source.
/// The X server will use this to determine the amount of data to copy. The amount
/// of the destination image that is overwritten is determined automatically.
/// * `src_height` - The height, in source image coordinates, of the data to copy from the source.
/// The X server will use this to determine the amount of data to copy. The amount
/// of the destination image that is overwritten is determined automatically.
/// * `dst_x` - The X coordinate on the destination drawable to copy to.
/// * `dst_y` - The Y coordinate on the destination drawable to copy to.
/// * `depth` - The depth to use.
/// * `format` - The format of the image being drawn. If it is XYBitmap, depth must be 1, or a
/// "BadMatch" error results. The foreground pixel in the GC determines the source
/// for the one bits in the image, and the background pixel determines the source
/// for the zero bits. For XYPixmap and ZPixmap, the depth must match the depth of
/// the drawable, or a "BadMatch" error results.
/// * `send_event` - True if the server should send an XCB_SHM_COMPLETION event when the blit
/// completes.
/// * `offset` - The offset that the source image starts at.
fn shm_put_image(&self, drawable: xproto::Drawable, gc: xproto::Gcontext, total_width: u16, total_height: u16, src_x: u16, src_y: u16, src_width: u16, src_height: u16, dst_x: i16, dst_y: i16, depth: u8, format: u8, send_event: bool, shmseg: Seg, offset: u32) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
put_image(self, drawable, gc, total_width, total_height, src_x, src_y, src_width, src_height, dst_x, dst_y, depth, format, send_event, shmseg, offset)
}
/// Copies data from the specified drawable to the shared memory segment..
///
/// Copy data from the specified drawable to the shared memory segment. The amount
/// of bytes written to the destination image is always equal to the number of bytes
/// read from the shared memory segment.
///
/// # Fields
///
/// * `drawable` - The drawable to copy the image out of.
/// * `x` - The X coordinate in the drawable to begin copying at.
/// * `y` - The Y coordinate in the drawable to begin copying at.
/// * `width` - The width of the image to copy.
/// * `height` - The height of the image to copy.
/// * `plane_mask` - A mask that determines which planes are used.
/// * `format` - The format to use for the copy (???).
/// * `shmseg` - The destination shared memory segment.
/// * `offset` - The offset in the shared memory segment to copy data to.
fn shm_get_image(&self, drawable: xproto::Drawable, x: i16, y: i16, width: u16, height: u16, plane_mask: u32, format: u8, shmseg: Seg, offset: u32) -> Result<Cookie<'_, Self, GetImageReply>, ConnectionError>
{
get_image(self, drawable, x, y, width, height, plane_mask, format, shmseg, offset)
}
/// Create a pixmap backed by shared memory..
///
/// Create a pixmap backed by shared memory. Writes to the shared memory will be
/// reflected in the contents of the pixmap, and writes to the pixmap will be
/// reflected in the contents of the shared memory.
///
/// # Fields
///
/// * `pid` - A pixmap ID created with xcb_generate_id().
/// * `drawable` - The drawable to create the pixmap in.
/// * `width` - The width of the pixmap to create. Must be nonzero, or a Value error results.
/// * `height` - The height of the pixmap to create. Must be nonzero, or a Value error results.
/// * `depth` - The depth of the pixmap to create. Must be nonzero, or a Value error results.
/// * `shmseg` - The shared memory segment to use to create the pixmap.
/// * `offset` - The offset in the segment to create the pixmap at.
fn shm_create_pixmap(&self, pid: xproto::Pixmap, drawable: xproto::Drawable, width: u16, height: u16, depth: u8, shmseg: Seg, offset: u32) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
create_pixmap(self, pid, drawable, width, height, depth, shmseg, offset)
}
/// Create a shared memory segment.
///
/// Create a shared memory segment. The file descriptor will be mapped at offset
/// zero, and the size will be obtained using fstat(). A zero size will result in a
/// Value error.
///
/// # Fields
///
/// * `shmseg` - A shared memory segment ID created with xcb_generate_id().
/// * `shm_fd` - The file descriptor the server should mmap().
/// * `read_only` - True if the segment shall be mapped read only by the X11 server, otherwise false.
fn shm_attach_fd<A>(&self, shmseg: Seg, shm_fd: A, read_only: bool) -> Result<VoidCookie<'_, Self>, ConnectionError>
where
A: Into<RawFdContainer>,
{
attach_fd(self, shmseg, shm_fd, read_only)
}
/// Asks the server to allocate a shared memory segment..
///
/// Asks the server to allocate a shared memory segment. The servers reply will
/// include a file descriptor for the client to pass to mmap().
///
/// # Fields
///
/// * `shmseg` - A shared memory segment ID created with xcb_generate_id().
/// * `size` - The size of the segment to create.
/// * `read_only` - True if the server should map the segment read-only; otherwise false.
fn shm_create_segment(&self, shmseg: Seg, size: u32, read_only: bool) -> Result<CookieWithFds<'_, Self, CreateSegmentReply>, ConnectionError>
{
create_segment(self, shmseg, size, read_only)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}
/// A RAII-like wrapper around a [Seg].
///
/// Instances of this struct represent a Seg that is freed in `Drop`.
///
/// Any errors during `Drop` are silently ignored. Most likely an error here means that your
/// X11 connection is broken and later requests will also fail.
#[derive(Debug)]
pub struct SegWrapper<C: RequestConnection>(C, Seg);
impl<C: RequestConnection> SegWrapper<C>
{
/// Assume ownership of the given resource and destroy it in `Drop`.
pub fn for_seg(conn: C, id: Seg) -> Self {
SegWrapper(conn, id)
}
/// Get the XID of the wrapped resource
pub fn seg(&self) -> Seg {
self.1
}
/// Assume ownership of the XID of the wrapped resource
///
/// This function destroys this wrapper without freeing the underlying resource.
pub fn into_seg(self) -> Seg {
let id = self.1;
std::mem::forget(self);
id
}
}
impl<'c, C: X11Connection> SegWrapper<&'c C>
{
/// Create a new Seg and return a Seg wrapper and a cookie.
///
/// This is a thin wrapper around [attach] that allocates an id for the Seg.
/// This function returns the resulting `SegWrapper` that owns the created Seg and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [attach].
///
/// Errors can come from the call to [X11Connection::generate_id] or [attach].
pub fn attach_and_get_cookie(conn: &'c C, shmid: u32, read_only: bool) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let shmseg = conn.generate_id()?;
let cookie = attach(conn, shmseg, shmid, read_only)?;
Ok((Self::for_seg(conn, shmseg), cookie))
}
}
impl<C: X11Connection> SegWrapper<C>
{
/// Create a new Seg and return a Seg wrapper
///
/// This is a thin wrapper around [attach] that allocates an id for the Seg.
/// This function returns the resulting `SegWrapper` that owns the created Seg and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [attach].
pub fn attach(conn: C, shmid: u32, read_only: bool) -> Result<Self, ReplyOrIdError>
{
let shmseg = conn.generate_id()?;
let _ = attach(&conn, shmseg, shmid, read_only)?;
Ok(Self::for_seg(conn, shmseg))
}
}
impl<'c, C: X11Connection> SegWrapper<&'c C>
{
/// Create a new Seg and return a Seg wrapper and a cookie.
///
/// This is a thin wrapper around [attach_fd] that allocates an id for the Seg.
/// This function returns the resulting `SegWrapper` that owns the created Seg and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [attach_fd].
///
/// Errors can come from the call to [X11Connection::generate_id] or [attach_fd].
pub fn attach_fd_and_get_cookie<A>(conn: &'c C, shm_fd: A, read_only: bool) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
where
A: Into<RawFdContainer>,
{
let shmseg = conn.generate_id()?;
let cookie = attach_fd(conn, shmseg, shm_fd, read_only)?;
Ok((Self::for_seg(conn, shmseg), cookie))
}
}
impl<C: X11Connection> SegWrapper<C>
{
/// Create a new Seg and return a Seg wrapper
///
/// This is a thin wrapper around [attach_fd] that allocates an id for the Seg.
/// This function returns the resulting `SegWrapper` that owns the created Seg and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [attach_fd].
pub fn attach_fd<A>(conn: C, shm_fd: A, read_only: bool) -> Result<Self, ReplyOrIdError>
where
A: Into<RawFdContainer>,
{
let shmseg = conn.generate_id()?;
let _ = attach_fd(&conn, shmseg, shm_fd, read_only)?;
Ok(Self::for_seg(conn, shmseg))
}
}
impl<C: RequestConnection> From<&SegWrapper<C>> for Seg {
fn from(from: &SegWrapper<C>) -> Self {
from.1
}
}
impl<C: RequestConnection> Drop for SegWrapper<C> {
fn drop(&mut self) {
let _ = detach(&self.0, self.1);
}
}

662
vendor/x11rb/src/protocol/sync.rs vendored Normal file
View File

@@ -0,0 +1,662 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `Sync` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::sync::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn initialize<Conn>(conn: &Conn, desired_major_version: u8, desired_minor_version: u8) -> Result<Cookie<'_, Conn, InitializeReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = InitializeRequest {
desired_major_version,
desired_minor_version,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn list_system_counters<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, ListSystemCountersReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ListSystemCountersRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn create_counter<Conn>(conn: &Conn, id: Counter, initial_value: Int64) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateCounterRequest {
id,
initial_value,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn destroy_counter<Conn>(conn: &Conn, counter: Counter) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DestroyCounterRequest {
counter,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn query_counter<Conn>(conn: &Conn, counter: Counter) -> Result<Cookie<'_, Conn, QueryCounterReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryCounterRequest {
counter,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn await_<'c, 'input, Conn>(conn: &'c Conn, wait_list: &'input [Waitcondition]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = AwaitRequest {
wait_list: Cow::Borrowed(wait_list),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn change_counter<Conn>(conn: &Conn, counter: Counter, amount: Int64) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ChangeCounterRequest {
counter,
amount,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn set_counter<Conn>(conn: &Conn, counter: Counter, value: Int64) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetCounterRequest {
counter,
value,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_alarm<'c, 'input, Conn>(conn: &'c Conn, id: Alarm, value_list: &'input CreateAlarmAux) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateAlarmRequest {
id,
value_list: Cow::Borrowed(value_list),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn change_alarm<'c, 'input, Conn>(conn: &'c Conn, id: Alarm, value_list: &'input ChangeAlarmAux) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ChangeAlarmRequest {
id,
value_list: Cow::Borrowed(value_list),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn destroy_alarm<Conn>(conn: &Conn, alarm: Alarm) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DestroyAlarmRequest {
alarm,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn query_alarm<Conn>(conn: &Conn, alarm: Alarm) -> Result<Cookie<'_, Conn, QueryAlarmReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryAlarmRequest {
alarm,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_priority<Conn>(conn: &Conn, id: u32, priority: i32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetPriorityRequest {
id,
priority,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_priority<Conn>(conn: &Conn, id: u32) -> Result<Cookie<'_, Conn, GetPriorityReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetPriorityRequest {
id,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn create_fence<Conn>(conn: &Conn, drawable: xproto::Drawable, fence: Fence, initially_triggered: bool) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateFenceRequest {
drawable,
fence,
initially_triggered,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn trigger_fence<Conn>(conn: &Conn, fence: Fence) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = TriggerFenceRequest {
fence,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn reset_fence<Conn>(conn: &Conn, fence: Fence) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ResetFenceRequest {
fence,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn destroy_fence<Conn>(conn: &Conn, fence: Fence) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DestroyFenceRequest {
fence,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn query_fence<Conn>(conn: &Conn, fence: Fence) -> Result<Cookie<'_, Conn, QueryFenceReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryFenceRequest {
fence,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn await_fence<'c, 'input, Conn>(conn: &'c Conn, fence_list: &'input [Fence]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = AwaitFenceRequest {
fence_list: Cow::Borrowed(fence_list),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn sync_initialize(&self, desired_major_version: u8, desired_minor_version: u8) -> Result<Cookie<'_, Self, InitializeReply>, ConnectionError>
{
initialize(self, desired_major_version, desired_minor_version)
}
fn sync_list_system_counters(&self) -> Result<Cookie<'_, Self, ListSystemCountersReply>, ConnectionError>
{
list_system_counters(self)
}
fn sync_create_counter(&self, id: Counter, initial_value: Int64) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
create_counter(self, id, initial_value)
}
fn sync_destroy_counter(&self, counter: Counter) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
destroy_counter(self, counter)
}
fn sync_query_counter(&self, counter: Counter) -> Result<Cookie<'_, Self, QueryCounterReply>, ConnectionError>
{
query_counter(self, counter)
}
fn sync_await_<'c, 'input>(&'c self, wait_list: &'input [Waitcondition]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
await_(self, wait_list)
}
fn sync_change_counter(&self, counter: Counter, amount: Int64) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
change_counter(self, counter, amount)
}
fn sync_set_counter(&self, counter: Counter, value: Int64) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
set_counter(self, counter, value)
}
fn sync_create_alarm<'c, 'input>(&'c self, id: Alarm, value_list: &'input CreateAlarmAux) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
create_alarm(self, id, value_list)
}
fn sync_change_alarm<'c, 'input>(&'c self, id: Alarm, value_list: &'input ChangeAlarmAux) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
change_alarm(self, id, value_list)
}
fn sync_destroy_alarm(&self, alarm: Alarm) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
destroy_alarm(self, alarm)
}
fn sync_query_alarm(&self, alarm: Alarm) -> Result<Cookie<'_, Self, QueryAlarmReply>, ConnectionError>
{
query_alarm(self, alarm)
}
fn sync_set_priority(&self, id: u32, priority: i32) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
set_priority(self, id, priority)
}
fn sync_get_priority(&self, id: u32) -> Result<Cookie<'_, Self, GetPriorityReply>, ConnectionError>
{
get_priority(self, id)
}
fn sync_create_fence(&self, drawable: xproto::Drawable, fence: Fence, initially_triggered: bool) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
create_fence(self, drawable, fence, initially_triggered)
}
fn sync_trigger_fence(&self, fence: Fence) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
trigger_fence(self, fence)
}
fn sync_reset_fence(&self, fence: Fence) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
reset_fence(self, fence)
}
fn sync_destroy_fence(&self, fence: Fence) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
destroy_fence(self, fence)
}
fn sync_query_fence(&self, fence: Fence) -> Result<Cookie<'_, Self, QueryFenceReply>, ConnectionError>
{
query_fence(self, fence)
}
fn sync_await_fence<'c, 'input>(&'c self, fence_list: &'input [Fence]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
await_fence(self, fence_list)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}
/// A RAII-like wrapper around a [Counter].
///
/// Instances of this struct represent a Counter that is freed in `Drop`.
///
/// Any errors during `Drop` are silently ignored. Most likely an error here means that your
/// X11 connection is broken and later requests will also fail.
#[derive(Debug)]
pub struct CounterWrapper<C: RequestConnection>(C, Counter);
impl<C: RequestConnection> CounterWrapper<C>
{
/// Assume ownership of the given resource and destroy it in `Drop`.
pub fn for_counter(conn: C, id: Counter) -> Self {
CounterWrapper(conn, id)
}
/// Get the XID of the wrapped resource
pub fn counter(&self) -> Counter {
self.1
}
/// Assume ownership of the XID of the wrapped resource
///
/// This function destroys this wrapper without freeing the underlying resource.
pub fn into_counter(self) -> Counter {
let id = self.1;
std::mem::forget(self);
id
}
}
impl<'c, C: X11Connection> CounterWrapper<&'c C>
{
/// Create a new Counter and return a Counter wrapper and a cookie.
///
/// This is a thin wrapper around [create_counter] that allocates an id for the Counter.
/// This function returns the resulting `CounterWrapper` that owns the created Counter and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [create_counter].
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_counter].
pub fn create_counter_and_get_cookie(conn: &'c C, initial_value: Int64) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let id = conn.generate_id()?;
let cookie = create_counter(conn, id, initial_value)?;
Ok((Self::for_counter(conn, id), cookie))
}
}
impl<C: X11Connection> CounterWrapper<C>
{
/// Create a new Counter and return a Counter wrapper
///
/// This is a thin wrapper around [create_counter] that allocates an id for the Counter.
/// This function returns the resulting `CounterWrapper` that owns the created Counter and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_counter].
pub fn create_counter(conn: C, initial_value: Int64) -> Result<Self, ReplyOrIdError>
{
let id = conn.generate_id()?;
let _ = create_counter(&conn, id, initial_value)?;
Ok(Self::for_counter(conn, id))
}
}
impl<C: RequestConnection> From<&CounterWrapper<C>> for Counter {
fn from(from: &CounterWrapper<C>) -> Self {
from.1
}
}
impl<C: RequestConnection> Drop for CounterWrapper<C> {
fn drop(&mut self) {
let _ = destroy_counter(&self.0, self.1);
}
}
/// A RAII-like wrapper around a [Alarm].
///
/// Instances of this struct represent a Alarm that is freed in `Drop`.
///
/// Any errors during `Drop` are silently ignored. Most likely an error here means that your
/// X11 connection is broken and later requests will also fail.
#[derive(Debug)]
pub struct AlarmWrapper<C: RequestConnection>(C, Alarm);
impl<C: RequestConnection> AlarmWrapper<C>
{
/// Assume ownership of the given resource and destroy it in `Drop`.
pub fn for_alarm(conn: C, id: Alarm) -> Self {
AlarmWrapper(conn, id)
}
/// Get the XID of the wrapped resource
pub fn alarm(&self) -> Alarm {
self.1
}
/// Assume ownership of the XID of the wrapped resource
///
/// This function destroys this wrapper without freeing the underlying resource.
pub fn into_alarm(self) -> Alarm {
let id = self.1;
std::mem::forget(self);
id
}
}
impl<'c, C: X11Connection> AlarmWrapper<&'c C>
{
/// Create a new Alarm and return a Alarm wrapper and a cookie.
///
/// This is a thin wrapper around [create_alarm] that allocates an id for the Alarm.
/// This function returns the resulting `AlarmWrapper` that owns the created Alarm and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [create_alarm].
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_alarm].
pub fn create_alarm_and_get_cookie(conn: &'c C, value_list: &CreateAlarmAux) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let id = conn.generate_id()?;
let cookie = create_alarm(conn, id, value_list)?;
Ok((Self::for_alarm(conn, id), cookie))
}
}
impl<C: X11Connection> AlarmWrapper<C>
{
/// Create a new Alarm and return a Alarm wrapper
///
/// This is a thin wrapper around [create_alarm] that allocates an id for the Alarm.
/// This function returns the resulting `AlarmWrapper` that owns the created Alarm and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_alarm].
pub fn create_alarm(conn: C, value_list: &CreateAlarmAux) -> Result<Self, ReplyOrIdError>
{
let id = conn.generate_id()?;
let _ = create_alarm(&conn, id, value_list)?;
Ok(Self::for_alarm(conn, id))
}
}
impl<C: RequestConnection> From<&AlarmWrapper<C>> for Alarm {
fn from(from: &AlarmWrapper<C>) -> Self {
from.1
}
}
impl<C: RequestConnection> Drop for AlarmWrapper<C> {
fn drop(&mut self) {
let _ = destroy_alarm(&self.0, self.1);
}
}
/// A RAII-like wrapper around a [Fence].
///
/// Instances of this struct represent a Fence that is freed in `Drop`.
///
/// Any errors during `Drop` are silently ignored. Most likely an error here means that your
/// X11 connection is broken and later requests will also fail.
#[derive(Debug)]
pub struct FenceWrapper<C: RequestConnection>(C, Fence);
impl<C: RequestConnection> FenceWrapper<C>
{
/// Assume ownership of the given resource and destroy it in `Drop`.
pub fn for_fence(conn: C, id: Fence) -> Self {
FenceWrapper(conn, id)
}
/// Get the XID of the wrapped resource
pub fn fence(&self) -> Fence {
self.1
}
/// Assume ownership of the XID of the wrapped resource
///
/// This function destroys this wrapper without freeing the underlying resource.
pub fn into_fence(self) -> Fence {
let id = self.1;
std::mem::forget(self);
id
}
}
impl<'c, C: X11Connection> FenceWrapper<&'c C>
{
/// Create a new Fence and return a Fence wrapper and a cookie.
///
/// This is a thin wrapper around [create_fence] that allocates an id for the Fence.
/// This function returns the resulting `FenceWrapper` that owns the created Fence and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [create_fence].
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_fence].
pub fn create_fence_and_get_cookie(conn: &'c C, drawable: xproto::Drawable, initially_triggered: bool) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let fence = conn.generate_id()?;
let cookie = create_fence(conn, drawable, fence, initially_triggered)?;
Ok((Self::for_fence(conn, fence), cookie))
}
}
impl<C: X11Connection> FenceWrapper<C>
{
/// Create a new Fence and return a Fence wrapper
///
/// This is a thin wrapper around [create_fence] that allocates an id for the Fence.
/// This function returns the resulting `FenceWrapper` that owns the created Fence and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_fence].
pub fn create_fence(conn: C, drawable: xproto::Drawable, initially_triggered: bool) -> Result<Self, ReplyOrIdError>
{
let fence = conn.generate_id()?;
let _ = create_fence(&conn, drawable, fence, initially_triggered)?;
Ok(Self::for_fence(conn, fence))
}
}
impl<'c, C: X11Connection> FenceWrapper<&'c C>
{
/// Create a new Fence and return a Fence wrapper and a cookie.
///
/// This is a thin wrapper around [super::dri3::fence_from_fd] that allocates an id for the Fence.
/// This function returns the resulting `FenceWrapper` that owns the created Fence and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [super::dri3::fence_from_fd].
///
/// Errors can come from the call to [X11Connection::generate_id] or [super::dri3::fence_from_fd].
#[cfg(feature = "dri3")]
pub fn dri3_fence_from_fd_and_get_cookie<A>(conn: &'c C, drawable: xproto::Drawable, initially_triggered: bool, fence_fd: A) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
where
A: Into<RawFdContainer>,
{
let fence = conn.generate_id()?;
let cookie = super::dri3::fence_from_fd(conn, drawable, fence, initially_triggered, fence_fd)?;
Ok((Self::for_fence(conn, fence), cookie))
}
}
impl<C: X11Connection> FenceWrapper<C>
{
/// Create a new Fence and return a Fence wrapper
///
/// This is a thin wrapper around [super::dri3::fence_from_fd] that allocates an id for the Fence.
/// This function returns the resulting `FenceWrapper` that owns the created Fence and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [super::dri3::fence_from_fd].
#[cfg(feature = "dri3")]
pub fn dri3_fence_from_fd<A>(conn: C, drawable: xproto::Drawable, initially_triggered: bool, fence_fd: A) -> Result<Self, ReplyOrIdError>
where
A: Into<RawFdContainer>,
{
let fence = conn.generate_id()?;
let _ = super::dri3::fence_from_fd(&conn, drawable, fence, initially_triggered, fence_fd)?;
Ok(Self::for_fence(conn, fence))
}
}
#[cfg(feature = "dri3")]
#[allow(unused_imports)]
use super::dri3;
impl<C: RequestConnection> From<&FenceWrapper<C>> for Fence {
fn from(from: &FenceWrapper<C>) -> Self {
from.1
}
}
impl<C: RequestConnection> Drop for FenceWrapper<C> {
fn drop(&mut self) {
let _ = destroy_fence(&self.0, self.1);
}
}

89
vendor/x11rb/src/protocol/xc_misc.rs vendored Normal file
View File

@@ -0,0 +1,89 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `XCMisc` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
pub use x11rb_protocol::protocol::xc_misc::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn get_version<Conn>(conn: &Conn, client_major_version: u16, client_minor_version: u16) -> Result<Cookie<'_, Conn, GetVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetVersionRequest {
client_major_version,
client_minor_version,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_xid_range<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, GetXIDRangeReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetXIDRangeRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_xid_list<Conn>(conn: &Conn, count: u32) -> Result<Cookie<'_, Conn, GetXIDListReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetXIDListRequest {
count,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn xc_misc_get_version(&self, client_major_version: u16, client_minor_version: u16) -> Result<Cookie<'_, Self, GetVersionReply>, ConnectionError>
{
get_version(self, client_major_version, client_minor_version)
}
fn xc_misc_get_xid_range(&self) -> Result<Cookie<'_, Self, GetXIDRangeReply>, ConnectionError>
{
get_xid_range(self)
}
fn xc_misc_get_xid_list(&self, count: u32) -> Result<Cookie<'_, Self, GetXIDListReply>, ConnectionError>
{
get_xid_list(self, count)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

126
vendor/x11rb/src/protocol/xevie.rs vendored Normal file
View File

@@ -0,0 +1,126 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `Xevie` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
pub use x11rb_protocol::protocol::xevie::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_version<Conn>(conn: &Conn, client_major_version: u16, client_minor_version: u16) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest {
client_major_version,
client_minor_version,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn start<Conn>(conn: &Conn, screen: u32) -> Result<Cookie<'_, Conn, StartReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = StartRequest {
screen,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn end<Conn>(conn: &Conn, cmap: u32) -> Result<Cookie<'_, Conn, EndReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = EndRequest {
cmap,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn send<Conn>(conn: &Conn, event: Event, data_type: u32) -> Result<Cookie<'_, Conn, SendReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SendRequest {
event,
data_type,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn select_input<Conn>(conn: &Conn, event_mask: u32) -> Result<Cookie<'_, Conn, SelectInputReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SelectInputRequest {
event_mask,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn xevie_query_version(&self, client_major_version: u16, client_minor_version: u16) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self, client_major_version, client_minor_version)
}
fn xevie_start(&self, screen: u32) -> Result<Cookie<'_, Self, StartReply>, ConnectionError>
{
start(self, screen)
}
fn xevie_end(&self, cmap: u32) -> Result<Cookie<'_, Self, EndReply>, ConnectionError>
{
end(self, cmap)
}
fn xevie_send(&self, event: Event, data_type: u32) -> Result<Cookie<'_, Self, SendReply>, ConnectionError>
{
send(self, event, data_type)
}
fn xevie_select_input(&self, event_mask: u32) -> Result<Cookie<'_, Self, SelectInputReply>, ConnectionError>
{
select_input(self, event_mask)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

248
vendor/x11rb/src/protocol/xf86dri.rs vendored Normal file
View File

@@ -0,0 +1,248 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `XF86Dri` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
pub use x11rb_protocol::protocol::xf86dri::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_version<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn query_direct_rendering_capable<Conn>(conn: &Conn, screen: u32) -> Result<Cookie<'_, Conn, QueryDirectRenderingCapableReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryDirectRenderingCapableRequest {
screen,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn open_connection<Conn>(conn: &Conn, screen: u32) -> Result<Cookie<'_, Conn, OpenConnectionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = OpenConnectionRequest {
screen,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn close_connection<Conn>(conn: &Conn, screen: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CloseConnectionRequest {
screen,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_client_driver_name<Conn>(conn: &Conn, screen: u32) -> Result<Cookie<'_, Conn, GetClientDriverNameReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetClientDriverNameRequest {
screen,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn create_context<Conn>(conn: &Conn, screen: u32, visual: u32, context: u32) -> Result<Cookie<'_, Conn, CreateContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateContextRequest {
screen,
visual,
context,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn destroy_context<Conn>(conn: &Conn, screen: u32, context: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DestroyContextRequest {
screen,
context,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_drawable<Conn>(conn: &Conn, screen: u32, drawable: u32) -> Result<Cookie<'_, Conn, CreateDrawableReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateDrawableRequest {
screen,
drawable,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn destroy_drawable<Conn>(conn: &Conn, screen: u32, drawable: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DestroyDrawableRequest {
screen,
drawable,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_drawable_info<Conn>(conn: &Conn, screen: u32, drawable: u32) -> Result<Cookie<'_, Conn, GetDrawableInfoReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetDrawableInfoRequest {
screen,
drawable,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_device_info<Conn>(conn: &Conn, screen: u32) -> Result<Cookie<'_, Conn, GetDeviceInfoReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetDeviceInfoRequest {
screen,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn auth_connection<Conn>(conn: &Conn, screen: u32, magic: u32) -> Result<Cookie<'_, Conn, AuthConnectionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = AuthConnectionRequest {
screen,
magic,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn xf86dri_query_version(&self) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self)
}
fn xf86dri_query_direct_rendering_capable(&self, screen: u32) -> Result<Cookie<'_, Self, QueryDirectRenderingCapableReply>, ConnectionError>
{
query_direct_rendering_capable(self, screen)
}
fn xf86dri_open_connection(&self, screen: u32) -> Result<Cookie<'_, Self, OpenConnectionReply>, ConnectionError>
{
open_connection(self, screen)
}
fn xf86dri_close_connection(&self, screen: u32) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
close_connection(self, screen)
}
fn xf86dri_get_client_driver_name(&self, screen: u32) -> Result<Cookie<'_, Self, GetClientDriverNameReply>, ConnectionError>
{
get_client_driver_name(self, screen)
}
fn xf86dri_create_context(&self, screen: u32, visual: u32, context: u32) -> Result<Cookie<'_, Self, CreateContextReply>, ConnectionError>
{
create_context(self, screen, visual, context)
}
fn xf86dri_destroy_context(&self, screen: u32, context: u32) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
destroy_context(self, screen, context)
}
fn xf86dri_create_drawable(&self, screen: u32, drawable: u32) -> Result<Cookie<'_, Self, CreateDrawableReply>, ConnectionError>
{
create_drawable(self, screen, drawable)
}
fn xf86dri_destroy_drawable(&self, screen: u32, drawable: u32) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
destroy_drawable(self, screen, drawable)
}
fn xf86dri_get_drawable_info(&self, screen: u32, drawable: u32) -> Result<Cookie<'_, Self, GetDrawableInfoReply>, ConnectionError>
{
get_drawable_info(self, screen, drawable)
}
fn xf86dri_get_device_info(&self, screen: u32) -> Result<Cookie<'_, Self, GetDeviceInfoReply>, ConnectionError>
{
get_device_info(self, screen)
}
fn xf86dri_auth_connection(&self, screen: u32, magic: u32) -> Result<Cookie<'_, Self, AuthConnectionReply>, ConnectionError>
{
auth_connection(self, screen, magic)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

477
vendor/x11rb/src/protocol/xf86vidmode.rs vendored Normal file
View File

@@ -0,0 +1,477 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `XF86VidMode` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
pub use x11rb_protocol::protocol::xf86vidmode::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_version<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_mode_line<Conn>(conn: &Conn, screen: u16) -> Result<Cookie<'_, Conn, GetModeLineReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetModeLineRequest {
screen,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn mod_mode_line<'c, 'input, Conn>(conn: &'c Conn, screen: u32, hdisplay: u16, hsyncstart: u16, hsyncend: u16, htotal: u16, hskew: u16, vdisplay: u16, vsyncstart: u16, vsyncend: u16, vtotal: u16, flags: ModeFlag, private: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ModModeLineRequest {
screen,
hdisplay,
hsyncstart,
hsyncend,
htotal,
hskew,
vdisplay,
vsyncstart,
vsyncend,
vtotal,
flags,
private: Cow::Borrowed(private),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn switch_mode<Conn>(conn: &Conn, screen: u16, zoom: u16) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SwitchModeRequest {
screen,
zoom,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_monitor<Conn>(conn: &Conn, screen: u16) -> Result<Cookie<'_, Conn, GetMonitorReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetMonitorRequest {
screen,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn lock_mode_switch<Conn>(conn: &Conn, screen: u16, lock: u16) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = LockModeSwitchRequest {
screen,
lock,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_all_mode_lines<Conn>(conn: &Conn, screen: u16) -> Result<Cookie<'_, Conn, GetAllModeLinesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetAllModeLinesRequest {
screen,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn add_mode_line<'c, 'input, Conn>(conn: &'c Conn, screen: u32, dotclock: Dotclock, hdisplay: u16, hsyncstart: u16, hsyncend: u16, htotal: u16, hskew: u16, vdisplay: u16, vsyncstart: u16, vsyncend: u16, vtotal: u16, flags: ModeFlag, after_dotclock: Dotclock, after_hdisplay: u16, after_hsyncstart: u16, after_hsyncend: u16, after_htotal: u16, after_hskew: u16, after_vdisplay: u16, after_vsyncstart: u16, after_vsyncend: u16, after_vtotal: u16, after_flags: ModeFlag, private: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = AddModeLineRequest {
screen,
dotclock,
hdisplay,
hsyncstart,
hsyncend,
htotal,
hskew,
vdisplay,
vsyncstart,
vsyncend,
vtotal,
flags,
after_dotclock,
after_hdisplay,
after_hsyncstart,
after_hsyncend,
after_htotal,
after_hskew,
after_vdisplay,
after_vsyncstart,
after_vsyncend,
after_vtotal,
after_flags,
private: Cow::Borrowed(private),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn delete_mode_line<'c, 'input, Conn>(conn: &'c Conn, screen: u32, dotclock: Dotclock, hdisplay: u16, hsyncstart: u16, hsyncend: u16, htotal: u16, hskew: u16, vdisplay: u16, vsyncstart: u16, vsyncend: u16, vtotal: u16, flags: ModeFlag, private: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DeleteModeLineRequest {
screen,
dotclock,
hdisplay,
hsyncstart,
hsyncend,
htotal,
hskew,
vdisplay,
vsyncstart,
vsyncend,
vtotal,
flags,
private: Cow::Borrowed(private),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn validate_mode_line<'c, 'input, Conn>(conn: &'c Conn, screen: u32, dotclock: Dotclock, hdisplay: u16, hsyncstart: u16, hsyncend: u16, htotal: u16, hskew: u16, vdisplay: u16, vsyncstart: u16, vsyncend: u16, vtotal: u16, flags: ModeFlag, private: &'input [u8]) -> Result<Cookie<'c, Conn, ValidateModeLineReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ValidateModeLineRequest {
screen,
dotclock,
hdisplay,
hsyncstart,
hsyncend,
htotal,
hskew,
vdisplay,
vsyncstart,
vsyncend,
vtotal,
flags,
private: Cow::Borrowed(private),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn switch_to_mode<'c, 'input, Conn>(conn: &'c Conn, screen: u32, dotclock: Dotclock, hdisplay: u16, hsyncstart: u16, hsyncend: u16, htotal: u16, hskew: u16, vdisplay: u16, vsyncstart: u16, vsyncend: u16, vtotal: u16, flags: ModeFlag, private: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SwitchToModeRequest {
screen,
dotclock,
hdisplay,
hsyncstart,
hsyncend,
htotal,
hskew,
vdisplay,
vsyncstart,
vsyncend,
vtotal,
flags,
private: Cow::Borrowed(private),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_view_port<Conn>(conn: &Conn, screen: u16) -> Result<Cookie<'_, Conn, GetViewPortReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetViewPortRequest {
screen,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_view_port<Conn>(conn: &Conn, screen: u16, x: u32, y: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetViewPortRequest {
screen,
x,
y,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_dot_clocks<Conn>(conn: &Conn, screen: u16) -> Result<Cookie<'_, Conn, GetDotClocksReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetDotClocksRequest {
screen,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_client_version<Conn>(conn: &Conn, major: u16, minor: u16) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetClientVersionRequest {
major,
minor,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn set_gamma<Conn>(conn: &Conn, screen: u16, red: u32, green: u32, blue: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetGammaRequest {
screen,
red,
green,
blue,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_gamma<Conn>(conn: &Conn, screen: u16) -> Result<Cookie<'_, Conn, GetGammaReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetGammaRequest {
screen,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_gamma_ramp<Conn>(conn: &Conn, screen: u16, size: u16) -> Result<Cookie<'_, Conn, GetGammaRampReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetGammaRampRequest {
screen,
size,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_gamma_ramp<'c, 'input, Conn>(conn: &'c Conn, screen: u16, size: u16, red: &'input [u16], green: &'input [u16], blue: &'input [u16]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetGammaRampRequest {
screen,
size,
red: Cow::Borrowed(red),
green: Cow::Borrowed(green),
blue: Cow::Borrowed(blue),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3]), IoSlice::new(&bytes[4])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_gamma_ramp_size<Conn>(conn: &Conn, screen: u16) -> Result<Cookie<'_, Conn, GetGammaRampSizeReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetGammaRampSizeRequest {
screen,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_permissions<Conn>(conn: &Conn, screen: u16) -> Result<Cookie<'_, Conn, GetPermissionsReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetPermissionsRequest {
screen,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn xf86vidmode_query_version(&self) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self)
}
fn xf86vidmode_get_mode_line(&self, screen: u16) -> Result<Cookie<'_, Self, GetModeLineReply>, ConnectionError>
{
get_mode_line(self, screen)
}
fn xf86vidmode_mod_mode_line<'c, 'input>(&'c self, screen: u32, hdisplay: u16, hsyncstart: u16, hsyncend: u16, htotal: u16, hskew: u16, vdisplay: u16, vsyncstart: u16, vsyncend: u16, vtotal: u16, flags: ModeFlag, private: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
mod_mode_line(self, screen, hdisplay, hsyncstart, hsyncend, htotal, hskew, vdisplay, vsyncstart, vsyncend, vtotal, flags, private)
}
fn xf86vidmode_switch_mode(&self, screen: u16, zoom: u16) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
switch_mode(self, screen, zoom)
}
fn xf86vidmode_get_monitor(&self, screen: u16) -> Result<Cookie<'_, Self, GetMonitorReply>, ConnectionError>
{
get_monitor(self, screen)
}
fn xf86vidmode_lock_mode_switch(&self, screen: u16, lock: u16) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
lock_mode_switch(self, screen, lock)
}
fn xf86vidmode_get_all_mode_lines(&self, screen: u16) -> Result<Cookie<'_, Self, GetAllModeLinesReply>, ConnectionError>
{
get_all_mode_lines(self, screen)
}
fn xf86vidmode_add_mode_line<'c, 'input>(&'c self, screen: u32, dotclock: Dotclock, hdisplay: u16, hsyncstart: u16, hsyncend: u16, htotal: u16, hskew: u16, vdisplay: u16, vsyncstart: u16, vsyncend: u16, vtotal: u16, flags: ModeFlag, after_dotclock: Dotclock, after_hdisplay: u16, after_hsyncstart: u16, after_hsyncend: u16, after_htotal: u16, after_hskew: u16, after_vdisplay: u16, after_vsyncstart: u16, after_vsyncend: u16, after_vtotal: u16, after_flags: ModeFlag, private: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
add_mode_line(self, screen, dotclock, hdisplay, hsyncstart, hsyncend, htotal, hskew, vdisplay, vsyncstart, vsyncend, vtotal, flags, after_dotclock, after_hdisplay, after_hsyncstart, after_hsyncend, after_htotal, after_hskew, after_vdisplay, after_vsyncstart, after_vsyncend, after_vtotal, after_flags, private)
}
fn xf86vidmode_delete_mode_line<'c, 'input>(&'c self, screen: u32, dotclock: Dotclock, hdisplay: u16, hsyncstart: u16, hsyncend: u16, htotal: u16, hskew: u16, vdisplay: u16, vsyncstart: u16, vsyncend: u16, vtotal: u16, flags: ModeFlag, private: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
delete_mode_line(self, screen, dotclock, hdisplay, hsyncstart, hsyncend, htotal, hskew, vdisplay, vsyncstart, vsyncend, vtotal, flags, private)
}
fn xf86vidmode_validate_mode_line<'c, 'input>(&'c self, screen: u32, dotclock: Dotclock, hdisplay: u16, hsyncstart: u16, hsyncend: u16, htotal: u16, hskew: u16, vdisplay: u16, vsyncstart: u16, vsyncend: u16, vtotal: u16, flags: ModeFlag, private: &'input [u8]) -> Result<Cookie<'c, Self, ValidateModeLineReply>, ConnectionError>
{
validate_mode_line(self, screen, dotclock, hdisplay, hsyncstart, hsyncend, htotal, hskew, vdisplay, vsyncstart, vsyncend, vtotal, flags, private)
}
fn xf86vidmode_switch_to_mode<'c, 'input>(&'c self, screen: u32, dotclock: Dotclock, hdisplay: u16, hsyncstart: u16, hsyncend: u16, htotal: u16, hskew: u16, vdisplay: u16, vsyncstart: u16, vsyncend: u16, vtotal: u16, flags: ModeFlag, private: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
switch_to_mode(self, screen, dotclock, hdisplay, hsyncstart, hsyncend, htotal, hskew, vdisplay, vsyncstart, vsyncend, vtotal, flags, private)
}
fn xf86vidmode_get_view_port(&self, screen: u16) -> Result<Cookie<'_, Self, GetViewPortReply>, ConnectionError>
{
get_view_port(self, screen)
}
fn xf86vidmode_set_view_port(&self, screen: u16, x: u32, y: u32) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
set_view_port(self, screen, x, y)
}
fn xf86vidmode_get_dot_clocks(&self, screen: u16) -> Result<Cookie<'_, Self, GetDotClocksReply>, ConnectionError>
{
get_dot_clocks(self, screen)
}
fn xf86vidmode_set_client_version(&self, major: u16, minor: u16) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
set_client_version(self, major, minor)
}
fn xf86vidmode_set_gamma(&self, screen: u16, red: u32, green: u32, blue: u32) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
set_gamma(self, screen, red, green, blue)
}
fn xf86vidmode_get_gamma(&self, screen: u16) -> Result<Cookie<'_, Self, GetGammaReply>, ConnectionError>
{
get_gamma(self, screen)
}
fn xf86vidmode_get_gamma_ramp(&self, screen: u16, size: u16) -> Result<Cookie<'_, Self, GetGammaRampReply>, ConnectionError>
{
get_gamma_ramp(self, screen, size)
}
fn xf86vidmode_set_gamma_ramp<'c, 'input>(&'c self, screen: u16, size: u16, red: &'input [u16], green: &'input [u16], blue: &'input [u16]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_gamma_ramp(self, screen, size, red, green, blue)
}
fn xf86vidmode_get_gamma_ramp_size(&self, screen: u16) -> Result<Cookie<'_, Self, GetGammaRampSizeReply>, ConnectionError>
{
get_gamma_ramp_size(self, screen)
}
fn xf86vidmode_get_permissions(&self, screen: u16) -> Result<Cookie<'_, Self, GetPermissionsReply>, ConnectionError>
{
get_permissions(self, screen)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

959
vendor/x11rb/src/protocol/xfixes.rs vendored Normal file
View File

@@ -0,0 +1,959 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `XFixes` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::render;
#[allow(unused_imports)]
use super::shape;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::xfixes::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_version<Conn>(conn: &Conn, client_major_version: u32, client_minor_version: u32) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest {
client_major_version,
client_minor_version,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn change_save_set<Conn>(conn: &Conn, mode: SaveSetMode, target: SaveSetTarget, map: SaveSetMapping, window: xproto::Window) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ChangeSaveSetRequest {
mode,
target,
map,
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn select_selection_input<Conn>(conn: &Conn, window: xproto::Window, selection: xproto::Atom, event_mask: SelectionEventMask) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SelectSelectionInputRequest {
window,
selection,
event_mask,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn select_cursor_input<Conn>(conn: &Conn, window: xproto::Window, event_mask: CursorNotifyMask) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SelectCursorInputRequest {
window,
event_mask,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_cursor_image<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, GetCursorImageReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetCursorImageRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn create_region<'c, 'input, Conn>(conn: &'c Conn, region: Region, rectangles: &'input [xproto::Rectangle]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateRegionRequest {
region,
rectangles: Cow::Borrowed(rectangles),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_region_from_bitmap<Conn>(conn: &Conn, region: Region, bitmap: xproto::Pixmap) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateRegionFromBitmapRequest {
region,
bitmap,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_region_from_window<Conn>(conn: &Conn, region: Region, window: xproto::Window, kind: shape::SK) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateRegionFromWindowRequest {
region,
window,
kind,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_region_from_gc<Conn>(conn: &Conn, region: Region, gc: xproto::Gcontext) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateRegionFromGCRequest {
region,
gc,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_region_from_picture<Conn>(conn: &Conn, region: Region, picture: render::Picture) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateRegionFromPictureRequest {
region,
picture,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn destroy_region<Conn>(conn: &Conn, region: Region) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DestroyRegionRequest {
region,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn set_region<'c, 'input, Conn>(conn: &'c Conn, region: Region, rectangles: &'input [xproto::Rectangle]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetRegionRequest {
region,
rectangles: Cow::Borrowed(rectangles),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn copy_region<Conn>(conn: &Conn, source: Region, destination: Region) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CopyRegionRequest {
source,
destination,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn union_region<Conn>(conn: &Conn, source1: Region, source2: Region, destination: Region) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = UnionRegionRequest {
source1,
source2,
destination,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn intersect_region<Conn>(conn: &Conn, source1: Region, source2: Region, destination: Region) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = IntersectRegionRequest {
source1,
source2,
destination,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn subtract_region<Conn>(conn: &Conn, source1: Region, source2: Region, destination: Region) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SubtractRegionRequest {
source1,
source2,
destination,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn invert_region<Conn>(conn: &Conn, source: Region, bounds: xproto::Rectangle, destination: Region) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = InvertRegionRequest {
source,
bounds,
destination,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn translate_region<Conn>(conn: &Conn, region: Region, dx: i16, dy: i16) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = TranslateRegionRequest {
region,
dx,
dy,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn region_extents<Conn>(conn: &Conn, source: Region, destination: Region) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = RegionExtentsRequest {
source,
destination,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn fetch_region<Conn>(conn: &Conn, region: Region) -> Result<Cookie<'_, Conn, FetchRegionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = FetchRegionRequest {
region,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_gc_clip_region<Conn, A>(conn: &Conn, gc: xproto::Gcontext, region: A, x_origin: i16, y_origin: i16) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
A: Into<Region>,
{
let region: Region = region.into();
let request0 = SetGCClipRegionRequest {
gc,
region,
x_origin,
y_origin,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn set_window_shape_region<Conn, A>(conn: &Conn, dest: xproto::Window, dest_kind: shape::SK, x_offset: i16, y_offset: i16, region: A) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
A: Into<Region>,
{
let region: Region = region.into();
let request0 = SetWindowShapeRegionRequest {
dest,
dest_kind,
x_offset,
y_offset,
region,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn set_picture_clip_region<Conn, A>(conn: &Conn, picture: render::Picture, region: A, x_origin: i16, y_origin: i16) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
A: Into<Region>,
{
let region: Region = region.into();
let request0 = SetPictureClipRegionRequest {
picture,
region,
x_origin,
y_origin,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn set_cursor_name<'c, 'input, Conn>(conn: &'c Conn, cursor: xproto::Cursor, name: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetCursorNameRequest {
cursor,
name: Cow::Borrowed(name),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_cursor_name<Conn>(conn: &Conn, cursor: xproto::Cursor) -> Result<Cookie<'_, Conn, GetCursorNameReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetCursorNameRequest {
cursor,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_cursor_image_and_name<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, GetCursorImageAndNameReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetCursorImageAndNameRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn change_cursor<Conn>(conn: &Conn, source: xproto::Cursor, destination: xproto::Cursor) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ChangeCursorRequest {
source,
destination,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn change_cursor_by_name<'c, 'input, Conn>(conn: &'c Conn, src: xproto::Cursor, name: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ChangeCursorByNameRequest {
src,
name: Cow::Borrowed(name),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn expand_region<Conn>(conn: &Conn, source: Region, destination: Region, left: u16, right: u16, top: u16, bottom: u16) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ExpandRegionRequest {
source,
destination,
left,
right,
top,
bottom,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn hide_cursor<Conn>(conn: &Conn, window: xproto::Window) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = HideCursorRequest {
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn show_cursor<Conn>(conn: &Conn, window: xproto::Window) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ShowCursorRequest {
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_pointer_barrier<'c, 'input, Conn>(conn: &'c Conn, barrier: Barrier, window: xproto::Window, x1: u16, y1: u16, x2: u16, y2: u16, directions: BarrierDirections, devices: &'input [u16]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreatePointerBarrierRequest {
barrier,
window,
x1,
y1,
x2,
y2,
directions,
devices: Cow::Borrowed(devices),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn delete_pointer_barrier<Conn>(conn: &Conn, barrier: Barrier) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DeletePointerBarrierRequest {
barrier,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Sets the disconnect mode for the client..
///
/// # Fields
///
/// * `disconnect_mode` - The new disconnect mode.
pub fn set_client_disconnect_mode<Conn>(conn: &Conn, disconnect_mode: ClientDisconnectFlags) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetClientDisconnectModeRequest {
disconnect_mode,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_client_disconnect_mode<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, GetClientDisconnectModeReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetClientDisconnectModeRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn xfixes_query_version(&self, client_major_version: u32, client_minor_version: u32) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self, client_major_version, client_minor_version)
}
fn xfixes_change_save_set(&self, mode: SaveSetMode, target: SaveSetTarget, map: SaveSetMapping, window: xproto::Window) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
change_save_set(self, mode, target, map, window)
}
fn xfixes_select_selection_input(&self, window: xproto::Window, selection: xproto::Atom, event_mask: SelectionEventMask) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
select_selection_input(self, window, selection, event_mask)
}
fn xfixes_select_cursor_input(&self, window: xproto::Window, event_mask: CursorNotifyMask) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
select_cursor_input(self, window, event_mask)
}
fn xfixes_get_cursor_image(&self) -> Result<Cookie<'_, Self, GetCursorImageReply>, ConnectionError>
{
get_cursor_image(self)
}
fn xfixes_create_region<'c, 'input>(&'c self, region: Region, rectangles: &'input [xproto::Rectangle]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
create_region(self, region, rectangles)
}
fn xfixes_create_region_from_bitmap(&self, region: Region, bitmap: xproto::Pixmap) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
create_region_from_bitmap(self, region, bitmap)
}
fn xfixes_create_region_from_window(&self, region: Region, window: xproto::Window, kind: shape::SK) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
create_region_from_window(self, region, window, kind)
}
fn xfixes_create_region_from_gc(&self, region: Region, gc: xproto::Gcontext) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
create_region_from_gc(self, region, gc)
}
fn xfixes_create_region_from_picture(&self, region: Region, picture: render::Picture) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
create_region_from_picture(self, region, picture)
}
fn xfixes_destroy_region(&self, region: Region) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
destroy_region(self, region)
}
fn xfixes_set_region<'c, 'input>(&'c self, region: Region, rectangles: &'input [xproto::Rectangle]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_region(self, region, rectangles)
}
fn xfixes_copy_region(&self, source: Region, destination: Region) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
copy_region(self, source, destination)
}
fn xfixes_union_region(&self, source1: Region, source2: Region, destination: Region) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
union_region(self, source1, source2, destination)
}
fn xfixes_intersect_region(&self, source1: Region, source2: Region, destination: Region) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
intersect_region(self, source1, source2, destination)
}
fn xfixes_subtract_region(&self, source1: Region, source2: Region, destination: Region) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
subtract_region(self, source1, source2, destination)
}
fn xfixes_invert_region(&self, source: Region, bounds: xproto::Rectangle, destination: Region) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
invert_region(self, source, bounds, destination)
}
fn xfixes_translate_region(&self, region: Region, dx: i16, dy: i16) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
translate_region(self, region, dx, dy)
}
fn xfixes_region_extents(&self, source: Region, destination: Region) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
region_extents(self, source, destination)
}
fn xfixes_fetch_region(&self, region: Region) -> Result<Cookie<'_, Self, FetchRegionReply>, ConnectionError>
{
fetch_region(self, region)
}
fn xfixes_set_gc_clip_region<A>(&self, gc: xproto::Gcontext, region: A, x_origin: i16, y_origin: i16) -> Result<VoidCookie<'_, Self>, ConnectionError>
where
A: Into<Region>,
{
set_gc_clip_region(self, gc, region, x_origin, y_origin)
}
fn xfixes_set_window_shape_region<A>(&self, dest: xproto::Window, dest_kind: shape::SK, x_offset: i16, y_offset: i16, region: A) -> Result<VoidCookie<'_, Self>, ConnectionError>
where
A: Into<Region>,
{
set_window_shape_region(self, dest, dest_kind, x_offset, y_offset, region)
}
fn xfixes_set_picture_clip_region<A>(&self, picture: render::Picture, region: A, x_origin: i16, y_origin: i16) -> Result<VoidCookie<'_, Self>, ConnectionError>
where
A: Into<Region>,
{
set_picture_clip_region(self, picture, region, x_origin, y_origin)
}
fn xfixes_set_cursor_name<'c, 'input>(&'c self, cursor: xproto::Cursor, name: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_cursor_name(self, cursor, name)
}
fn xfixes_get_cursor_name(&self, cursor: xproto::Cursor) -> Result<Cookie<'_, Self, GetCursorNameReply>, ConnectionError>
{
get_cursor_name(self, cursor)
}
fn xfixes_get_cursor_image_and_name(&self) -> Result<Cookie<'_, Self, GetCursorImageAndNameReply>, ConnectionError>
{
get_cursor_image_and_name(self)
}
fn xfixes_change_cursor(&self, source: xproto::Cursor, destination: xproto::Cursor) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
change_cursor(self, source, destination)
}
fn xfixes_change_cursor_by_name<'c, 'input>(&'c self, src: xproto::Cursor, name: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
change_cursor_by_name(self, src, name)
}
fn xfixes_expand_region(&self, source: Region, destination: Region, left: u16, right: u16, top: u16, bottom: u16) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
expand_region(self, source, destination, left, right, top, bottom)
}
fn xfixes_hide_cursor(&self, window: xproto::Window) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
hide_cursor(self, window)
}
fn xfixes_show_cursor(&self, window: xproto::Window) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
show_cursor(self, window)
}
fn xfixes_create_pointer_barrier<'c, 'input>(&'c self, barrier: Barrier, window: xproto::Window, x1: u16, y1: u16, x2: u16, y2: u16, directions: BarrierDirections, devices: &'input [u16]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
create_pointer_barrier(self, barrier, window, x1, y1, x2, y2, directions, devices)
}
fn xfixes_delete_pointer_barrier(&self, barrier: Barrier) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
delete_pointer_barrier(self, barrier)
}
/// Sets the disconnect mode for the client..
///
/// # Fields
///
/// * `disconnect_mode` - The new disconnect mode.
fn xfixes_set_client_disconnect_mode(&self, disconnect_mode: ClientDisconnectFlags) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
set_client_disconnect_mode(self, disconnect_mode)
}
fn xfixes_get_client_disconnect_mode(&self) -> Result<Cookie<'_, Self, GetClientDisconnectModeReply>, ConnectionError>
{
get_client_disconnect_mode(self)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}
/// A RAII-like wrapper around a [Region].
///
/// Instances of this struct represent a Region that is freed in `Drop`.
///
/// Any errors during `Drop` are silently ignored. Most likely an error here means that your
/// X11 connection is broken and later requests will also fail.
#[derive(Debug)]
pub struct RegionWrapper<C: RequestConnection>(C, Region);
impl<C: RequestConnection> RegionWrapper<C>
{
/// Assume ownership of the given resource and destroy it in `Drop`.
pub fn for_region(conn: C, id: Region) -> Self {
RegionWrapper(conn, id)
}
/// Get the XID of the wrapped resource
pub fn region(&self) -> Region {
self.1
}
/// Assume ownership of the XID of the wrapped resource
///
/// This function destroys this wrapper without freeing the underlying resource.
pub fn into_region(self) -> Region {
let id = self.1;
std::mem::forget(self);
id
}
}
impl<'c, C: X11Connection> RegionWrapper<&'c C>
{
/// Create a new Region and return a Region wrapper and a cookie.
///
/// This is a thin wrapper around [create_region] that allocates an id for the Region.
/// This function returns the resulting `RegionWrapper` that owns the created Region and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [create_region].
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_region].
pub fn create_region_and_get_cookie(conn: &'c C, rectangles: &[xproto::Rectangle]) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let region = conn.generate_id()?;
let cookie = create_region(conn, region, rectangles)?;
Ok((Self::for_region(conn, region), cookie))
}
}
impl<C: X11Connection> RegionWrapper<C>
{
/// Create a new Region and return a Region wrapper
///
/// This is a thin wrapper around [create_region] that allocates an id for the Region.
/// This function returns the resulting `RegionWrapper` that owns the created Region and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_region].
pub fn create_region(conn: C, rectangles: &[xproto::Rectangle]) -> Result<Self, ReplyOrIdError>
{
let region = conn.generate_id()?;
let _ = create_region(&conn, region, rectangles)?;
Ok(Self::for_region(conn, region))
}
}
impl<'c, C: X11Connection> RegionWrapper<&'c C>
{
/// Create a new Region and return a Region wrapper and a cookie.
///
/// This is a thin wrapper around [create_region_from_bitmap] that allocates an id for the Region.
/// This function returns the resulting `RegionWrapper` that owns the created Region and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [create_region_from_bitmap].
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_region_from_bitmap].
pub fn create_region_from_bitmap_and_get_cookie(conn: &'c C, bitmap: xproto::Pixmap) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let region = conn.generate_id()?;
let cookie = create_region_from_bitmap(conn, region, bitmap)?;
Ok((Self::for_region(conn, region), cookie))
}
}
impl<C: X11Connection> RegionWrapper<C>
{
/// Create a new Region and return a Region wrapper
///
/// This is a thin wrapper around [create_region_from_bitmap] that allocates an id for the Region.
/// This function returns the resulting `RegionWrapper` that owns the created Region and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_region_from_bitmap].
pub fn create_region_from_bitmap(conn: C, bitmap: xproto::Pixmap) -> Result<Self, ReplyOrIdError>
{
let region = conn.generate_id()?;
let _ = create_region_from_bitmap(&conn, region, bitmap)?;
Ok(Self::for_region(conn, region))
}
}
impl<'c, C: X11Connection> RegionWrapper<&'c C>
{
/// Create a new Region and return a Region wrapper and a cookie.
///
/// This is a thin wrapper around [create_region_from_window] that allocates an id for the Region.
/// This function returns the resulting `RegionWrapper` that owns the created Region and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [create_region_from_window].
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_region_from_window].
pub fn create_region_from_window_and_get_cookie(conn: &'c C, window: xproto::Window, kind: shape::SK) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let region = conn.generate_id()?;
let cookie = create_region_from_window(conn, region, window, kind)?;
Ok((Self::for_region(conn, region), cookie))
}
}
impl<C: X11Connection> RegionWrapper<C>
{
/// Create a new Region and return a Region wrapper
///
/// This is a thin wrapper around [create_region_from_window] that allocates an id for the Region.
/// This function returns the resulting `RegionWrapper` that owns the created Region and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_region_from_window].
pub fn create_region_from_window(conn: C, window: xproto::Window, kind: shape::SK) -> Result<Self, ReplyOrIdError>
{
let region = conn.generate_id()?;
let _ = create_region_from_window(&conn, region, window, kind)?;
Ok(Self::for_region(conn, region))
}
}
impl<'c, C: X11Connection> RegionWrapper<&'c C>
{
/// Create a new Region and return a Region wrapper and a cookie.
///
/// This is a thin wrapper around [create_region_from_gc] that allocates an id for the Region.
/// This function returns the resulting `RegionWrapper` that owns the created Region and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [create_region_from_gc].
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_region_from_gc].
pub fn create_region_from_gc_and_get_cookie(conn: &'c C, gc: xproto::Gcontext) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let region = conn.generate_id()?;
let cookie = create_region_from_gc(conn, region, gc)?;
Ok((Self::for_region(conn, region), cookie))
}
}
impl<C: X11Connection> RegionWrapper<C>
{
/// Create a new Region and return a Region wrapper
///
/// This is a thin wrapper around [create_region_from_gc] that allocates an id for the Region.
/// This function returns the resulting `RegionWrapper` that owns the created Region and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_region_from_gc].
pub fn create_region_from_gc(conn: C, gc: xproto::Gcontext) -> Result<Self, ReplyOrIdError>
{
let region = conn.generate_id()?;
let _ = create_region_from_gc(&conn, region, gc)?;
Ok(Self::for_region(conn, region))
}
}
impl<'c, C: X11Connection> RegionWrapper<&'c C>
{
/// Create a new Region and return a Region wrapper and a cookie.
///
/// This is a thin wrapper around [create_region_from_picture] that allocates an id for the Region.
/// This function returns the resulting `RegionWrapper` that owns the created Region and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [create_region_from_picture].
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_region_from_picture].
pub fn create_region_from_picture_and_get_cookie(conn: &'c C, picture: render::Picture) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let region = conn.generate_id()?;
let cookie = create_region_from_picture(conn, region, picture)?;
Ok((Self::for_region(conn, region), cookie))
}
}
impl<C: X11Connection> RegionWrapper<C>
{
/// Create a new Region and return a Region wrapper
///
/// This is a thin wrapper around [create_region_from_picture] that allocates an id for the Region.
/// This function returns the resulting `RegionWrapper` that owns the created Region and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [create_region_from_picture].
pub fn create_region_from_picture(conn: C, picture: render::Picture) -> Result<Self, ReplyOrIdError>
{
let region = conn.generate_id()?;
let _ = create_region_from_picture(&conn, region, picture)?;
Ok(Self::for_region(conn, region))
}
}
impl<'c, C: X11Connection> RegionWrapper<&'c C>
{
/// Create a new Region and return a Region wrapper and a cookie.
///
/// This is a thin wrapper around [super::composite::create_region_from_border_clip] that allocates an id for the Region.
/// This function returns the resulting `RegionWrapper` that owns the created Region and frees
/// it in `Drop`. This also returns a `VoidCookie` that comes from the call to
/// [super::composite::create_region_from_border_clip].
///
/// Errors can come from the call to [X11Connection::generate_id] or [super::composite::create_region_from_border_clip].
#[cfg(feature = "composite")]
pub fn composite_create_region_from_border_clip_and_get_cookie(conn: &'c C, window: xproto::Window) -> Result<(Self, VoidCookie<'c, C>), ReplyOrIdError>
{
let region = conn.generate_id()?;
let cookie = super::composite::create_region_from_border_clip(conn, region, window)?;
Ok((Self::for_region(conn, region), cookie))
}
}
impl<C: X11Connection> RegionWrapper<C>
{
/// Create a new Region and return a Region wrapper
///
/// This is a thin wrapper around [super::composite::create_region_from_border_clip] that allocates an id for the Region.
/// This function returns the resulting `RegionWrapper` that owns the created Region and frees
/// it in `Drop`.
///
/// Errors can come from the call to [X11Connection::generate_id] or [super::composite::create_region_from_border_clip].
#[cfg(feature = "composite")]
pub fn composite_create_region_from_border_clip(conn: C, window: xproto::Window) -> Result<Self, ReplyOrIdError>
{
let region = conn.generate_id()?;
let _ = super::composite::create_region_from_border_clip(&conn, region, window)?;
Ok(Self::for_region(conn, region))
}
}
#[cfg(feature = "composite")]
#[allow(unused_imports)]
use super::composite;
impl<C: RequestConnection> From<&RegionWrapper<C>> for Region {
fn from(from: &RegionWrapper<C>) -> Self {
from.1
}
}
impl<C: RequestConnection> Drop for RegionWrapper<C> {
fn drop(&mut self) {
let _ = destroy_region(&self.0, self.1);
}
}

141
vendor/x11rb/src/protocol/xinerama.rs vendored Normal file
View File

@@ -0,0 +1,141 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `Xinerama` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::xinerama::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_version<Conn>(conn: &Conn, major: u8, minor: u8) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest {
major,
minor,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_state<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetStateReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetStateRequest {
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_screen_count<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetScreenCountReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetScreenCountRequest {
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_screen_size<Conn>(conn: &Conn, window: xproto::Window, screen: u32) -> Result<Cookie<'_, Conn, GetScreenSizeReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetScreenSizeRequest {
window,
screen,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn is_active<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, IsActiveReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = IsActiveRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn query_screens<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, QueryScreensReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryScreensRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn xinerama_query_version(&self, major: u8, minor: u8) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self, major, minor)
}
fn xinerama_get_state(&self, window: xproto::Window) -> Result<Cookie<'_, Self, GetStateReply>, ConnectionError>
{
get_state(self, window)
}
fn xinerama_get_screen_count(&self, window: xproto::Window) -> Result<Cookie<'_, Self, GetScreenCountReply>, ConnectionError>
{
get_screen_count(self, window)
}
fn xinerama_get_screen_size(&self, window: xproto::Window, screen: u32) -> Result<Cookie<'_, Self, GetScreenSizeReply>, ConnectionError>
{
get_screen_size(self, window, screen)
}
fn xinerama_is_active(&self) -> Result<Cookie<'_, Self, IsActiveReply>, ConnectionError>
{
is_active(self)
}
fn xinerama_query_screens(&self) -> Result<Cookie<'_, Self, QueryScreensReply>, ConnectionError>
{
query_screens(self)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

1339
vendor/x11rb/src/protocol/xinput.rs vendored Normal file

File diff suppressed because it is too large Load Diff

621
vendor/x11rb/src/protocol/xkb.rs vendored Normal file
View File

@@ -0,0 +1,621 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `xkb` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::xkb::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn use_extension<Conn>(conn: &Conn, wanted_major: u16, wanted_minor: u16) -> Result<Cookie<'_, Conn, UseExtensionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = UseExtensionRequest {
wanted_major,
wanted_minor,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn select_events<'c, 'input, Conn>(conn: &'c Conn, device_spec: DeviceSpec, clear: EventType, select_all: EventType, affect_map: MapPart, map: MapPart, details: &'input SelectEventsAux) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SelectEventsRequest {
device_spec,
clear,
select_all,
affect_map,
map,
details: Cow::Borrowed(details),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn bell<Conn>(conn: &Conn, device_spec: DeviceSpec, bell_class: BellClassSpec, bell_id: IDSpec, percent: i8, force_sound: bool, event_only: bool, pitch: i16, duration: i16, name: xproto::Atom, window: xproto::Window) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = BellRequest {
device_spec,
bell_class,
bell_id,
percent,
force_sound,
event_only,
pitch,
duration,
name,
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_state<Conn>(conn: &Conn, device_spec: DeviceSpec) -> Result<Cookie<'_, Conn, GetStateReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetStateRequest {
device_spec,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn latch_lock_state<Conn>(conn: &Conn, device_spec: DeviceSpec, affect_mod_locks: xproto::ModMask, mod_locks: xproto::ModMask, lock_group: bool, group_lock: Group, affect_mod_latches: xproto::ModMask, latch_group: bool, group_latch: u16) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = LatchLockStateRequest {
device_spec,
affect_mod_locks,
mod_locks,
lock_group,
group_lock,
affect_mod_latches,
latch_group,
group_latch,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_controls<Conn>(conn: &Conn, device_spec: DeviceSpec) -> Result<Cookie<'_, Conn, GetControlsReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetControlsRequest {
device_spec,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_controls<'c, 'input, Conn>(conn: &'c Conn, device_spec: DeviceSpec, affect_internal_real_mods: xproto::ModMask, internal_real_mods: xproto::ModMask, affect_ignore_lock_real_mods: xproto::ModMask, ignore_lock_real_mods: xproto::ModMask, affect_internal_virtual_mods: VMod, internal_virtual_mods: VMod, affect_ignore_lock_virtual_mods: VMod, ignore_lock_virtual_mods: VMod, mouse_keys_dflt_btn: u8, groups_wrap: u8, access_x_options: AXOption, affect_enabled_controls: BoolCtrl, enabled_controls: BoolCtrl, change_controls: Control, repeat_delay: u16, repeat_interval: u16, slow_keys_delay: u16, debounce_delay: u16, mouse_keys_delay: u16, mouse_keys_interval: u16, mouse_keys_time_to_max: u16, mouse_keys_max_speed: u16, mouse_keys_curve: i16, access_x_timeout: u16, access_x_timeout_mask: BoolCtrl, access_x_timeout_values: BoolCtrl, access_x_timeout_options_mask: AXOption, access_x_timeout_options_values: AXOption, per_key_repeat: &'input [u8; 32]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetControlsRequest {
device_spec,
affect_internal_real_mods,
internal_real_mods,
affect_ignore_lock_real_mods,
ignore_lock_real_mods,
affect_internal_virtual_mods,
internal_virtual_mods,
affect_ignore_lock_virtual_mods,
ignore_lock_virtual_mods,
mouse_keys_dflt_btn,
groups_wrap,
access_x_options,
affect_enabled_controls,
enabled_controls,
change_controls,
repeat_delay,
repeat_interval,
slow_keys_delay,
debounce_delay,
mouse_keys_delay,
mouse_keys_interval,
mouse_keys_time_to_max,
mouse_keys_max_speed,
mouse_keys_curve,
access_x_timeout,
access_x_timeout_mask,
access_x_timeout_values,
access_x_timeout_options_mask,
access_x_timeout_options_values,
per_key_repeat: Cow::Borrowed(per_key_repeat),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_map<Conn>(conn: &Conn, device_spec: DeviceSpec, full: MapPart, partial: MapPart, first_type: u8, n_types: u8, first_key_sym: xproto::Keycode, n_key_syms: u8, first_key_action: xproto::Keycode, n_key_actions: u8, first_key_behavior: xproto::Keycode, n_key_behaviors: u8, virtual_mods: VMod, first_key_explicit: xproto::Keycode, n_key_explicit: u8, first_mod_map_key: xproto::Keycode, n_mod_map_keys: u8, first_v_mod_map_key: xproto::Keycode, n_v_mod_map_keys: u8) -> Result<Cookie<'_, Conn, GetMapReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetMapRequest {
device_spec,
full,
partial,
first_type,
n_types,
first_key_sym,
n_key_syms,
first_key_action,
n_key_actions,
first_key_behavior,
n_key_behaviors,
virtual_mods,
first_key_explicit,
n_key_explicit,
first_mod_map_key,
n_mod_map_keys,
first_v_mod_map_key,
n_v_mod_map_keys,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_map<'c, 'input, Conn>(conn: &'c Conn, device_spec: DeviceSpec, flags: SetMapFlags, min_key_code: xproto::Keycode, max_key_code: xproto::Keycode, first_type: u8, n_types: u8, first_key_sym: xproto::Keycode, n_key_syms: u8, total_syms: u16, first_key_action: xproto::Keycode, n_key_actions: u8, total_actions: u16, first_key_behavior: xproto::Keycode, n_key_behaviors: u8, total_key_behaviors: u8, first_key_explicit: xproto::Keycode, n_key_explicit: u8, total_key_explicit: u8, first_mod_map_key: xproto::Keycode, n_mod_map_keys: u8, total_mod_map_keys: u8, first_v_mod_map_key: xproto::Keycode, n_v_mod_map_keys: u8, total_v_mod_map_keys: u8, virtual_mods: VMod, values: &'input SetMapAux) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetMapRequest {
device_spec,
flags,
min_key_code,
max_key_code,
first_type,
n_types,
first_key_sym,
n_key_syms,
total_syms,
first_key_action,
n_key_actions,
total_actions,
first_key_behavior,
n_key_behaviors,
total_key_behaviors,
first_key_explicit,
n_key_explicit,
total_key_explicit,
first_mod_map_key,
n_mod_map_keys,
total_mod_map_keys,
first_v_mod_map_key,
n_v_mod_map_keys,
total_v_mod_map_keys,
virtual_mods,
values: Cow::Borrowed(values),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_compat_map<Conn>(conn: &Conn, device_spec: DeviceSpec, groups: SetOfGroup, get_all_si: bool, first_si: u16, n_si: u16) -> Result<Cookie<'_, Conn, GetCompatMapReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetCompatMapRequest {
device_spec,
groups,
get_all_si,
first_si,
n_si,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_compat_map<'c, 'input, Conn>(conn: &'c Conn, device_spec: DeviceSpec, recompute_actions: bool, truncate_si: bool, groups: SetOfGroup, first_si: u16, si: &'input [SymInterpret], group_maps: &'input [ModDef]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetCompatMapRequest {
device_spec,
recompute_actions,
truncate_si,
groups,
first_si,
si: Cow::Borrowed(si),
group_maps: Cow::Borrowed(group_maps),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_indicator_state<Conn>(conn: &Conn, device_spec: DeviceSpec) -> Result<Cookie<'_, Conn, GetIndicatorStateReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetIndicatorStateRequest {
device_spec,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_indicator_map<Conn>(conn: &Conn, device_spec: DeviceSpec, which: u32) -> Result<Cookie<'_, Conn, GetIndicatorMapReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetIndicatorMapRequest {
device_spec,
which,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_indicator_map<'c, 'input, Conn>(conn: &'c Conn, device_spec: DeviceSpec, which: u32, maps: &'input [IndicatorMap]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetIndicatorMapRequest {
device_spec,
which,
maps: Cow::Borrowed(maps),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_named_indicator<Conn, A>(conn: &Conn, device_spec: DeviceSpec, led_class: LedClass, led_id: A, indicator: xproto::Atom) -> Result<Cookie<'_, Conn, GetNamedIndicatorReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
A: Into<IDSpec>,
{
let led_id: IDSpec = led_id.into();
let request0 = GetNamedIndicatorRequest {
device_spec,
led_class,
led_id,
indicator,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_named_indicator<Conn, A>(conn: &Conn, device_spec: DeviceSpec, led_class: LedClass, led_id: A, indicator: xproto::Atom, set_state: bool, on: bool, set_map: bool, create_map: bool, map_flags: IMFlag, map_which_groups: IMGroupsWhich, map_groups: SetOfGroups, map_which_mods: IMModsWhich, map_real_mods: xproto::ModMask, map_vmods: VMod, map_ctrls: BoolCtrl) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
A: Into<IDSpec>,
{
let led_id: IDSpec = led_id.into();
let request0 = SetNamedIndicatorRequest {
device_spec,
led_class,
led_id,
indicator,
set_state,
on,
set_map,
create_map,
map_flags,
map_which_groups,
map_groups,
map_which_mods,
map_real_mods,
map_vmods,
map_ctrls,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_names<Conn>(conn: &Conn, device_spec: DeviceSpec, which: NameDetail) -> Result<Cookie<'_, Conn, GetNamesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetNamesRequest {
device_spec,
which,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_names<'c, 'input, Conn>(conn: &'c Conn, device_spec: DeviceSpec, virtual_mods: VMod, first_type: u8, n_types: u8, first_kt_levelt: u8, n_kt_levels: u8, indicators: u32, group_names: SetOfGroup, n_radio_groups: u8, first_key: xproto::Keycode, n_keys: u8, n_key_aliases: u8, total_kt_level_names: u16, values: &'input SetNamesAux) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetNamesRequest {
device_spec,
virtual_mods,
first_type,
n_types,
first_kt_levelt,
n_kt_levels,
indicators,
group_names,
n_radio_groups,
first_key,
n_keys,
n_key_aliases,
total_kt_level_names,
values: Cow::Borrowed(values),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn per_client_flags<Conn>(conn: &Conn, device_spec: DeviceSpec, change: PerClientFlag, value: PerClientFlag, ctrls_to_change: BoolCtrl, auto_ctrls: BoolCtrl, auto_ctrls_values: BoolCtrl) -> Result<Cookie<'_, Conn, PerClientFlagsReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PerClientFlagsRequest {
device_spec,
change,
value,
ctrls_to_change,
auto_ctrls,
auto_ctrls_values,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn list_components<Conn>(conn: &Conn, device_spec: DeviceSpec, max_names: u16) -> Result<Cookie<'_, Conn, ListComponentsReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ListComponentsRequest {
device_spec,
max_names,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_kbd_by_name<Conn>(conn: &Conn, device_spec: DeviceSpec, need: GBNDetail, want: GBNDetail, load: bool) -> Result<Cookie<'_, Conn, GetKbdByNameReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetKbdByNameRequest {
device_spec,
need,
want,
load,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_device_info<Conn, A>(conn: &Conn, device_spec: DeviceSpec, wanted: XIFeature, all_buttons: bool, first_button: u8, n_buttons: u8, led_class: LedClass, led_id: A) -> Result<Cookie<'_, Conn, GetDeviceInfoReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
A: Into<IDSpec>,
{
let led_id: IDSpec = led_id.into();
let request0 = GetDeviceInfoRequest {
device_spec,
wanted,
all_buttons,
first_button,
n_buttons,
led_class,
led_id,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_device_info<'c, 'input, Conn>(conn: &'c Conn, device_spec: DeviceSpec, first_btn: u8, change: XIFeature, btn_actions: &'input [Action], leds: &'input [DeviceLedInfo]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetDeviceInfoRequest {
device_spec,
first_btn,
change,
btn_actions: Cow::Borrowed(btn_actions),
leds: Cow::Borrowed(leds),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn set_debugging_flags<'c, 'input, Conn>(conn: &'c Conn, affect_flags: u32, flags: u32, affect_ctrls: u32, ctrls: u32, message: &'input [String8]) -> Result<Cookie<'c, Conn, SetDebuggingFlagsReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetDebuggingFlagsRequest {
affect_flags,
flags,
affect_ctrls,
ctrls,
message: Cow::Borrowed(message),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn xkb_use_extension(&self, wanted_major: u16, wanted_minor: u16) -> Result<Cookie<'_, Self, UseExtensionReply>, ConnectionError>
{
use_extension(self, wanted_major, wanted_minor)
}
fn xkb_select_events<'c, 'input>(&'c self, device_spec: DeviceSpec, clear: EventType, select_all: EventType, affect_map: MapPart, map: MapPart, details: &'input SelectEventsAux) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
select_events(self, device_spec, clear, select_all, affect_map, map, details)
}
fn xkb_bell(&self, device_spec: DeviceSpec, bell_class: BellClassSpec, bell_id: IDSpec, percent: i8, force_sound: bool, event_only: bool, pitch: i16, duration: i16, name: xproto::Atom, window: xproto::Window) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
bell(self, device_spec, bell_class, bell_id, percent, force_sound, event_only, pitch, duration, name, window)
}
fn xkb_get_state(&self, device_spec: DeviceSpec) -> Result<Cookie<'_, Self, GetStateReply>, ConnectionError>
{
get_state(self, device_spec)
}
fn xkb_latch_lock_state(&self, device_spec: DeviceSpec, affect_mod_locks: xproto::ModMask, mod_locks: xproto::ModMask, lock_group: bool, group_lock: Group, affect_mod_latches: xproto::ModMask, latch_group: bool, group_latch: u16) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
latch_lock_state(self, device_spec, affect_mod_locks, mod_locks, lock_group, group_lock, affect_mod_latches, latch_group, group_latch)
}
fn xkb_get_controls(&self, device_spec: DeviceSpec) -> Result<Cookie<'_, Self, GetControlsReply>, ConnectionError>
{
get_controls(self, device_spec)
}
fn xkb_set_controls<'c, 'input>(&'c self, device_spec: DeviceSpec, affect_internal_real_mods: xproto::ModMask, internal_real_mods: xproto::ModMask, affect_ignore_lock_real_mods: xproto::ModMask, ignore_lock_real_mods: xproto::ModMask, affect_internal_virtual_mods: VMod, internal_virtual_mods: VMod, affect_ignore_lock_virtual_mods: VMod, ignore_lock_virtual_mods: VMod, mouse_keys_dflt_btn: u8, groups_wrap: u8, access_x_options: AXOption, affect_enabled_controls: BoolCtrl, enabled_controls: BoolCtrl, change_controls: Control, repeat_delay: u16, repeat_interval: u16, slow_keys_delay: u16, debounce_delay: u16, mouse_keys_delay: u16, mouse_keys_interval: u16, mouse_keys_time_to_max: u16, mouse_keys_max_speed: u16, mouse_keys_curve: i16, access_x_timeout: u16, access_x_timeout_mask: BoolCtrl, access_x_timeout_values: BoolCtrl, access_x_timeout_options_mask: AXOption, access_x_timeout_options_values: AXOption, per_key_repeat: &'input [u8; 32]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_controls(self, device_spec, affect_internal_real_mods, internal_real_mods, affect_ignore_lock_real_mods, ignore_lock_real_mods, affect_internal_virtual_mods, internal_virtual_mods, affect_ignore_lock_virtual_mods, ignore_lock_virtual_mods, mouse_keys_dflt_btn, groups_wrap, access_x_options, affect_enabled_controls, enabled_controls, change_controls, repeat_delay, repeat_interval, slow_keys_delay, debounce_delay, mouse_keys_delay, mouse_keys_interval, mouse_keys_time_to_max, mouse_keys_max_speed, mouse_keys_curve, access_x_timeout, access_x_timeout_mask, access_x_timeout_values, access_x_timeout_options_mask, access_x_timeout_options_values, per_key_repeat)
}
fn xkb_get_map(&self, device_spec: DeviceSpec, full: MapPart, partial: MapPart, first_type: u8, n_types: u8, first_key_sym: xproto::Keycode, n_key_syms: u8, first_key_action: xproto::Keycode, n_key_actions: u8, first_key_behavior: xproto::Keycode, n_key_behaviors: u8, virtual_mods: VMod, first_key_explicit: xproto::Keycode, n_key_explicit: u8, first_mod_map_key: xproto::Keycode, n_mod_map_keys: u8, first_v_mod_map_key: xproto::Keycode, n_v_mod_map_keys: u8) -> Result<Cookie<'_, Self, GetMapReply>, ConnectionError>
{
get_map(self, device_spec, full, partial, first_type, n_types, first_key_sym, n_key_syms, first_key_action, n_key_actions, first_key_behavior, n_key_behaviors, virtual_mods, first_key_explicit, n_key_explicit, first_mod_map_key, n_mod_map_keys, first_v_mod_map_key, n_v_mod_map_keys)
}
fn xkb_set_map<'c, 'input>(&'c self, device_spec: DeviceSpec, flags: SetMapFlags, min_key_code: xproto::Keycode, max_key_code: xproto::Keycode, first_type: u8, n_types: u8, first_key_sym: xproto::Keycode, n_key_syms: u8, total_syms: u16, first_key_action: xproto::Keycode, n_key_actions: u8, total_actions: u16, first_key_behavior: xproto::Keycode, n_key_behaviors: u8, total_key_behaviors: u8, first_key_explicit: xproto::Keycode, n_key_explicit: u8, total_key_explicit: u8, first_mod_map_key: xproto::Keycode, n_mod_map_keys: u8, total_mod_map_keys: u8, first_v_mod_map_key: xproto::Keycode, n_v_mod_map_keys: u8, total_v_mod_map_keys: u8, virtual_mods: VMod, values: &'input SetMapAux) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_map(self, device_spec, flags, min_key_code, max_key_code, first_type, n_types, first_key_sym, n_key_syms, total_syms, first_key_action, n_key_actions, total_actions, first_key_behavior, n_key_behaviors, total_key_behaviors, first_key_explicit, n_key_explicit, total_key_explicit, first_mod_map_key, n_mod_map_keys, total_mod_map_keys, first_v_mod_map_key, n_v_mod_map_keys, total_v_mod_map_keys, virtual_mods, values)
}
fn xkb_get_compat_map(&self, device_spec: DeviceSpec, groups: SetOfGroup, get_all_si: bool, first_si: u16, n_si: u16) -> Result<Cookie<'_, Self, GetCompatMapReply>, ConnectionError>
{
get_compat_map(self, device_spec, groups, get_all_si, first_si, n_si)
}
fn xkb_set_compat_map<'c, 'input>(&'c self, device_spec: DeviceSpec, recompute_actions: bool, truncate_si: bool, groups: SetOfGroup, first_si: u16, si: &'input [SymInterpret], group_maps: &'input [ModDef]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_compat_map(self, device_spec, recompute_actions, truncate_si, groups, first_si, si, group_maps)
}
fn xkb_get_indicator_state(&self, device_spec: DeviceSpec) -> Result<Cookie<'_, Self, GetIndicatorStateReply>, ConnectionError>
{
get_indicator_state(self, device_spec)
}
fn xkb_get_indicator_map(&self, device_spec: DeviceSpec, which: u32) -> Result<Cookie<'_, Self, GetIndicatorMapReply>, ConnectionError>
{
get_indicator_map(self, device_spec, which)
}
fn xkb_set_indicator_map<'c, 'input>(&'c self, device_spec: DeviceSpec, which: u32, maps: &'input [IndicatorMap]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_indicator_map(self, device_spec, which, maps)
}
fn xkb_get_named_indicator<A>(&self, device_spec: DeviceSpec, led_class: LedClass, led_id: A, indicator: xproto::Atom) -> Result<Cookie<'_, Self, GetNamedIndicatorReply>, ConnectionError>
where
A: Into<IDSpec>,
{
get_named_indicator(self, device_spec, led_class, led_id, indicator)
}
fn xkb_set_named_indicator<A>(&self, device_spec: DeviceSpec, led_class: LedClass, led_id: A, indicator: xproto::Atom, set_state: bool, on: bool, set_map: bool, create_map: bool, map_flags: IMFlag, map_which_groups: IMGroupsWhich, map_groups: SetOfGroups, map_which_mods: IMModsWhich, map_real_mods: xproto::ModMask, map_vmods: VMod, map_ctrls: BoolCtrl) -> Result<VoidCookie<'_, Self>, ConnectionError>
where
A: Into<IDSpec>,
{
set_named_indicator(self, device_spec, led_class, led_id, indicator, set_state, on, set_map, create_map, map_flags, map_which_groups, map_groups, map_which_mods, map_real_mods, map_vmods, map_ctrls)
}
fn xkb_get_names(&self, device_spec: DeviceSpec, which: NameDetail) -> Result<Cookie<'_, Self, GetNamesReply>, ConnectionError>
{
get_names(self, device_spec, which)
}
fn xkb_set_names<'c, 'input>(&'c self, device_spec: DeviceSpec, virtual_mods: VMod, first_type: u8, n_types: u8, first_kt_levelt: u8, n_kt_levels: u8, indicators: u32, group_names: SetOfGroup, n_radio_groups: u8, first_key: xproto::Keycode, n_keys: u8, n_key_aliases: u8, total_kt_level_names: u16, values: &'input SetNamesAux) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_names(self, device_spec, virtual_mods, first_type, n_types, first_kt_levelt, n_kt_levels, indicators, group_names, n_radio_groups, first_key, n_keys, n_key_aliases, total_kt_level_names, values)
}
fn xkb_per_client_flags(&self, device_spec: DeviceSpec, change: PerClientFlag, value: PerClientFlag, ctrls_to_change: BoolCtrl, auto_ctrls: BoolCtrl, auto_ctrls_values: BoolCtrl) -> Result<Cookie<'_, Self, PerClientFlagsReply>, ConnectionError>
{
per_client_flags(self, device_spec, change, value, ctrls_to_change, auto_ctrls, auto_ctrls_values)
}
fn xkb_list_components(&self, device_spec: DeviceSpec, max_names: u16) -> Result<Cookie<'_, Self, ListComponentsReply>, ConnectionError>
{
list_components(self, device_spec, max_names)
}
fn xkb_get_kbd_by_name(&self, device_spec: DeviceSpec, need: GBNDetail, want: GBNDetail, load: bool) -> Result<Cookie<'_, Self, GetKbdByNameReply>, ConnectionError>
{
get_kbd_by_name(self, device_spec, need, want, load)
}
fn xkb_get_device_info<A>(&self, device_spec: DeviceSpec, wanted: XIFeature, all_buttons: bool, first_button: u8, n_buttons: u8, led_class: LedClass, led_id: A) -> Result<Cookie<'_, Self, GetDeviceInfoReply>, ConnectionError>
where
A: Into<IDSpec>,
{
get_device_info(self, device_spec, wanted, all_buttons, first_button, n_buttons, led_class, led_id)
}
fn xkb_set_device_info<'c, 'input>(&'c self, device_spec: DeviceSpec, first_btn: u8, change: XIFeature, btn_actions: &'input [Action], leds: &'input [DeviceLedInfo]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_device_info(self, device_spec, first_btn, change, btn_actions, leds)
}
fn xkb_set_debugging_flags<'c, 'input>(&'c self, affect_flags: u32, flags: u32, affect_ctrls: u32, ctrls: u32, message: &'input [String8]) -> Result<Cookie<'c, Self, SetDebuggingFlagsReply>, ConnectionError>
{
set_debugging_flags(self, affect_flags, flags, affect_ctrls, ctrls, message)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

472
vendor/x11rb/src/protocol/xprint.rs vendored Normal file
View File

@@ -0,0 +1,472 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `XPrint` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::xprint::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn print_query_version<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, PrintQueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintQueryVersionRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn print_get_printer_list<'c, 'input, Conn>(conn: &'c Conn, printer_name: &'input [String8], locale: &'input [String8]) -> Result<Cookie<'c, Conn, PrintGetPrinterListReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintGetPrinterListRequest {
printer_name: Cow::Borrowed(printer_name),
locale: Cow::Borrowed(locale),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3]), IoSlice::new(&bytes[4])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn print_rehash_printer_list<Conn>(conn: &Conn) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintRehashPrinterListRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_context<'c, 'input, Conn>(conn: &'c Conn, context_id: u32, printer_name: &'input [String8], locale: &'input [String8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateContextRequest {
context_id,
printer_name: Cow::Borrowed(printer_name),
locale: Cow::Borrowed(locale),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3]), IoSlice::new(&bytes[4])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn print_set_context<Conn>(conn: &Conn, context: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintSetContextRequest {
context,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn print_get_context<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, PrintGetContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintGetContextRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn print_destroy_context<Conn>(conn: &Conn, context: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintDestroyContextRequest {
context,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn print_get_screen_of_context<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, PrintGetScreenOfContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintGetScreenOfContextRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn print_start_job<Conn>(conn: &Conn, output_mode: u8) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintStartJobRequest {
output_mode,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn print_end_job<Conn>(conn: &Conn, cancel: bool) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintEndJobRequest {
cancel,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn print_start_doc<Conn>(conn: &Conn, driver_mode: u8) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintStartDocRequest {
driver_mode,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn print_end_doc<Conn>(conn: &Conn, cancel: bool) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintEndDocRequest {
cancel,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn print_put_document_data<'c, 'input, Conn>(conn: &'c Conn, drawable: xproto::Drawable, data: &'input [u8], doc_format: &'input [String8], options: &'input [String8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintPutDocumentDataRequest {
drawable,
data: Cow::Borrowed(data),
doc_format: Cow::Borrowed(doc_format),
options: Cow::Borrowed(options),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2]), IoSlice::new(&bytes[3]), IoSlice::new(&bytes[4]), IoSlice::new(&bytes[5]), IoSlice::new(&bytes[6])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn print_get_document_data<Conn>(conn: &Conn, context: Pcontext, max_bytes: u32) -> Result<Cookie<'_, Conn, PrintGetDocumentDataReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintGetDocumentDataRequest {
context,
max_bytes,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn print_start_page<Conn>(conn: &Conn, window: xproto::Window) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintStartPageRequest {
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn print_end_page<Conn>(conn: &Conn, cancel: bool) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintEndPageRequest {
cancel,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn print_select_input<Conn>(conn: &Conn, context: Pcontext, event_mask: u32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintSelectInputRequest {
context,
event_mask,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn print_input_selected<Conn>(conn: &Conn, context: Pcontext) -> Result<Cookie<'_, Conn, PrintInputSelectedReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintInputSelectedRequest {
context,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn print_get_attributes<Conn>(conn: &Conn, context: Pcontext, pool: u8) -> Result<Cookie<'_, Conn, PrintGetAttributesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintGetAttributesRequest {
context,
pool,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn print_get_one_attributes<'c, 'input, Conn>(conn: &'c Conn, context: Pcontext, pool: u8, name: &'input [String8]) -> Result<Cookie<'c, Conn, PrintGetOneAttributesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintGetOneAttributesRequest {
context,
pool,
name: Cow::Borrowed(name),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn print_set_attributes<'c, 'input, Conn>(conn: &'c Conn, context: Pcontext, string_len: u32, pool: u8, rule: u8, attributes: &'input [String8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintSetAttributesRequest {
context,
string_len,
pool,
rule,
attributes: Cow::Borrowed(attributes),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn print_get_page_dimensions<Conn>(conn: &Conn, context: Pcontext) -> Result<Cookie<'_, Conn, PrintGetPageDimensionsReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintGetPageDimensionsRequest {
context,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn print_query_screens<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, PrintQueryScreensReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintQueryScreensRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn print_set_image_resolution<Conn>(conn: &Conn, context: Pcontext, image_resolution: u16) -> Result<Cookie<'_, Conn, PrintSetImageResolutionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintSetImageResolutionRequest {
context,
image_resolution,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn print_get_image_resolution<Conn>(conn: &Conn, context: Pcontext) -> Result<Cookie<'_, Conn, PrintGetImageResolutionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PrintGetImageResolutionRequest {
context,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn xprint_print_query_version(&self) -> Result<Cookie<'_, Self, PrintQueryVersionReply>, ConnectionError>
{
print_query_version(self)
}
fn xprint_print_get_printer_list<'c, 'input>(&'c self, printer_name: &'input [String8], locale: &'input [String8]) -> Result<Cookie<'c, Self, PrintGetPrinterListReply>, ConnectionError>
{
print_get_printer_list(self, printer_name, locale)
}
fn xprint_print_rehash_printer_list(&self) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
print_rehash_printer_list(self)
}
fn xprint_create_context<'c, 'input>(&'c self, context_id: u32, printer_name: &'input [String8], locale: &'input [String8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
create_context(self, context_id, printer_name, locale)
}
fn xprint_print_set_context(&self, context: u32) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
print_set_context(self, context)
}
fn xprint_print_get_context(&self) -> Result<Cookie<'_, Self, PrintGetContextReply>, ConnectionError>
{
print_get_context(self)
}
fn xprint_print_destroy_context(&self, context: u32) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
print_destroy_context(self, context)
}
fn xprint_print_get_screen_of_context(&self) -> Result<Cookie<'_, Self, PrintGetScreenOfContextReply>, ConnectionError>
{
print_get_screen_of_context(self)
}
fn xprint_print_start_job(&self, output_mode: u8) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
print_start_job(self, output_mode)
}
fn xprint_print_end_job(&self, cancel: bool) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
print_end_job(self, cancel)
}
fn xprint_print_start_doc(&self, driver_mode: u8) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
print_start_doc(self, driver_mode)
}
fn xprint_print_end_doc(&self, cancel: bool) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
print_end_doc(self, cancel)
}
fn xprint_print_put_document_data<'c, 'input>(&'c self, drawable: xproto::Drawable, data: &'input [u8], doc_format: &'input [String8], options: &'input [String8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
print_put_document_data(self, drawable, data, doc_format, options)
}
fn xprint_print_get_document_data(&self, context: Pcontext, max_bytes: u32) -> Result<Cookie<'_, Self, PrintGetDocumentDataReply>, ConnectionError>
{
print_get_document_data(self, context, max_bytes)
}
fn xprint_print_start_page(&self, window: xproto::Window) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
print_start_page(self, window)
}
fn xprint_print_end_page(&self, cancel: bool) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
print_end_page(self, cancel)
}
fn xprint_print_select_input(&self, context: Pcontext, event_mask: u32) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
print_select_input(self, context, event_mask)
}
fn xprint_print_input_selected(&self, context: Pcontext) -> Result<Cookie<'_, Self, PrintInputSelectedReply>, ConnectionError>
{
print_input_selected(self, context)
}
fn xprint_print_get_attributes(&self, context: Pcontext, pool: u8) -> Result<Cookie<'_, Self, PrintGetAttributesReply>, ConnectionError>
{
print_get_attributes(self, context, pool)
}
fn xprint_print_get_one_attributes<'c, 'input>(&'c self, context: Pcontext, pool: u8, name: &'input [String8]) -> Result<Cookie<'c, Self, PrintGetOneAttributesReply>, ConnectionError>
{
print_get_one_attributes(self, context, pool, name)
}
fn xprint_print_set_attributes<'c, 'input>(&'c self, context: Pcontext, string_len: u32, pool: u8, rule: u8, attributes: &'input [String8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
print_set_attributes(self, context, string_len, pool, rule, attributes)
}
fn xprint_print_get_page_dimensions(&self, context: Pcontext) -> Result<Cookie<'_, Self, PrintGetPageDimensionsReply>, ConnectionError>
{
print_get_page_dimensions(self, context)
}
fn xprint_print_query_screens(&self) -> Result<Cookie<'_, Self, PrintQueryScreensReply>, ConnectionError>
{
print_query_screens(self)
}
fn xprint_print_set_image_resolution(&self, context: Pcontext, image_resolution: u16) -> Result<Cookie<'_, Self, PrintSetImageResolutionReply>, ConnectionError>
{
print_set_image_resolution(self, context, image_resolution)
}
fn xprint_print_get_image_resolution(&self, context: Pcontext) -> Result<Cookie<'_, Self, PrintGetImageResolutionReply>, ConnectionError>
{
print_get_image_resolution(self, context)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

5980
vendor/x11rb/src/protocol/xproto.rs vendored Normal file

File diff suppressed because it is too large Load Diff

422
vendor/x11rb/src/protocol/xselinux.rs vendored Normal file
View File

@@ -0,0 +1,422 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `SELinux` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::xselinux::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_version<Conn>(conn: &Conn, client_major: u8, client_minor: u8) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest {
client_major,
client_minor,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_device_create_context<'c, 'input, Conn>(conn: &'c Conn, context: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetDeviceCreateContextRequest {
context: Cow::Borrowed(context),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_device_create_context<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, GetDeviceCreateContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetDeviceCreateContextRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_device_context<'c, 'input, Conn>(conn: &'c Conn, device: u32, context: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetDeviceContextRequest {
device,
context: Cow::Borrowed(context),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_device_context<Conn>(conn: &Conn, device: u32) -> Result<Cookie<'_, Conn, GetDeviceContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetDeviceContextRequest {
device,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_window_create_context<'c, 'input, Conn>(conn: &'c Conn, context: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetWindowCreateContextRequest {
context: Cow::Borrowed(context),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_window_create_context<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, GetWindowCreateContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetWindowCreateContextRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_window_context<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, GetWindowContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetWindowContextRequest {
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_property_create_context<'c, 'input, Conn>(conn: &'c Conn, context: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetPropertyCreateContextRequest {
context: Cow::Borrowed(context),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_property_create_context<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, GetPropertyCreateContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetPropertyCreateContextRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_property_use_context<'c, 'input, Conn>(conn: &'c Conn, context: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetPropertyUseContextRequest {
context: Cow::Borrowed(context),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_property_use_context<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, GetPropertyUseContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetPropertyUseContextRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_property_context<Conn>(conn: &Conn, window: xproto::Window, property: xproto::Atom) -> Result<Cookie<'_, Conn, GetPropertyContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetPropertyContextRequest {
window,
property,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_property_data_context<Conn>(conn: &Conn, window: xproto::Window, property: xproto::Atom) -> Result<Cookie<'_, Conn, GetPropertyDataContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetPropertyDataContextRequest {
window,
property,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn list_properties<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, ListPropertiesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ListPropertiesRequest {
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_selection_create_context<'c, 'input, Conn>(conn: &'c Conn, context: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetSelectionCreateContextRequest {
context: Cow::Borrowed(context),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_selection_create_context<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, GetSelectionCreateContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetSelectionCreateContextRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_selection_use_context<'c, 'input, Conn>(conn: &'c Conn, context: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetSelectionUseContextRequest {
context: Cow::Borrowed(context),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_selection_use_context<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, GetSelectionUseContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetSelectionUseContextRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_selection_context<Conn>(conn: &Conn, selection: xproto::Atom) -> Result<Cookie<'_, Conn, GetSelectionContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetSelectionContextRequest {
selection,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_selection_data_context<Conn>(conn: &Conn, selection: xproto::Atom) -> Result<Cookie<'_, Conn, GetSelectionDataContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetSelectionDataContextRequest {
selection,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn list_selections<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, ListSelectionsReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ListSelectionsRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn get_client_context<Conn>(conn: &Conn, resource: u32) -> Result<Cookie<'_, Conn, GetClientContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetClientContextRequest {
resource,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn xselinux_query_version(&self, client_major: u8, client_minor: u8) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self, client_major, client_minor)
}
fn xselinux_set_device_create_context<'c, 'input>(&'c self, context: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_device_create_context(self, context)
}
fn xselinux_get_device_create_context(&self) -> Result<Cookie<'_, Self, GetDeviceCreateContextReply>, ConnectionError>
{
get_device_create_context(self)
}
fn xselinux_set_device_context<'c, 'input>(&'c self, device: u32, context: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_device_context(self, device, context)
}
fn xselinux_get_device_context(&self, device: u32) -> Result<Cookie<'_, Self, GetDeviceContextReply>, ConnectionError>
{
get_device_context(self, device)
}
fn xselinux_set_window_create_context<'c, 'input>(&'c self, context: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_window_create_context(self, context)
}
fn xselinux_get_window_create_context(&self) -> Result<Cookie<'_, Self, GetWindowCreateContextReply>, ConnectionError>
{
get_window_create_context(self)
}
fn xselinux_get_window_context(&self, window: xproto::Window) -> Result<Cookie<'_, Self, GetWindowContextReply>, ConnectionError>
{
get_window_context(self, window)
}
fn xselinux_set_property_create_context<'c, 'input>(&'c self, context: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_property_create_context(self, context)
}
fn xselinux_get_property_create_context(&self) -> Result<Cookie<'_, Self, GetPropertyCreateContextReply>, ConnectionError>
{
get_property_create_context(self)
}
fn xselinux_set_property_use_context<'c, 'input>(&'c self, context: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_property_use_context(self, context)
}
fn xselinux_get_property_use_context(&self) -> Result<Cookie<'_, Self, GetPropertyUseContextReply>, ConnectionError>
{
get_property_use_context(self)
}
fn xselinux_get_property_context(&self, window: xproto::Window, property: xproto::Atom) -> Result<Cookie<'_, Self, GetPropertyContextReply>, ConnectionError>
{
get_property_context(self, window, property)
}
fn xselinux_get_property_data_context(&self, window: xproto::Window, property: xproto::Atom) -> Result<Cookie<'_, Self, GetPropertyDataContextReply>, ConnectionError>
{
get_property_data_context(self, window, property)
}
fn xselinux_list_properties(&self, window: xproto::Window) -> Result<Cookie<'_, Self, ListPropertiesReply>, ConnectionError>
{
list_properties(self, window)
}
fn xselinux_set_selection_create_context<'c, 'input>(&'c self, context: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_selection_create_context(self, context)
}
fn xselinux_get_selection_create_context(&self) -> Result<Cookie<'_, Self, GetSelectionCreateContextReply>, ConnectionError>
{
get_selection_create_context(self)
}
fn xselinux_set_selection_use_context<'c, 'input>(&'c self, context: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
set_selection_use_context(self, context)
}
fn xselinux_get_selection_use_context(&self) -> Result<Cookie<'_, Self, GetSelectionUseContextReply>, ConnectionError>
{
get_selection_use_context(self)
}
fn xselinux_get_selection_context(&self, selection: xproto::Atom) -> Result<Cookie<'_, Self, GetSelectionContextReply>, ConnectionError>
{
get_selection_context(self, selection)
}
fn xselinux_get_selection_data_context(&self, selection: xproto::Atom) -> Result<Cookie<'_, Self, GetSelectionDataContextReply>, ConnectionError>
{
get_selection_data_context(self, selection)
}
fn xselinux_list_selections(&self) -> Result<Cookie<'_, Self, ListSelectionsReply>, ConnectionError>
{
list_selections(self)
}
fn xselinux_get_client_context(&self, resource: u32) -> Result<Cookie<'_, Self, GetClientContextReply>, ConnectionError>
{
get_client_context(self, resource)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

117
vendor/x11rb/src/protocol/xtest.rs vendored Normal file
View File

@@ -0,0 +1,117 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `Test` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::xtest::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn get_version<Conn>(conn: &Conn, major_version: u8, minor_version: u16) -> Result<Cookie<'_, Conn, GetVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetVersionRequest {
major_version,
minor_version,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn compare_cursor<Conn>(conn: &Conn, window: xproto::Window, cursor: xproto::Cursor) -> Result<Cookie<'_, Conn, CompareCursorReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CompareCursorRequest {
window,
cursor,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn fake_input<Conn>(conn: &Conn, type_: u8, detail: u8, time: u32, root: xproto::Window, root_x: i16, root_y: i16, deviceid: u8) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = FakeInputRequest {
type_,
detail,
time,
root,
root_x,
root_y,
deviceid,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn grab_control<Conn>(conn: &Conn, impervious: bool) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GrabControlRequest {
impervious,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn xtest_get_version(&self, major_version: u8, minor_version: u16) -> Result<Cookie<'_, Self, GetVersionReply>, ConnectionError>
{
get_version(self, major_version, minor_version)
}
fn xtest_compare_cursor(&self, window: xproto::Window, cursor: xproto::Cursor) -> Result<Cookie<'_, Self, CompareCursorReply>, ConnectionError>
{
compare_cursor(self, window, cursor)
}
fn xtest_fake_input(&self, type_: u8, detail: u8, time: u32, root: xproto::Window, root_x: i16, root_y: i16, deviceid: u8) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
fake_input(self, type_, detail, time, root, root_x, root_y, deviceid)
}
fn xtest_grab_control(&self, impervious: bool) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
grab_control(self, impervious)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

475
vendor/x11rb/src/protocol/xv.rs vendored Normal file
View File

@@ -0,0 +1,475 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `Xv` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::shm;
#[allow(unused_imports)]
use super::xproto;
pub use x11rb_protocol::protocol::xv::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_extension<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, QueryExtensionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryExtensionRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn query_adaptors<Conn>(conn: &Conn, window: xproto::Window) -> Result<Cookie<'_, Conn, QueryAdaptorsReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryAdaptorsRequest {
window,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn query_encodings<Conn>(conn: &Conn, port: Port) -> Result<Cookie<'_, Conn, QueryEncodingsReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryEncodingsRequest {
port,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn grab_port<Conn, A>(conn: &Conn, port: Port, time: A) -> Result<Cookie<'_, Conn, GrabPortReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
A: Into<xproto::Timestamp>,
{
let time: xproto::Timestamp = time.into();
let request0 = GrabPortRequest {
port,
time,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn ungrab_port<Conn, A>(conn: &Conn, port: Port, time: A) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
A: Into<xproto::Timestamp>,
{
let time: xproto::Timestamp = time.into();
let request0 = UngrabPortRequest {
port,
time,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn put_video<Conn>(conn: &Conn, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, vid_x: i16, vid_y: i16, vid_w: u16, vid_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PutVideoRequest {
port,
drawable,
gc,
vid_x,
vid_y,
vid_w,
vid_h,
drw_x,
drw_y,
drw_w,
drw_h,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn put_still<Conn>(conn: &Conn, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, vid_x: i16, vid_y: i16, vid_w: u16, vid_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PutStillRequest {
port,
drawable,
gc,
vid_x,
vid_y,
vid_w,
vid_h,
drw_x,
drw_y,
drw_w,
drw_h,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_video<Conn>(conn: &Conn, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, vid_x: i16, vid_y: i16, vid_w: u16, vid_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetVideoRequest {
port,
drawable,
gc,
vid_x,
vid_y,
vid_w,
vid_h,
drw_x,
drw_y,
drw_w,
drw_h,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_still<Conn>(conn: &Conn, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, vid_x: i16, vid_y: i16, vid_w: u16, vid_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetStillRequest {
port,
drawable,
gc,
vid_x,
vid_y,
vid_w,
vid_h,
drw_x,
drw_y,
drw_w,
drw_h,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn stop_video<Conn>(conn: &Conn, port: Port, drawable: xproto::Drawable) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = StopVideoRequest {
port,
drawable,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn select_video_notify<Conn>(conn: &Conn, drawable: xproto::Drawable, onoff: bool) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SelectVideoNotifyRequest {
drawable,
onoff,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn select_port_notify<Conn>(conn: &Conn, port: Port, onoff: bool) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SelectPortNotifyRequest {
port,
onoff,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn query_best_size<Conn>(conn: &Conn, port: Port, vid_w: u16, vid_h: u16, drw_w: u16, drw_h: u16, motion: bool) -> Result<Cookie<'_, Conn, QueryBestSizeReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryBestSizeRequest {
port,
vid_w,
vid_h,
drw_w,
drw_h,
motion,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn set_port_attribute<Conn>(conn: &Conn, port: Port, attribute: xproto::Atom, value: i32) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = SetPortAttributeRequest {
port,
attribute,
value,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn get_port_attribute<Conn>(conn: &Conn, port: Port, attribute: xproto::Atom) -> Result<Cookie<'_, Conn, GetPortAttributeReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = GetPortAttributeRequest {
port,
attribute,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn query_port_attributes<Conn>(conn: &Conn, port: Port) -> Result<Cookie<'_, Conn, QueryPortAttributesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryPortAttributesRequest {
port,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn list_image_formats<Conn>(conn: &Conn, port: Port) -> Result<Cookie<'_, Conn, ListImageFormatsReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ListImageFormatsRequest {
port,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn query_image_attributes<Conn>(conn: &Conn, port: Port, id: u32, width: u16, height: u16) -> Result<Cookie<'_, Conn, QueryImageAttributesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryImageAttributesRequest {
port,
id,
width,
height,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn put_image<'c, 'input, Conn>(conn: &'c Conn, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, id: u32, src_x: i16, src_y: i16, src_w: u16, src_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16, width: u16, height: u16, data: &'input [u8]) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = PutImageRequest {
port,
drawable,
gc,
id,
src_x,
src_y,
src_w,
src_h,
drw_x,
drw_y,
drw_w,
drw_h,
width,
height,
data: Cow::Borrowed(data),
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn shm_put_image<Conn>(conn: &Conn, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, shmseg: shm::Seg, id: u32, offset: u32, src_x: i16, src_y: i16, src_w: u16, src_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16, width: u16, height: u16, send_event: u8) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ShmPutImageRequest {
port,
drawable,
gc,
shmseg,
id,
offset,
src_x,
src_y,
src_w,
src_h,
drw_x,
drw_y,
drw_w,
drw_h,
width,
height,
send_event,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn xv_query_extension(&self) -> Result<Cookie<'_, Self, QueryExtensionReply>, ConnectionError>
{
query_extension(self)
}
fn xv_query_adaptors(&self, window: xproto::Window) -> Result<Cookie<'_, Self, QueryAdaptorsReply>, ConnectionError>
{
query_adaptors(self, window)
}
fn xv_query_encodings(&self, port: Port) -> Result<Cookie<'_, Self, QueryEncodingsReply>, ConnectionError>
{
query_encodings(self, port)
}
fn xv_grab_port<A>(&self, port: Port, time: A) -> Result<Cookie<'_, Self, GrabPortReply>, ConnectionError>
where
A: Into<xproto::Timestamp>,
{
grab_port(self, port, time)
}
fn xv_ungrab_port<A>(&self, port: Port, time: A) -> Result<VoidCookie<'_, Self>, ConnectionError>
where
A: Into<xproto::Timestamp>,
{
ungrab_port(self, port, time)
}
fn xv_put_video(&self, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, vid_x: i16, vid_y: i16, vid_w: u16, vid_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
put_video(self, port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h)
}
fn xv_put_still(&self, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, vid_x: i16, vid_y: i16, vid_w: u16, vid_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
put_still(self, port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h)
}
fn xv_get_video(&self, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, vid_x: i16, vid_y: i16, vid_w: u16, vid_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
get_video(self, port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h)
}
fn xv_get_still(&self, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, vid_x: i16, vid_y: i16, vid_w: u16, vid_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
get_still(self, port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h)
}
fn xv_stop_video(&self, port: Port, drawable: xproto::Drawable) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
stop_video(self, port, drawable)
}
fn xv_select_video_notify(&self, drawable: xproto::Drawable, onoff: bool) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
select_video_notify(self, drawable, onoff)
}
fn xv_select_port_notify(&self, port: Port, onoff: bool) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
select_port_notify(self, port, onoff)
}
fn xv_query_best_size(&self, port: Port, vid_w: u16, vid_h: u16, drw_w: u16, drw_h: u16, motion: bool) -> Result<Cookie<'_, Self, QueryBestSizeReply>, ConnectionError>
{
query_best_size(self, port, vid_w, vid_h, drw_w, drw_h, motion)
}
fn xv_set_port_attribute(&self, port: Port, attribute: xproto::Atom, value: i32) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
set_port_attribute(self, port, attribute, value)
}
fn xv_get_port_attribute(&self, port: Port, attribute: xproto::Atom) -> Result<Cookie<'_, Self, GetPortAttributeReply>, ConnectionError>
{
get_port_attribute(self, port, attribute)
}
fn xv_query_port_attributes(&self, port: Port) -> Result<Cookie<'_, Self, QueryPortAttributesReply>, ConnectionError>
{
query_port_attributes(self, port)
}
fn xv_list_image_formats(&self, port: Port) -> Result<Cookie<'_, Self, ListImageFormatsReply>, ConnectionError>
{
list_image_formats(self, port)
}
fn xv_query_image_attributes(&self, port: Port, id: u32, width: u16, height: u16) -> Result<Cookie<'_, Self, QueryImageAttributesReply>, ConnectionError>
{
query_image_attributes(self, port, id, width, height)
}
fn xv_put_image<'c, 'input>(&'c self, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, id: u32, src_x: i16, src_y: i16, src_w: u16, src_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16, width: u16, height: u16, data: &'input [u8]) -> Result<VoidCookie<'c, Self>, ConnectionError>
{
put_image(self, port, drawable, gc, id, src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, width, height, data)
}
fn xv_shm_put_image(&self, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, shmseg: shm::Seg, id: u32, offset: u32, src_x: i16, src_y: i16, src_w: u16, src_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16, width: u16, height: u16, send_event: u8) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
shm_put_image(self, port, drawable, gc, shmseg, id, offset, src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, width, height, send_event)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}

203
vendor/x11rb/src/protocol/xvmc.rs vendored Normal file
View File

@@ -0,0 +1,203 @@
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `XvMC` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
#[allow(unused_imports)]
use std::convert::TryInto;
#[allow(unused_imports)]
use crate::utils::RawFdContainer;
#[allow(unused_imports)]
use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd};
use std::io::IoSlice;
use crate::connection::RequestConnection;
#[allow(unused_imports)]
use crate::connection::Connection as X11Connection;
#[allow(unused_imports)]
use crate::cookie::{Cookie, CookieWithFds, VoidCookie};
use crate::errors::ConnectionError;
#[allow(unused_imports)]
use crate::errors::ReplyOrIdError;
#[allow(unused_imports)]
use super::xv;
pub use x11rb_protocol::protocol::xvmc::*;
/// Get the major opcode of this extension
fn major_opcode<Conn: RequestConnection + ?Sized>(conn: &Conn) -> Result<u8, ConnectionError> {
let info = conn.extension_information(X11_EXTENSION_NAME)?;
let info = info.ok_or(ConnectionError::UnsupportedExtension)?;
Ok(info.major_opcode)
}
pub fn query_version<Conn>(conn: &Conn) -> Result<Cookie<'_, Conn, QueryVersionReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = QueryVersionRequest;
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn list_surface_types<Conn>(conn: &Conn, port_id: xv::Port) -> Result<Cookie<'_, Conn, ListSurfaceTypesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ListSurfaceTypesRequest {
port_id,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn create_context<Conn>(conn: &Conn, context_id: Context, port_id: xv::Port, surface_id: Surface, width: u16, height: u16, flags: u32) -> Result<Cookie<'_, Conn, CreateContextReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateContextRequest {
context_id,
port_id,
surface_id,
width,
height,
flags,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn destroy_context<Conn>(conn: &Conn, context_id: Context) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DestroyContextRequest {
context_id,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_surface<Conn>(conn: &Conn, surface_id: Surface, context_id: Context) -> Result<Cookie<'_, Conn, CreateSurfaceReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateSurfaceRequest {
surface_id,
context_id,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn destroy_surface<Conn>(conn: &Conn, surface_id: Surface) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DestroySurfaceRequest {
surface_id,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn create_subpicture<Conn>(conn: &Conn, subpicture_id: Subpicture, context: Context, xvimage_id: u32, width: u16, height: u16) -> Result<Cookie<'_, Conn, CreateSubpictureReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = CreateSubpictureRequest {
subpicture_id,
context,
xvimage_id,
width,
height,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
pub fn destroy_subpicture<Conn>(conn: &Conn, subpicture_id: Subpicture) -> Result<VoidCookie<'_, Conn>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = DestroySubpictureRequest {
subpicture_id,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_without_reply(&slices, fds)
}
pub fn list_subpicture_types<Conn>(conn: &Conn, port_id: xv::Port, surface_id: Surface) -> Result<Cookie<'_, Conn, ListSubpictureTypesReply>, ConnectionError>
where
Conn: RequestConnection + ?Sized,
{
let request0 = ListSubpictureTypesRequest {
port_id,
surface_id,
};
let (bytes, fds) = request0.serialize(major_opcode(conn)?);
let slices = [IoSlice::new(&bytes[0])];
assert_eq!(slices.len(), bytes.len());
conn.send_request_with_reply(&slices, fds)
}
/// Extension trait defining the requests of this extension.
pub trait ConnectionExt: RequestConnection {
fn xvmc_query_version(&self) -> Result<Cookie<'_, Self, QueryVersionReply>, ConnectionError>
{
query_version(self)
}
fn xvmc_list_surface_types(&self, port_id: xv::Port) -> Result<Cookie<'_, Self, ListSurfaceTypesReply>, ConnectionError>
{
list_surface_types(self, port_id)
}
fn xvmc_create_context(&self, context_id: Context, port_id: xv::Port, surface_id: Surface, width: u16, height: u16, flags: u32) -> Result<Cookie<'_, Self, CreateContextReply>, ConnectionError>
{
create_context(self, context_id, port_id, surface_id, width, height, flags)
}
fn xvmc_destroy_context(&self, context_id: Context) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
destroy_context(self, context_id)
}
fn xvmc_create_surface(&self, surface_id: Surface, context_id: Context) -> Result<Cookie<'_, Self, CreateSurfaceReply>, ConnectionError>
{
create_surface(self, surface_id, context_id)
}
fn xvmc_destroy_surface(&self, surface_id: Surface) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
destroy_surface(self, surface_id)
}
fn xvmc_create_subpicture(&self, subpicture_id: Subpicture, context: Context, xvimage_id: u32, width: u16, height: u16) -> Result<Cookie<'_, Self, CreateSubpictureReply>, ConnectionError>
{
create_subpicture(self, subpicture_id, context, xvimage_id, width, height)
}
fn xvmc_destroy_subpicture(&self, subpicture_id: Subpicture) -> Result<VoidCookie<'_, Self>, ConnectionError>
{
destroy_subpicture(self, subpicture_id)
}
fn xvmc_list_subpicture_types(&self, port_id: xv::Port, surface_id: Surface) -> Result<Cookie<'_, Self, ListSubpictureTypesReply>, ConnectionError>
{
list_subpicture_types(self, port_id, surface_id)
}
}
impl<C: RequestConnection + ?Sized> ConnectionExt for C {}