mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-01 08:17:38 +00:00
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.
This commit is contained in:
parent
5abc977bbb
commit
24f25fc2f8
@ -38,19 +38,40 @@ own back buffers, which use too much memory (up to 96 MB for a
|
||||
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 @@ else if (bitmap != null)
|
||||
now. */
|
||||
|
||||
if (frontBuffer != null)
|
||||
canvas.drawBitmap (frontBuffer, 0f, 0f, bitmapPaint);
|
||||
canvas.drawBitmap (frontBuffer, 0f, 0f, uiThreadPaint);
|
||||
}
|
||||
};
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user