1
/* Copyright (C) 2011 cwlin <https://github.com/cwlin>
3
* This library is free software; you can redistribute it and/or
4
* modify it under the terms of the GNU Lesser General Public
5
* License as published by the Free Software Foundation; either
6
* version 2.1 of the License, or (at your option) any later version.
8
* This library is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
* Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public
14
* License along with this library; if not, write to the Free Software
15
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
#include <chewing/chewing.h>
29
#include "im-client/hime-im-client-attr.h"
30
#include "hime-module.h"
31
#include "hime-module-cb.h"
32
#include "hime-conf.h"
34
#define MAX_SEG_NUM 128
35
#define HIME_CHEWING_CONFIG "/.config/hime/config/chewing_conf.dat"
36
#define HIME_KB_CONFIG "/.config/hime/config/phonetic-keyboard2"
38
#define HIME_CHEWING_DEFAULT_SELECT_KEYS { '1', '2', '3', '4', \
42
#define HIME_CHEWING_DEFAULT_KEY_MIN (XK_space)
43
#define HIME_CHEWING_DEFAULT_KEY_MAX (XK_asciitilde + 1)
44
#define HIME_CHEWING_KEY_MAX (XK_Delete + 1)
46
#define HIME_CHEWING_WRAPPER_FUNC(FUNC_NAME) return (chewing_buffer_Len (g_pChewingCtx) \
47
== 0 ? (-1) : FUNC_NAME(g_pChewingCtx));
49
typedef struct _SEGMENT
52
unsigned char selidx, selN;
55
typedef struct KB_MAPPING
58
char *pszChewingKbName;
61
// hime module callbacks
62
int module_init_win (HIME_module_main_functions *pFuncs);
63
void module_get_win_geom (void);
64
int module_reset (void);
65
int module_get_preedit (char *pszStr, HIME_PREEDIT_ATTR attr[],
66
int *pnCursor, int *pCompFlag);
67
gboolean module_feedkey (int nKeyVal, int nKeyState);
68
int module_feedkey_release (KeySym xkey, int nKbState);
69
void module_move_win(int x, int y);
70
void module_change_font_size (void);
71
void module_show_win (void);
72
void module_hide_win (void);
73
int module_win_visible (void);
74
int module_flush_input (void);
77
void chewing_config_open (gboolean bWrite);
78
void chewing_config_load (ChewingConfigData *pChewingConfig);
79
void chewing_config_set (ChewingContext *pChewingContext);
80
void chewing_config_dump (void);
81
void chewing_config_close (void);
82
gboolean chewing_config_save (int nVal[]);