1 /* 2 * This program is free software; you can redistribute it and/or modify 3 * it under the terms of the GNU General Public License as published by 4 * the Free Software Foundation; either version 2 of the License, or 5 * (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software 14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 * 16 * Copyright (C) 2006-2016 XNeur Team 17 * 18 */ 19 20 #ifndef _KEYMAP_H_ 21 #define _KEYMAP_H_ 22 23 #include <X11/XKBlib.h> 24 25 #include "xneur.h" 26 27 int get_keycode_mod(int keyboard_group); 28 int get_languages_mask(void); 29 void purge_keymap_caches(void); 30 31 struct keycode_to_symbol_pair; 32 struct symbol_to_keycode_pair; 33 34 struct _keymap 35 { 36 struct _xneur_handle *handle; 37 38 Display *display; 39 40 KeySym *keymap; 41 42 struct keycode_to_symbol_pair *keycode_to_symbol_cache; 43 struct symbol_to_keycode_pair *symbol_to_keycode_cache; 44 size_t keycode_to_symbol_cache_pos; 45 size_t symbol_to_keycode_cache_pos; 46 47 int latin_group; 48 int latin_group_mask; 49 int min_keycode; 50 int max_keycode; 51 int keysyms_per_keycode; 52 53 unsigned int numlock_mask; 54 unsigned int scrolllock_mask; 55 unsigned int capslock_mask; 56 57 void (*purge_caches)(struct _keymap *p); 58 void (*get_keysyms_by_string)(struct _keymap *p, char *keyname, KeySym *Lower, KeySym *Upper); 59 char* (*keycode_to_symbol)(struct _keymap *p, KeyCode kc, int group, int state); 60 char (*get_ascii)(struct _keymap *p, const char *sym, int* preferred_lang, KeyCode *kc, int *modifier, size_t* symbol_len); 61 char (*get_cur_ascii_char) (struct _keymap *p, XEvent *e); 62 void (*convert_text_to_ascii)(struct _keymap *p, char *text, KeyCode *kc, int *kc_mod); 63 void (*print_keymaps)(struct _keymap *p); 64 char* (*lower_by_keymaps)(struct _keymap *p, int gr, char *text); 65 void (*uninit) (struct _keymap *p); 66 }; 67 68 struct _keymap *keymap_init(struct _xneur_handle *handle, Display *display); 69 70 #endif /* _KEYMAP_H_ */ 71