mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Simplify management of Android handle IDs
* java/org/gnu/emacs/EmacsCursor.java (EmacsCursor): * java/org/gnu/emacs/EmacsGC.java (EmacsGC): * java/org/gnu/emacs/EmacsHandleObject.java (EmacsHandleObject): Remove HANDLE argument to constructor. * java/org/gnu/emacs/EmacsPixmap.java (EmacsPixmap): * java/org/gnu/emacs/EmacsWindow.java (EmacsWindow): * java/org/gnu/emacs/EmacsInputConnection.java (EmacsInputConnection) <windowHandle>: Change type to long. * java/org/gnu/emacs/EmacsNative.java (EmacsNative) (sendConfigureNotify, sendKeyPress, sendKeyRelease, sendFocusIn) (sendFocusOut, sendWindowAction, sendEnterNotify) (sendLeaveNotify, sendMotionNotify, sendButtonPress) (sendButtonRelease, sendTouchDown, sendTouchUp, sendTouchMove) (sendWheel, sendIconified, sendDeiconified, sendContextMenu) (sendExpose, sendDndDrag, sendDndUri, sendDndText) (beginBatchEdit, commitCompletion, endBatchEdit, commitText) (deleteSurroundingText, finishComposingText, replaceText) (getSelectedText, getTextAfterCursor, getTextBeforeCursor) (setComposingText, setComposingRegion, setSelection) (performEditorAction, performContextMenuAction, getExtractedText) (requestSelectionUpdate, requestCursorUpdates, clearInputFlags) (getSurroundingText, takeSnapshot, getSelection): Accept handles as longs, rather than shorts. All callers changed. * java/org/gnu/emacs/EmacsService.java (queryTree): Return handles as longs rather than shorts. (viewGetSelection): Take long WINDOW, not short. * src/android.c (struct android_emacs_handle): New structure. (handle_class): New variable. (android_init_emacs_service, android_init_emacs_pixmap) (android_init_emacs_gc_class, android_init_emacs_cursor): Adjust to match signature changes in constructors. (android_init_emacs_handle): New function. (initEmacs): Initialize the handle class, its fields and metods. (sendConfigureNotify, sendKeyPress, sendKeyRelease, sendFocusIn) (sendFocusOut, sendWindowAction, sendEnterNotify) (sendLeaveNotify, sendMotionNotify, sendButtonPress) (sendButtonRelease, sendTouchDown, sendTouchUp, sendTouchMove) (sendWheel, sendIconified, sendDeiconified, sendContextMenu) (sendExpose, sendDndDrag, sendDndUri, sendDndText): Update for changes to handle type. (android_alloc_id, android_resolve_handle) (android_resolve_handle2): Remove functions; replace the second with a macro that accepts one fewer argument. All callers changed. (android_destroy_handle): Cease indexing the handle list for the handle object. (android_globalize_reference): New function. (android_create_window, android_create_gc, android_create_pixmap) (android_create_font_cursor): Call android_globalize_reference to convert global references into handles. (android_free_cursor, android_destroy_window): Cease verifying the handle type. (android_copy_area): Check destination object type rather than handle entry. (android_query_tree): Adjust for changes to return types. (likely): Define __builtin_expect variant unconditionally. * src/android.h (android_resolve_handle): New macro. * src/androidgui.h (android_handle): Define to intptr_t. * src/androidterm.c (deleteSurroundingText, finishComposingText) (performEditorAction, performContextMenuAction, getExtractedText) (getSelectedText, requestSelectionUpdate, requestCursorUpdates) (clearInputFlags, getSurroundingText) (android_get_surrounding_text_internal): Accept handles as longs, not jshorts.
This commit is contained in:
parent
7a7dd87842
commit
139931fefb
18 changed files with 307 additions and 525 deletions
|
|
@ -440,8 +440,7 @@ public class EmacsActivity extends Activity
|
||||||
if (!EmacsContextMenu.itemAlreadySelected)
|
if (!EmacsContextMenu.itemAlreadySelected)
|
||||||
{
|
{
|
||||||
serial = EmacsContextMenu.lastMenuEventSerial;
|
serial = EmacsContextMenu.lastMenuEventSerial;
|
||||||
EmacsNative.sendContextMenu ((short) 0, 0,
|
EmacsNative.sendContextMenu (0, 0, serial);
|
||||||
serial);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onContextMenuClosed (menu);
|
super.onContextMenuClosed (menu);
|
||||||
|
|
|
||||||
|
|
@ -121,8 +121,7 @@ public final class EmacsContextMenu
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send a context menu event. */
|
/* Send a context menu event. */
|
||||||
EmacsNative.sendContextMenu ((short) 0, itemID,
|
EmacsNative.sendContextMenu (0, itemID, lastMenuEventSerial);
|
||||||
lastMenuEventSerial);
|
|
||||||
|
|
||||||
/* Say that an item has already been selected. */
|
/* Say that an item has already been selected. */
|
||||||
itemAlreadySelected = true;
|
itemAlreadySelected = true;
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,9 @@ public final class EmacsCursor extends EmacsHandleObject
|
||||||
public final PointerIcon icon;
|
public final PointerIcon icon;
|
||||||
|
|
||||||
public
|
public
|
||||||
EmacsCursor (short handle, int glyph)
|
EmacsCursor (int glyph)
|
||||||
{
|
{
|
||||||
super (handle);
|
super ();
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ public final class EmacsDialog implements DialogInterface.OnDismissListener
|
||||||
onClick (View view)
|
onClick (View view)
|
||||||
{
|
{
|
||||||
wasButtonClicked = true;
|
wasButtonClicked = true;
|
||||||
EmacsNative.sendContextMenu ((short) 0, id, menuEventSerial);
|
EmacsNative.sendContextMenu (0, id, menuEventSerial);
|
||||||
dismissDialog.dismiss ();
|
dismissDialog.dismiss ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,7 +102,7 @@ public final class EmacsDialog implements DialogInterface.OnDismissListener
|
||||||
onClick (DialogInterface dialog, int which)
|
onClick (DialogInterface dialog, int which)
|
||||||
{
|
{
|
||||||
wasButtonClicked = true;
|
wasButtonClicked = true;
|
||||||
EmacsNative.sendContextMenu ((short) 0, id, menuEventSerial);
|
EmacsNative.sendContextMenu (0, id, menuEventSerial);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -414,6 +414,6 @@ public final class EmacsDialog implements DialogInterface.OnDismissListener
|
||||||
if (wasButtonClicked)
|
if (wasButtonClicked)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EmacsNative.sendContextMenu ((short) 0, 0, menuEventSerial);
|
EmacsNative.sendContextMenu (0, 0, menuEventSerial);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -71,13 +71,13 @@ public final class EmacsGC extends EmacsHandleObject
|
||||||
/* The following fields are only set on immutable GCs. */
|
/* The following fields are only set on immutable GCs. */
|
||||||
|
|
||||||
public
|
public
|
||||||
EmacsGC (short handle)
|
EmacsGC ()
|
||||||
{
|
{
|
||||||
/* For historical reasons the C code has an extra layer of
|
/* For historical reasons the C code has an extra layer of
|
||||||
indirection above this GC handle. struct android_gc is the GC
|
indirection above this GC handle. struct android_gc is the GC
|
||||||
used by Emacs code, while android_gcontext is the type of the
|
used by Emacs code, while android_gcontext is the type of the
|
||||||
handle. */
|
handle. */
|
||||||
super (handle);
|
super ();
|
||||||
|
|
||||||
fill_style = GC_FILL_SOLID;
|
fill_style = GC_FILL_SOLID;
|
||||||
function = GC_COPY;
|
function = GC_COPY;
|
||||||
|
|
|
||||||
|
|
@ -33,14 +33,9 @@ public abstract class EmacsHandleObject
|
||||||
/* Whether or not this handle has been destroyed. */
|
/* Whether or not this handle has been destroyed. */
|
||||||
volatile boolean destroyed;
|
volatile boolean destroyed;
|
||||||
|
|
||||||
/* The handle associated with this object. */
|
/* The handle associated with this object, set in
|
||||||
public short handle;
|
android_globalize_reference. */
|
||||||
|
public long handle;
|
||||||
public
|
|
||||||
EmacsHandleObject (short handle)
|
|
||||||
{
|
|
||||||
this.handle = handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void
|
public void
|
||||||
destroyHandle () throws IllegalStateException
|
destroyHandle () throws IllegalStateException
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ public final class EmacsInputConnection implements InputConnection
|
||||||
private EmacsView view;
|
private EmacsView view;
|
||||||
|
|
||||||
/* The handle ID associated with that view's window. */
|
/* The handle ID associated with that view's window. */
|
||||||
private short windowHandle;
|
private long windowHandle;
|
||||||
|
|
||||||
/* Number of batch edits currently underway. Used to avoid
|
/* Number of batch edits currently underway. Used to avoid
|
||||||
synchronizing with the Emacs thread after each
|
synchronizing with the Emacs thread after each
|
||||||
|
|
|
||||||
|
|
@ -108,92 +108,92 @@ public final class EmacsNative
|
||||||
|
|
||||||
/* Send an ANDROID_CONFIGURE_NOTIFY event. The values of all the
|
/* Send an ANDROID_CONFIGURE_NOTIFY event. The values of all the
|
||||||
functions below are the serials of the events sent. */
|
functions below are the serials of the events sent. */
|
||||||
public static native long sendConfigureNotify (short window, long time,
|
public static native long sendConfigureNotify (long window, long time,
|
||||||
int x, int y, int width,
|
int x, int y, int width,
|
||||||
int height);
|
int height);
|
||||||
|
|
||||||
/* Send an ANDROID_KEY_PRESS event. */
|
/* Send an ANDROID_KEY_PRESS event. */
|
||||||
public static native long sendKeyPress (short window, long time, int state,
|
public static native long sendKeyPress (long window, long time, int state,
|
||||||
int keyCode, int unicodeChar);
|
int keyCode, int unicodeChar);
|
||||||
|
|
||||||
/* Send an ANDROID_KEY_RELEASE event. */
|
/* Send an ANDROID_KEY_RELEASE event. */
|
||||||
public static native long sendKeyRelease (short window, long time, int state,
|
public static native long sendKeyRelease (long window, long time, int state,
|
||||||
int keyCode, int unicodeChar);
|
int keyCode, int unicodeChar);
|
||||||
|
|
||||||
/* Send an ANDROID_FOCUS_IN event. */
|
/* Send an ANDROID_FOCUS_IN event. */
|
||||||
public static native long sendFocusIn (short window, long time);
|
public static native long sendFocusIn (long window, long time);
|
||||||
|
|
||||||
/* Send an ANDROID_FOCUS_OUT event. */
|
/* Send an ANDROID_FOCUS_OUT event. */
|
||||||
public static native long sendFocusOut (short window, long time);
|
public static native long sendFocusOut (long window, long time);
|
||||||
|
|
||||||
/* Send an ANDROID_WINDOW_ACTION event. */
|
/* Send an ANDROID_WINDOW_ACTION event. */
|
||||||
public static native long sendWindowAction (short window, int action);
|
public static native long sendWindowAction (long window, int action);
|
||||||
|
|
||||||
/* Send an ANDROID_ENTER_NOTIFY event. */
|
/* Send an ANDROID_ENTER_NOTIFY event. */
|
||||||
public static native long sendEnterNotify (short window, int x, int y,
|
public static native long sendEnterNotify (long window, int x, int y,
|
||||||
long time);
|
long time);
|
||||||
|
|
||||||
/* Send an ANDROID_LEAVE_NOTIFY event. */
|
/* Send an ANDROID_LEAVE_NOTIFY event. */
|
||||||
public static native long sendLeaveNotify (short window, int x, int y,
|
public static native long sendLeaveNotify (long window, int x, int y,
|
||||||
long time);
|
long time);
|
||||||
|
|
||||||
/* Send an ANDROID_MOTION_NOTIFY event. */
|
/* Send an ANDROID_MOTION_NOTIFY event. */
|
||||||
public static native long sendMotionNotify (short window, int x, int y,
|
public static native long sendMotionNotify (long window, int x, int y,
|
||||||
long time);
|
long time);
|
||||||
|
|
||||||
/* Send an ANDROID_BUTTON_PRESS event. */
|
/* Send an ANDROID_BUTTON_PRESS event. */
|
||||||
public static native long sendButtonPress (short window, int x, int y,
|
public static native long sendButtonPress (long window, int x, int y,
|
||||||
long time, int state,
|
long time, int state,
|
||||||
int button);
|
int button);
|
||||||
|
|
||||||
/* Send an ANDROID_BUTTON_RELEASE event. */
|
/* Send an ANDROID_BUTTON_RELEASE event. */
|
||||||
public static native long sendButtonRelease (short window, int x, int y,
|
public static native long sendButtonRelease (long window, int x, int y,
|
||||||
long time, int state,
|
long time, int state,
|
||||||
int button);
|
int button);
|
||||||
|
|
||||||
/* Send an ANDROID_TOUCH_DOWN event. */
|
/* Send an ANDROID_TOUCH_DOWN event. */
|
||||||
public static native long sendTouchDown (short window, int x, int y,
|
public static native long sendTouchDown (long window, int x, int y,
|
||||||
long time, int pointerID,
|
long time, int pointerID,
|
||||||
int flags);
|
int flags);
|
||||||
|
|
||||||
/* Send an ANDROID_TOUCH_UP event. */
|
/* Send an ANDROID_TOUCH_UP event. */
|
||||||
public static native long sendTouchUp (short window, int x, int y,
|
public static native long sendTouchUp (long window, int x, int y,
|
||||||
long time, int pointerID,
|
long time, int pointerID,
|
||||||
int flags);
|
int flags);
|
||||||
|
|
||||||
/* Send an ANDROID_TOUCH_MOVE event. */
|
/* Send an ANDROID_TOUCH_MOVE event. */
|
||||||
public static native long sendTouchMove (short window, int x, int y,
|
public static native long sendTouchMove (long window, int x, int y,
|
||||||
long time, int pointerID,
|
long time, int pointerID,
|
||||||
int flags);
|
int flags);
|
||||||
|
|
||||||
/* Send an ANDROID_WHEEL event. */
|
/* Send an ANDROID_WHEEL event. */
|
||||||
public static native long sendWheel (short window, int x, int y,
|
public static native long sendWheel (long window, int x, int y,
|
||||||
long time, int state,
|
long time, int state,
|
||||||
float xDelta, float yDelta);
|
float xDelta, float yDelta);
|
||||||
|
|
||||||
/* Send an ANDROID_ICONIFIED event. */
|
/* Send an ANDROID_ICONIFIED event. */
|
||||||
public static native long sendIconified (short window);
|
public static native long sendIconified (long window);
|
||||||
|
|
||||||
/* Send an ANDROID_DEICONIFIED event. */
|
/* Send an ANDROID_DEICONIFIED event. */
|
||||||
public static native long sendDeiconified (short window);
|
public static native long sendDeiconified (long window);
|
||||||
|
|
||||||
/* Send an ANDROID_CONTEXT_MENU event. */
|
/* Send an ANDROID_CONTEXT_MENU event. */
|
||||||
public static native long sendContextMenu (short window, int menuEventID,
|
public static native long sendContextMenu (long window, int menuEventID,
|
||||||
int menuEventSerial);
|
int menuEventSerial);
|
||||||
|
|
||||||
/* Send an ANDROID_EXPOSE event. */
|
/* Send an ANDROID_EXPOSE event. */
|
||||||
public static native long sendExpose (short window, int x, int y,
|
public static native long sendExpose (long window, int x, int y,
|
||||||
int width, int height);
|
int width, int height);
|
||||||
|
|
||||||
/* Send an ANDROID_DND_DRAG event. */
|
/* Send an ANDROID_DND_DRAG event. */
|
||||||
public static native long sendDndDrag (short window, int x, int y);
|
public static native long sendDndDrag (long window, int x, int y);
|
||||||
|
|
||||||
/* Send an ANDROID_DND_URI event. */
|
/* Send an ANDROID_DND_URI event. */
|
||||||
public static native long sendDndUri (short window, int x, int y,
|
public static native long sendDndUri (long window, int x, int y,
|
||||||
String text);
|
String text);
|
||||||
|
|
||||||
/* Send an ANDROID_DND_TEXT event. */
|
/* Send an ANDROID_DND_TEXT event. */
|
||||||
public static native long sendDndText (short window, int x, int y,
|
public static native long sendDndText (long window, int x, int y,
|
||||||
String text);
|
String text);
|
||||||
|
|
||||||
/* Send an ANDROID_NOTIFICATION_CANCELED event. */
|
/* Send an ANDROID_NOTIFICATION_CANCELED event. */
|
||||||
|
|
@ -241,48 +241,48 @@ public final class EmacsNative
|
||||||
/* Input connection functions. These mostly correspond to their
|
/* Input connection functions. These mostly correspond to their
|
||||||
counterparts in Android's InputConnection. */
|
counterparts in Android's InputConnection. */
|
||||||
|
|
||||||
public static native void beginBatchEdit (short window);
|
public static native void beginBatchEdit (long window);
|
||||||
public static native void endBatchEdit (short window);
|
public static native void endBatchEdit (long window);
|
||||||
public static native void commitCompletion (short window, String text,
|
public static native void commitCompletion (long window, String text,
|
||||||
int position);
|
int position);
|
||||||
public static native void commitText (short window, String text,
|
public static native void commitText (long window, String text,
|
||||||
int position);
|
int position);
|
||||||
public static native void deleteSurroundingText (short window,
|
public static native void deleteSurroundingText (long window,
|
||||||
int leftLength,
|
int leftLength,
|
||||||
int rightLength);
|
int rightLength);
|
||||||
public static native void finishComposingText (short window);
|
public static native void finishComposingText (long window);
|
||||||
public static native void replaceText (short window, int start, int end,
|
public static native void replaceText (long window, int start, int end,
|
||||||
String text, int newCursorPosition,
|
String text, int newCursorPosition,
|
||||||
TextAttribute attributes);
|
TextAttribute attributes);
|
||||||
public static native String getSelectedText (short window, int flags);
|
public static native String getSelectedText (long window, int flags);
|
||||||
public static native String getTextAfterCursor (short window, int length,
|
public static native String getTextAfterCursor (long window, int length,
|
||||||
int flags);
|
int flags);
|
||||||
public static native String getTextBeforeCursor (short window, int length,
|
public static native String getTextBeforeCursor (long window, int length,
|
||||||
int flags);
|
int flags);
|
||||||
public static native void setComposingText (short window, String text,
|
public static native void setComposingText (long window, String text,
|
||||||
int newCursorPosition);
|
int newCursorPosition);
|
||||||
public static native void setComposingRegion (short window, int start,
|
public static native void setComposingRegion (long window, int start,
|
||||||
int end);
|
int end);
|
||||||
public static native void setSelection (short window, int start, int end);
|
public static native void setSelection (long window, int start, int end);
|
||||||
public static native void performEditorAction (short window,
|
public static native void performEditorAction (long window,
|
||||||
int editorAction);
|
int editorAction);
|
||||||
public static native void performContextMenuAction (short window,
|
public static native void performContextMenuAction (long window,
|
||||||
int contextMenuAction);
|
int contextMenuAction);
|
||||||
public static native ExtractedText getExtractedText (short window,
|
public static native ExtractedText getExtractedText (long window,
|
||||||
ExtractedTextRequest req,
|
ExtractedTextRequest req,
|
||||||
int flags);
|
int flags);
|
||||||
public static native void requestSelectionUpdate (short window);
|
public static native void requestSelectionUpdate (long window);
|
||||||
public static native void requestCursorUpdates (short window, int mode);
|
public static native void requestCursorUpdates (long window, int mode);
|
||||||
public static native void clearInputFlags (short window);
|
public static native void clearInputFlags (long window);
|
||||||
public static native SurroundingText getSurroundingText (short window,
|
public static native SurroundingText getSurroundingText (long window,
|
||||||
int left, int right,
|
int left, int right,
|
||||||
int flags);
|
int flags);
|
||||||
public static native TextSnapshot takeSnapshot (short window);
|
public static native TextSnapshot takeSnapshot (long window);
|
||||||
|
|
||||||
|
|
||||||
/* Return the current value of the selection, or -1 upon
|
/* Return the current value of the selection, or -1 upon
|
||||||
failure. */
|
failure. */
|
||||||
public static native int[] getSelection (short window);
|
public static native int[] getSelection (long window);
|
||||||
|
|
||||||
|
|
||||||
/* Graphics functions used as replacements for potentially buggy
|
/* Graphics functions used as replacements for potentially buggy
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,9 @@ public final class EmacsPixmap extends EmacsHandleObject
|
||||||
private long gcClipRectID;
|
private long gcClipRectID;
|
||||||
|
|
||||||
public
|
public
|
||||||
EmacsPixmap (short handle, int width, int height, int depth)
|
EmacsPixmap (int width, int height, int depth)
|
||||||
{
|
{
|
||||||
super (handle);
|
super ();
|
||||||
|
|
||||||
if (depth != 1 && depth != 24)
|
if (depth != 1 && depth != 24)
|
||||||
throw new IllegalArgumentException ("Invalid depth specified"
|
throw new IllegalArgumentException ("Invalid depth specified"
|
||||||
|
|
|
||||||
|
|
@ -514,10 +514,10 @@ public final class EmacsService extends Service
|
||||||
vibrator.vibrate (duration);
|
vibrator.vibrate (duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public short[]
|
public long[]
|
||||||
queryTree (EmacsWindow window)
|
queryTree (EmacsWindow window)
|
||||||
{
|
{
|
||||||
short[] array;
|
long[] array;
|
||||||
List<EmacsWindow> windowList;
|
List<EmacsWindow> windowList;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -529,7 +529,7 @@ public final class EmacsService extends Service
|
||||||
|
|
||||||
synchronized (windowList)
|
synchronized (windowList)
|
||||||
{
|
{
|
||||||
array = new short[windowList.size () + 1];
|
array = new long[windowList.size () + 1];
|
||||||
i = 1;
|
i = 1;
|
||||||
|
|
||||||
array[0] = (window == null
|
array[0] = (window == null
|
||||||
|
|
@ -846,7 +846,7 @@ public final class EmacsService extends Service
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int[]
|
public static int[]
|
||||||
viewGetSelection (short window)
|
viewGetSelection (long window)
|
||||||
{
|
{
|
||||||
int[] selection;
|
int[] selection;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,11 +170,9 @@ public final class EmacsWindow extends EmacsHandleObject
|
||||||
public boolean preserve, previouslyAttached;
|
public boolean preserve, previouslyAttached;
|
||||||
|
|
||||||
public
|
public
|
||||||
EmacsWindow (short handle, final EmacsWindow parent, int x, int y,
|
EmacsWindow (final EmacsWindow parent, int x, int y,
|
||||||
int width, int height, boolean overrideRedirect)
|
int width, int height, boolean overrideRedirect)
|
||||||
{
|
{
|
||||||
super (handle);
|
|
||||||
|
|
||||||
rect = new Rect (x, y, x + width, y + height);
|
rect = new Rect (x, y, x + width, y + height);
|
||||||
pointerMap = new SparseArray<Coordinate> ();
|
pointerMap = new SparseArray<Coordinate> ();
|
||||||
|
|
||||||
|
|
@ -205,7 +203,7 @@ public final class EmacsWindow extends EmacsHandleObject
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
scratchGC = new EmacsGC ((short) 0);
|
scratchGC = new EmacsGC ();
|
||||||
|
|
||||||
/* Create the map of input method-committed strings. Keep at most
|
/* Create the map of input method-committed strings. Keep at most
|
||||||
ten strings in the map. */
|
ten strings in the map. */
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ public final class EmacsWindowManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EmacsNative.sendWindowAction ((short) 0, 0);
|
EmacsNative.sendWindowAction (0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void
|
public synchronized void
|
||||||
|
|
|
||||||
560
src/android.c
560
src/android.c
File diff suppressed because it is too large
Load diff
|
|
@ -101,16 +101,9 @@ extern ssize_t android_readlinkat (int, const char *restrict, char *restrict,
|
||||||
extern double android_pixel_density_x, android_pixel_density_y;
|
extern double android_pixel_density_x, android_pixel_density_y;
|
||||||
extern double android_scaled_pixel_density;
|
extern double android_scaled_pixel_density;
|
||||||
|
|
||||||
enum android_handle_type
|
verify (sizeof (android_handle) == sizeof (jobject));
|
||||||
{
|
#define android_resolve_handle(handle) ((jobject) (handle))
|
||||||
ANDROID_HANDLE_WINDOW,
|
|
||||||
ANDROID_HANDLE_GCONTEXT,
|
|
||||||
ANDROID_HANDLE_PIXMAP,
|
|
||||||
ANDROID_HANDLE_CURSOR,
|
|
||||||
};
|
|
||||||
|
|
||||||
extern jobject android_resolve_handle (android_handle,
|
|
||||||
enum android_handle_type);
|
|
||||||
extern unsigned char *android_lock_bitmap (android_drawable,
|
extern unsigned char *android_lock_bitmap (android_drawable,
|
||||||
AndroidBitmapInfo *,
|
AndroidBitmapInfo *,
|
||||||
jobject *);
|
jobject *);
|
||||||
|
|
|
||||||
|
|
@ -657,10 +657,8 @@ androidfont_draw (struct glyph_string *s, int from, int to,
|
||||||
verify (sizeof (unsigned int) == sizeof (jint));
|
verify (sizeof (unsigned int) == sizeof (jint));
|
||||||
info = (struct androidfont_info *) s->font;
|
info = (struct androidfont_info *) s->font;
|
||||||
|
|
||||||
gcontext = android_resolve_handle (s->gc->gcontext,
|
gcontext = android_resolve_handle (s->gc->gcontext);
|
||||||
ANDROID_HANDLE_GCONTEXT);
|
drawable = android_resolve_handle (FRAME_ANDROID_DRAWABLE (s->f));
|
||||||
drawable = android_resolve_handle (FRAME_ANDROID_DRAWABLE (s->f),
|
|
||||||
ANDROID_HANDLE_WINDOW);
|
|
||||||
chars = (*android_java_env)->NewIntArray (android_java_env,
|
chars = (*android_java_env)->NewIntArray (android_java_env,
|
||||||
to - from);
|
to - from);
|
||||||
android_exception_check ();
|
android_exception_check ();
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
#ifndef _ANDROID_GUI_H_
|
#ifndef _ANDROID_GUI_H_
|
||||||
#define _ANDROID_GUI_H_
|
#define _ANDROID_GUI_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
struct android_char_struct
|
struct android_char_struct
|
||||||
{
|
{
|
||||||
int rbearing;
|
int rbearing;
|
||||||
|
|
@ -30,7 +32,8 @@ struct android_char_struct
|
||||||
|
|
||||||
typedef struct android_char_struct XCharStruct;
|
typedef struct android_char_struct XCharStruct;
|
||||||
|
|
||||||
typedef unsigned short android_handle;
|
/* Handles are but JNI handles cast to intptr_t. */
|
||||||
|
typedef intptr_t android_handle;
|
||||||
|
|
||||||
typedef android_handle android_pixmap, Emacs_Pixmap;
|
typedef android_handle android_pixmap, Emacs_Pixmap;
|
||||||
typedef android_handle android_window, Emacs_Window;
|
typedef android_handle android_window, Emacs_Window;
|
||||||
|
|
|
||||||
|
|
@ -488,8 +488,7 @@ android_menu_show (struct frame *f, int x, int y, int menuflags,
|
||||||
unbind_to (count1, Qnil);
|
unbind_to (count1, Qnil);
|
||||||
|
|
||||||
/* Now, display the context menu. */
|
/* Now, display the context menu. */
|
||||||
window = android_resolve_handle (FRAME_ANDROID_WINDOW (f),
|
window = android_resolve_handle (FRAME_ANDROID_WINDOW (f));
|
||||||
ANDROID_HANDLE_WINDOW);
|
|
||||||
rc = (*env)->CallNonvirtualBooleanMethod (env, context_menu,
|
rc = (*env)->CallNonvirtualBooleanMethod (env, context_menu,
|
||||||
menu_class.class,
|
menu_class.class,
|
||||||
menu_class.display,
|
menu_class.display,
|
||||||
|
|
|
||||||
|
|
@ -4925,7 +4925,7 @@ android_copy_java_string (JNIEnv *env, jstring string, size_t *length)
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
NATIVE_NAME (beginBatchEdit) (JNIEnv *env, jobject object, jshort window)
|
NATIVE_NAME (beginBatchEdit) (JNIEnv *env, jobject object, jlong window)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
||||||
|
|
@ -4946,7 +4946,7 @@ NATIVE_NAME (beginBatchEdit) (JNIEnv *env, jobject object, jshort window)
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
NATIVE_NAME (endBatchEdit) (JNIEnv *env, jobject object, jshort window)
|
NATIVE_NAME (endBatchEdit) (JNIEnv *env, jobject object, jlong window)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
||||||
|
|
@ -4967,7 +4967,7 @@ NATIVE_NAME (endBatchEdit) (JNIEnv *env, jobject object, jshort window)
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
NATIVE_NAME (commitCompletion) (JNIEnv *env, jobject object, jshort window,
|
NATIVE_NAME (commitCompletion) (JNIEnv *env, jobject object, jlong window,
|
||||||
jstring completion_text, jint position)
|
jstring completion_text, jint position)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
@ -5001,7 +5001,7 @@ NATIVE_NAME (commitCompletion) (JNIEnv *env, jobject object, jshort window,
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
NATIVE_NAME (commitText) (JNIEnv *env, jobject object, jshort window,
|
NATIVE_NAME (commitText) (JNIEnv *env, jobject object, jlong window,
|
||||||
jstring commit_text, jint position)
|
jstring commit_text, jint position)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
@ -5036,7 +5036,7 @@ NATIVE_NAME (commitText) (JNIEnv *env, jobject object, jshort window,
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
NATIVE_NAME (deleteSurroundingText) (JNIEnv *env, jobject object,
|
NATIVE_NAME (deleteSurroundingText) (JNIEnv *env, jobject object,
|
||||||
jshort window, jint left_length,
|
jlong window, jint left_length,
|
||||||
jint right_length)
|
jint right_length)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
@ -5059,7 +5059,7 @@ NATIVE_NAME (deleteSurroundingText) (JNIEnv *env, jobject object,
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
NATIVE_NAME (finishComposingText) (JNIEnv *env, jobject object,
|
NATIVE_NAME (finishComposingText) (JNIEnv *env, jobject object,
|
||||||
jshort window)
|
jlong window)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
||||||
|
|
@ -5080,7 +5080,7 @@ NATIVE_NAME (finishComposingText) (JNIEnv *env, jobject object,
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
NATIVE_NAME (replaceText) (JNIEnv *env, jobject object, jshort window,
|
NATIVE_NAME (replaceText) (JNIEnv *env, jobject object, jlong window,
|
||||||
jint start, jint end, jobject text,
|
jint start, jint end, jobject text,
|
||||||
int new_cursor_position, jobject attribute)
|
int new_cursor_position, jobject attribute)
|
||||||
{
|
{
|
||||||
|
|
@ -5246,7 +5246,7 @@ android_text_to_string (JNIEnv *env, char *buffer, ptrdiff_t n,
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
NATIVE_NAME (getTextAfterCursor) (JNIEnv *env, jobject object, jshort window,
|
NATIVE_NAME (getTextAfterCursor) (JNIEnv *env, jobject object, jlong window,
|
||||||
jint length, jint flags)
|
jint length, jint flags)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
@ -5290,7 +5290,7 @@ NATIVE_NAME (getTextAfterCursor) (JNIEnv *env, jobject object, jshort window,
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
NATIVE_NAME (getTextBeforeCursor) (JNIEnv *env, jobject object, jshort window,
|
NATIVE_NAME (getTextBeforeCursor) (JNIEnv *env, jobject object, jlong window,
|
||||||
jint length, jint flags)
|
jint length, jint flags)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
@ -5334,7 +5334,7 @@ NATIVE_NAME (getTextBeforeCursor) (JNIEnv *env, jobject object, jshort window,
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
NATIVE_NAME (setComposingText) (JNIEnv *env, jobject object, jshort window,
|
NATIVE_NAME (setComposingText) (JNIEnv *env, jobject object, jlong window,
|
||||||
jstring composing_text,
|
jstring composing_text,
|
||||||
jint new_cursor_position)
|
jint new_cursor_position)
|
||||||
{
|
{
|
||||||
|
|
@ -5369,7 +5369,7 @@ NATIVE_NAME (setComposingText) (JNIEnv *env, jobject object, jshort window,
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
NATIVE_NAME (setComposingRegion) (JNIEnv *env, jobject object, jshort window,
|
NATIVE_NAME (setComposingRegion) (JNIEnv *env, jobject object, jlong window,
|
||||||
jint start, jint end)
|
jint start, jint end)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
@ -5391,7 +5391,7 @@ NATIVE_NAME (setComposingRegion) (JNIEnv *env, jobject object, jshort window,
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
NATIVE_NAME (setSelection) (JNIEnv *env, jobject object, jshort window,
|
NATIVE_NAME (setSelection) (JNIEnv *env, jobject object, jlong window,
|
||||||
jint start, jint end)
|
jint start, jint end)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
@ -5469,7 +5469,7 @@ android_get_selection (void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jintArray JNICALL
|
JNIEXPORT jintArray JNICALL
|
||||||
NATIVE_NAME (getSelection) (JNIEnv *env, jobject object, jshort window)
|
NATIVE_NAME (getSelection) (JNIEnv *env, jobject object, jlong window)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
||||||
|
|
@ -5508,7 +5508,7 @@ NATIVE_NAME (getSelection) (JNIEnv *env, jobject object, jshort window)
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
NATIVE_NAME (performEditorAction) (JNIEnv *env, jobject object,
|
NATIVE_NAME (performEditorAction) (JNIEnv *env, jobject object,
|
||||||
jshort window, int action)
|
jlong window, int action)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
||||||
|
|
@ -5560,7 +5560,7 @@ NATIVE_NAME (performEditorAction) (JNIEnv *env, jobject object,
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
NATIVE_NAME (performContextMenuAction) (JNIEnv *env, jobject object,
|
NATIVE_NAME (performContextMenuAction) (JNIEnv *env, jobject object,
|
||||||
jshort window, int action)
|
jlong window, int action)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
||||||
|
|
@ -5765,7 +5765,7 @@ android_build_extracted_text (jstring text, ptrdiff_t start,
|
||||||
|
|
||||||
JNIEXPORT jobject JNICALL
|
JNIEXPORT jobject JNICALL
|
||||||
NATIVE_NAME (getExtractedText) (JNIEnv *env, jobject ignored_object,
|
NATIVE_NAME (getExtractedText) (JNIEnv *env, jobject ignored_object,
|
||||||
jshort window, jobject request,
|
jlong window, jobject request,
|
||||||
jint flags)
|
jint flags)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
@ -5877,7 +5877,7 @@ NATIVE_NAME (getExtractedText) (JNIEnv *env, jobject ignored_object,
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
NATIVE_NAME (getSelectedText) (JNIEnv *env, jobject object,
|
NATIVE_NAME (getSelectedText) (JNIEnv *env, jobject object,
|
||||||
jshort window)
|
jlong window)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
||||||
|
|
@ -5907,7 +5907,7 @@ NATIVE_NAME (getSelectedText) (JNIEnv *env, jobject object,
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
NATIVE_NAME (requestSelectionUpdate) (JNIEnv *env, jobject object,
|
NATIVE_NAME (requestSelectionUpdate) (JNIEnv *env, jobject object,
|
||||||
jshort window)
|
jlong window)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
||||||
|
|
@ -5929,7 +5929,7 @@ NATIVE_NAME (requestSelectionUpdate) (JNIEnv *env, jobject object,
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
NATIVE_NAME (requestCursorUpdates) (JNIEnv *env, jobject object,
|
NATIVE_NAME (requestCursorUpdates) (JNIEnv *env, jobject object,
|
||||||
jshort window, jint mode)
|
jlong window, jint mode)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
||||||
|
|
@ -5958,7 +5958,7 @@ NATIVE_NAME (requestCursorUpdates) (JNIEnv *env, jobject object,
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
NATIVE_NAME (clearInputFlags) (JNIEnv *env, jobject object,
|
NATIVE_NAME (clearInputFlags) (JNIEnv *env, jobject object,
|
||||||
jshort window)
|
jlong window)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
||||||
|
|
@ -6073,7 +6073,7 @@ android_get_surrounding_text (void *data)
|
||||||
Value is the object upon success, else NULL. */
|
Value is the object upon success, else NULL. */
|
||||||
|
|
||||||
static jobject
|
static jobject
|
||||||
android_get_surrounding_text_internal (JNIEnv *env, jshort window,
|
android_get_surrounding_text_internal (JNIEnv *env, jlong window,
|
||||||
jint before_length,
|
jint before_length,
|
||||||
jint after_length,
|
jint after_length,
|
||||||
ptrdiff_t *conversion_start,
|
ptrdiff_t *conversion_start,
|
||||||
|
|
@ -6166,7 +6166,7 @@ android_get_surrounding_text_internal (JNIEnv *env, jshort window,
|
||||||
|
|
||||||
JNIEXPORT jobject JNICALL
|
JNIEXPORT jobject JNICALL
|
||||||
NATIVE_NAME (getSurroundingText) (JNIEnv *env, jobject object,
|
NATIVE_NAME (getSurroundingText) (JNIEnv *env, jobject object,
|
||||||
jshort window, jint before_length,
|
jlong window, jint before_length,
|
||||||
jint after_length, jint flags)
|
jint after_length, jint flags)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
@ -6176,7 +6176,7 @@ NATIVE_NAME (getSurroundingText) (JNIEnv *env, jobject object,
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jobject JNICALL
|
JNIEXPORT jobject JNICALL
|
||||||
NATIVE_NAME (takeSnapshot) (JNIEnv *env, jobject object, jshort window)
|
NATIVE_NAME (takeSnapshot) (JNIEnv *env, jobject object, jlong window)
|
||||||
{
|
{
|
||||||
JNI_STACK_ALIGNMENT_PROLOGUE;
|
JNI_STACK_ALIGNMENT_PROLOGUE;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue