1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
/*
* ISF(Input Service Framework)
*
* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable.
* Copyright (c) 2013 Intel Corporation
* Copyright (c) 2013-2015 Samsung Electronics Co., Ltd.
*
* Contact: Jihoon Kim <jihoon48.kim@samsung.com>, Li Zhang <li2012.zhang@samsung.com>
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __ISF_WSC_CONTEXT_H_
#define __ISF_WSC_CONTEXT_H_
#include <Ecore.h>
#include <Ecore_IMF.h>
#include <dlog.h>
#include "scim_stl_map.h"
#if SCIM_USE_STL_EXT_HASH_MAP
typedef __gnu_cxx::hash_map <uint32_t, uint32_t, __gnu_cxx::hash <uint32_t> > KeycodeRepository;
#elif SCIM_USE_STL_HASH_MAP
typedef std::hash_map <uint32_t, ClientInfo, std::hash <uint32_t> > KeycodeRepository;
#else
typedef std::map <uint32_t, uint32_t> KeycodeRepository;
#endif
typedef enum {
INPUT_RESOURCE_LOCAL,
INPUT_RESOURCE_REMOTE,
INPUT_RESOURCE_NONE
} Input_Resource;
struct weescim;
struct _wl_im;
const double HIDE_TIMER_INTERVAL = 0.05;
const double WILL_SHOW_TIMER_INTERVAL = 5.0;
typedef struct _WSCContextISF WSCContextISF;
typedef struct _WSCContextISFImpl WSCContextISFImpl;
struct weescim
{
struct wl_input_method *im;
WSCContextISF *wsc_ctx;
};
struct _wl_im
{
struct weescim *wsc;
struct wl_input_method *input_method;
struct wl_input_method_context *im_ctx;
Eina_Bool need_focus_event;
};
struct _WSCContextISF {
weescim *ctx;
#if ENABLE_GRAB_KEYBOARD
struct wl_keyboard *keyboard;
struct xkb_context *xkb_context;
uint32_t modifiers;
struct xkb_keymap *keymap;
struct xkb_state *state;
xkb_mod_mask_t control_mask;
xkb_mod_mask_t alt_mask;
xkb_mod_mask_t shift_mask;
KeycodeRepository _keysym2keycode;
#endif
struct wl_input_method_context *im_ctx;
Ecore_Fd_Handler* surrounding_text_fd_read_handler;
Ecore_Fd_Handler* selection_text_fd_read_handler;
Ecore_Fd_Handler* remote_surrounding_text_fd_read_handler;
char *surrounding_text;
char *remote_surrounding_text;
char *selection_text;
char *preedit_str;
char *language;
uint32_t serial;
uint32_t content_hint;
uint32_t content_purpose;
uint32_t surrounding_cursor;
uint32_t return_key_type;
uint32_t bidi_direction;
uint32_t caps_mode;
Eina_Bool layout_initialized;
Eina_Bool prediction_allow_initialized;
Eina_Bool autocapital_type_initialized;
Eina_Bool language_initialized;
Eina_Bool return_key_disabled;
Eina_Bool input_panel_shown;
WSCContextISFImpl *impl;
int id; /* Input Context id*/
_WSCContextISF *next;
_WSCContextISF() : ctx(NULL),
im_ctx(NULL),
surrounding_text_fd_read_handler(NULL),
selection_text_fd_read_handler(NULL),
remote_surrounding_text_fd_read_handler(NULL),
surrounding_text(NULL),
remote_surrounding_text(NULL),
selection_text(NULL),
preedit_str(NULL),
language(NULL),
serial(0),
content_hint(0),
content_purpose(0),
surrounding_cursor(0),
return_key_type(0),
bidi_direction(0),
caps_mode(0),
layout_initialized(EINA_FALSE),
prediction_allow_initialized(EINA_FALSE),
autocapital_type_initialized(EINA_FALSE),
language_initialized(EINA_FALSE),
return_key_disabled(EINA_FALSE),
input_panel_shown(EINA_FALSE),
impl(NULL),
id(0),
next(NULL)
{
}
};
void get_language(char **language);
int get_panel_client_id ();
WSCContextISF *get_focused_ic ();
void context_scim_imdata_get (WSCContextISF *wsc_ctx, void* data, int* length, int max_len);
void context_scim_mime_type_get (WSCContextISF *wsc_ctx, char *mime_types, int max_len);
void isf_wsc_context_add (WSCContextISF *wsc_ctx);
void isf_wsc_context_del (WSCContextISF *wsc_ctx);
void isf_wsc_context_focus_in (WSCContextISF *wsc_ctx);
void isf_wsc_context_focus_out (WSCContextISF *wsc_ctx);
void isf_wsc_context_preedit_string_get (WSCContextISF *wsc_ctx, char** str, int *cursor_pos);
void isf_wsc_context_autocapital_type_set (WSCContextISF* wsc_ctx, Ecore_IMF_Autocapital_Type autocapital_type);
void isf_wsc_context_bidi_direction_set (WSCContextISF* wsc_ctx, Ecore_IMF_BiDi_Direction direction);
void isf_wsc_context_send_surrounding_text (WSCContextISF* wsc_ctx, const char *text, int cursor);
void isf_wsc_context_send_entry_metadata (WSCContextISF* wsc_ctx, Ecore_IMF_Input_Hints hint,
Ecore_IMF_Input_Panel_Layout layout, int variation,
Ecore_IMF_Autocapital_Type type, int return_key_disabled,
Ecore_IMF_Input_Panel_Return_Key_Type return_key_type);
#if !(ENABLE_GRAB_KEYBOARD)
void isf_wsc_context_filter_key_event (WSCContextISF* wsc_ctx,
uint32_t serial,
uint32_t timestamp, const char *keyname,
bool press, uint32_t modifiers,
const char *dev_name, uint32_t dev_class, uint32_t dev_subclass, uint32_t keycode);
#else
void isf_wsc_context_filter_key_event (WSCContextISF* wsc_ctx,
uint32_t serial,
uint32_t timestamp, uint32_t key, uint32_t unicode,
char *keyname,
enum wl_keyboard_key_state state);
#endif
bool wsc_context_surrounding_get (WSCContextISF *wsc_ctx, char **text, int *cursor_pos);
void wsc_context_remote_surrounding_get (WSCContextISF *wsc_ctx);
Ecore_IMF_Input_Panel_Layout wsc_context_input_panel_layout_get(WSCContextISF *wsc_ctx);
int wsc_context_input_panel_layout_variation_get (WSCContextISF *wsc_ctx);
bool wsc_context_input_panel_caps_lock_mode_get(WSCContextISF *wsc_ctx);
void wsc_context_delete_surrounding (WSCContextISF *wsc_ctx, int offset, int len);
Ecore_IMF_Autocapital_Type wsc_context_autocapital_type_get (WSCContextISF *wsc_ctx);
Ecore_IMF_Input_Panel_Lang wsc_context_input_panel_language_get (WSCContextISF *wsc_ctx);
bool wsc_context_input_panel_password_mode_get (WSCContextISF *wsc_ctx);
Ecore_IMF_Input_Hints wsc_context_input_hint_get (WSCContextISF *wsc_ctx);
Eina_Bool wsc_context_prediction_allow_get (WSCContextISF *wsc_ctx);
Ecore_IMF_BiDi_Direction wsc_context_bidi_direction_get (WSCContextISF *wsc_ctx);
void wsc_context_commit_preedit_string(WSCContextISF *wsc_ctx);
void wsc_context_commit_string(WSCContextISF *wsc_ctx, const char *str);
void wsc_context_send_preedit_string(WSCContextISF *wsc_ctx);
void wsc_context_send_key(WSCContextISF *wsc_ctx, uint32_t keysym, uint32_t modifiers, uint32_t time, bool press);
#endif /* __ISF_WSC_CONTEXT_H_ */
|