[][src]Struct breadx::display::Display

pub struct Display<Conn> { /* fields omitted */ }

The connection to the X11 server. Most operations done in breadx revolve around this object in some way, shape or form.

Internally, this acts as a layer of abstraction over the inner Conn object that keeps track of the setup, outgoing and pending requests and replies, the event queue, et cetera. Orthodoxically, X11 usually takes place over a TCP stream or a Unix socket connection; however, Display is able to use any object implementing the Connection trait as a vehicle for the X11 protocol.

Upon its instantiation, the Display sends bytes to the server requesting the setup information, and then stores it for later use. Afterwards, it awaits commands from the programmer to send requests, receive replies or process events.

Example

Open a connection to the X11 server and get the screen resolution.

use breadx::DisplayConnection;

let mut conn = DisplayConnection::create(None, None).unwrap();

let default_screen = conn.default_screen();
println!("Default screen is {} x {}", default_screen.width_in_pixels, default_screen.height_in_pixels);

Implementations

impl<Conn: Connection> Display<Conn>[src]

pub fn create_window(
    &mut self,
    parent: Window,
    class: WindowClass,
    depth: Option<u8>,
    visual: Option<Visualid>,
    x: i16,
    y: i16,
    width: u16,
    height: u16,
    border_width: u16,
    props: WindowParameters
) -> Result<Window>
[src]

Create a new window.

pub async fn create_window_async<'_>(
    &'_ mut self,
    parent: Window,
    class: WindowClass,
    depth: Option<u8>,
    visual: Option<Visualid>,
    x: i16,
    y: i16,
    width: u16,
    height: u16,
    border_width: u16,
    props: WindowParameters
) -> Result<Window>
[src]

Create a new window, async redox.

pub fn create_simple_window(
    &mut self,
    parent: Window,
    x: i16,
    y: i16,
    width: u16,
    height: u16,
    border_width: u16,
    border: u32,
    background: u32
) -> Result<Window>
[src]

Create a window, but assume some parameters from its parents.

pub async fn create_simple_window_async<'_>(
    &'_ mut self,
    parent: Window,
    x: i16,
    y: i16,
    width: u16,
    height: u16,
    border_width: u16,
    border: u32,
    background: u32
) -> Result<Window>
[src]

Create a window, but assume some parameters from its parents, async redox.

pub fn create_gc<Target: Into<Drawable>>(
    &mut self,
    target: Target,
    props: GcParameters
) -> Result<Gcontext>
[src]

Create a new graphics context for the specified target.

pub async fn create_gc_async<Target: Into<Drawable>, '_>(
    &'_ mut self,
    target: Target,
    props: GcParameters
) -> Result<Gcontext>
[src]

Create a new graphics context, async redox.

pub fn intern_atom(
    &mut self,
    name: String,
    only_if_exists: bool
) -> Result<RequestCookie<InternAtomRequest>>
[src]

Intern a string and get a corresponding atom for that string.

pub async fn intern_atom_async<'_>(
    &'_ mut self,
    name: String,
    only_if_exists: bool
) -> Result<RequestCookie<InternAtomRequest>>
[src]

Intern an atom, async redox. See function intern_atom for more information.

pub fn intern_atom_immediate(
    &mut self,
    name: String,
    only_if_exists: bool
) -> Result<Atom>
[src]

Intern an atom, but try to resolve the request immediately.

pub async fn intern_atom_immediate_async<'_>(
    &'_ mut self,
    name: String,
    only_if_exists: bool
) -> Result<Atom>
[src]

Intern an atom, but try to resolve the request immediately, async redox.

pub fn change_keyboard_control(&mut self, props: KbParameters) -> Result<()>[src]

Change the keyboard's control properties.

pub async fn change_keyboard_control_async<'_>(
    &'_ mut self,
    props: KbParameters
) -> Result<()>
[src]

Change the keyboard's control properties, async redox.

pub fn bell(&mut self, percent: i8) -> Result[src]

pub async fn bell_async<'_>(&'_ mut self, percent: i8) -> Result[src]

pub fn set_access_control(&mut self, mode: AccessControl) -> Result[src]

pub async fn set_access_control_async<'_>(
    &'_ mut self,
    mode: AccessControl
) -> Result
[src]

pub fn change_active_pointer_grab(
    &mut self,
    event_mask: EventMask,
    cursor: Cursor,
    time: Option<Timestamp>
) -> Result
[src]

pub async fn change_active_pointer_grab_async<'_>(
    &'_ mut self,
    event_mask: EventMask,
    cursor: Cursor,
    time: Option<Timestamp>
) -> Result
[src]

pub fn set_close_down_mode(&mut self, mode: CloseDown) -> Result[src]

pub async fn set_close_down_mode_async<'_>(
    &'_ mut self,
    mode: CloseDown
) -> Result
[src]

pub fn change_pointer_control(
    &mut self,
    accel_numerator: i16,
    accel_denominator: i16,
    threshold: i16,
    do_acceleration: bool,
    do_threshold: bool
) -> Result
[src]

pub async fn change_pointer_control_async<'_>(
    &'_ mut self,
    accel_numerator: i16,
    accel_denominator: i16,
    threshold: i16,
    do_acceleration: bool,
    do_threshold: bool
) -> Result
[src]

pub fn create_cursor(
    &mut self,
    source: Pixmap,
    mask: Pixmap,
    fg_red: u16,
    fg_green: u16,
    fg_blue: u16,
    bg_red: u16,
    bg_green: u16,
    bg_blue: u16,
    x: u16,
    y: u16
) -> Result<Cursor>
[src]

