Struct winit::platform_impl::linux::x11::xdisplay::XConnection

source ·
pub struct XConnection {
Show 14 fields pub xlib: Xlib, pub xcursor: Xcursor, pub xinput2: XInput2, pub display: *mut Display, xcb: Option<XCBConnection>, atoms: Box<Atoms>, default_screen: usize, timestamp: AtomicU32, pub monitor_handles: Mutex<Option<Vec<MonitorHandle>>>, database: RwLock<Database>, randr_version: (u32, u32), xsettings_screen: Option<Atom>, 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§xcursor: Xcursor§xinput2: XInput2§display: *mut Display§xcb: Option<XCBConnection>

The manager for the XCB connection.

The Option ensures that we can drop it before we close the Display.

§atoms: Box<Atoms>

The atoms used by winit.

This is a large structure, so I’ve elected to Box it to make accessing the fields of this struct easier. Feel free to unbox it if you like kicking puppies.

§default_screen: usize

The index of the default screen.

§timestamp: AtomicU32

The last timestamp received by this connection.

§monitor_handles: Mutex<Option<Vec<MonitorHandle>>>

List of monitor handles.

§database: RwLock<Database>

The resource database.

§randr_version: (u32, u32)

RandR version.

§xsettings_screen: Option<Atom>

Atom for the XSettings screen.

§latest_error: Mutex<Option<XError>>§cursor_cache: Mutex<HashMap<Option<CursorIcon>, Cursor>>

Implementations§

source§

impl XConnection

source

pub(crate) fn request_activation_token( &self, window_title: &str, ) -> Result<String, X11Error>

“Request” a new activation token from the server.

source

pub(crate) fn remove_activation_token( &self, window: Window, startup_id: &str, ) -> Result<(), X11Error>

Finish launching a window with the given startup ID.

source

fn send_message(&self, message: &[u8]) -> Result<(), X11Error>

Send a startup notification message to the window manager.

source§

impl XConnection

source§

impl XConnection

source§

impl XConnection

source

pub fn send_client_msg( &self, window: Window, target_window: Window, message_type: Atom, event_mask: Option<EventMask>, data: impl Into<ClientMessageData>, ) -> Result<VoidCookie<'_, XCBConnection>, X11Error>

source§

impl XConnection

source

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

source

pub(crate) fn set_custom_cursor(&self, window: Window, cursor: &CustomCursor)

source

fn create_empty_cursor(&self) -> Cursor

source

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

source

fn update_cursor(&self, window: Window, cursor: Cursor) -> Result<(), X11Error>

source§

impl XConnection

source§

impl XConnection

source

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

source

pub fn set_motif_hints( &self, window: Window, hints: &MotifHints, ) -> Result<VoidCookie<'_, XCBConnection>, X11Error>

source§

impl XConnection

source

pub fn select_xinput_events( &self, window: Window, device_id: u16, mask: XIEventMask, ) -> Result<VoidCookie<'_, XCBConnection>, X11Error>

source

pub fn select_xkb_events( &self, device_id: DeviceSpec, mask: EventType, ) -> Result<bool, X11Error>

source

pub fn query_pointer( &self, window: Window, device_id: u16, ) -> Result<XIQueryPointerReply, X11Error>

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 query_keymap(&self) -> Keymap

source§

impl XConnection

source

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

source

pub fn get_output_info( &self, resources: &ScreenResources, crtc: &GetCrtcInfoReply, ) -> Option<(String, f64, Vec<VideoModeHandle>)>

source

pub fn set_crtc_config( &self, crtc_id: Crtc, mode_id: Mode, ) -> Result<(), X11Error>

source

pub fn get_crtc_mode(&self, crtc_id: Crtc) -> Result<Mode, X11Error>

source§

impl XConnection

source

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

source

pub fn change_property<'a, T: NoUninit>( &'a self, window: Window, property: Atom, property_type: Atom, mode: PropMode, new_value: &[T], ) -> Result<VoidCookie<'a, XCBConnection>, X11Error>

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

fn new_xsettings_screen( xcb: &XCBConnection, default_screen: usize, ) -> Option<Atom>

source

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

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

source

pub fn randr_version(&self) -> (u32, u32)

source

pub fn xcb_connection(&self) -> &XCBConnection

Get the underlying XCB connection.

source

pub fn atoms(&self) -> &Atoms

Get the list of atoms.

source

pub fn default_screen_index(&self) -> usize

Get the index of the default screen.

source

pub fn default_root(&self) -> &Screen

Get the default screen.

source

pub fn database(&self) -> RwLockReadGuard<'_, Database>

Get the resource database.

source

pub fn reload_database(&self) -> Result<(), X11Error>

Reload the resource database.

source

pub fn timestamp(&self) -> u32

Get the latest timestamp.

source

pub fn set_timestamp(&self, timestamp: u32)

Set the last witnessed timestamp.

source

pub fn xsettings_screen(&self) -> Option<Atom>

Get the atom for Xsettings.

source§

impl XConnection

source

pub(crate) fn xsettings_dpi( &self, xsettings_screen: Atom, ) -> Result<Option<f64>, X11Error>

Get the DPI from XSettings.

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 T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

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 T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

source§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more