aboutsummaryrefslogtreecommitdiffstats
path: root/src/androidterm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/androidterm.c')
-rw-r--r--src/androidterm.c70
1 files changed, 67 insertions, 3 deletions
diff --git a/src/androidterm.c b/src/androidterm.c
index a9b5834c08f..c302e3f2877 100644
--- a/src/androidterm.c
+++ b/src/androidterm.c
@@ -681,7 +681,6 @@ android_handle_ime_event (union android_event *event, struct frame *f)
681 switch (event->ime.operation) 681 switch (event->ime.operation)
682 { 682 {
683 case ANDROID_IME_COMMIT_TEXT: 683 case ANDROID_IME_COMMIT_TEXT:
684 case ANDROID_IME_FINISH_COMPOSING_TEXT:
685 case ANDROID_IME_SET_COMPOSING_TEXT: 684 case ANDROID_IME_SET_COMPOSING_TEXT:
686 text = android_decode_utf16 (event->ime.text, 685 text = android_decode_utf16 (event->ime.text,
687 event->ime.length); 686 event->ime.length);
@@ -708,7 +707,8 @@ android_handle_ime_event (union android_event *event, struct frame *f)
708 break; 707 break;
709 708
710 case ANDROID_IME_FINISH_COMPOSING_TEXT: 709 case ANDROID_IME_FINISH_COMPOSING_TEXT:
711 finish_composing_text (f, event->ime.counter); 710 finish_composing_text (f, event->ime.counter,
711 event->ime.length);
712 break; 712 break;
713 713
714 case ANDROID_IME_SET_COMPOSING_TEXT: 714 case ANDROID_IME_SET_COMPOSING_TEXT:
@@ -5161,7 +5161,71 @@ NATIVE_NAME (performEditorAction) (JNIEnv *env, jobject object,
5161 /* Undocumented behavior: performEditorAction is apparently expected 5161 /* Undocumented behavior: performEditorAction is apparently expected
5162 to finish composing any text. */ 5162 to finish composing any text. */
5163 5163
5164 NATIVE_NAME (finishComposingText) (env, object, window); 5164 event.ime.type = ANDROID_INPUT_METHOD;
5165 event.ime.serial = ++event_serial;
5166 event.ime.window = window;
5167 event.ime.operation = ANDROID_IME_FINISH_COMPOSING_TEXT;
5168 event.ime.start = 0;
5169 event.ime.end = 0;
5170
5171 /* This value of `length' means that the input method should receive
5172 an update containing the new conversion region. */
5173
5174 event.ime.length = 1;
5175 event.ime.position = 0;
5176 event.ime.text = NULL;
5177 event.ime.counter = ++edit_counter;
5178
5179 android_write_event (&event);
5180
5181 /* Finally, send the return key press. */
5182
5183 event.xkey.type = ANDROID_KEY_PRESS;
5184 event.xkey.serial = ++event_serial;
5185 event.xkey.window = window;
5186 event.xkey.time = 0;
5187 event.xkey.state = 0;
5188 event.xkey.keycode = 66;
5189 event.xkey.unicode_char = 0;
5190
5191 android_write_event (&event);
5192}
5193
5194JNIEXPORT void JNICALL
5195NATIVE_NAME (performContextMenuAction) (JNIEnv *env, jobject object,
5196 jshort window, int action)
5197{
5198 JNI_STACK_ALIGNMENT_PROLOGUE;
5199
5200 union android_event event;
5201 int key;
5202
5203 /* Note that ACTION is determined in EmacsInputConnection, and as
5204 such they are not actual resource IDs. */
5205
5206 switch (action)
5207 {
5208 case 0: /* android.R.id.selectAll */
5209 case 1: /* android.R.id.startSelectingText */
5210 case 2: /* android.R.id.stopSelectingText */
5211 /* These actions are not implemented. */
5212 return;
5213
5214 case 3: /* android.R.id.cut */
5215 key = 277;
5216 break;
5217
5218 case 4: /* android.R.id.copy */
5219 key = 278;
5220 break;
5221
5222 case 5: /* android.R.id.paste */
5223 key = 279;
5224 break;
5225
5226 default:
5227 emacs_abort ();
5228 }
5165 5229
5166 event.xkey.type = ANDROID_KEY_PRESS; 5230 event.xkey.type = ANDROID_KEY_PRESS;
5167 event.xkey.serial = ++event_serial; 5231 event.xkey.serial = ++event_serial;