1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837
/*
* Copyright (C) 2013 James Miller <james@aatch.net>
* Copyright (c) 2016
* Remi Thebault <remi.thebault@gmail.com>
* Thomas Bracht Laumann Jespersen <laumann.thomas@gmail.com>
* Copyright (c) 2017-2021 Remi Thebault <remi.thebault@gmail.com>
*
* Permission is hereby granted, free of charge, to any
* person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the
* Software without restriction, including without
* limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice
* shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
* SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#![allow(dead_code)]
#![allow(unused_imports)]
#![allow(unused_parens)]
#![allow(clippy::len_without_is_empty)]
#![allow(clippy::diverging_sub_expression)]
//! Rust bindings to the XCB library.
//!
//! The X protocol C-language Binding (XCB - <https://xcb.freedesktop.org/>) is
//! a replacement for Xlib featuring a small footprint, latency hiding, direct
//! access to the protocol, improved threading support, and extensibility.
//!
//! The communication is established with the X server by the creation of a
//! [Connection] object.
//!
//! A client communicates with the server by sending requests. There are 2 types
//! of requests:
//!
//! - void requests: requests that do not expect an answer
//! (e.g. [x::ChangeProperty])
//! - non-void requests: requests that need a `Reply` (e.g. [x::GetProperty])
//!
//! Requests are passed to the server by filling a request structure e.g.
//! [x::CreateWindow] and passing it to [Connection::send_request].
//!
//! The server can also communicate with clients by sending `Event`s.
//! The client listens to events with calls such as [Connection::wait_for_event]
//! (blocking) or [Connection::poll_for_event] (non-blocking).
//!
//! The [x] module contains definitions of the core X protocol.
//! Each extension is defined in its own module such as [xkb] or [render], and
//! is activated by a cargo feature of the same name.
//!
//! # Example
//!
//! Here is a walk-through of a simple `xcb` client.
//! ```no_run
//! // we import the necessary modules (only the core X module in this application).
//! use xcb::{x};
//! // we need to import the `Xid` trait for the `resource_id` call down there.
//! use xcb::{Xid};
//!
//! // Many xcb functions return a `xcb::Result` or compatible result.
//! fn main() -> xcb::Result<()> {
//! // Connect to the X server.
//! let (conn, screen_num) = xcb::Connection::connect(None)?;
//!
//! // Fetch the `x::Setup` and get the main `x::Screen` object.
//! let setup = conn.get_setup();
//! let screen = setup.roots().nth(screen_num as usize).unwrap();
//!
//! // Generate an `Xid` for the client window.
//! // The type inference is needed here.
//! let window: x::Window = conn.generate_id();
//!
//! // We can now create a window. For this we pass a `Request`
//! // object to the `send_request_checked` method. The method
//! // returns a cookie that will be used to check for success.
//! let cookie = conn.send_request_checked(&x::CreateWindow {
//! depth: x::COPY_FROM_PARENT as u8,
//! wid: window,
//! parent: screen.root(),
//! x: 0,
//! y: 0,
//! width: 150,
//! height: 150,
//! border_width: 0,
//! class: x::WindowClass::InputOutput,
//! visual: screen.root_visual(),
//! // this list must be in same order than `Cw` enum order
//! value_list: &[
//! x::Cw::BackPixel(screen.white_pixel()),
//! x::Cw::EventMask(x::EventMask::EXPOSURE | x::EventMask::KEY_PRESS)
//! ],
//! });
//! // We now check if the window creation worked.
//! // A cookie can't be cloned; it is moved to the function.
//! conn.check_request(cookie)?;
//!
//! // Let's change the window title
//! let cookie = conn.send_request_checked(&x::ChangeProperty {
//! mode: x::PropMode::Replace,
//! window,
//! property: x::ATOM_WM_NAME,
//! r#type: x::ATOM_STRING,
//! data: b"My XCB Window",
//! });
//! // And check for success again
//! conn.check_request(cookie)?;
//!
//! // We now show ("map" in X terminology) the window.
//! // This time we do not check for success, so we discard the cookie.
//! conn.send_request(&x::MapWindow {
//! window,
//! });
//!
//! // We need a few atoms for our application.
//! // We send a few requests in a row and wait for the replies after.
//! let (wm_protocols, wm_del_window, wm_state, wm_state_maxv, wm_state_maxh) = {
//! let cookies = (
//! conn.send_request(&x::InternAtom {
//! only_if_exists: true,
//! name: b"WM_PROTOCOLS",
//! }),
//! conn.send_request(&x::InternAtom {
//! only_if_exists: true,
//! name: b"WM_DELETE_WINDOW",
//! }),
//! conn.send_request(&x::InternAtom {
//! only_if_exists: true,
//! name: b"_NET_WM_STATE",
//! }),
//! conn.send_request(&x::InternAtom {
//! only_if_exists: true,
//! name: b"_NET_WM_STATE_MAXIMIZED_VERT",
//! }),
//! conn.send_request(&x::InternAtom {
//! only_if_exists: true,
//! name: b"_NET_WM_STATE_MAXIMIZED_HORZ",
//! }),
//! );
//! (
//! conn.wait_for_reply(cookies.0)?.atom(),
//! conn.wait_for_reply(cookies.1)?.atom(),
//! conn.wait_for_reply(cookies.2)?.atom(),
//! conn.wait_for_reply(cookies.3)?.atom(),
//! conn.wait_for_reply(cookies.4)?.atom(),
//! )
//! };
//!
//! // We now activate the window close event by sending the following request.
//! // If we don't do this we can still close the window by clicking on the "x" button,
//! // but the event loop is notified through a connection shutdown error.
//! conn.check_request(conn.send_request_checked(&x::ChangeProperty {
//! mode: x::PropMode::Replace,
//! window,
//! property: wm_protocols,
//! r#type: x::ATOM_ATOM,
//! data: &[wm_del_window],
//! }))?;
//!
//! // Previous request was checked, so a flush is not necessary in this case.
//! // Otherwise, here is how to perform a connection flush.
//! conn.flush()?;
//!
//! let mut maximized = false;
//!
//! // We enter the main event loop
//! loop {
//! match conn.wait_for_event()? {
//! xcb::Event::X(x::Event::KeyPress(ev)) => {
//! if ev.detail() == 0x3a {
//! // The M key was pressed
//! // (M only on qwerty keyboards. Keymap support is done
//! // with the `xkb` extension and the `xkbcommon-rs` crate)
//!
//! // We toggle maximized state, for this we send a message
//! // by building a `x::ClientMessageEvent` with the proper
//! // atoms and send it to the server.
//!
//! let data = x::ClientMessageData::Data32([
//! if maximized { 0 } else { 1 },
//! wm_state_maxv.resource_id(),
//! wm_state_maxh.resource_id(),
//! 0,
//! 0,
//! ]);
//! let event = x::ClientMessageEvent::new(window, wm_state, data);
//! let cookie = conn.send_request_checked(&x::SendEvent {
//! propagate: false,
//! destination: x::SendEventDest::Window(screen.root()),
//! event_mask: x::EventMask::STRUCTURE_NOTIFY,
//! event: &event,
//! });
//! conn.check_request(cookie)?;
//!
//! // Same as before, if we don't check for error, we have to flush
//! // the connection.
//! // conn.flush()?;
//!
//! maximized = !maximized;
//! } else if ev.detail() == 0x18 {
//! // Q (on qwerty)
//!
//! // We exit the event loop (and the program)
//! break Ok(());
//! }
//! }
//! xcb::Event::X(x::Event::ClientMessage(ev)) => {
//! // We have received a message from the server
//! if let x::ClientMessageData::Data32([atom, ..]) = ev.data() {
//! if atom == wm_del_window.resource_id() {
//! // The received atom is "WM_DELETE_WINDOW".
//! // We can check here if the user needs to save before
//! // exit, or in our case, exit right away.
//! break Ok(());
//! }
//! }
//! }
//! _ => {}
//! }
//! }
//! }
//! ```
//!
//! # Cargo features
//!
//! The following Cargo features are available
//!
//! ## `xlib_xcb`
//!
//! This feature activates the use of `xlib::Display` to connect to XCB, therefore making
//! available both Xlib and XCB functions to the same connection.
//! While XCB is sufficient to handle all communication with the X server, some things can
//! still only be done by Xlib. E.g. hardware initialization for OpenGL is done by Xlib only.
//!
//! ## `debug_atom_names`
//!
//! When this feature is activated, the `fmt::Debug` implementation for `x::Atom` will print
//! out the name of the atom in addition to its value.
//!
//! E.g. the feature would turn `Atom { res_id: 303 }` into `Atom("Abs Pressure" ; 303)`.
//!
//! This can be useful in situations where you are not sure which atom you have to intern
//! in order to look up some data in a reply.
//!
//! It should be noted that the feature sets global variable to have access to
//! the connection in the `fmt::Debug` implementation, and that the `Debug` print
//! have side effects (`x::GetAtomName` requests) which can sometimes not be desirable.
//! The feature should therefore only be activated when needed.
//!
//! ## `libxcb_v1_14`
//!
//! This feature is enabled by default and activates the libxcb API version 1.14.
//! To use a version of the libxcb API prior to 1.14, you must disable it.
//!
//! ## Extension features
//!
//! The following X extensions are activated by a cargo feature:
//!
//! | Extension name | Cargo feature |
//! |-------------------------------|---------------|
//! | `Composite` | `composite` |
//! | `DAMAGE` | `damage` |
//! | `DPMS` | `dpms` |
//! | `DRI2` | `dri2` |
//! | `DRI3` | `dri3` |
//! | `Generic Event Extension` | `ge` |
//! | `GLX` | `glx` |
//! | `Present` | `present` |
//! | `RANDR` | `randr` |
//! | `RECORD` | `record` |
//! | `RENDER` | `render` |
//! | `X-Resource` | `res` |
//! | `MIT-SCREEN-SAVER` | `screensaver` |
//! | `SHAPE` | `shape` |
//! | `MIT-SHM` | `shm` |
//! | `SYNC` | `sync` |
//! | `XEVIE` | `xevie` |
//! | `XFree86-DRI` | `xf86dri` |
//! | `XFree86-VidModeExtension` | `xf86vidmode` |
//! | `XFIXES` | `xfixes` |
//! | `XINERAMA` | `xinerama` |
//! | `XInputExtension` | `xinput` |
//! | `XKEYBOARD` | `xkb` |
//! | `XpExtension` | `xprint` |
//! | `SELinux` | `xselinux` |
//! | `TEST` | `xtest` |
//! | `XVideo` | `xv` |
//! | `XVideo-MotionCompensation` | `xvmc` |
mod base;
mod error;
mod event;
mod ext;
mod lat1_str;
pub use base::*;
pub use error::*;
pub use event::*;
pub use ext::*;
pub use lat1_str::*;
pub mod x {
//! The core X protocol definitions
pub use super::xproto::*;
}
pub mod ffi {
//! Module for Foreign Function Interface bindings.
#![allow(non_camel_case_types)]
#![allow(improper_ctypes)]
pub(crate) mod base;
pub(crate) mod ext;
#[cfg(feature = "xlib_xcb")]
pub(crate) mod xlib_xcb;
pub use base::*;
pub use ext::*;
#[cfg(feature = "xlib_xcb")]
pub use xlib_xcb::*;
}
#[cfg(test)]
mod test;
mod xproto {
#![allow(unused_variables)]
#![allow(clippy::unit_arg)]
#![allow(clippy::new_ret_no_self)]
#![allow(clippy::too_many_arguments)]
/// `COPY_FROM_PARENT` can be used for many `CreateWindow` fields
pub const COPY_FROM_PARENT: u32 = 0;
/// `CURRENT_TIME` can be used in most requests that take a `Timestamp`
pub const CURRENT_TIME: Timestamp = 0;
/// `NO_SYMBOL` fills in unused entries in `Keysym` tables
pub const NO_SYMBOL: Keysym = 0;
/// `GRAB_ANY` can be used in various requests such as `GrabKey`, `UngrabKey`, `xinput::GrabDeviceKey`...
pub const GRAB_ANY: Keycode = 0;
pub const ATOM_ANY: Atom = Atom { res_id: 0 };
/// Trait for element in a property list
///
/// In events (e.g. `GetProperty::value`), it allows to assert that the format
/// correspond to the type cast and therefore to do the cast safely at runtime.
///
/// In request (e.g. `ChangeProperty::data`), it allows to infer the format value
/// from the type of passed data.
pub trait PropEl {
const FORMAT: u8;
}
impl PropEl for u8 {
const FORMAT: u8 = 8;
}
impl PropEl for u16 {
const FORMAT: u8 = 16;
}
impl PropEl for u32 {
const FORMAT: u8 = 32;
}
impl PropEl for Atom {
const FORMAT: u8 = 32;
}
impl PropEl for Window {
// _NET_CLIENT_LIST returns a list of windows
const FORMAT: u8 = 32;
}
include!(concat!(env!("OUT_DIR"), "/xproto.rs"));
}
/// An helper macro that generate a struct of atoms.
///
/// The struct provide a constructor `intern_all` that takes a `Connection` as parameter,
/// interns all the atoms and return `xcb::Result<[struct name]>`.
/// `intern_all` takes advantage of XCB asynchronous design by sending all the
/// [`x::InternAtom`] requests before starting to wait for the first reply.
/// Fields that refer to atoms not existing in the server are set to `x::ATOM_NONE`
/// (i.e. `only_if_exists` is always set to `true`).
///
/// Both the struct and each field can receive visibility attributes.
///
/// # Example
/// ```no_run
/// # use xcb::x;
/// xcb::atoms_struct! {
/// #[derive(Copy, Clone, Debug)]
/// pub(crate) struct Atoms {
/// pub wm_protocols => b"WM_PROTOCOLS",
/// pub wm_del_window => b"WM_DELETE_WINDOW",
/// /// Supported EWMH hints
/// pub net_supported => b"_NET_SUPPORTED",
///
/// // You can also explicitly set the `only_if_exists` argument when interning
/// // each atom with the following syntax (the default is `true`):
/// pub custom_atom => b"MY_CUSTOM_ATOM" only_if_exists = false,
/// }
/// }
///
/// fn main() -> xcb::Result<()> {
/// # let (conn, screen_num) = xcb::Connection::connect(None)?;
/// # let window = conn.generate_id();
/// // ...
/// let atoms = Atoms::intern_all(&conn)?;
///
/// conn.check_request(conn.send_request_checked(&x::ChangeProperty {
/// mode: x::PropMode::Replace,
/// window,
/// property: atoms.wm_protocols,
/// r#type: x::ATOM_ATOM,
/// data: &[atoms.wm_del_window],
/// }))?;
/// // ...
/// # Ok(())
/// }
/// ```
#[macro_export]
macro_rules! atoms_struct {
(
$(#[$outer:meta])*
$vis:vis struct $Atoms:ident {
$(
$(#[$fmeta:meta])* $fvis:vis $field:ident => $name:tt $( only_if_exists = $only_if_exists:expr)?,
)*
}
) => {
$(#[$outer])*
$vis struct $Atoms {
$($(#[$fmeta])* $fvis $field: xcb::x::Atom,)*
}
impl $Atoms {
#[allow(dead_code)]
pub fn intern_all(conn: &xcb::Connection) -> xcb::Result<$Atoms> {
$(
#[allow(unused_assignments)]
let mut only_if_exists = true;
$( only_if_exists = $only_if_exists; )?
let $field = conn.send_request(&xcb::x::InternAtom {
only_if_exists,
name: $name,
});
)*
$(
let $field = conn.wait_for_reply($field)?.atom();
)*
Ok($Atoms {
$($field,)*
})
}
}
};
}
pub mod bigreq {
//! The `BIG-REQUESTS` extension.
include!(concat!(env!("OUT_DIR"), "/bigreq.rs"));
}
pub mod xc_misc {
//! The `XC-MISC` extension.
include!(concat!(env!("OUT_DIR"), "/xc_misc.rs"));
}
#[cfg(feature = "composite")]
pub mod composite {
//! The `Composite` X extension.
//!
//! Accessible with the `composite` cargo feature.
include!(concat!(env!("OUT_DIR"), "/composite.rs"));
}
#[cfg(feature = "damage")]
pub mod damage {
//! The `DAMAGE` X extension.
//!
//! Accessible with the `damage` cargo feature.
include!(concat!(env!("OUT_DIR"), "/damage.rs"));
}
#[cfg(feature = "dpms")]
pub mod dpms {
//! The `DPMS` X extension.
//!
//! Accessible with the `dpms` cargo feature.
include!(concat!(env!("OUT_DIR"), "/dpms.rs"));
}
#[cfg(feature = "dri2")]
pub mod dri2 {
//! The `DRI2` X extension.
//!
//! Accessible with the `dri2` cargo feature.
#![allow(clippy::too_many_arguments)]
include!(concat!(env!("OUT_DIR"), "/dri2.rs"));
}
#[cfg(feature = "dri3")]
pub mod dri3 {
//! The `DRI3` X extension.
//!
//! Accessible with the `dri3` cargo feature.
include!(concat!(env!("OUT_DIR"), "/dri3.rs"));
}
#[cfg(feature = "ge")]
pub mod ge {
//! The `Generic Event Extension` X extension.
//!
//! Accessible with the `ge` cargo feature.
include!(concat!(env!("OUT_DIR"), "/ge.rs"));
}
#[cfg(feature = "glx")]
pub mod glx {
//! The `GLX` X extension.
//!
//! Accessible with the `glx` cargo feature.
#![allow(clippy::too_many_arguments)]
include!(concat!(env!("OUT_DIR"), "/glx.rs"));
}
#[cfg(feature = "xinput")]
pub mod xinput {
//! The `XInputExtension` X extension.
//!
//! Accessible with the `xinput` cargo feature.
#![allow(unused_variables)]
#![allow(unused_mut)]
#![allow(clippy::unit_arg)]
#![allow(clippy::too_many_arguments)]
#[derive(Copy, Clone, Debug)]
pub enum Device {
All,
AllMaster,
Id(u16),
}
impl Device {
pub fn from_id(id: u16) -> Self {
match id {
0 => Device::All,
1 => Device::AllMaster,
id => Device::Id(id),
}
}
pub fn id(&self) -> u16 {
match self {
Device::All => 0,
Device::AllMaster => 1,
Device::Id(id) => *id,
}
}
}
impl WiredOut for Device {
fn wire_len(&self) -> usize {
2
}
fn serialize(&self, wire_buf: &mut [u8]) -> usize {
assert!(wire_buf.len() >= 2);
unsafe {
*(wire_buf.as_mut_ptr() as *mut u16) = self.id();
}
2
}
}
impl WiredIn for Device {
type Params = ();
unsafe fn compute_wire_len(_ptr: *const u8, _params: ()) -> usize {
2
}
unsafe fn unserialize(ptr: *const u8, params: Self::Params, offset: &mut usize) -> Self {
*offset = 2;
let id = *(ptr as *const u16);
Device::from_id(id)
}
}
include!(concat!(env!("OUT_DIR"), "/xinput.rs"));
}
#[cfg(feature = "present")]
pub mod present {
//! The `Present` X extension.
//!
//! Accessible with the `present` cargo feature.
#![allow(clippy::unit_arg)]
include!(concat!(env!("OUT_DIR"), "/present.rs"));
}
#[cfg(feature = "randr")]
pub mod randr {
//! The `RANDR` X extension.
//!
//! Accessible with the `randr` cargo feature.
#![allow(clippy::unit_arg)]
#![allow(clippy::too_many_arguments)]
include!(concat!(env!("OUT_DIR"), "/randr.rs"));
/// For information on what the various properties mean, see the [RandR specification][randr-spec]
///
/// [randr-spec]: https://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt#n1860
mod property {
#[doc(alias = "RR_PROPERTY_BACKLIGHT")]
pub const BACKLIGHT: &str = "Backlight";
#[doc(alias = "RR_PROPERTY_CLONE_LIST")]
pub const CLONE_LIST: &str = "CloneList";
#[doc(alias = "RR_PROPERTY_COMPATIBILITY_LIST")]
pub const COMPATIBILITY_LIST: &str = "CompatibilityList";
#[doc(alias = "RR_PROPERTY_CONNECTOR_NUMBER")]
pub const CONNECTOR_NUMBER: &str = "ConnectorNumber";
#[doc(alias = "RR_PROPERTY_CONNECTOR_TYPE")]
pub const CONNECTOR_TYPE: &str = "ConnectorType";
#[doc(alias = "RR_PROPERTY_RANDR_EDID")]
pub const EDID: &str = "EDID";
#[doc(alias = "RR_PROPERTY_SIGNAL_FORMAT")]
pub const SIGNAL_FORMAT: &str = "SignalFormat";
#[doc(alias = "RR_PROPERTY_SIGNAL_PROPERTIES")]
pub const SIGNAL_PROPERTIES: &str = "SignalProperties";
#[doc(alias = "RR_PROPERTY_BORDER")]
pub const BORDER: &str = "Border";
#[doc(alias = "RR_PROPERTY_BORDER_DIMENSIONS")]
pub const BORDER_DIMENSIONS: &str = "BorderDimensions";
#[doc(alias = "RR_PROPERTY_GUID")]
pub const GUID: &str = "GUID";
#[doc(alias = "RR_PROPERTY_RANDR_TILE")]
pub const TILE: &str = "TILE";
#[doc(alias = "RR_PROPERTY_NON_DESKTOP")]
pub const NON_DESKTOP: &str = "non-desktop";
}
}
#[cfg(feature = "record")]
pub mod record {
//! The `RECORD` X extension.
//!
//! Accessible with the `record` cargo feature.
#![allow(clippy::unit_arg)]
#![allow(clippy::too_many_arguments)]
include!(concat!(env!("OUT_DIR"), "/record.rs"));
}
#[cfg(feature = "render")]
pub mod render {
//! The `RENDER` X extension.
//!
//! Accessible with the `render` cargo feature.
#![allow(unused_variables)]
#![allow(clippy::unit_arg)]
include!(concat!(env!("OUT_DIR"), "/render.rs"));
}
#[cfg(feature = "res")]
pub mod res {
//! The `X-Resource` X extension.
//!
//! Accessible with the `res` cargo feature.
#![allow(unused_variables)]
#![allow(clippy::unit_arg)]
include!(concat!(env!("OUT_DIR"), "/res.rs"));
}
#[cfg(feature = "screensaver")]
pub mod screensaver {
//! The `MIT-SCREEN-SAVER` X extension.
//!
//! Accessible with the `screensaver` cargo feature.
#![allow(unused_variables)]
include!(concat!(env!("OUT_DIR"), "/screensaver.rs"));
}
#[cfg(feature = "xselinux")]
pub mod xselinux {
//! The `SELinux` X extension.
//!
//! Accessible with the `xselinux` cargo feature.
#![allow(clippy::unit_arg)]
include!(concat!(env!("OUT_DIR"), "/xselinux.rs"));
}
#[cfg(feature = "shape")]
pub mod shape {
//! The `SHAPE` X extension.
//!
//! Accessible with the `shape` cargo feature.
#![allow(clippy::too_many_arguments)]
include!(concat!(env!("OUT_DIR"), "/shape.rs"));
}
#[cfg(feature = "shm")]
pub mod shm {
//! The `MIT-SHM` X extension.
//!
//! Accessible with the `shm` cargo feature.
include!(concat!(env!("OUT_DIR"), "/shm.rs"));
}
#[cfg(feature = "sync")]
pub mod sync {
//! The `SYNC` X extension.
//!
//! Accessible with the `sync` cargo feature.
#![allow(unused_variables)]
#![allow(clippy::unit_arg)]
#![allow(clippy::too_many_arguments)]
include!(concat!(env!("OUT_DIR"), "/sync.rs"));
}
#[cfg(feature = "xtest")]
pub mod xtest {
//! The `XTEST` X extension.
//!
//! Accessible with the `xtest` cargo feature.
include!(concat!(env!("OUT_DIR"), "/xtest.rs"));
}
#[cfg(feature = "xprint")]
pub mod xprint {
//! The `XpExtension` X extension.
//!
//! Accessible with the `xprint` cargo feature.
#![allow(clippy::unit_arg)]
include!(concat!(env!("OUT_DIR"), "/xprint.rs"));
}
#[cfg(feature = "xevie")]
pub mod xevie {
//! The `XEVIE` X extension.
//!
//! Accessible with the `xevie` cargo feature.
include!(concat!(env!("OUT_DIR"), "/xevie.rs"));
}
#[cfg(feature = "xf86dri")]
pub mod xf86dri {
//! The `XFree86-DRI` X extension.
//!
//! Accessible with the `xf86dri` cargo feature.
include!(concat!(env!("OUT_DIR"), "/xf86dri.rs"));
}
#[cfg(feature = "xf86vidmode")]
pub mod xf86vidmode {
//! The `XFree86-VidModeExtension` X extension.
//!
//! Accessible with the `xf86vidmode` cargo feature.
#![allow(clippy::too_many_arguments)]
include!(concat!(env!("OUT_DIR"), "/xf86vidmode.rs"));
}
#[cfg(feature = "xfixes")]
pub mod xfixes {
//! The `XFIXES` X extension.
//!
//! Accessible with the `xfixes` cargo feature.
include!(concat!(env!("OUT_DIR"), "/xfixes.rs"));
}
#[cfg(feature = "xinerama")]
pub mod xinerama {
//! The `XINERAMA` X extension.
//!
//! Accessible with the `xinerama` cargo feature.
include!(concat!(env!("OUT_DIR"), "/xinerama.rs"));
}
#[cfg(feature = "xkb")]
pub mod xkb {
//! The `XKEYBOARD` X extension.
//!
//! Accessible with the `xkb` cargo feature.
#![allow(unused_variables)]
#![allow(clippy::let_unit_value)]
#![allow(clippy::unit_arg)]
#![allow(clippy::too_many_arguments)]
include!(concat!(env!("OUT_DIR"), "/xkb.rs"));
}
#[cfg(feature = "xv")]
pub mod xv {
//! The `XVideo` X extension.
//!
//! Accessible with the `xv` cargo feature.
#![allow(clippy::unit_arg)]
#![allow(clippy::too_many_arguments)]
include!(concat!(env!("OUT_DIR"), "/xv.rs"));
}
#[cfg(feature = "xvmc")]
pub mod xvmc {
//! The `XVideo-MotionCompensation` X extension.
//!
//! Accessible with the `xvmc` cargo feature.
include!(concat!(env!("OUT_DIR"), "/xvmc.rs"));
}