Create a new cursor.

pub async fn create_cursor_async<'_>(
    &'_ mut self,
    source: Pixmap,
    mask: Pixmap,
    fg_red: u16,
    fg_green: u16,
    fg_blue: u16,
    bg_red: u16,
    bg_green: u16,
    bg_blue: u16,
    x: u16,
    y: u16
) -> Result<Cursor>
[src]

Create a new cursor, async redox.

pub fn force_screensaver(&mut self, mode: ScreenSaver) -> Result[src]

pub async fn force_screensaver_async<'_>(
    &'_ mut self,
    mode: ScreenSaver
) -> Result
[src]

impl<Conn: Connection> Display<Conn>[src]

pub fn send_request_internal<R: Request>(
    &mut self,
    req: R
) -> Result<RequestCookie<R>>
[src]

pub async fn send_request_internal_async<R: Request, '_>(
    &'_ mut self,
    req: R
) -> Result<RequestCookie<R>>
[src]

impl<Conn: Connection> Display<Conn>[src]

pub fn send_request<R: Request>(&mut self, req: R) -> Result<RequestCookie<R>>[src]

Send a request object to the X11 server.

Given a request object, this function sends it across the connection to the X11 server and returns a cookie used to determine when this request will resolve. Usually, the Display object has functions that act as a wrapper around this object; however, if you'd like to circumvent those, this is usually the best option.

pub fn resolve_request<R: Request>(
    &mut self,
    token: RequestCookie<R>
) -> Result<R::Reply> where
    R::Reply: Default
[src]

Wait for a request from the X11 server.

This function checks the Display's queues to see if a reply matching the given RequestCookie has been processed by the X11 server. If not, it polls the server for new events until it has determined that the request has resolved.

pub async fn send_request_async<R: Request, '_>(
    &'_ mut self,
    req: R
) -> Result<RequestCookie<R>>
[src]

Send a request object to the X11 server, async redox. See the send_request function for more information.

pub async fn resolve_request_async<R: Request, '_>(
    &'_ mut self,
    token: RequestCookie<R>
) -> Result<R::Reply> where
    R::Reply: Default
[src]

Wait for a request from the X11 server, async redox. See the resolve_request function for more information.

pub fn from_connection(connection: Conn, auth: Option<AuthInfo>) -> Result<Self>[src]

Creates a new Display from a connection and authentication info.

It is expected that the connection passed in has not had any information sent into it aside from what is necessary for the underlying protocol. After the object is created, the Display will poll the server for setup information.

pub async fn from_connection_async(
    connection: Conn,
    auth: Option<AuthInfo>
) -> Result<Self>
[src]

Creates a new Display from a connection and authentication info, async redox. See the from_connection function for more information.

pub fn setup(&self) -> &Setup[src]

Get the setup associates with this display.

pub fn default_screen(&self) -> &Screen[src]

pub fn default_white_pixel(&self) -> u32[src]

pub fn default_black_pixel(&self) -> u32[src]

pub fn default_visual_id(&self) -> Visualid[src]

pub fn default_visual(&self) -> &Visualtype[src]

pub fn default_colormap(&self) -> Colormap[src]

pub fn visual_id_to_visual(&self, id: Visualid) -> Option<&Visualtype>[src]

Get a visual type from a visual ID.

pub fn generate_xid(&mut self) -> Result<XID>[src]

Generate a unique X ID for a window, colormap, or other object. Usually, Display's helper functions will generate this for you. If you'd like to circumvent them, this will generate ID's for you.

pub fn wait_for_event(&mut self) -> Result<Event>[src]

Wait for an event to be generated by the X server.

This checks the event queue for a new event. If the queue is empty, the Display will poll the server for new events.

pub async fn wait_for_event_async<'_>(&'_ mut self) -> Result<Event>[src]

Wait for an event to be generated by the X server, async redox. See the wait_for_event function for more information.

pub fn check_if_event<F: FnMut(&Event) -> bool>(&self, predicate: F) -> bool[src]

If there is an event currently in the queue that matches the predicate, returns true.

pub fn save_context(
    &mut self,
    xid: XID,
    context: ContextID,
    data: NonNull<c_void>
)
[src]

Save a pointer into this display's map of contexts.

pub fn find_context(
    &mut self,
    xid: XID,
    context: ContextID
) -> Option<NonNull<c_void>>
[src]

Retrieve a pointer from the context.

pub fn delete_context(&mut self, xid: XID, context: ContextID)[src]

Delete an entry in the context.

impl Display<NameConnection>[src]

pub fn create(
    name: Option<Cow<'_, str>>,
    auth_info: Option<AuthInfo>
) -> Result<Self>
[src]

Create a new connection to the X server, given an optional name and authorization information.

pub async fn create_async<'_>(
    name: Option<Cow<'_, str>>,
    auth_info: Option<AuthInfo>
) -> Result<Self>
[src]

Create a new connection to the X server, given an optional name and authorization information, async redox.

Trait Implementations

impl<Conn: Debug> Debug for Display<Conn>[src]

Auto Trait Implementations

impl<Conn> RefUnwindSafe for Display<Conn> where
    Conn: RefUnwindSafe

impl<Conn> !Send for Display<Conn>

impl<Conn> !Sync for Display<Conn>

impl<Conn> Unpin for Display<Conn> where
    Conn: Unpin

impl<Conn> UnwindSafe for Display<Conn> where
    Conn: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.