aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorPo Lu2023-06-11 14:35:13 +0800
committerPo Lu2023-06-11 14:35:13 +0800
commit24f25fc2f8823b1999fa66e4b21601ee4000f321 (patch)
tree73ffc3c062c2c8899b86d2973a5c985a83044084 /java
parent5abc977bbb2d38f3c607f1575e02aa7a6c483db0 (diff)
downloademacs-24f25fc2f8823b1999fa66e4b21601ee4000f321.tar.gz
emacs-24f25fc2f8823b1999fa66e4b21601ee4000f321.zip
Update Android port
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView): Document member variables. (onDraw): Use separate Paint object on the UI thread. * src/textconv.c (really_commit_text, really_set_composing_text) (really_delete_surrounding_text): Run modification hooks when deleting text.
Diffstat (limited to 'java')
-rw-r--r--java/org/gnu/emacs/EmacsSurfaceView.java29
1 files changed, 25 insertions, 4 deletions
diff --git a/java/org/gnu/emacs/EmacsSurfaceView.java b/java/org/gnu/emacs/EmacsSurfaceView.java
index 0deb930c2c2..738b1a99eef 100644
--- a/java/org/gnu/emacs/EmacsSurfaceView.java
+++ b/java/org/gnu/emacs/EmacsSurfaceView.java
@@ -38,19 +38,40 @@ import java.lang.ref.WeakReference;
38public final class EmacsSurfaceView extends View 38public final class EmacsSurfaceView extends View
39{ 39{
40 private static final String TAG = "EmacsSurfaceView"; 40 private static final String TAG = "EmacsSurfaceView";
41
42 /* The EmacsView representing the window that this surface is
43 displaying. */
41 private EmacsView view; 44 private EmacsView view;
45
46 /* The complete buffer contents at the time of the last draw. */
42 private Bitmap frontBuffer; 47 private Bitmap frontBuffer;
48
49 /* Canvas representing the front buffer. */
43 private Canvas bitmapCanvas; 50 private Canvas bitmapCanvas;
51
52 /* Reference to the last bitmap copied to the front buffer. */
44 private WeakReference<Bitmap> bitmap; 53 private WeakReference<Bitmap> bitmap;
45 private Paint bitmapPaint; 54
55 /* Paint objects used on the main and UI threads, respectively. */
56 private static final Paint bitmapPaint, uiThreadPaint;
57
58 static
59 {
60 /* Create two different Paint objects; one is used on the main
61 thread for buffer swaps, while the other is used from the UI
62 thread in `onDraw'. This is necessary because Paint objects
63 are not thread-safe, even if their uses are interlocked. */
64
65 bitmapPaint = new Paint ();
66 uiThreadPaint = new Paint ();
67 };
46 68
47 public 69 public
48 EmacsSurfaceView (final EmacsView view) 70 EmacsSurfaceView (EmacsView view)
49 { 71 {
50 super (view.getContext ()); 72 super (view.getContext ());
51 73
52 this.view = view; 74 this.view = view;
53 this.bitmapPaint = new Paint ();
54 this.bitmap = new WeakReference<Bitmap> (null); 75 this.bitmap = new WeakReference<Bitmap> (null);
55 } 76 }
56 77
@@ -161,6 +182,6 @@ public final class EmacsSurfaceView extends View
161 now. */ 182 now. */
162 183
163 if (frontBuffer != null) 184 if (frontBuffer != null)
164 canvas.drawBitmap (frontBuffer, 0f, 0f, bitmapPaint); 185 canvas.drawBitmap (frontBuffer, 0f, 0f, uiThreadPaint);
165 } 186 }
166}; 187};