summaryrefslogtreecommitdiff
path: root/java/org/gnu/emacs/EmacsView.java
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2023-06-04 12:04:15 +0800
committerPo Lu <luangruo@yahoo.com>2023-06-04 12:04:15 +0800
commit740af4668c8d9bc8e4ee1e60ebeb366690fee93e (patch)
tree99d1b732788406053b9fbeb30609b3c4410d94d6 /java/org/gnu/emacs/EmacsView.java
parentc389df992a9f054f9aced4f9a267730b2221e03a (diff)
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.
Diffstat (limited to 'java/org/gnu/emacs/EmacsView.java')
-rw-r--r--java/org/gnu/emacs/EmacsView.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/java/org/gnu/emacs/EmacsView.java b/java/org/gnu/emacs/EmacsView.java
index bb450bb8e6b..c223dfa7911 100644
--- a/java/org/gnu/emacs/EmacsView.java
+++ b/java/org/gnu/emacs/EmacsView.java
@@ -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;