1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-19 01:10:57 -08:00

Update Android port

* java/org/gnu/emacs/EmacsView.java (EmacsView)
(prepareForLayout): New function.  Call this prior to mapping
the view.
(onGlobalLayout): New function.  Register as global layout
listener.
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow)
(notifyContentRectPosition): New function.  Use specified
xPosition and yPosition when reporting the offsets of children
of the root window.
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(registerWindow): Specify activity launch bounds if necessary.
* src/androidterm.c (handle_one_android_event): Send
MOVE_FRAME_EVENT where necessary.
This commit is contained in:
Po Lu 2023-03-18 10:54:26 +08:00
parent 773bdb15ab
commit 634e3fcc20
4 changed files with 160 additions and 63 deletions

View file

@ -28,6 +28,7 @@ import android.view.View;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
@ -51,6 +52,7 @@ import android.util.Log;
It is also a ViewGroup, as it also lays out children. */
public final class EmacsView extends ViewGroup
implements ViewTreeObserver.OnGlobalLayoutListener
{
public static final String TAG = "EmacsView";
@ -136,6 +138,9 @@ public final class EmacsView extends ViewGroup
context = getContext ();
tem = context.getSystemService (Context.INPUT_METHOD_SERVICE);
imManager = (InputMethodManager) tem;
/* Add this view as its own global layout listener. */
getViewTreeObserver ().addOnGlobalLayoutListener (this);
}
private void
@ -238,6 +243,13 @@ public final class EmacsView extends ViewGroup
return canvas;
}
public void
prepareForLayout (int wantedWidth, int wantedHeight)
{
measuredWidth = wantedWidth;
measuredHeight = wantedWidth;
}
@Override
protected void
onMeasure (int widthMeasureSpec, int heightMeasureSpec)
@ -562,8 +574,7 @@ public final class EmacsView extends ViewGroup
bitmapDirty = true;
/* Now expose the view contents again. */
EmacsNative.sendExpose (this.window.handle, 0, 0,
measuredWidth, measuredHeight);
EmacsNative.sendExpose (this.window.handle, 0, 0, 0, 0);
super.onAttachedToWindow ();
}
@ -678,4 +689,19 @@ public final class EmacsView extends ViewGroup
{
return icMode;
}
@Override
public void
onGlobalLayout ()
{
int[] locations;
/* Get the absolute offset of this view and specify its left and
top position in subsequent ConfigureNotify events. */
locations = new int[2];
getLocationInWindow (locations);
window.notifyContentRectPosition (locations[0],
locations[1]);
}
};