diff options
| author | Po Lu | 2023-06-01 15:16:02 +0800 |
|---|---|---|
| committer | Po Lu | 2023-06-01 15:16:02 +0800 |
| commit | aed0a11147e29fc73405f1815fef91ecf6cca7fb (patch) | |
| tree | 35f335168eb4fe2c642a4c1a26109c71c3dacae6 /src/textconv.c | |
| parent | 9a958c59a2ce546e6ec99c58ca181dafeac8dd6b (diff) | |
| download | emacs-aed0a11147e29fc73405f1815fef91ecf6cca7fb.tar.gz emacs-aed0a11147e29fc73405f1815fef91ecf6cca7fb.zip | |
Update Android port
* java/org/gnu/emacs/EmacsInputConnection.java
(EmacsInputConnection, performContextMenuAction): New function.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative)
(performContextMenuAction): New function.
* src/android.c (android_get_gc_values): Implement more
efficiently.
* src/androidterm.c (android_handle_ime_event): Pass through
`update' argument to `finish_composing_text'. Fix thinko.
* src/textconv.c (really_finish_composing_text)
(really_set_composing_text, really_set_composing_region)
(handle_pending_conversion_events_1, finish_composing_text): New
argument `update'. Notify IME of conversion region changes if
set.
* src/textconv.h: Update structs and prototypes.
Diffstat (limited to 'src/textconv.c')
| -rw-r--r-- | src/textconv.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/textconv.c b/src/textconv.c index dcf016104fe..d8166bcfd03 100644 --- a/src/textconv.c +++ b/src/textconv.c | |||
| @@ -676,10 +676,11 @@ really_commit_text (struct frame *f, EMACS_INT position, | |||
| 676 | } | 676 | } |
| 677 | 677 | ||
| 678 | /* Remove the composition region on the frame F, while leaving its | 678 | /* Remove the composition region on the frame F, while leaving its |
| 679 | contents intact. */ | 679 | contents intact. If UPDATE, also notify the input method of the |
| 680 | change. */ | ||
| 680 | 681 | ||
| 681 | static void | 682 | static void |
| 682 | really_finish_composing_text (struct frame *f) | 683 | really_finish_composing_text (struct frame *f, bool update) |
| 683 | { | 684 | { |
| 684 | if (!NILP (f->conversion.compose_region_start)) | 685 | if (!NILP (f->conversion.compose_region_start)) |
| 685 | { | 686 | { |
| @@ -687,6 +688,10 @@ really_finish_composing_text (struct frame *f) | |||
| 687 | Fset_marker (f->conversion.compose_region_end, Qnil, Qnil); | 688 | Fset_marker (f->conversion.compose_region_end, Qnil, Qnil); |
| 688 | f->conversion.compose_region_start = Qnil; | 689 | f->conversion.compose_region_start = Qnil; |
| 689 | f->conversion.compose_region_end = Qnil; | 690 | f->conversion.compose_region_end = Qnil; |
| 691 | |||
| 692 | if (update && text_interface | ||
| 693 | && text_interface->compose_region_changed) | ||
| 694 | (*text_interface->compose_region_changed) (f); | ||
| 690 | } | 695 | } |
| 691 | 696 | ||
| 692 | /* Delete the composition region overlay. */ | 697 | /* Delete the composition region overlay. */ |
| @@ -796,7 +801,7 @@ really_set_composing_text (struct frame *f, ptrdiff_t position, | |||
| 796 | the documentation, but is ultimately what programs expect. */ | 801 | the documentation, but is ultimately what programs expect. */ |
| 797 | 802 | ||
| 798 | if (!SCHARS (text)) | 803 | if (!SCHARS (text)) |
| 799 | really_finish_composing_text (f); | 804 | really_finish_composing_text (f, false); |
| 800 | 805 | ||
| 801 | /* If PT hasn't changed, the conversion region definitely has. | 806 | /* If PT hasn't changed, the conversion region definitely has. |
| 802 | Otherwise, redisplay will update the input method instead. */ | 807 | Otherwise, redisplay will update the input method instead. */ |
| @@ -838,7 +843,7 @@ really_set_composing_region (struct frame *f, ptrdiff_t start, | |||
| 838 | 843 | ||
| 839 | if (max (0, start) == max (0, end)) | 844 | if (max (0, start) == max (0, end)) |
| 840 | { | 845 | { |
| 841 | really_finish_composing_text (f); | 846 | really_finish_composing_text (f, false); |
| 842 | return; | 847 | return; |
| 843 | } | 848 | } |
| 844 | 849 | ||
| @@ -1167,7 +1172,7 @@ handle_pending_conversion_events_1 (struct frame *f, | |||
| 1167 | break; | 1172 | break; |
| 1168 | 1173 | ||
| 1169 | case TEXTCONV_FINISH_COMPOSING_TEXT: | 1174 | case TEXTCONV_FINISH_COMPOSING_TEXT: |
| 1170 | really_finish_composing_text (f); | 1175 | really_finish_composing_text (f, !NILP (data)); |
| 1171 | break; | 1176 | break; |
| 1172 | 1177 | ||
| 1173 | case TEXTCONV_SET_COMPOSING_TEXT: | 1178 | case TEXTCONV_SET_COMPOSING_TEXT: |
| @@ -1360,16 +1365,20 @@ commit_text (struct frame *f, Lisp_Object string, | |||
| 1360 | /* Remove the composition region and its overlay from F's current | 1365 | /* Remove the composition region and its overlay from F's current |
| 1361 | buffer. Leave the text being composed intact. | 1366 | buffer. Leave the text being composed intact. |
| 1362 | 1367 | ||
| 1368 | If UPDATE, call `compose_region_changed' after the region is | ||
| 1369 | removed. | ||
| 1370 | |||
| 1363 | COUNTER means the same as in `start_batch_edit'. */ | 1371 | COUNTER means the same as in `start_batch_edit'. */ |
| 1364 | 1372 | ||
| 1365 | void | 1373 | void |
| 1366 | finish_composing_text (struct frame *f, unsigned long counter) | 1374 | finish_composing_text (struct frame *f, unsigned long counter, |
| 1375 | bool update) | ||
| 1367 | { | 1376 | { |
| 1368 | struct text_conversion_action *action, **last; | 1377 | struct text_conversion_action *action, **last; |
| 1369 | 1378 | ||
| 1370 | action = xmalloc (sizeof *action); | 1379 | action = xmalloc (sizeof *action); |
| 1371 | action->operation = TEXTCONV_FINISH_COMPOSING_TEXT; | 1380 | action->operation = TEXTCONV_FINISH_COMPOSING_TEXT; |
| 1372 | action->data = Qnil; | 1381 | action->data = update ? Qt : Qnil; |
| 1373 | action->next = NULL; | 1382 | action->next = NULL; |
| 1374 | action->counter = counter; | 1383 | action->counter = counter; |
| 1375 | for (last = &f->conversion.actions; *last; last = &(*last)->next) | 1384 | for (last = &f->conversion.actions; *last; last = &(*last)->next) |