aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorPo Lu2023-02-16 23:57:01 +0800
committerPo Lu2023-02-16 23:57:01 +0800
commit2dcce30290dc7782e9de3b4adf59f38b42408c98 (patch)
tree67b79ee1049c8fa31c8fdc2c9c67df77ac4e86ee /java
parentcf24b61985c26cbf2e5a24cb0b64a8528aa3a9cc (diff)
downloademacs-2dcce30290dc7782e9de3b4adf59f38b42408c98.tar.gz
emacs-2dcce30290dc7782e9de3b4adf59f38b42408c98.zip
Update Android port
* doc/emacs/android.texi (Android Fonts): * doc/emacs/input.texi (On-Screen Keyboards): * doc/lispref/commands.texi (Misc Events): Update documentation. * java/org/gnu/emacs/EmacsInputConnection.java (setSelection): New function. * java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView) (reconfigureFrontBuffer): Make bitmap references weak references. * java/org/gnu/emacs/EmacsView.java (handleDirtyBitmap): Don't clear surfaceView bitmap. * lisp/comint.el (comint-mode): * lisp/international/fontset.el (script-representative-chars) (setup-default-fontset): Improve detection of CJK fonts. * lisp/isearch.el (set-text-conversion-style): New variable. (isearch-mode, isearch-done): Save and restore the text conversion style. * lisp/minibuffer.el (minibuffer-mode): Set an appropriate text conversion style. * lisp/simple.el (analyze-text-conversion): Run post-self-insert-hook properly. * lisp/subr.el (read-char-from-minibuffer): Disable text conversion when reading character. * src/androidterm.c (show_back_buffer): Don't check that F is not garbaged. (android_update_selection, android_reset_conversion): Use the ephemeral last point and handle text conversion being disabled. * src/buffer.c (syms_of_buffer): Convert old style DEFVAR. * src/keyboard.c (kbd_buffer_get_event): Handle text conversion first. * src/lisp.h: Update prototypes. * src/lread.c (read_filtered_event): Temporarily disable text conversion. * src/sfnt.c (sfnt_decompose_glyph_1, sfnt_decompose_glyph_2): New functions. (sfnt_decompose_glyph, sfnt_decompose_instructed_outline): Refactor contour decomposition to those two functions. (main): Update tests. * src/sfntfont-android.c (system_font_directories): Add empty field. (Fandroid_enumerate_fonts, init_sfntfont_android): Enumerate fonts in a user fonts directory. * src/sfntfont.c (struct sfnt_font_desc): New field `num_glyphs'. (sfnt_enum_font_1): Set num_glyphs and avoid duplicate fonts. (sfntfont_glyph_valid): New function. (sfntfont_lookup_char, sfntfont_list_1): Make sure glyphs found are valid. * src/textconv.c (sync_overlay, really_commit_text) (really_set_composing_text, really_set_composing_region) (really_delete_surrounding_text, really_set_point_and_mark) (handle_pending_conversion_events_1) (handle_pending_conversion_events, conversion_disabled_p) (disable_text_conversion, resume_text_conversion) (Fset_text_conversion_style, syms_of_textconv): Update to respect new options. * src/textconv.h: * src/window.h (GCALIGNED_STRUCT): New field `ephemeral_last_point'. * src/xdisp.c (mark_window_display_accurate_1): Set it.
Diffstat (limited to 'java')
-rw-r--r--java/org/gnu/emacs/EmacsInputConnection.java14
-rw-r--r--java/org/gnu/emacs/EmacsSurfaceView.java17
-rw-r--r--java/org/gnu/emacs/EmacsView.java8
3 files changed, 24 insertions, 15 deletions
diff --git a/java/org/gnu/emacs/EmacsInputConnection.java b/java/org/gnu/emacs/EmacsInputConnection.java
index 5eb56d5aa71..e2a15894695 100644
--- a/java/org/gnu/emacs/EmacsInputConnection.java
+++ b/java/org/gnu/emacs/EmacsInputConnection.java
@@ -173,7 +173,8 @@ public class EmacsInputConnection extends BaseInputConnection
173 setComposingText (CharSequence text, int newCursorPosition) 173 setComposingText (CharSequence text, int newCursorPosition)
174 { 174 {
175 if (EmacsService.DEBUG_IC) 175 if (EmacsService.DEBUG_IC)
176 Log.d (TAG, "setComposingText: " + newCursorPosition); 176 Log.d (TAG, ("setComposingText: "
177 + text + " ## " + newCursorPosition));
177 178
178 EmacsNative.setComposingText (windowHandle, text.toString (), 179 EmacsNative.setComposingText (windowHandle, text.toString (),
179 newCursorPosition); 180 newCursorPosition);
@@ -213,6 +214,17 @@ public class EmacsInputConnection extends BaseInputConnection
213 flags); 214 flags);
214 } 215 }
215 216
217 @Override
218 public boolean
219 setSelection (int start, int end)
220 {
221 if (EmacsService.DEBUG_IC)
222 Log.d (TAG, "setSelection: " + start + " " + end);
223
224 EmacsNative.setSelection (windowHandle, start, end);
225 return true;
226 }
227
216 228
217 /* Override functions which are not implemented. */ 229 /* Override functions which are not implemented. */
218 230
diff --git a/java/org/gnu/emacs/EmacsSurfaceView.java b/java/org/gnu/emacs/EmacsSurfaceView.java
index 2d80be0881a..62e927094e4 100644
--- a/java/org/gnu/emacs/EmacsSurfaceView.java
+++ b/java/org/gnu/emacs/EmacsSurfaceView.java
@@ -28,6 +28,8 @@ import android.graphics.Canvas;
28import android.graphics.Rect; 28import android.graphics.Rect;
29import android.graphics.Paint; 29import android.graphics.Paint;
30 30
31import java.lang.ref.WeakReference;
32
31/* This originally extended SurfaceView. However, doing so proved to 33/* This originally extended SurfaceView. However, doing so proved to
32 be too slow, and Android's surface view keeps up to three of its 34 be too slow, and Android's surface view keeps up to three of its
33 own back buffers, which use too much memory (up to 96 MB for a 35 own back buffers, which use too much memory (up to 96 MB for a
@@ -39,7 +41,7 @@ public class EmacsSurfaceView extends View
39 private EmacsView view; 41 private EmacsView view;
40 private Bitmap frontBuffer; 42 private Bitmap frontBuffer;
41 private Canvas bitmapCanvas; 43 private Canvas bitmapCanvas;
42 private Bitmap bitmap; 44 private WeakReference<Bitmap> bitmap;
43 private Paint bitmapPaint; 45 private Paint bitmapPaint;
44 46
45 public 47 public
@@ -49,10 +51,11 @@ public class EmacsSurfaceView extends View
49 51
50 this.view = view; 52 this.view = view;
51 this.bitmapPaint = new Paint (); 53 this.bitmapPaint = new Paint ();
54 this.bitmap = new WeakReference<Bitmap> (null);
52 } 55 }
53 56
54 private void 57 private void
55 copyToFrontBuffer (Rect damageRect) 58 copyToFrontBuffer (Bitmap bitmap, Rect damageRect)
56 { 59 {
57 if (damageRect != null) 60 if (damageRect != null)
58 bitmapCanvas.drawBitmap (bitmap, damageRect, damageRect, 61 bitmapCanvas.drawBitmap (bitmap, damageRect, damageRect,
@@ -73,7 +76,7 @@ public class EmacsSurfaceView extends View
73 bitmapCanvas = null; 76 bitmapCanvas = null;
74 } 77 }
75 78
76 this.bitmap = bitmap; 79 this.bitmap = new WeakReference<Bitmap> (bitmap);
77 80
78 /* Next, create the new front buffer if necessary. */ 81 /* Next, create the new front buffer if necessary. */
79 82
@@ -92,20 +95,20 @@ public class EmacsSurfaceView extends View
92 bitmapCanvas = new Canvas (frontBuffer); 95 bitmapCanvas = new Canvas (frontBuffer);
93 96
94 /* And copy over the bitmap contents. */ 97 /* And copy over the bitmap contents. */
95 copyToFrontBuffer (null); 98 copyToFrontBuffer (bitmap, null);
96 } 99 }
97 else if (bitmap != null) 100 else if (bitmap != null)
98 /* Just copy over the bitmap contents. */ 101 /* Just copy over the bitmap contents. */
99 copyToFrontBuffer (null); 102 copyToFrontBuffer (bitmap, null);
100 } 103 }
101 104
102 public synchronized void 105 public synchronized void
103 setBitmap (Bitmap bitmap, Rect damageRect) 106 setBitmap (Bitmap bitmap, Rect damageRect)
104 { 107 {
105 if (bitmap != this.bitmap) 108 if (bitmap != this.bitmap.get ())
106 reconfigureFrontBuffer (bitmap); 109 reconfigureFrontBuffer (bitmap);
107 else if (bitmap != null) 110 else if (bitmap != null)
108 copyToFrontBuffer (damageRect); 111 copyToFrontBuffer (bitmap, damageRect);
109 112
110 if (bitmap != null) 113 if (bitmap != null)
111 { 114 {
diff --git a/java/org/gnu/emacs/EmacsView.java b/java/org/gnu/emacs/EmacsView.java
index 52da6d41f7d..5ea8b0dcc0e 100644
--- a/java/org/gnu/emacs/EmacsView.java
+++ b/java/org/gnu/emacs/EmacsView.java
@@ -186,13 +186,7 @@ public class EmacsView extends ViewGroup
186 /* Explicitly free the old bitmap's memory. */ 186 /* Explicitly free the old bitmap's memory. */
187 187
188 if (oldBitmap != null) 188 if (oldBitmap != null)
189 { 189 oldBitmap.recycle ();
190 oldBitmap.recycle ();
191
192 /* Make sure to set the view's bitmap to the new bitmap, or
193 ugly flicker can result. */
194 surfaceView.setBitmap (bitmap, null);
195 }
196 190
197 /* Some Android versions still don't free the bitmap until the 191 /* Some Android versions still don't free the bitmap until the
198 next GC. */ 192 next GC. */