diff options
| author | Po Lu | 2023-03-03 15:23:21 +0800 |
|---|---|---|
| committer | Po Lu | 2023-03-03 15:23:21 +0800 |
| commit | bc9239eb51b1a346dac8a7f0f20b857143114bae (patch) | |
| tree | 550fe2442699c940ba9a055430640c9cbd849522 /src | |
| parent | bf93380c1c9a319840f89106ff6b9492faf923b4 (diff) | |
| download | emacs-bc9239eb51b1a346dac8a7f0f20b857143114bae.tar.gz emacs-bc9239eb51b1a346dac8a7f0f20b857143114bae.zip | |
Update Android port
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity)
(onCreate): Add view tree observer.
(onGlobalLayout): Sync fullscreen state.
(syncFullscreenWith): Improve visibility flag setting.
* src/textconv.c (select_window): New function.
(textconv_query):
(restore_selected_window):
(really_commit_text):
(really_set_composing_text):
(really_set_composing_region):
(really_delete_surrounding_text):
(really_set_point_and_mark):
(get_extracted_text): Call it instead of Fselect_window
to avoid selecting the mini window if it is no longer active.
Diffstat (limited to 'src')
| -rw-r--r-- | src/textconv.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/src/textconv.c b/src/textconv.c index 3da8dc831c8..91d386d4c61 100644 --- a/src/textconv.c +++ b/src/textconv.c | |||
| @@ -115,6 +115,25 @@ get_mark (void) | |||
| 115 | return -1; | 115 | return -1; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | /* Like Fselect_window. However, if WINDOW is a mini buffer window | ||
| 119 | but not the active minibuffer window, select its frame's selected | ||
| 120 | window instead. */ | ||
| 121 | |||
| 122 | static void | ||
| 123 | select_window (Lisp_Object window, Lisp_Object norecord) | ||
| 124 | { | ||
| 125 | struct window *w; | ||
| 126 | |||
| 127 | w = XWINDOW (window); | ||
| 128 | |||
| 129 | if (MINI_WINDOW_P (w) | ||
| 130 | && WINDOW_LIVE_P (window) | ||
| 131 | && !EQ (window, Factive_minibuffer_window ())) | ||
| 132 | window = WINDOW_XFRAME (w)->selected_window; | ||
| 133 | |||
| 134 | Fselect_window (window, norecord); | ||
| 135 | } | ||
| 136 | |||
| 118 | /* Perform the text conversion operation specified in QUERY and return | 137 | /* Perform the text conversion operation specified in QUERY and return |
| 119 | the results. | 138 | the results. |
| 120 | 139 | ||
| @@ -153,9 +172,9 @@ textconv_query (struct frame *f, struct textconv_callback_struct *query, | |||
| 153 | 172 | ||
| 154 | /* Temporarily switch to F's selected window at the time of the last | 173 | /* Temporarily switch to F's selected window at the time of the last |
| 155 | redisplay. */ | 174 | redisplay. */ |
| 156 | Fselect_window ((WINDOW_LIVE_P (f->old_selected_window) | 175 | select_window ((WINDOW_LIVE_P (f->old_selected_window) |
| 157 | ? f->old_selected_window | 176 | ? f->old_selected_window |
| 158 | : f->selected_window), Qt); | 177 | : f->selected_window), Qt); |
| 159 | 178 | ||
| 160 | /* Now find the appropriate text bounds for QUERY. First, move | 179 | /* Now find the appropriate text bounds for QUERY. First, move |
| 161 | point QUERY->position steps forward or backwards. */ | 180 | point QUERY->position steps forward or backwards. */ |
| @@ -526,7 +545,7 @@ static void | |||
| 526 | restore_selected_window (Lisp_Object window) | 545 | restore_selected_window (Lisp_Object window) |
| 527 | { | 546 | { |
| 528 | /* FIXME: not sure what to do if WINDOW has been deleted. */ | 547 | /* FIXME: not sure what to do if WINDOW has been deleted. */ |
| 529 | Fselect_window (window, Qt); | 548 | select_window (window, Qt); |
| 530 | } | 549 | } |
| 531 | 550 | ||
| 532 | /* Commit the given text in the composing region. If there is no | 551 | /* Commit the given text in the composing region. If there is no |
| @@ -552,7 +571,7 @@ really_commit_text (struct frame *f, EMACS_INT position, | |||
| 552 | 571 | ||
| 553 | /* Temporarily switch to F's selected window at the time of the last | 572 | /* Temporarily switch to F's selected window at the time of the last |
| 554 | redisplay. */ | 573 | redisplay. */ |
| 555 | Fselect_window (f->old_selected_window, Qt); | 574 | select_window (f->old_selected_window, Qt); |
| 556 | 575 | ||
| 557 | /* Now detect whether or not there is a composing region. | 576 | /* Now detect whether or not there is a composing region. |
| 558 | If there is, then replace it with TEXT. Don't do that | 577 | If there is, then replace it with TEXT. Don't do that |
| @@ -703,7 +722,7 @@ really_set_composing_text (struct frame *f, ptrdiff_t position, | |||
| 703 | /* Temporarily switch to F's selected window at the time of the last | 722 | /* Temporarily switch to F's selected window at the time of the last |
| 704 | redisplay. */ | 723 | redisplay. */ |
| 705 | w = XWINDOW (f->old_selected_window); | 724 | w = XWINDOW (f->old_selected_window); |
| 706 | Fselect_window (f->old_selected_window, Qt); | 725 | select_window (f->old_selected_window, Qt); |
| 707 | 726 | ||
| 708 | /* Now set up the composition region if necessary. */ | 727 | /* Now set up the composition region if necessary. */ |
| 709 | 728 | ||
| @@ -824,7 +843,7 @@ really_set_composing_region (struct frame *f, ptrdiff_t start, | |||
| 824 | 843 | ||
| 825 | /* Temporarily switch to F's selected window at the time of the last | 844 | /* Temporarily switch to F's selected window at the time of the last |
| 826 | redisplay. */ | 845 | redisplay. */ |
| 827 | Fselect_window (f->old_selected_window, Qt); | 846 | select_window (f->old_selected_window, Qt); |
| 828 | 847 | ||
| 829 | /* Now set up the composition region if necessary. */ | 848 | /* Now set up the composition region if necessary. */ |
| 830 | 849 | ||
| @@ -873,7 +892,7 @@ really_delete_surrounding_text (struct frame *f, ptrdiff_t left, | |||
| 873 | 892 | ||
| 874 | /* Temporarily switch to F's selected window at the time of the last | 893 | /* Temporarily switch to F's selected window at the time of the last |
| 875 | redisplay. */ | 894 | redisplay. */ |
| 876 | Fselect_window (f->old_selected_window, Qt); | 895 | select_window (f->old_selected_window, Qt); |
| 877 | 896 | ||
| 878 | /* Figure out where to start deleting from. */ | 897 | /* Figure out where to start deleting from. */ |
| 879 | 898 | ||
| @@ -963,7 +982,7 @@ really_set_point_and_mark (struct frame *f, ptrdiff_t point, | |||
| 963 | 982 | ||
| 964 | /* Temporarily switch to F's selected window at the time of the last | 983 | /* Temporarily switch to F's selected window at the time of the last |
| 965 | redisplay. */ | 984 | redisplay. */ |
| 966 | Fselect_window (f->old_selected_window, Qt); | 985 | select_window (f->old_selected_window, Qt); |
| 967 | 986 | ||
| 968 | if (point == PT) | 987 | if (point == PT) |
| 969 | { | 988 | { |
| @@ -1475,7 +1494,7 @@ get_extracted_text (struct frame *f, ptrdiff_t n, | |||
| 1475 | 1494 | ||
| 1476 | /* Temporarily switch to F's selected window at the time of the last | 1495 | /* Temporarily switch to F's selected window at the time of the last |
| 1477 | redisplay. */ | 1496 | redisplay. */ |
| 1478 | Fselect_window (f->old_selected_window, Qt); | 1497 | select_window (f->old_selected_window, Qt); |
| 1479 | buffer = NULL; | 1498 | buffer = NULL; |
| 1480 | 1499 | ||
| 1481 | /* Figure out the bounds of the text to return. */ | 1500 | /* Figure out the bounds of the text to return. */ |