x11rb::protocol::xproto

Struct SendEventRequest

pub struct SendEventRequest<'input> {
    pub propagate: bool,
    pub destination: u32,
    pub event_mask: EventMask,
    pub event: Cow<'input, [u8; 32]>,
}
Expand description

send an event.

Identifies the destination window, determines which clients should receive the specified event and ignores any active grabs.

The event must be one of the core events or an event defined by an extension, so that the X server can correctly byte-swap the contents as necessary. The contents of event are otherwise unaltered and unchecked except for the send_event field which is forced to ‘true’.

§Fields

  • destination - The window to send this event to. Every client which selects any event within event_mask on destination will get the event.

The special value XCB_SEND_EVENT_DEST_POINTER_WINDOW refers to the window that contains the mouse pointer.

The special value XCB_SEND_EVENT_DEST_ITEM_FOCUS refers to the window which has the keyboard focus.

  • event_mask - Event_mask for determining which clients should receive the specified event. See destination and propagate.
  • propagate - If propagate is true and no clients have selected any event on destination, the destination is replaced with the closest ancestor of destination for which some client has selected a type in event_mask and for which no intervening window has that type in its do-not-propagate-mask. If no such window exists or if the window is an ancestor of the focus window and InputFocus was originally specified as the destination, the event is not sent to any clients. Otherwise, the event is reported to every client selecting on the final destination any of the types specified in event_mask.
  • event - The event to send to the specified destination.

§Errors

  • Window - The specified destination window does not exist.
  • Value - The given event is neither a core event nor an event defined by an extension.

§See

  • ConfigureNotify: event

§Example

/*
 * Tell the given window that it was configured to a size of 800x600 pixels.
 *
 */
void my_example(xcb_connection_t *conn, xcb_window_t window) {
    /* Every X11 event is 32 bytes long. Therefore, XCB will copy 32 bytes.
     * In order to properly initialize these bytes, we allocate 32 bytes even
     * though we only need less for an xcb_configure_notify_event_t */
    xcb_configure_notify_event_t *event = calloc(32, 1);

    event->event = window;
    event->window = window;
    event->response_type = XCB_CONFIGURE_NOTIFY;

    event->x = 0;
    event->y = 0;
    event->width = 800;
    event->height = 600;

    event->border_width = 0;
    event->above_sibling = XCB_NONE;
    event->override_redirect = false;

    xcb_send_event(conn, false, window, XCB_EVENT_MASK_STRUCTURE_NOTIFY,
                   (char*)event);
    xcb_flush(conn);
    free(event);
}

Fields§

§propagate: bool§destination: u32§event_mask: EventMask§event: Cow<'input, [u8; 32]>

Implementations§

§

impl<'input> SendEventRequest<'input>

pub fn serialize(self) -> ([Cow<'input, [u8]>; 2], Vec<OwnedFd>)

Serialize this request into bytes for the provided connection

pub fn into_owned(self) -> SendEventRequest<'static>

Clone all borrowed data in this SendEventRequest.

Trait Implementations§

§

impl<'input> Clone for SendEventRequest<'input>

§

fn clone(&self) -> SendEventRequest<'input>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for SendEventRequest<'_>

§

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

Formats the value using the given formatter. Read more
§

impl<'input> Default for SendEventRequest<'input>

§

fn default() -> SendEventRequest<'input>

Returns the “default value” for a type. Read more
§

impl<'input> Request for SendEventRequest<'input>

§

const EXTENSION_NAME: Option<&'static str> = None

The protocol name of the extension that this request belongs to, or None for core requests
§

fn serialize(self, _major_opcode: u8) -> (Vec<u8>, Vec<OwnedFd>)

Serialize this request into its X11 protocol wire representation. Read more
§

impl<'input> VoidRequest for SendEventRequest<'input>

Auto Trait Implementations§

§

impl<'input> Freeze for SendEventRequest<'input>

§

impl<'input> RefUnwindSafe for SendEventRequest<'input>

§

impl<'input> Send for SendEventRequest<'input>

§

impl<'input> Sync for SendEventRequest<'input>

§

impl<'input> Unpin for SendEventRequest<'input>

§

impl<'input> UnwindSafe for SendEventRequest<'input>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.