1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-18 17:01:01 -08:00

Fix input method synchronization problems

* java/debug.sh (gdbserver_cmd, is_root): Prefer TCP again.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): New
function `queryAndSpin'.
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(icBeginSynchronous, icEndSynchronous, viewGetSelection): New
synchronization functions.
(resetIC, updateCursorAnchorInfo): Call those instead.
* java/org/gnu/emacs/EmacsView.java (onCreateInputConnection):
Call viewGetSelection.
* src/android.c (JNICALL, android_answer_query_spin): New
functions.
This commit is contained in:
Po Lu 2023-06-04 12:04:15 +08:00
parent c389df992a
commit 740af4668c
5 changed files with 123 additions and 38 deletions

View file

@ -630,12 +630,11 @@ public final class EmacsView extends ViewGroup
/* Obtain the current position of point and set it as the
selection. Don't do this under one specific situation: if
`android_update_ic' is being called in the main thread, trying
to synchronize with it can cause a dead lock in the IM
manager. */
to synchronize with it can cause a dead lock in the IM manager.
See icBeginSynchronous in EmacsService.java for more
details. */
EmacsService.imSyncInProgress = true;
selection = EmacsNative.getSelection (window.handle);
EmacsService.imSyncInProgress = false;
selection = EmacsService.viewGetSelection (window.handle);
if (selection != null)
Log.d (TAG, "onCreateInputConnection: current selection is: "
@ -664,6 +663,10 @@ public final class EmacsView extends ViewGroup
if (inputConnection == null)
inputConnection = new EmacsInputConnection (this);
else
/* Reset the composing region, in case there is still composing
text. */
inputConnection.finishComposingText ();
/* Return the input connection. */
return inputConnection;