mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-25 15:00:45 -08:00
Update Android port
* doc/lispref/frames.texi (On-Screen Keyboards): Describe return value of `frame-toggle-on-screen-keyboard'. * java/org/gnu/emacs/EmacsSurfaceView.java (surfaceChanged) (surfaceCreated, EmacsSurfaceView): Remove unuseful synchronization code. The framework doesn't seem to look at this at all. * java/org/gnu/emacs/EmacsView.java (EmacsView): (onLayout): Lay out the window after children. (swapBuffers): Properly implement `force'. (windowUpdated): Delete function. * lisp/frame.el (frame-toggle-on-screen-keyboard): Return whether or not the on screen keyboard might've been displayed. * lisp/minibuffer.el (minibuffer-on-screen-keyboard-timer): (minibuffer-on-screen-keyboard-displayed): (minibuffer-setup-on-screen-keyboard): (minibuffer-exit-on-screen-keyboard): Improve OSK dismissal when there are consecutive minibuffers. * lisp/touch-screen.el (touch-screen-window-selection-changed): New function. (touch-screen-handle-point-up): Register it as a window selection changed function. * src/android.c (struct android_emacs_window) (android_init_emacs_window): Remove references to `windowUpdated'. (android_window_updated): Delete function. * src/android.h (struct android_output): Remove `last_configure_serial'. * src/androidterm.c (handle_one_android_event) (android_frame_up_to_date): * src/androidterm.h (struct android_output): Remove frame synchronization, as that does not work on Android.
This commit is contained in:
parent
7fb0df0ce2
commit
0bd4b7fdab
10 changed files with 94 additions and 135 deletions
|
|
@ -45,14 +45,11 @@ public class EmacsSurfaceView extends SurfaceView
|
|||
surfaceChanged (SurfaceHolder holder, int format,
|
||||
int width, int height)
|
||||
{
|
||||
Log.d (TAG, "surfaceChanged: " + view + ", " + view.pendingConfigure);
|
||||
Canvas canvas;
|
||||
|
||||
/* Make sure not to swap buffers if there is pending
|
||||
configuration, because otherwise the redraw callback will not
|
||||
run correctly. */
|
||||
Log.d (TAG, "surfaceChanged: " + view + ", ");
|
||||
|
||||
if (view.pendingConfigure == 0)
|
||||
view.swapBuffers ();
|
||||
view.swapBuffers (true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -67,7 +64,7 @@ public class EmacsSurfaceView extends SurfaceView
|
|||
|
||||
/* Drop the lock when doing this, or a deadlock can
|
||||
result. */
|
||||
view.swapBuffers ();
|
||||
view.swapBuffers (true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -82,44 +79,6 @@ public class EmacsSurfaceView extends SurfaceView
|
|||
}
|
||||
}
|
||||
|
||||
/* And this is the callback used on Android 26 and later. It is
|
||||
used because it can tell the system when drawing completes. */
|
||||
|
||||
private class Callback2 extends Callback implements SurfaceHolder.Callback2
|
||||
{
|
||||
@Override
|
||||
public void
|
||||
surfaceRedrawNeeded (SurfaceHolder holder)
|
||||
{
|
||||
/* This version is not supported. */
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void
|
||||
surfaceRedrawNeededAsync (SurfaceHolder holder,
|
||||
Runnable drawingFinished)
|
||||
{
|
||||
Runnable old;
|
||||
|
||||
Log.d (TAG, "surfaceRedrawNeededAsync: " + view.pendingConfigure);
|
||||
|
||||
/* The system calls this function when it wants to know whether
|
||||
or not Emacs is still configuring itself in response to a
|
||||
resize.
|
||||
|
||||
If the view did not send an outstanding ConfigureNotify
|
||||
event, then call drawingFinish immediately. Else, give it to
|
||||
the view to execute after drawing completes. */
|
||||
|
||||
if (view.pendingConfigure == 0)
|
||||
drawingFinished.run ();
|
||||
else
|
||||
/* And set this runnable to run once drawing completes. */
|
||||
view.drawingFinished = drawingFinished;
|
||||
}
|
||||
}
|
||||
|
||||
public
|
||||
EmacsSurfaceView (final EmacsView view)
|
||||
{
|
||||
|
|
@ -128,10 +87,7 @@ public class EmacsSurfaceView extends SurfaceView
|
|||
this.surfaceChangeLock = new Object ();
|
||||
this.view = view;
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
|
||||
getHolder ().addCallback (new Callback ());
|
||||
else
|
||||
getHolder ().addCallback (new Callback2 ());
|
||||
getHolder ().addCallback (new Callback ());
|
||||
}
|
||||
|
||||
public boolean
|
||||
|
|
|
|||
|
|
@ -96,13 +96,6 @@ public class EmacsView extends ViewGroup
|
|||
/* The InputMethodManager for this view's context. */
|
||||
private InputMethodManager imManager;
|
||||
|
||||
/* Runnable that will run once drawing completes. */
|
||||
public Runnable drawingFinished;
|
||||
|
||||
/* Serial of the last ConfigureNotify event sent that Emacs has not
|
||||
yet responded to. 0 if there is no such outstanding event. */
|
||||
public long pendingConfigure;
|
||||
|
||||
/* Whether or not this view is attached to a window. */
|
||||
public boolean isAttachedToWindow;
|
||||
|
||||
|
|
@ -110,6 +103,14 @@ public class EmacsView extends ViewGroup
|
|||
displayed whenever possible. */
|
||||
public boolean isCurrentlyTextEditor;
|
||||
|
||||
/* An empty rectangle. */
|
||||
public static final Rect emptyRect;
|
||||
|
||||
static
|
||||
{
|
||||
emptyRect = new Rect ();
|
||||
};
|
||||
|
||||
public
|
||||
EmacsView (EmacsWindow window)
|
||||
{
|
||||
|
|
@ -286,16 +287,10 @@ public class EmacsView extends ViewGroup
|
|||
int count, i;
|
||||
View child;
|
||||
Rect windowRect;
|
||||
int wantedWidth, wantedHeight;
|
||||
|
||||
count = getChildCount ();
|
||||
|
||||
if (changed || mustReportLayout)
|
||||
{
|
||||
mustReportLayout = false;
|
||||
pendingConfigure
|
||||
= window.viewLayout (left, top, right, bottom);
|
||||
}
|
||||
|
||||
measuredWidth = right - left;
|
||||
measuredHeight = bottom - top;
|
||||
|
||||
|
|
@ -311,8 +306,6 @@ public class EmacsView extends ViewGroup
|
|||
Log.d (TAG, "onLayout: " + child);
|
||||
|
||||
if (child == surfaceView)
|
||||
/* The child is the surface view, so give it the entire
|
||||
view. */
|
||||
child.layout (0, 0, right - left, bottom - top);
|
||||
else if (child.getVisibility () != GONE)
|
||||
{
|
||||
|
|
@ -326,6 +319,14 @@ public class EmacsView extends ViewGroup
|
|||
windowRect.right, windowRect.bottom);
|
||||
}
|
||||
}
|
||||
|
||||
/* Now report the layout change to the window. */
|
||||
|
||||
if (changed || mustReportLayout)
|
||||
{
|
||||
mustReportLayout = false;
|
||||
window.viewLayout (left, top, right, bottom);
|
||||
}
|
||||
}
|
||||
|
||||
public void
|
||||
|
|
@ -352,7 +353,7 @@ public class EmacsView extends ViewGroup
|
|||
|
||||
synchronized (damageRegion)
|
||||
{
|
||||
if (damageRegion.isEmpty ())
|
||||
if (!force && damageRegion.isEmpty ())
|
||||
return;
|
||||
|
||||
bitmap = getBitmap ();
|
||||
|
|
@ -363,7 +364,10 @@ public class EmacsView extends ViewGroup
|
|||
|
||||
synchronized (surfaceView.surfaceChangeLock)
|
||||
{
|
||||
damageRect = damageRegion.getBounds ();
|
||||
if (!force)
|
||||
damageRect = damageRegion.getBounds ();
|
||||
else
|
||||
damageRect = emptyRect;
|
||||
|
||||
if (!surfaceView.isCreated ())
|
||||
return;
|
||||
|
|
@ -612,24 +616,6 @@ public class EmacsView extends ViewGroup
|
|||
isCurrentlyTextEditor = false;
|
||||
}
|
||||
|
||||
public void
|
||||
windowUpdated (long serial)
|
||||
{
|
||||
Log.d (TAG, "windowUpdated: serial is " + serial);
|
||||
|
||||
if (pendingConfigure <= serial
|
||||
/* Detect wraparound. */
|
||||
|| pendingConfigure - serial >= 0x7fffffff)
|
||||
{
|
||||
pendingConfigure = 0;
|
||||
|
||||
if (drawingFinished != null)
|
||||
drawingFinished.run ();
|
||||
|
||||
drawingFinished = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputConnection
|
||||
onCreateInputConnection (EditorInfo info)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue