xcb_send_event(3) XCB Requests xcb_send_event(3)NAME
xcb_send_event - send an event
SYNOPSIS
#include <xcb/xproto.h>
Request function
xcb_void_cookie_t xcb_send_event(xcb_connection_t *conn, uint8_t propagate, xcb_window_t destination, uint32_t event_mask, const
char *event);
REQUEST ARGUMENTS
conn The XCB connection to X11.
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.
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.
event The event to send to the specified destination.
DESCRIPTION
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'.
RETURN VALUE
Returns an xcb_void_cookie_t. Errors (if any) have to be handled in the event loop.
If you want to handle errors directly with xcb_request_check instead, use xcb_send_event_checked. See xcb-requests(3) for details.
ERRORS
xcb_window_error_t
The specified destination window does not exist.
xcb_value_error_t
The given event is neither a core event nor an event defined by an extension.
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);
}
SEE ALSO xcb-requests(3), xcb-examples(3), xcb_configure_notify_event_t(3)AUTHOR
Generated from xproto.xml. Contact xcb@lists.freedesktop.org for corrections and improvements.
XCB 2014-06-10 xcb_send_event(3)
Check Out this Related Man Page
XSendEvent() XSendEvent()
Name
XSendEvent - send an event.
Synopsis
Status XSendEvent(display, w, propagate, event_mask, event_send)
Display *display;
Window w;
Bool propagate;
long event_mask;
XEvent *event_send;
Arguments
display Specifies a connection to an X server; returned from XOpenDisplay().
w Specifies the ID of the window where you want to send the event. Pass the window resource ID, PointerWindow, or InputFocus.
propagate Specifies how the sent event should propagate depending on event_mask. See description below. May be True or False.
event_mask
Specifies the event mask. See XSelectInput() for a detailed list of the event masks.
event_send
Specifies a pointer to the event to be sent.
Returns
Zero on failure, non-zero on success.
Description
XSendEvent() sends an event from one client to another (or conceivably to itself). This function is used for communication between clients
using selections, for simulating user actions in demos, and for other purposes.
The specified event is sent to the window indicated by w regardless of active grabs.
If w is set to PointerWindow, the destination of the event will be the window that the pointer is in. If w is InputFocus is specified,
then the destination is the focus window, regardless of pointer position.
If propagate is False, then the event is sent to every client selecting on the window specified by w any of the event types in event_mask.
If propagate is True and no clients have been selected on w any of the event types in event_mask, then the event propagates like any other
event.
The event code must be one of the core events, or one of the events defined by a loaded extension, so that the server can correctly byte
swap the contents as necessary. The contents of the event are otherwise unaltered and unchecked by the server. The send_event field is in
every event type; if True it indicates that the event was sent with XSendEvent().
This function is often used in selection processing. For example, the owner of a selection should use XSendEvent() to send a SelectionNo-
tify event to a requestor when a selection has been converted and stored as a property. See Volume One, Chapter 12, Interclient Communica-
tion for more information.
The status returned by XSendEvent() indicates whether or not the given XEvent structure was successfully converted into a wire event. This
value is zero on failure, or non-zero on success.
Errors
BadValue Specified event is not a valid core or extension event type, or event mask is invalid.
BadWindow
Structures
See Appendix E, Event Reference, for the contents of each event structure.
See Also
XQLength(), XAllowEvents(), XCheckIfEvent(), XCheckMaskEvent(), XCheckTypedEvent(), XCheckTypedWindowEvent(), XCheckWindowEvent(),
XEventsQueued(), XGetInputFocus(), XGetMotionEvents(), XIfEvent(), XMaskEvent(), XNextEvent(), XPeekEvent(), XPeekIfEvent(), XPending(),
XPutBackEvent(), XSelectInput(), XSetInputFocus(), XSynchronize(), XWindowEvent().
Xlib - Input Handling XSendEvent()