A multilingual input method framework
Revision | a79acc17d5f259f56a2a835e23c159121d5f60fe (tree) |
---|---|
Time | 2006-06-29 12:42:07 |
Author | ekato <ekato@ff9a...> |
Commiter | ekato |
* emacs/helper.c
* emacs/uim-el-agent.c
@@ -117,19 +117,19 @@ helper_send_im_list(void) | ||
117 | 117 | |
118 | 118 | |
119 | 119 | |
120 | -static void | |
120 | +static int | |
121 | 121 | helper_im_changed(char *request, char *engine_name) |
122 | 122 | { |
123 | 123 | |
124 | 124 | debug_printf(DEBUG_NOTE, "helper_im_changed: %s\n", engine_name); |
125 | 125 | |
126 | - if (strcmp(request, "im_change_this_text_area_only") == 0) { | |
126 | + if (focused && strcmp(request, "im_change_this_text_area_only") == 0) { | |
127 | 127 | |
128 | 128 | if (current) |
129 | 129 | switch_context_im(current, engine_name); |
130 | 130 | |
131 | 131 | } else if (strcmp(request, "im_change_whole_desktop") == 0 |
132 | - || strcmp(request, "im_change_this_application_only") == 0) { | |
132 | + || (focused && strcmp(request, "im_change_this_application_only") == 0)) { | |
133 | 133 | |
134 | 134 | /* change default */ |
135 | 135 | update_default_engine(engine_name); |
@@ -137,7 +137,12 @@ helper_im_changed(char *request, char *engine_name) | ||
137 | 137 | /* check focus state when change IM of current application */ |
138 | 138 | if (strcmp(request, "im_change_whole_desktop") == 0 || current) |
139 | 139 | switch_context_im_all(engine_name); |
140 | + } else { | |
141 | + | |
142 | + return 0; | |
140 | 143 | } |
144 | + | |
145 | + return 1; | |
141 | 146 | } |
142 | 147 | |
143 | 148 |
@@ -152,7 +157,7 @@ helper_handler(uim_agent_context *ua, char *helper_message) | ||
152 | 157 | |
153 | 158 | debug_printf(DEBUG_NOTE, " message \"%s\"\n", message); |
154 | 159 | |
155 | - if (strcmp("focus_in", message) == 0) { | |
160 | + if (focused && strcmp("focus_in", message) == 0) { | |
156 | 161 | |
157 | 162 | /* some other window is focused */ |
158 | 163 |
@@ -160,7 +165,7 @@ helper_handler(uim_agent_context *ua, char *helper_message) | ||
160 | 165 | |
161 | 166 | focused = 0; |
162 | 167 | |
163 | - } else if (strncmp("prop_activate", message, 13) == 0) { | |
168 | + } else if (focused && strncmp("prop_activate", message, 13) == 0) { | |
164 | 169 | |
165 | 170 | debug_printf(DEBUG_NOTE, " prop_activate\n"); |
166 | 171 |
@@ -176,7 +181,8 @@ helper_handler(uim_agent_context *ua, char *helper_message) | ||
176 | 181 | } |
177 | 182 | } |
178 | 183 | |
179 | - } else if (strcmp("prop_list_get", message) == 0) { | |
184 | + | |
185 | + } else if (focused && strcmp("prop_list_get", message) == 0) { | |
180 | 186 | |
181 | 187 | debug_printf(DEBUG_NOTE, " prop_list_get\n"); |
182 | 188 |
@@ -190,16 +196,16 @@ helper_handler(uim_agent_context *ua, char *helper_message) | ||
190 | 196 | if ((p = strchr(message, ' ')) != NULL) { |
191 | 197 | *p = '\0'; |
192 | 198 | engine = p + 1; |
193 | - helper_im_changed(message, engine); | |
199 | + return helper_im_changed(message, engine); | |
194 | 200 | } |
195 | 201 | |
196 | - } else if (strcmp("im_list_get", message) == 0) { | |
202 | + } else if (focused && strcmp("im_list_get", message) == 0) { | |
197 | 203 | |
198 | 204 | debug_printf(DEBUG_NOTE, " im_list_get\n"); |
199 | 205 | |
200 | 206 | helper_send_im_list(); |
201 | 207 | |
202 | - } else if (strncmp("commit_string", message, 13) == 0) { | |
208 | + } else if (focused && strncmp("commit_string", message, 13) == 0) { | |
203 | 209 | |
204 | 210 | char *encoding, *str; |
205 | 211 |
@@ -230,7 +236,7 @@ helper_handler(uim_agent_context *ua, char *helper_message) | ||
230 | 236 | free(str); |
231 | 237 | |
232 | 238 | } |
233 | - } | |
239 | + } | |
234 | 240 | } |
235 | 241 | |
236 | 242 | } else if (strncmp("prop_update_custom", message, 18) == 0) { |
@@ -263,6 +269,7 @@ helper_handler(uim_agent_context *ua, char *helper_message) | ||
263 | 269 | } else { |
264 | 270 | |
265 | 271 | debug_printf(DEBUG_WARNING, " undefined helper message: %s\n", message); |
272 | + return 0; | |
266 | 273 | |
267 | 274 | } |
268 | 275 |
@@ -64,25 +64,23 @@ static int | ||
64 | 64 | cmd_helper(int context_id, char *helper_message) |
65 | 65 | { |
66 | 66 | uim_agent_context *ua; |
67 | + int ret; | |
67 | 68 | |
68 | - if (focused) { | |
69 | - int ret; | |
70 | - ua = get_uim_agent_context(context_id); | |
71 | - ret = helper_handler(ua, helper_message); | |
69 | + ua = get_uim_agent_context(context_id); | |
70 | + ret = helper_handler(ua, helper_message); | |
72 | 71 | |
73 | - if (ua) { | |
74 | - show_commit_string_uim_agent_context(current); | |
75 | - show_preedit_uim_agent_context(ua); | |
76 | - show_candidate_uim_agent_context(ua); | |
72 | + if (ua && ret) { | |
73 | + show_commit_string_uim_agent_context(current); | |
74 | + show_preedit_uim_agent_context(ua); | |
75 | + show_candidate_uim_agent_context(ua); | |
77 | 76 | |
78 | - check_prop_list_update(ua); | |
79 | - check_default_engine(); | |
80 | - } | |
77 | + check_prop_list_update(ua); | |
78 | + check_default_engine(); | |
81 | 79 | |
82 | - return ret; | |
83 | - } else { | |
84 | - return 0; | |
80 | + return ret; | |
85 | 81 | } |
82 | + | |
83 | + return 0; | |
86 | 84 | } |
87 | 85 | |
88 | 86 |