| 1 | #ifndef __XCB_KEYSYMS_H__ |
| 2 | #define __XCB_KEYSYMS_H__ |
| 3 | |
| 4 | #include <xcb/xcb.h> |
| 5 | |
| 6 | |
| 7 | #ifdef __cplusplus |
| 8 | extern "C" { |
| 9 | #endif |
| 10 | |
| 11 | |
| 12 | typedef struct _XCBKeySymbols xcb_key_symbols_t; |
| 13 | |
| 14 | xcb_key_symbols_t *xcb_key_symbols_alloc (xcb_connection_t *c); |
| 15 | |
| 16 | void xcb_key_symbols_free (xcb_key_symbols_t *syms); |
| 17 | |
| 18 | xcb_keysym_t xcb_key_symbols_get_keysym (xcb_key_symbols_t *syms, |
| 19 | xcb_keycode_t keycode, |
| 20 | int col); |
| 21 | |
| 22 | /** |
| 23 | * @brief Get the keycodes attached to a keysyms. |
| 24 | * There can be several value, so what is returned is an array of keycode |
| 25 | * terminated by XCB_NO_SYMBOL. You are responsible to free it. |
| 26 | * Be aware that this function can be slow. It will convert all |
| 27 | * combinations of all available keycodes to keysyms to find the ones that |
| 28 | * match. |
| 29 | * @param syms Key symbols. |
| 30 | * @param keysym The keysym to look for. |
| 31 | * @return A XCB_NO_SYMBOL terminated array of keycode, or NULL if nothing is found. |
| 32 | */ |
| 33 | xcb_keycode_t * xcb_key_symbols_get_keycode(xcb_key_symbols_t *syms, |
| 34 | xcb_keysym_t keysym); |
| 35 | |
| 36 | xcb_keysym_t xcb_key_press_lookup_keysym (xcb_key_symbols_t *syms, |
| 37 | xcb_key_press_event_t *event, |
| 38 | int col); |
| 39 | |
| 40 | xcb_keysym_t xcb_key_release_lookup_keysym (xcb_key_symbols_t *syms, |
| 41 | xcb_key_release_event_t *event, |
| 42 | int col); |
| 43 | |
| 44 | int xcb_refresh_keyboard_mapping (xcb_key_symbols_t *syms, |
| 45 | xcb_mapping_notify_event_t *event); |
| 46 | |
| 47 | /* TODO: need XLookupString equivalent */ |
| 48 | |
| 49 | /* Tests for classes of symbols */ |
| 50 | |
| 51 | int xcb_is_keypad_key (xcb_keysym_t keysym); |
| 52 | |
| 53 | int xcb_is_private_keypad_key (xcb_keysym_t keysym); |
| 54 | |
| 55 | int xcb_is_cursor_key (xcb_keysym_t keysym); |
| 56 | |
| 57 | int xcb_is_pf_key (xcb_keysym_t keysym); |
| 58 | |
| 59 | int xcb_is_function_key (xcb_keysym_t keysym); |
| 60 | |
| 61 | int xcb_is_misc_function_key (xcb_keysym_t keysym); |
| 62 | |
| 63 | int xcb_is_modifier_key (xcb_keysym_t keysym); |
| 64 | |
| 65 | |
| 66 | #ifdef __cplusplus |
| 67 | } |
| 68 | #endif |
| 69 | |
| 70 | |
| 71 | #endif /* __XCB_KEYSYMS_H__ */ |
| 72 | |