xcb_atom.h | xcb_atom.h | |||
---|---|---|---|---|
#ifndef __XCB_ATOM_H__ | #ifndef __XCB_ATOM_H__ | |||
#define __XCB_ATOM_H__ | #define __XCB_ATOM_H__ | |||
#include <xcb/xcb.h> | #include <xcb/xcb.h> | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
enum xcb_atom_fast_tag_t { | ||||
TAG_COOKIE, | ||||
TAG_VALUE | ||||
}; | ||||
typedef struct { | ||||
enum xcb_atom_fast_tag_t tag; | ||||
union { | ||||
xcb_intern_atom_cookie_t cookie; | ||||
xcb_atom_t atom; | ||||
} u; | ||||
} xcb_atom_fast_cookie_t; | ||||
/** | ||||
* @brief Get an atom synchronously. | ||||
* @param connection The connection to the X server. | ||||
* @param atom_name The name of the atom that should be returned. | ||||
* @return The requested atom, or XCB_NONE if there is an error. | ||||
* | ||||
* xcb_atom_get() is essentially a synchronous version of xcb_intern_atom() | ||||
, | ||||
* use it only on non-performance critical execution paths. | ||||
*/ | ||||
xcb_atom_t xcb_atom_get(xcb_connection_t *connection, const char *atom_name | ||||
); | ||||
xcb_atom_t xcb_atom_get_predefined(uint16_t name_len, const char *name); | xcb_atom_t xcb_atom_get_predefined(uint16_t name_len, const char *name); | |||
xcb_atom_fast_cookie_t xcb_atom_get_fast(xcb_connection_t *c, uint8_t only_ | ||||
if_exists, uint16_t name_len, const char *name); | ||||
xcb_atom_t xcb_atom_get_fast_reply(xcb_connection_t *c, xcb_atom_fast_cooki | ||||
e_t cookie, xcb_generic_error_t **e); | ||||
const char *xcb_atom_get_name_predefined(xcb_atom_t atom); | const char *xcb_atom_get_name_predefined(xcb_atom_t atom); | |||
int xcb_atom_get_name(xcb_connection_t *c, xcb_atom_t atom, const char **na mep, int *lengthp); | ||||
char *xcb_atom_name_by_screen(const char *base, uint8_t screen); | char *xcb_atom_name_by_screen(const char *base, uint8_t screen); | |||
char *xcb_atom_name_by_resource(const char *base, uint32_t resource); | char *xcb_atom_name_by_resource(const char *base, uint32_t resource); | |||
char *xcb_atom_name_unique(const char *base, uint32_t id); | char *xcb_atom_name_unique(const char *base, uint32_t id); | |||
extern const xcb_atom_t PRIMARY; | ||||
extern const xcb_atom_t SECONDARY; | ||||
extern const xcb_atom_t ARC; | ||||
extern const xcb_atom_t ATOM; | ||||
extern const xcb_atom_t BITMAP; | ||||
extern const xcb_atom_t CARDINAL; | ||||
extern const xcb_atom_t COLORMAP; | ||||
extern const xcb_atom_t CURSOR; | ||||
extern const xcb_atom_t CUT_BUFFER0; | ||||
extern const xcb_atom_t CUT_BUFFER1; | ||||
extern const xcb_atom_t CUT_BUFFER2; | ||||
extern const xcb_atom_t CUT_BUFFER3; | ||||
extern const xcb_atom_t CUT_BUFFER4; | ||||
extern const xcb_atom_t CUT_BUFFER5; | ||||
extern const xcb_atom_t CUT_BUFFER6; | ||||
extern const xcb_atom_t CUT_BUFFER7; | ||||
extern const xcb_atom_t DRAWABLE; | ||||
extern const xcb_atom_t FONT; | ||||
extern const xcb_atom_t INTEGER; | ||||
extern const xcb_atom_t PIXMAP; | ||||
extern const xcb_atom_t POINT; | ||||
extern const xcb_atom_t RECTANGLE; | ||||
extern const xcb_atom_t RESOURCE_MANAGER; | ||||
extern const xcb_atom_t RGB_COLOR_MAP; | ||||
extern const xcb_atom_t RGB_BEST_MAP; | ||||
extern const xcb_atom_t RGB_BLUE_MAP; | ||||
extern const xcb_atom_t RGB_DEFAULT_MAP; | ||||
extern const xcb_atom_t RGB_GRAY_MAP; | ||||
extern const xcb_atom_t RGB_GREEN_MAP; | ||||
extern const xcb_atom_t RGB_RED_MAP; | ||||
extern const xcb_atom_t STRING; | ||||
extern const xcb_atom_t VISUALID; | ||||
extern const xcb_atom_t WINDOW; | ||||
extern const xcb_atom_t WM_COMMAND; | ||||
extern const xcb_atom_t WM_HINTS; | ||||
extern const xcb_atom_t WM_CLIENT_MACHINE; | ||||
extern const xcb_atom_t WM_ICON_NAME; | ||||
extern const xcb_atom_t WM_ICON_SIZE; | ||||
extern const xcb_atom_t WM_NAME; | ||||
extern const xcb_atom_t WM_NORMAL_HINTS; | ||||
extern const xcb_atom_t WM_SIZE_HINTS; | ||||
extern const xcb_atom_t WM_ZOOM_HINTS; | ||||
extern const xcb_atom_t MIN_SPACE; | ||||
extern const xcb_atom_t NORM_SPACE; | ||||
extern const xcb_atom_t MAX_SPACE; | ||||
extern const xcb_atom_t END_SPACE; | ||||
extern const xcb_atom_t SUPERSCRIPT_X; | ||||
extern const xcb_atom_t SUPERSCRIPT_Y; | ||||
extern const xcb_atom_t SUBSCRIPT_X; | ||||
extern const xcb_atom_t SUBSCRIPT_Y; | ||||
extern const xcb_atom_t UNDERLINE_POSITION; | ||||
extern const xcb_atom_t UNDERLINE_THICKNESS; | ||||
extern const xcb_atom_t STRIKEOUT_ASCENT; | ||||
extern const xcb_atom_t STRIKEOUT_DESCENT; | ||||
extern const xcb_atom_t ITALIC_ANGLE; | ||||
extern const xcb_atom_t X_HEIGHT; | ||||
extern const xcb_atom_t QUAD_WIDTH; | ||||
extern const xcb_atom_t WEIGHT; | ||||
extern const xcb_atom_t POINT_SIZE; | ||||
extern const xcb_atom_t RESOLUTION; | ||||
extern const xcb_atom_t COPYRIGHT; | ||||
extern const xcb_atom_t NOTICE; | ||||
extern const xcb_atom_t FONT_NAME; | ||||
extern const xcb_atom_t FAMILY_NAME; | ||||
extern const xcb_atom_t FULL_NAME; | ||||
extern const xcb_atom_t CAP_HEIGHT; | ||||
extern const xcb_atom_t WM_CLASS; | ||||
extern const xcb_atom_t WM_TRANSIENT_FOR; | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* __XCB_ATOM_H__ */ | #endif /* __XCB_ATOM_H__ */ | |||
End of changes. 4 change blocks. | ||||
99 lines changed or deleted | 0 lines changed or added | |||
xcb_event.h | xcb_event.h | |||
---|---|---|---|---|
skipping to change at line 59 | skipping to change at line 59 | |||
* Each event in the X11 protocol contains an 8-bit type code. | * Each event in the X11 protocol contains an 8-bit type code. | |||
* The most-significant bit in this code is set if the event was | * The most-significant bit in this code is set if the event was | |||
* generated from a SendEvent request. This mask can be used to | * generated from a SendEvent request. This mask can be used to | |||
* determine the type of event regardless of how the event was | * determine the type of event regardless of how the event was | |||
* generated. See the X11R6 protocol specification for details. | * generated. See the X11R6 protocol specification for details. | |||
*/ | */ | |||
#define XCB_EVENT_RESPONSE_TYPE_MASK (0x7f) | #define XCB_EVENT_RESPONSE_TYPE_MASK (0x7f) | |||
#define XCB_EVENT_RESPONSE_TYPE(e) (e->response_type & XCB_EVENT_RESPONS E_TYPE_MASK) | #define XCB_EVENT_RESPONSE_TYPE(e) (e->response_type & XCB_EVENT_RESPONS E_TYPE_MASK) | |||
#define XCB_EVENT_SENT(e) (e->response_type & ~XCB_EVENT_RESPONS E_TYPE_MASK) | #define XCB_EVENT_SENT(e) (e->response_type & ~XCB_EVENT_RESPONS E_TYPE_MASK) | |||
typedef int (*xcb_generic_event_handler_t)(void *data, xcb_connection_t *c, | ||||
xcb_generic_event_t *event); | ||||
typedef int (*xcb_generic_error_handler_t)(void *data, xcb_connection_t *c, | ||||
xcb_generic_error_t *error); | ||||
typedef struct xcb_event_handler xcb_event_handler_t; | ||||
struct xcb_event_handler | ||||
{ | ||||
xcb_generic_event_handler_t handler; | ||||
void *data; | ||||
}; | ||||
typedef struct xcb_event_handlers xcb_event_handlers_t; | ||||
struct xcb_event_handlers | ||||
{ | ||||
xcb_event_handler_t event[126]; | ||||
xcb_event_handler_t error[256]; | ||||
xcb_connection_t *c; | ||||
}; | ||||
/** | ||||
* @brief Initialize event handlers data structure. | ||||
* @param c The connection to the X server. | ||||
* @param evenths A pointer to the event handler data structure to initiali | ||||
ze. | ||||
*/ | ||||
void xcb_event_handlers_init(xcb_connection_t *c, xcb_event_handlers_t *eve | ||||
nths); | ||||
/** | ||||
* @brief Get X connection used in event handlers. | ||||
* @param evenths The event handlers. | ||||
* @return The connection to the X server. | ||||
*/ | ||||
xcb_connection_t *xcb_event_get_xcb_connection(xcb_event_handlers_t *eventh | ||||
s); | ||||
/** | ||||
* @brief Wait for event and handle it with event handler. | ||||
* @param evenths The event handlers. | ||||
*/ | ||||
void xcb_event_wait_for_event_loop(xcb_event_handlers_t *evenths); | ||||
/** | ||||
* @brief Poll for event and handle it with event handler. | ||||
* @param evenths The event handlers. | ||||
*/ | ||||
void xcb_event_poll_for_event_loop(xcb_event_handlers_t *evenths); | ||||
/** | ||||
* @brief Handle an event using event handlers from event handlers data | ||||
* structure. | ||||
* @param evenths The event handlers. | ||||
* @param event The event to handle. | ||||
* @return The return value of the handler, or 0 if no handler exists for t | ||||
his | ||||
* event. | ||||
*/ | ||||
int xcb_event_handle(xcb_event_handlers_t *evenths, xcb_generic_event_t *ev | ||||
ent); | ||||
/** | ||||
* @brief Set an event handler for an event type. | ||||
* @param evenths The event handlers data structure. | ||||
* @param event The event type. | ||||
* @param handler The callback function to call for this event type. | ||||
* @param data Optional data pointer to pass to handler callback function. | ||||
*/ | ||||
void xcb_event_set_handler(xcb_event_handlers_t *evenths, int event, xcb_ge | ||||
neric_event_handler_t handler, void *data); | ||||
/** | ||||
* @brief Set an error handler for an error type. | ||||
* @param evenths The error handlers data structure. | ||||
* @param error The error type. | ||||
* @param handler The callback function to call for this error type. | ||||
* @param data Optional data pointer to pass to handler callback function. | ||||
*/ | ||||
void xcb_event_set_error_handler(xcb_event_handlers_t *evenths, int error, | ||||
xcb_generic_error_handler_t handler, void *data); | ||||
#define XCB_EVENT_MAKE_EVENT_HANDLER(lkind, ukind) \ | ||||
static inline void xcb_event_set_##lkind##_handler(xcb_event_handlers_t *ev | ||||
enths, int (*handler)(void *, xcb_connection_t *, xcb_##lkind##_event_t *), | ||||
void *data) \ | ||||
{ \ | ||||
xcb_event_set_handler(evenths, XCB_##ukind, (xcb_generic_event_handler_ | ||||
t) handler, data); \ | ||||
} | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(key_press, KEY_PRESS) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(key_release, KEY_RELEASE) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(button_press, BUTTON_PRESS) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(button_release, BUTTON_RELEASE) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(motion_notify, MOTION_NOTIFY) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(enter_notify, ENTER_NOTIFY) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(leave_notify, LEAVE_NOTIFY) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(focus_in, FOCUS_IN) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(focus_out, FOCUS_OUT) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(keymap_notify, KEYMAP_NOTIFY) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(expose, EXPOSE) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(graphics_exposure, GRAPHICS_EXPOSURE) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(no_exposure, NO_EXPOSURE) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(visibility_notify, VISIBILITY_NOTIFY) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(create_notify, CREATE_NOTIFY) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(destroy_notify, DESTROY_NOTIFY) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(unmap_notify, UNMAP_NOTIFY) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(map_notify, MAP_NOTIFY) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(map_request, MAP_REQUEST) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(reparent_notify, REPARENT_NOTIFY) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(configure_notify, CONFIGURE_NOTIFY) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(configure_request, CONFIGURE_REQUEST) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(gravity_notify, GRAVITY_NOTIFY) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(resize_request, RESIZE_REQUEST) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(circulate_notify, CIRCULATE_NOTIFY) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(circulate_request, CIRCULATE_REQUEST) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(property_notify, PROPERTY_NOTIFY) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(selection_clear, SELECTION_CLEAR) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(selection_request, SELECTION_REQUEST) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(selection_notify, SELECTION_NOTIFY) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(colormap_notify, COLORMAP_NOTIFY) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(client_message, CLIENT_MESSAGE) | ||||
XCB_EVENT_MAKE_EVENT_HANDLER(mapping_notify, MAPPING_NOTIFY) | ||||
/** Everyting is ok */ | ||||
#define XCB_EVENT_ERROR_SUCESS 0 | ||||
/** Bad request code */ | ||||
#define XCB_EVENT_ERROR_BAD_REQUEST 1 | ||||
/** Int parameter out of range */ | ||||
#define XCB_EVENT_ERROR_BAD_VALUE 2 | ||||
/** Parameter not a Window */ | ||||
#define XCB_EVENT_ERROR_BAD_WINDOW 3 | ||||
/** Parameter not a Pixmap */ | ||||
#define XCB_EVENT_ERROR_BAD_PIXMAP 4 | ||||
/** Parameter not an Atom */ | ||||
#define XCB_EVENT_ERROR_BAD_ATOM 5 | ||||
/** Parameter not a Cursor */ | ||||
#define XCB_EVENT_ERROR_BAD_CURSOR 6 | ||||
/** Parameter not a Font */ | ||||
#define XCB_EVENT_ERROR_BAD_FONT 7 | ||||
/** Parameter mismatch */ | ||||
#define XCB_EVENT_ERROR_BAD_MATCH 8 | ||||
/** Parameter not a Pixmap or Window */ | ||||
#define XCB_EVENT_ERROR_BAD_DRAWABLE 9 | ||||
/* Depending on context: | ||||
- key/button already grabbed | ||||
- attempt to free an illegal | ||||
cmap entry | ||||
- attempt to store into a read-only | ||||
color map entry. | ||||
- attempt to modify the access control | ||||
list from other than the local host. | ||||
*/ | ||||
#define XCB_EVENT_ERROR_BAD_ACCESS 10 | ||||
/** Insufficient resources */ | ||||
#define XCB_EVENT_ERROR_BAD_ALLOC 11 | ||||
/** No such colormap */ | ||||
#define XCB_EVENT_ERROR_BAD_COLOR 12 | ||||
/** Parameter not a GC */ | ||||
#define XCB_EVENT_ERROR_BAD_GC 13 | ||||
/** Choice not in range or already used */ | ||||
#define XCB_EVENT_ERROR_BAD_ID_CHOICE 14 | ||||
/** Font or color name doesn't exist */ | ||||
#define XCB_EVENT_ERROR_BAD_NAME 15 | ||||
/** Request length incorrect */ | ||||
#define XCB_EVENT_ERROR_BAD_LENGTH 16 | ||||
/** Server is defective */ | ||||
#define XCB_EVENT_ERROR_BAD_IMPLEMENTATION 17 | ||||
/** | /** | |||
* @brief Convert an event reponse type to a label. | * @brief Convert an event response type to a label. | |||
* @param type The event type. | * @param type The event type. | |||
* @return A string with the event name, or NULL if unknown. | * @return A string with the event name, or NULL if unknown. | |||
*/ | */ | |||
const char * xcb_event_get_label(uint8_t type); | const char * xcb_event_get_label(uint8_t type); | |||
/** | /** | |||
* @brief Convert an event error type to a label. | * @brief Convert an event error type to a label. | |||
* @param type The erro type. | * @param type The error type. | |||
* @return A string with the event name, or NULL if unknown or if the event is | * @return A string with the event name, or NULL if unknown or if the event is | |||
* not an error. | * not an error. | |||
*/ | */ | |||
const char * xcb_event_get_error_label(uint8_t type); | const char * xcb_event_get_error_label(uint8_t type); | |||
/** | /** | |||
* @brief Convert an event request type to a label. | * @brief Convert an event request type to a label. | |||
* @param type The request type. | * @param type The request type. | |||
* @return A string with the event name, or NULL if unknown or if the event is | * @return A string with the event name, or NULL if unknown or if the event is | |||
* not an error. | * not an error. | |||
End of changes. 3 change blocks. | ||||
171 lines changed or deleted | 2 lines changed or added | |||