[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/android 24f25fc2f88: Update Android port
From: |
Po Lu |
Subject: |
feature/android 24f25fc2f88: Update Android port |
Date: |
Sun, 11 Jun 2023 02:36:26 -0400 (EDT) |
branch: feature/android
commit 24f25fc2f8823b1999fa66e4b21601ee4000f321
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
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.
---
java/org/gnu/emacs/EmacsSurfaceView.java | 29 +++++++++++++++++++++++++----
src/textconv.c | 12 ++++++------
2 files changed, 31 insertions(+), 10 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;
public final class EmacsSurfaceView extends View
{
private static final String TAG = "EmacsSurfaceView";
+
+ /* The EmacsView representing the window that this surface is
+ displaying. */
private EmacsView view;
+
+ /* The complete buffer contents at the time of the last draw. */
private Bitmap frontBuffer;
+
+ /* Canvas representing the front buffer. */
private Canvas bitmapCanvas;
+
+ /* Reference to the last bitmap copied to the front buffer. */
private WeakReference<Bitmap> bitmap;
- private Paint bitmapPaint;
+
+ /* Paint objects used on the main and UI threads, respectively. */
+ private static final Paint bitmapPaint, uiThreadPaint;
+
+ static
+ {
+ /* Create two different Paint objects; one is used on the main
+ thread for buffer swaps, while the other is used from the UI
+ thread in `onDraw'. This is necessary because Paint objects
+ are not thread-safe, even if their uses are interlocked. */
+
+ bitmapPaint = new Paint ();
+ uiThreadPaint = new Paint ();
+ };
public
- EmacsSurfaceView (final EmacsView view)
+ EmacsSurfaceView (EmacsView view)
{
super (view.getContext ());
this.view = view;
- this.bitmapPaint = new Paint ();
this.bitmap = new WeakReference<Bitmap> (null);
}
@@ -161,6 +182,6 @@ public final class EmacsSurfaceView extends View
now. */
if (frontBuffer != null)
- canvas.drawBitmap (frontBuffer, 0f, 0f, bitmapPaint);
+ canvas.drawBitmap (frontBuffer, 0f, 0f, uiThreadPaint);
}
};
diff --git a/src/textconv.c b/src/textconv.c
index d86877b5515..6718568ac98 100644
--- a/src/textconv.c
+++ b/src/textconv.c
@@ -617,7 +617,7 @@ really_commit_text (struct frame *f, EMACS_INT position,
/* Now delete whatever needs to go. */
- del_range (start, end);
+ del_range_1 (start, end, true, false);
record_buffer_change (start, start, Qt);
/* Don't record changes if TEXT is empty. */
@@ -821,7 +821,7 @@ really_set_composing_text (struct frame *f, ptrdiff_t
position,
if (end != start)
{
- del_range (start, end);
+ del_range_1 (start, end, true, false);
set_point (start);
record_buffer_change (start, start, Qt);
}
@@ -841,7 +841,7 @@ really_set_composing_text (struct frame *f, ptrdiff_t
position,
its end. */
start = marker_position (f->conversion.compose_region_start);
end = marker_position (f->conversion.compose_region_end);
- del_range (start, end);
+ del_range_1 (start, end, true, false);
set_point (start);
if (start != end)
@@ -1041,7 +1041,7 @@ really_delete_surrounding_text (struct frame *f,
ptrdiff_t left,
start = max (BEGV, lstart - left);
end = min (ZV, rstart + right);
- text = del_range_1 (start, end, false, true);
+ text = del_range_1 (start, end, true, true);
record_buffer_change (start, start, text);
}
else
@@ -1051,14 +1051,14 @@ really_delete_surrounding_text (struct frame *f,
ptrdiff_t left,
start = rstart;
end = min (ZV, rstart + right);
- text = del_range_1 (start, end, false, true);
+ text = del_range_1 (start, end, true, true);
record_buffer_change (start, start, Qnil);
/* Now delete what must be deleted on the left. */
start = max (BEGV, lstart - left);
end = lstart;
- text = del_range_1 (start, end, false, true);
+ text = del_range_1 (start, end, true, true);
record_buffer_change (start, start, text);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- feature/android 24f25fc2f88: Update Android port,
Po Lu <=