| 1 |
/* |
| 2 |
* Copyright (C) 2008-2009 Julien Danjou <[email protected]> |
| 3 |
* |
| 4 |
* Permission is hereby granted, free of charge, to any person |
| 5 |
* obtaining a copy of this software and associated documentation |
| 6 |
* files (the "Software"), to deal in the Software without |
| 7 |
* restriction, including without limitation the rights to use, copy, |
| 8 |
* modify, merge, publish, distribute, sublicense, and/or sell copies |
| 9 |
* of the Software, and to permit persons to whom the Software is |
| 10 |
* furnished to do so, subject to the following conditions: |
| 11 |
* |
| 12 |
* The above copyright notice and this permission notice shall be |
| 13 |
* included in all copies or substantial portions of the Software. |
| 14 |
* |
| 15 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 16 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 17 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 18 |
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY |
| 19 |
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF |
| 20 |
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 21 |
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 22 |
* |
| 23 |
* Except as contained in this notice, the names of the authors or |
| 24 |
* their institutions shall not be used in advertising or otherwise to |
| 25 |
* promote the sale, use or other dealings in this Software without |
| 26 |
* prior written authorization from the authors. |
| 27 |
*/ |
| 28 |
|
| 29 |
/** |
| 30 |
* @defgroup xcb__event_t XCB Event Functions |
| 31 |
* |
| 32 |
* These functions ease the handling of X events received. |
| 33 |
* |
| 34 |
* @{ |
| 35 |
*/ |
| 36 |
|
| 37 |
#ifndef __XCB_EVENT_H__ |
| 38 |
#define __XCB_EVENT_H__ |
| 39 |
|
| 40 |
#include <xcb/xcb.h> |
| 41 |
|
| 42 |
#ifdef __cplusplus |
| 43 |
extern "C" { |
| 44 |
#endif |
| 45 |
|
| 46 |
/** |
| 47 |
* @brief Bit mask to find event type regardless of event source. |
| 48 |
* |
| 49 |
* Each event in the X11 protocol contains an 8-bit type code. |
| 50 |
* The most-significant bit in this code is set if the event was |
| 51 |
* generated from a SendEvent request. This mask can be used to |
| 52 |
* determine the type of event regardless of how the event was |
| 53 |
* generated. See the X11R6 protocol specification for details. |
| 54 |
*/ |
| 55 |
#define XCB_EVENT_RESPONSE_TYPE_MASK (0x7f) |
| 56 |
#define XCB_EVENT_RESPONSE_TYPE(e) (e->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) |
| 57 |
#define XCB_EVENT_SENT(e) (e->response_type & ~XCB_EVENT_RESPONSE_TYPE_MASK) |
| 58 |
|
| 59 |
/** |
| 60 |
* @brief Convert an event response type to a label. |
| 61 |
* @param type The event type. |
| 62 |
* @return A string with the event name, or NULL if unknown. |
| 63 |
*/ |
| 64 |
const char * xcb_event_get_label(uint8_t type); |
| 65 |
|
| 66 |
/** |
| 67 |
* @brief Convert an event error type to a label. |
| 68 |
* @param type The error type. |
| 69 |
* @return A string with the event name, or NULL if unknown or if the event is |
| 70 |
* not an error. |
| 71 |
*/ |
| 72 |
const char * xcb_event_get_error_label(uint8_t type); |
| 73 |
|
| 74 |
/** |
| 75 |
* @brief Convert an event request type to a label. |
| 76 |
* @param type The request type. |
| 77 |
* @return A string with the event name, or NULL if unknown or if the event is |
| 78 |
* not an error. |
| 79 |
*/ |
| 80 |
const char * xcb_event_get_request_label(uint8_t type); |
| 81 |
|
| 82 |
#ifdef __cplusplus |
| 83 |
} |
| 84 |
#endif |
| 85 |
|
| 86 |
/** |
| 87 |
* @} |
| 88 |
*/ |
| 89 |
|
| 90 |
#endif /* __XCB_EVENT_H__ */ |