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
impl XConnection
sourcepub(crate) fn request_activation_token(
&self,
window_title: &str,
) -> Result<String, X11Error>
pub(crate) fn request_activation_token( &self, window_title: &str, ) -> Result<String, X11Error>
“Request” a new activation token from the server.
source§impl XConnection
impl XConnection
pub fn invalidate_cached_monitor_list(&self) -> Option<Vec<MonitorHandle>>
source§impl XConnection
impl XConnection
pub fn get_monitor_for_window( &self, window_rect: Option<AaRect>, ) -> Result<MonitorHandle, X11Error>
fn query_monitor_list(&self) -> Result<Vec<MonitorHandle>, X11Error>
pub fn available_monitors(&self) -> Result<Vec<MonitorHandle>, X11Error>
pub fn primary_monitor(&self) -> Result<MonitorHandle, X11Error>
pub fn select_xrandr_input(&self, root: Window) -> Result<u8, X11Error>
source§impl XConnection
impl XConnection
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
impl XConnection
pub fn set_cursor_icon(&self, window: Window, cursor: Option<CursorIcon>)
pub(crate) fn set_custom_cursor(&self, window: Window, cursor: &CustomCursor)
fn create_empty_cursor(&self) -> Cursor
fn get_cursor(&self, cursor: Option<CursorIcon>) -> Cursor
fn update_cursor(&self, window: Window, cursor: Cursor) -> Result<(), X11Error>
source§impl XConnection
impl XConnection
pub fn translate_coords( &self, window: Window, root: Window, ) -> Result<TranslateCoordinatesReply, X11Error>
pub fn get_geometry(&self, window: Window) -> Result<GetGeometryReply, X11Error>
fn get_frame_extents(&self, window: Window) -> Option<FrameExtents>
pub fn is_top_level(&self, window: Window, root: Window) -> Option<bool>
fn get_parent_window(&self, window: Window) -> Result<Window, X11Error>
fn climb_hierarchy( &self, window: Window, root: Window, ) -> Result<Window, X11Error>
pub fn get_frame_extents_heuristic( &self, window: Window, root: Window, ) -> FrameExtentsHeuristic
source§impl XConnection
impl XConnection
pub fn get_motif_hints(&self, window: Window) -> MotifHints
pub fn set_motif_hints( &self, window: Window, hints: &MotifHints, ) -> Result<VoidCookie<'_, XCBConnection>, X11Error>
source§impl XConnection
impl XConnection
pub fn select_xinput_events( &self, window: Window, device_id: u16, mask: XIEventMask, ) -> Result<VoidCookie<'_, XCBConnection>, X11Error>
pub fn select_xkb_events( &self, device_id: DeviceSpec, mask: EventType, ) -> Result<bool, X11Error>
pub fn query_pointer( &self, window: Window, device_id: u16, ) -> Result<XIQueryPointerReply, X11Error>
fn lookup_utf8_inner( &self, ic: XIC, key_event: &mut XKeyEvent, buffer: *mut u8, size: usize, ) -> (KeySym, Status, c_int)
pub fn lookup_utf8(&self, ic: XIC, key_event: &mut XKeyEvent) -> String
source§impl XConnection
impl XConnection
pub fn query_keymap(&self) -> Keymap
source§impl XConnection
impl XConnection
pub fn get_xft_dpi(&self) -> Option<f64>
pub fn get_output_info( &self, resources: &ScreenResources, crtc: &GetCrtcInfoReply, ) -> Option<(String, f64, Vec<VideoModeHandle>)>
pub fn set_crtc_config( &self, crtc_id: Crtc, mode_id: Mode, ) -> Result<(), X11Error>
pub fn get_crtc_mode(&self, crtc_id: Crtc) -> Result<Mode, X11Error>
source§impl XConnection
impl XConnection
pub fn get_property<T: Pod>( &self, window: Window, property: Atom, property_type: Atom, ) -> Result<Vec<T>, GetPropertyError>
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
impl XConnection
pub fn update_cached_wm_info(&self, root: Window)
fn get_supported_hints(&self, root: Window) -> Vec<Atom>
fn get_wm_name(&self, root: Window) -> Option<String>
source§impl XConnection
impl XConnection
pub fn flush_requests(&self) -> Result<(), XError>
pub fn sync_with_server(&self) -> Result<(), XError>
source§impl XConnection
impl XConnection
pub fn new( error_handler: Option<unsafe extern "C" fn(_: *mut Display, _: *mut XErrorEvent) -> c_int>, ) -> Result<XConnection, XNotSupported>
fn new_xsettings_screen( xcb: &XCBConnection, default_screen: usize, ) -> Option<Atom>
sourcepub fn check_errors(&self) -> Result<(), XError>
pub fn check_errors(&self) -> Result<(), XError>
Checks whether an error has been triggered by the previous function calls.
pub fn randr_version(&self) -> (u32, u32)
sourcepub fn xcb_connection(&self) -> &XCBConnection
pub fn xcb_connection(&self) -> &XCBConnection
Get the underlying XCB connection.
sourcepub fn default_screen_index(&self) -> usize
pub fn default_screen_index(&self) -> usize
Get the index of the default screen.
sourcepub fn default_root(&self) -> &Screen
pub fn default_root(&self) -> &Screen
Get the default screen.
sourcepub fn database(&self) -> RwLockReadGuard<'_, Database>
pub fn database(&self) -> RwLockReadGuard<'_, Database>
Get the resource database.
sourcepub fn reload_database(&self) -> Result<(), X11Error>
pub fn reload_database(&self) -> Result<(), X11Error>
Reload the resource database.
sourcepub fn set_timestamp(&self, timestamp: u32)
pub fn set_timestamp(&self, timestamp: u32)
Set the last witnessed timestamp.
sourcepub fn xsettings_screen(&self) -> Option<Atom>
pub fn xsettings_screen(&self) -> Option<Atom>
Get the atom for Xsettings.
source§impl XConnection
impl XConnection
Trait Implementations§
source§impl Debug for XConnection
impl Debug for XConnection
source§impl Drop for XConnection
impl Drop for XConnection
impl Send for XConnection
impl Sync for XConnection
Auto Trait Implementations§
impl !Freeze for XConnection
impl RefUnwindSafe for XConnection
impl Unpin for XConnection
impl UnwindSafe for XConnection
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.