pub(crate) struct XConnection {
    pub xlib: Xlib,
    pub xrandr: Xrandr_2_2_0,
    pub xcursor: Xcursor,
    pub xinput2: XInput2,
    pub xlib_xcb: Xlib_xcb,
    pub display: *mut Display,
    pub x11_fd: c_int,
    pub latest_error: Mutex<Option<XError>>,
    pub cursor_cache: Mutex<HashMap<Option<CursorIcon>, Cursor>>,
}
Expand description

A connection to an X server.

Fields§

§xlib: Xlib§xrandr: Xrandr_2_2_0

Exposes XRandR functions from version < 1.5

§xcursor: Xcursor§xinput2: XInput2§xlib_xcb: Xlib_xcb§display: *mut Display§x11_fd: c_int§latest_error: Mutex<Option<XError>>§cursor_cache: Mutex<HashMap<Option<CursorIcon>, Cursor>>

Implementations§

source§

impl XConnection

source§

impl XConnection

source

pub fn get_atom<T: AsRef<CStr> + Debug>(&self, name: T) -> Atom

source

pub unsafe fn get_atom_unchecked(&self, name: &[u8]) -> Atom

source

pub unsafe fn get_atoms(
    &self,
    names: &[*mut c_char]
) -> Result<Vec<Atom>, XError>

source§

impl XConnection

source

pub fn send_event<T: Into<XEvent>>(
    &self,
    target_window: c_ulong,
    event_mask: Option<c_long>,
    event: T
) -> Flusher<'_>

source

pub fn send_client_msg(
    &self,
    window: c_ulong,
    target_window: c_ulong,
    message_type: Atom,
    event_mask: Option<c_long>,
    data: [c_long; 5]
) -> Flusher<'_>

source§

impl XConnection

source

pub fn set_cursor_icon(&self, window: Window, cursor: Option<CursorIcon>)

source

fn create_empty_cursor(&self) -> Cursor

source

fn load_cursor(&self, name: &[u8]) -> Cursor

source

fn load_first_existing_cursor(&self, names: &[&[u8]]) -> Cursor

source

fn get_cursor(&self, cursor: Option<CursorIcon>) -> Cursor

source

fn update_cursor(&self, window: Window, cursor: Cursor)

source§

impl XConnection

source

pub fn translate_coords(
    &self,
    window: Window,
    root: Window
) -> Result<TranslatedCoords, XError>

source

pub fn get_geometry(&self, window: Window) -> Result<Geometry, XError>

source

fn get_frame_extents(&self, window: Window) -> Option<FrameExtents>

source

pub fn is_top_level(&self, window: Window, root: Window) -> Option<bool>

source

fn get_parent_window(&self, window: Window) -> Result<Window, XError>

source

fn climb_hierarchy(&self, window: Window, root: Window) -> Result<Window, XError>

source

pub fn get_frame_extents_heuristic(
    &self,
    window: Window,
    root: Window
) -> FrameExtentsHeuristic

source§

impl XConnection

source

pub fn get_wm_hints(
    &self,
    window: Window
) -> Result<XSmartPointer<'_, XWMHints>, XError>

source

pub fn set_wm_hints(
    &self,
    window: Window,
    wm_hints: XSmartPointer<'_, XWMHints>
) -> Flusher<'_>

source

pub fn get_normal_hints(&self, window: Window) -> Result<NormalHints<'_>, XError>

source

pub fn set_normal_hints(
    &self,
    window: Window,
    normal_hints: NormalHints<'_>
) -> Flusher<'_>

source

pub fn get_motif_hints(&self, window: Window) -> MotifHints

source

pub fn set_motif_hints(&self, window: Window, hints: &MotifHints) -> Flusher<'_>

source§

impl XConnection

source

pub fn select_xinput_events(
    &self,
    window: c_ulong,
    device_id: c_int,
    mask: i32
) -> Flusher<'_>

source

pub fn select_xkb_events(
    &self,
    device_id: c_uint,
    mask: c_ulong
) -> Option<Flusher<'_>>

source

pub fn query_pointer(
    &self,
    window: Window,
    device_id: c_int
) -> Result<PointerState<'_>, XError>

source

fn lookup_utf8_inner(
    &self,
    ic: XIC,
    key_event: &mut XKeyEvent,
    buffer: *mut u8,
    size: usize
) -> (KeySym, Status, c_int)

source

pub fn lookup_utf8(&self, ic: XIC, key_event: &mut XKeyEvent) -> String

source§

impl XConnection

source

pub fn keycode_to_keysym(&self, keycode: KeyCode) -> KeySym

source

pub fn lookup_keysym(&self, xkev: &mut XKeyEvent) -> KeySym

source

pub fn query_keymap(&self) -> Keymap

source§

impl XConnection

source§

impl XConnection

source

pub unsafe fn get_xft_dpi(&self) -> Option<f64>

source

pub unsafe fn get_output_info(
    &self,
    resources: *mut XRRScreenResources,
    crtc: *mut XRRCrtcInfo
) -> Option<(String, f64, Vec<VideoMode>)>

source

pub fn set_crtc_config(&self, crtc_id: RRCrtc, mode_id: RRMode) -> Option<()>

source

pub fn get_crtc_mode(&self, crtc_id: RRCrtc) -> RRMode

source§

impl XConnection

source

pub fn get_property<T: Formattable>(
    &self,
    window: c_ulong,
    property: Atom,
    property_type: Atom
) -> Result<Vec<T>, GetPropertyError>

source

pub fn change_property<'a, T: Formattable>(
    &'a self,
    window: c_ulong,
    property: Atom,
    property_type: Atom,
    mode: PropMode,
    new_value: &[T]
) -> Flusher<'a>

source§

impl XConnection

source§

impl XConnection

source§

impl XConnection

source

pub fn new(
    error_handler: Option<unsafe extern "C" fn(_: *mut Display, _: *mut XErrorEvent) -> c_int>
) -> Result<XConnection, XNotSupported>

source

pub fn check_errors(&self) -> Result<(), XError>

Checks whether an error has been triggered by the previous function calls.

Trait Implementations§

source§

impl Debug for XConnection

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for XConnection

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Send for XConnection

source§

impl Sync for XConnection

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.