1 /* input.h -- header file for the input method module. 2 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 3 National Institute of Advanced Industrial Science and Technology (AIST) 4 Registration Number H15PRO112 5 6 This file is part of the m17n library. 7 8 The m17n library is free software; you can redistribute it and/or 9 modify it under the terms of the GNU Lesser General Public License 10 as published by the Free Software Foundation; either version 2.1 of 11 the License, or (at your option) any later version. 12 13 The m17n library is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 Lesser General Public License for more details. 17 18 You should have received a copy of the GNU Lesser General Public 19 License along with the m17n library; if not, write to the Free 20 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 Boston, MA 02110-1301 USA. */ 22 23 #ifndef _M17N_INPUT_H_ 24 #define _M17N_INPUT_H_ 25 26 typedef struct _MInputMethodInfo MInputMethodInfo; 27 28 struct _MInputMethodInfo 29 { 30 MDatabase *mdb; 31 MSymbol language, name, extra; 32 MPlist *cmds, *configured_cmds, *bc_cmds; 33 MPlist *vars, *configured_vars, *bc_vars; 34 MText *description; 35 MText *title; 36 MPlist *maps; 37 MPlist *states; 38 MPlist *macros; 39 MPlist *externals; 40 unsigned long tick; 41 }; 42 43 typedef struct MIMState MIMState; 44 45 typedef struct MIMMap MIMMap; 46 47 typedef struct MIMInputStack MIMInputStack; 48 49 typedef struct 50 { 51 /** The current state. */ 52 MIMState *state; 53 54 /** The previous state. */ 55 MIMState *prev_state; 56 57 /** The current map. */ 58 MIMMap *map; 59 60 /** Table of typed keys. */ 61 int size, inc, used; 62 MSymbol *keys; 63 64 /** Index of the key handled firstly in the current state. */ 65 int state_key_head; 66 67 /** Index of the key not yet handled. */ 68 int key_head; 69 70 /** Index of the key at the time of committing. */ 71 int commit_key_head; 72 73 /** Saved M-text when entered in the current state. */ 74 MText *preedit_saved; 75 76 /** The insertion position when shifted to the current state. */ 77 int state_pos; 78 79 /** List of markers. */ 80 MPlist *markers; 81 82 /** List of variables. */ 83 MPlist *vars; 84 85 MPlist *vars_saved; 86 87 MText *preceding_text, *following_text; 88 89 int key_unhandled; 90 91 /** Used by minput_win_driver (input-win.c). */ 92 void *win_info; 93 94 MPlist *state_hook; 95 96 unsigned long tick; 97 98 /* A pushing/switching input method is recorded here by 99 take_action_list (). */ 100 MPlist *pushing_or_switching; 101 /* List of pointers to MInputContext for fallback input methods. */ 102 MPlist *fallbacks; 103 MIMInputStack *stack; 104 } MInputContextInfo; 105 106 #define MINPUT_KEY_SHIFT_MODIFIER (1 << 0) 107 #define MINPUT_KEY_CONTROL_MODIFIER (1 << 1) 108 #define MINPUT_KEY_META_MODIFIER (1 << 2) 109 #define MINPUT_KEY_ALT_MODIFIER (1 << 3) 110 #define MINPUT_KEY_SUPER_MODIFIER (1 << 4) 111 #define MINPUT_KEY_HYPER_MODIFIER (1 << 5) 112 #define MINPUT_KEY_ALTGR_MODIFIER (1 << 6) 113 114 extern MSymbol minput__char_to_key (int c); 115 116 #endif /* not _M17N_INPUT_H_ */ 117