* .gitignore: Don't ignore verbose.mk.android. * doc/emacs/Makefile.in (EMACSSOURCES): Add android.texi and input.texi. * doc/emacs/android.texi (Android): Document support for the on-screen keyboard. (Android Startup): Document how to start Emacs with -Q on Android. (Android Environment): Document how Emacs works around the system ``task killer''. Document changes to frame deletion behavior. * doc/emacs/emacs.texi (Top): * doc/emacs/input.texi (Other Input Devices, On-Screen Keyboards): Document how to use Emacs with virtual keyboards. * doc/lispref/commands.texi (Touchscreen Events): Document changes to `touch-screen-track-drag'. * doc/lispref/frames.texi (Frames, On-Screen Keyboards): New node. * java/AndroidManifest.xml.in: Add settings activity and appropriate OSK adjustment mode. * java/org/gnu/emacs/EmacsActivity.java (onCreate): Allow creating Emacs with -Q. (onDestroy): Don't remove if killed by the system. * java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems): Fix context menus again. * java/org/gnu/emacs/EmacsNative.java (EmacsNative): Make all event sending functions return long. * java/org/gnu/emacs/EmacsPreferencesActivity.java (EmacsPreferencesActivity): New class. * java/org/gnu/emacs/EmacsService.java (EmacsService) (onStartCommand, onCreate, startEmacsService): Start as a foreground service if necessary to bypass system restrictions. * java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView): * java/org/gnu/emacs/EmacsThread.java (EmacsThread, run): * java/org/gnu/emacs/EmacsView.java (EmacsView, onLayout) (onDetachedFromWindow): * java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, viewLayout): Implement frame resize synchronization.. * java/org/gnu/emacs/EmacsWindowAttachmentManager.java (EmacsWindowAttachmentManager, removeWindowConsumer): Adjust accordingly for changes to frame deletion behavior. * lisp/frame.el (android-toggle-on-screen-keyboard) (frame-toggle-on-screen-keyboard): New function. * lisp/minibuffer.el (minibuffer-setup-on-screen-keyboard) (minibuffer-exit-on-screen-keyboard): New functions. (minibuffer-setup-hook, minibuffer-exit-hook): Add new functions to hooks. * lisp/touch-screen.el (touch-screen-relative-xy): Accept new value of window `frame'. Return frame coordinates in that case. (touch-screen-set-point-commands): New variable. (touch-screen-handle-point-up): Respect that variable. (touch-screen-track-drag): Return `no-drag' where appropriate. (touch-screen-drag-mode-line-1, touch-screen-drag-mode-line): Refactor to use `no-drag'. * src/android.c (struct android_emacs_window): New methods. Make all event sending functions return the event serial. (android_toggle_on_screen_keyboard, android_window_updated): New functions. * src/android.h: Update prototypes. * src/androidfns.c (Fandroid_toggle_on_screen_keyboard) (syms_of_androidfns): New function. * src/androidgui.h (struct android_any_event) (struct android_key_event, struct android_configure_event) (struct android_focus_event, struct android_window_action_event) (struct android_crossing_event, struct android_motion_event) (struct android_button_event, struct android_touch_event) (struct android_wheel_event, struct android_iconify_event) (struct android_menu_event): Add `serial' fields. * src/androidterm.c (handle_one_android_event) (android_frame_up_to_date): * src/androidterm.h (struct android_output): Implement frame resize synchronization.
139 lines
4.8 KiB
Java
139 lines
4.8 KiB
Java
/* Communication module for Android terminals. -*- c-file-style: "GNU" -*-
|
|
|
|
Copyright (C) 2023 Free Software Foundation, Inc.
|
|
|
|
This file is part of GNU Emacs.
|
|
|
|
GNU Emacs is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or (at
|
|
your option) any later version.
|
|
|
|
GNU Emacs is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
|
|
|
package org.gnu.emacs;
|
|
|
|
import java.lang.System;
|
|
|
|
import android.content.res.AssetManager;
|
|
|
|
public class EmacsNative
|
|
{
|
|
/* Set certain parameters before initializing Emacs. This proves
|
|
that libemacs.so is being loaded from Java code.
|
|
|
|
assetManager must be the asset manager associated with the
|
|
context that is loading Emacs. It is saved and remains for the
|
|
remainder the lifetime of the Emacs process.
|
|
|
|
filesDir must be the package's data storage location for the
|
|
current Android user.
|
|
|
|
libDir must be the package's data storage location for native
|
|
libraries. It is used as PATH.
|
|
|
|
cacheDir must be the package's cache directory. It is used as
|
|
the `temporary-file-directory'.
|
|
|
|
pixelDensityX and pixelDensityY are the DPI values that will be
|
|
used by Emacs.
|
|
|
|
emacsService must be the emacsService singleton. */
|
|
public static native void setEmacsParams (AssetManager assetManager,
|
|
String filesDir,
|
|
String libDir,
|
|
String cacheDir,
|
|
float pixelDensityX,
|
|
float pixelDensityY,
|
|
EmacsService emacsService);
|
|
|
|
/* Initialize Emacs with the argument array ARGV. Each argument
|
|
must contain a NULL terminated string, or else the behavior is
|
|
undefined. */
|
|
public static native void initEmacs (String argv[]);
|
|
|
|
/* Abort and generate a native core dump. */
|
|
public static native void emacsAbort ();
|
|
|
|
/* Send an ANDROID_CONFIGURE_NOTIFY event. The values of all the
|
|
functions below are the serials of the events sent. */
|
|
public static native long sendConfigureNotify (short window, long time,
|
|
int x, int y, int width,
|
|
int height);
|
|
|
|
/* Send an ANDROID_KEY_PRESS event. */
|
|
public static native long sendKeyPress (short window, long time, int state,
|
|
int keyCode, int unicodeChar);
|
|
|
|
/* Send an ANDROID_KEY_RELEASE event. */
|
|
public static native long sendKeyRelease (short window, long time, int state,
|
|
int keyCode, int unicodeChar);
|
|
|
|
/* Send an ANDROID_FOCUS_IN event. */
|
|
public static native long sendFocusIn (short window, long time);
|
|
|
|
/* Send an ANDROID_FOCUS_OUT event. */
|
|
public static native long sendFocusOut (short window, long time);
|
|
|
|
/* Send an ANDROID_WINDOW_ACTION event. */
|
|
public static native long sendWindowAction (short window, int action);
|
|
|
|
/* Send an ANDROID_ENTER_NOTIFY event. */
|
|
public static native long sendEnterNotify (short window, int x, int y,
|
|
long time);
|
|
|
|
/* Send an ANDROID_LEAVE_NOTIFY event. */
|
|
public static native long sendLeaveNotify (short window, int x, int y,
|
|
long time);
|
|
|
|
/* Send an ANDROID_MOTION_NOTIFY event. */
|
|
public static native long sendMotionNotify (short window, int x, int y,
|
|
long time);
|
|
|
|
/* Send an ANDROID_BUTTON_PRESS event. */
|
|
public static native long sendButtonPress (short window, int x, int y,
|
|
long time, int state,
|
|
int button);
|
|
|
|
/* Send an ANDROID_BUTTON_RELEASE event. */
|
|
public static native long sendButtonRelease (short window, int x, int y,
|
|
long time, int state,
|
|
int button);
|
|
|
|
/* Send an ANDROID_TOUCH_DOWN event. */
|
|
public static native long sendTouchDown (short window, int x, int y,
|
|
long time, int pointerID);
|
|
|
|
/* Send an ANDROID_TOUCH_UP event. */
|
|
public static native long sendTouchUp (short window, int x, int y,
|
|
long time, int pointerID);
|
|
|
|
/* Send an ANDROID_TOUCH_MOVE event. */
|
|
public static native long sendTouchMove (short window, int x, int y,
|
|
long time, int pointerID);
|
|
|
|
/* Send an ANDROID_WHEEL event. */
|
|
public static native long sendWheel (short window, int x, int y,
|
|
long time, int state,
|
|
float xDelta, float yDelta);
|
|
|
|
/* Send an ANDROID_ICONIFIED event. */
|
|
public static native long sendIconified (short window);
|
|
|
|
/* Send an ANDROID_DEICONIFIED event. */
|
|
public static native long sendDeiconified (short window);
|
|
|
|
/* Send an ANDROID_CONTEXT_MENU event. */
|
|
public static native long sendContextMenu (short window, int menuEventID);
|
|
|
|
static
|
|
{
|
|
System.loadLibrary ("emacs");
|
|
};
|
|
};
|