Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(798)

Side by Side Diff: src/IBusChewingEngine.gob

Issue 2436006: Add support for selecting candidates via mouseclick. (Closed) Base URL: ssh://git@chromiumos-git/ibus-chewing.git
Patch Set: Code Review Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/IBusChewingEngine-keys.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 requires 2.0.0 1 requires 2.0.0
2 2
3 %alltop{ 3 %alltop{
4 /* 4 /*
5 * Copyright © 2009 Red Hat, Inc. All rights reserved. 5 * Copyright © 2009 Red Hat, Inc. All rights reserved.
6 * Copyright © 2009 Ding-Yi Chen <dchen at redhat.com> 6 * Copyright © 2009 Ding-Yi Chen <dchen at redhat.com>
7 * 7 *
8 * This file is part of the ibus-chewing Project. 8 * This file is part of the ibus-chewing Project.
9 * 9 *
10 * This program is free software; you can redistribute it and/or 10 * This program is free software; you can redistribute it and/or
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 typedef void IBusKeymap; 133 typedef void IBusKeymap;
134 IBusKeymap *ibus_keymap_get(gchar *keymap_name); 134 IBusKeymap *ibus_keymap_get(gchar *keymap_name);
135 #endif /* IBUS_1_1 */ 135 #endif /* IBUS_1_1 */
136 136
137 #define G_DEBUG_MSG(level, msg, args...) if (level<=ibus_chewing_verbose) g_debu g(msg, ##args) 137 #define G_DEBUG_MSG(level, msg, args...) if (level<=ibus_chewing_verbose) g_debu g(msg, ##args)
138 %} 138 %}
139 139
140 %privateheader{ 140 %privateheader{
141 gboolean ibus_chewing_engine_process_key_event(IBusEngine *engine, 141 gboolean ibus_chewing_engine_process_key_event(IBusEngine *engine,
142 guint keyval, guint modifiers); 142 guint keyval, guint modifiers);
143 void ibus_chewing_engine_candidate_clicked(IBusEngine *engine, guint index,
144 guint button, guint state);
143 145
144 #ifndef IBUS_1_1 146 #ifndef IBUS_1_1
145 gboolean ibus_chewing_engine_process_key_event_1_2(IBusEngine *engine, 147 gboolean ibus_chewing_engine_process_key_event_1_2(IBusEngine *engine,
146 guint keyval_ignore, guint keycode, guint modifiers); 148 guint keyval_ignore, guint keycode, guint modifiers);
147 149
148 #endif /* IBUS_1_1 */ 150 #endif /* IBUS_1_1 */
149 %} 151 %}
150 152
151 %{ 153 %{
152 extern gboolean ibus_chewing_verbose; 154 extern gboolean ibus_chewing_verbose;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 ibus_chewing_engine_set_status_flag(self,ENGINE_STATUS_INITIALIZED); 263 ibus_chewing_engine_set_status_flag(self,ENGINE_STATUS_INITIALIZED);
262 } 264 }
263 } 265 }
264 266
265 class_init(klass){ 267 class_init(klass){
266 #ifdef IBUS_1_1 268 #ifdef IBUS_1_1
267 ibus_engine_class->process_key_event = ibus_chewing_engine_process_key_e vent; 269 ibus_engine_class->process_key_event = ibus_chewing_engine_process_key_e vent;
268 #else 270 #else
269 ibus_engine_class->process_key_event = ibus_chewing_engine_process_key_e vent_1_2; 271 ibus_engine_class->process_key_event = ibus_chewing_engine_process_key_e vent_1_2;
270 #endif /* IBUS_1_1 */ 272 #endif /* IBUS_1_1 */
273 ibus_engine_class->candidate_clicked = ibus_chewing_engine_candidate_cli cked;
271 } 274 }
272 275
273 private void load_setting(self){ 276 private void load_setting(self){
274 #define BUFFER_SIZE_LOCAL 200 277 #define BUFFER_SIZE_LOCAL 200
275 G_DEBUG_MSG(3,"[I3] load_setting()"); 278 G_DEBUG_MSG(3,"[I3] load_setting()");
276 int i; 279 int i;
277 //gchar buf[BUFFER_SIZE_LOCAL]; 280 //gchar buf[BUFFER_SIZE_LOCAL];
278 PropertyContext context = {NULL, self}; 281 PropertyContext context = {NULL, self};
279 282
280 for (i=0; propSpecs[i].valueType!=G_TYPE_INVALID;i++){ 283 for (i=0; propSpecs[i].valueType!=G_TYPE_INVALID;i++){
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 chewing_handle_Default(self->context,keyval); 737 chewing_handle_Default(self->context,keyval);
735 if (self->flags & CHEWING_FLAG_PLAIN_ZHUYIN){ 738 if (self->flags & CHEWING_FLAG_PLAIN_ZHUYIN){
736 if (self_is_selectKey(self,self->_priv->key_last) && 739 if (self_is_selectKey(self,self->_priv->key_last) &&
737 self->inputMode==CHEWING_INPUT_MODE_SELECTING){ 740 self->inputMode==CHEWING_INPUT_MODE_SELECTING){
738 chewing_handle_Enter(self->context); 741 chewing_handle_Enter(self->context);
739 self->inputMode= CHEWING_INPUT_MODE_SELECTING_DONE; 742 self->inputMode= CHEWING_INPUT_MODE_SELECTING_DONE;
740 } 743 }
741 } 744 }
742 } 745 }
743 746
747 protected void handle_candidate_clicked(self, guint index, guint button, gui nt state){
748 if (index >= chewing_get_candPerPage(self->context)) {
749 G_DEBUG_MSG(3,"[I3] handle_cadidate_clicked(-, %u, %u, %u) ... index out of range.", index, button, state);
750 return;
751 }
752 if (self->inputMode==CHEWING_INPUT_MODE_SELECTING_DONE){
753 int* keys = chewing_get_selKey(self->context);
754 if (!keys) {
755 G_DEBUG_MSG(3,"[I3] handle_cadidate_clicked(-, %u, %u, %u) ... N o sel keys.", index, button, state);
756 return;
757 }
758 ibus_chewing_engine_set_status_flag(self, ENGINE_STATUS_NEED_COMMIT) ;
759 chewing_handle_Default(self->context, keys[index]);
760 self_update(self);
761 } else {
762 G_DEBUG_MSG(3,"[I3] handle_cadidate_clicked() ... Wrong mode: %u", s elf->inputMode);
763 }
764 }
765
744 /* 766 /*
745 * determine_input_mode: 767 * determine_input_mode:
746 * 768 *
747 * Determine input mode. 769 * Determine input mode.
748 */ 770 */
749 private void determine_input_mode(self){ 771 private void determine_input_mode(self){
750 gint zhuyin_count=-1; 772 gint zhuyin_count=-1;
751 gchar *str_ptr=chewing_zuin_String(self->context,&zhuyin_count); 773 gchar *str_ptr=chewing_zuin_String(self->context,&zhuyin_count);
752 G_DEBUG_MSG(3, "[I3] determine_input_mode(): chewing_zuin_String=%s coun t=%d inputMode=%d", 774 G_DEBUG_MSG(3, "[I3] determine_input_mode(): chewing_zuin_String=%s coun t=%d inputMode=%d",
753 str_ptr,zhuyin_count,self->inputMode); 775 str_ptr,zhuyin_count,self->inputMode);
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 IBusProperty *prop=self_get_iBusProperty(self, prop_name); 1024 IBusProperty *prop=self_get_iBusProperty(self, prop_name);
1003 ibus_property_set_visible(prop,FALSE); 1025 ibus_property_set_visible(prop,FALSE);
1004 ibus_engine_update_property(engine,prop); 1026 ibus_engine_update_property(engine,prop);
1005 } 1027 }
1006 } 1028 }
1007 1029
1008 %{ 1030 %{
1009 #include "IBusChewingEngine-keys.c" 1031 #include "IBusChewingEngine-keys.c"
1010 %} 1032 %}
1011 1033
OLDNEW
« no previous file with comments | « no previous file | src/IBusChewingEngine-keys.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698