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

Side by Side Diff: src/IBusChewingEngine-keys.c

Issue 1733014: Fix the space bar to insert spaces in ibus-chewing (Closed)
Patch Set: Code Review Created 10 years, 7 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 | « src/IBusChewingEngine-def.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #ifndef IBUS_1_1 1 #ifndef IBUS_1_1
2 gboolean ibus_chewing_engine_process_key_event_1_2(IBusEngine *engine, 2 gboolean ibus_chewing_engine_process_key_event_1_2(IBusEngine *engine,
3 guint keysym_ignore, guint keycode, guint modifiers){ 3 guint keysym_ignore, guint keycode, guint modifiers){
4 if (modifiers & IBUS_RELEASE_MASK){ 4 if (modifiers & IBUS_RELEASE_MASK){
5 /* Skip release event */ 5 /* Skip release event */
6 return TRUE; 6 return TRUE;
7 } 7 }
8 IBusChewingEngine *self=IBUS_CHEWING_ENGINE(engine); 8 IBusChewingEngine *self=IBUS_CHEWING_ENGINE(engine);
9 guint keysym=ibus_keymap_lookup_keysym (self->keymap_us,keycode,modifiers); 9 guint keysym=ibus_keymap_lookup_keysym (self->keymap_us,keycode,modifiers);
10 return ibus_chewing_engine_process_key_event(engine, keysym, modifiers); 10 return ibus_chewing_engine_process_key_event(engine, keysym, modifiers);
(...skipping 23 matching lines...) Expand all
34 /* Convert kp numbers to normal */ 34 /* Convert kp numbers to normal */
35 self_handle_Default(self,keysym_tmp,FALSE); 35 self_handle_Default(self,keysym_tmp,FALSE);
36 } 36 }
37 }else{ 37 }else{
38 switch (keysym){ 38 switch (keysym){
39 case IBUS_Return: 39 case IBUS_Return:
40 case IBUS_KP_Enter: 40 case IBUS_KP_Enter:
41 chewing_handle_Enter(self->context); 41 chewing_handle_Enter(self->context);
42 break; 42 break;
43 case IBUS_Escape: 43 case IBUS_Escape:
44 if (self->inputMode==CHEWING_INPUT_MODE_BYPASS)
45 return FALSE;
44 chewing_handle_Esc(self->context); 46 chewing_handle_Esc(self->context);
45 break; 47 break;
46 case IBUS_BackSpace: 48 case IBUS_BackSpace:
49 if (self->inputMode==CHEWING_INPUT_MODE_BYPASS)
50 return FALSE;
47 chewing_handle_Backspace(self->context); 51 chewing_handle_Backspace(self->context);
48 break; 52 break;
49 case IBUS_Delete: 53 case IBUS_Delete:
50 case IBUS_KP_Delete: 54 case IBUS_KP_Delete:
55 if (self->inputMode==CHEWING_INPUT_MODE_BYPASS)
56 return FALSE;
51 chewing_handle_Del(self->context); 57 chewing_handle_Del(self->context);
52 break; 58 break;
53 case IBUS_space: 59 case IBUS_space:
54 case IBUS_KP_Space: 60 case IBUS_KP_Space:
55 /** 61 /**
56 * Fix for space in Temporary mode. 62 * Fix for space in Temporary mode.
57 */ 63 */
58 chewing_handle_Space(self->context); 64 chewing_handle_Space(self->context);
59 » » if (self->inputMode==CHEWING_INPUT_MODE_SELECTING_DONE) 65 » » if (self->inputMode==CHEWING_INPUT_MODE_SELECTING_DONE ||
66 » » » self->inputMode==CHEWING_INPUT_MODE_BYPASS )
60 ibus_chewing_engine_set_status_flag(self,ENGINE_STATUS_N EED_COMMIT); 67 ibus_chewing_engine_set_status_flag(self,ENGINE_STATUS_N EED_COMMIT);
61 break; 68 break;
62 case IBUS_Page_Up: 69 case IBUS_Page_Up:
63 case IBUS_KP_Page_Up: 70 case IBUS_KP_Page_Up:
64 if (self->inputMode==CHEWING_INPUT_MODE_BYPASS) 71 if (self->inputMode==CHEWING_INPUT_MODE_BYPASS)
65 return FALSE; 72 return FALSE;
66 IBUS_ENGINE_GET_CLASS(engine)->page_up(engine); 73 IBUS_ENGINE_GET_CLASS(engine)->page_up(engine);
67 break; 74 break;
68 case IBUS_Page_Down: 75 case IBUS_Page_Down:
69 case IBUS_KP_Page_Down: 76 case IBUS_KP_Page_Down:
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 if (self->inputMode==CHEWING_INPUT_MODE_BYPASS) 113 if (self->inputMode==CHEWING_INPUT_MODE_BYPASS)
107 return FALSE; 114 return FALSE;
108 chewing_handle_End(self->context); 115 chewing_handle_End(self->context);
109 break; 116 break;
110 case IBUS_Tab: 117 case IBUS_Tab:
111 if (self->inputMode==CHEWING_INPUT_MODE_BYPASS) 118 if (self->inputMode==CHEWING_INPUT_MODE_BYPASS)
112 return FALSE; 119 return FALSE;
113 chewing_handle_Tab(self->context); 120 chewing_handle_Tab(self->context);
114 break; 121 break;
115 case IBUS_Caps_Lock: 122 case IBUS_Caps_Lock:
123 /* When Chi->Eng with incomplete character */
124 if (chewing_get_ChiEngMode(self->context) && !chewing_zuin_C heck(self->context)){
125 /* chewing_zuin_Check==0 means incomplete character */
126 /* Send a space to finish the character */
127 chewing_handle_Space(self->context);
128 }
116 chewing_handle_Capslock(self->context); 129 chewing_handle_Capslock(self->context);
117 self_refresh_property(self,"chewing_chieng_prop"); 130 self_refresh_property(self,"chewing_chieng_prop");
118 break; 131 break;
119 case IBUS_Shift_L: 132 case IBUS_Shift_L:
120 case IBUS_Shift_R: 133 case IBUS_Shift_R:
121 /* Some QT application will sneak these through */ 134 /* Some QT application will sneak these through */
122 return FALSE; 135 return FALSE;
123 case IBUS_Alt_L: 136 case IBUS_Alt_L:
124 case IBUS_Alt_R: 137 case IBUS_Alt_R:
125 /* Some QT application will sneak these through */ 138 /* Some QT application will sneak these through */
(...skipping 13 matching lines...) Expand all
139 if (self->inputMode==CHEWING_INPUT_MODE_BYPASS) 152 if (self->inputMode==CHEWING_INPUT_MODE_BYPASS)
140 return FALSE; 153 return FALSE;
141 chewing_handle_ShiftLeft(self->context); 154 chewing_handle_ShiftLeft(self->context);
142 break; 155 break;
143 case IBUS_Right: 156 case IBUS_Right:
144 if (self->inputMode==CHEWING_INPUT_MODE_BYPASS) 157 if (self->inputMode==CHEWING_INPUT_MODE_BYPASS)
145 return FALSE; 158 return FALSE;
146 chewing_handle_ShiftRight(self->context); 159 chewing_handle_ShiftRight(self->context);
147 break; 160 break;
148 case IBUS_Up: 161 case IBUS_Up:
149 » » return FALSE; 162 » case IBUS_KP_Up:
150 case IBUS_Down: 163 case IBUS_Down:
164 case IBUS_KP_Down:
165 case IBUS_Page_Up:
166 case IBUS_KP_Page_Up:
167 case IBUS_Page_Down:
168 case IBUS_KP_Page_Down:
169 case IBUS_Home:
170 case IBUS_End:
171 if (self->_priv->statusFlags & ENGINE_STATUS_NEED_COMMIT)
172 self_force_commit(self);
151 return FALSE; 173 return FALSE;
152 case IBUS_space: 174 case IBUS_space:
153 case IBUS_KP_Space: 175 case IBUS_KP_Space:
154 chewing_handle_ShiftSpace(self->context); 176 chewing_handle_ShiftSpace(self->context);
155 chewing_set_ShapeMode(self->context, !chewing_get_ShapeMode(self ->context)); 177 chewing_set_ShapeMode(self->context, !chewing_get_ShapeMode(self ->context));
156 self_refresh_property(self,"chewing_alnumSize_prop"); 178 self_refresh_property(self,"chewing_alnumSize_prop");
157 break; 179 break;
158 default: 180 default:
159 self_handle_Default(self,keysym,TRUE); 181 self_handle_Default(self,keysym,TRUE);
160 break; 182 break;
161 } 183 }
162 }else if (state==IBUS_CONTROL_MASK){ 184 }else if (state==IBUS_CONTROL_MASK){
163 if (keysym>=IBUS_0 && keysym<=IBUS_9){ 185 if (keysym>=IBUS_0 && keysym<=IBUS_9){
164 chewing_handle_CtrlNum(self->context,keysym); 186 chewing_handle_CtrlNum(self->context,keysym);
165 }else if (keysym==IBUS_v || keysym==IBUS_V){ 187 }else if (keysym==IBUS_v || keysym==IBUS_V){
166 chewing_handle_Right(self->context); 188 chewing_handle_Right(self->context);
167 }else{ 189 }else{
168 result=FALSE; 190 result=FALSE;
169 } 191 }
170 192
171 }else{ 193 }else{
172 result=FALSE; 194 result=FALSE;
173 } 195 }
174 if (!result){ 196 if (!result){
175 return FALSE; 197 return FALSE;
176 } 198 }
177 return self_update(self); 199 return self_update(self);
178 } 200 }
179
OLDNEW
« no previous file with comments | « src/IBusChewingEngine-def.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698