1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-12 22:40:46 -08:00
emacs/src/android.h
Po Lu 0bd4b7fdab 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.
2023-02-08 22:40:10 +08:00

128 lines
3.8 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* Android initialization for GNU Emacs.
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/>. */
/* On Android, Emacs is built as a shared library loaded from Java
using the Java Native Interface. Emacs's `main' function is
renamed `android_emacs_init', and runs with some modifications
inside a separate thread, communicating with the Java code through
a table of function pointers. */
#ifndef _ANDROID_H_
#ifndef ANDROID_STUBIFY
#include <jni.h>
#include <pwd.h>
#include <sys/stat.h>
#include <dirent.h>
#include <stdio.h>
#include <android/bitmap.h>
#include "androidgui.h"
#include "lisp.h"
#endif
extern bool android_init_gui;
#ifndef ANDROID_STUBIFY
extern int android_emacs_init (int, char **, char *);
extern int android_select (int, fd_set *, fd_set *, fd_set *,
struct timespec *);
extern int android_open (const char *, int, int);
extern char *android_user_full_name (struct passwd *);
extern int android_fstat (int, struct stat *);
extern int android_fstatat (int, const char *restrict,
struct stat *restrict, int);
extern int android_faccessat (int, const char *, int, int);
extern int android_close (int);
extern int android_fclose (FILE *);
extern const char *android_get_home_directory (void);
extern double android_pixel_density_x, android_pixel_density_y;
enum android_handle_type
{
ANDROID_HANDLE_WINDOW,
ANDROID_HANDLE_GCONTEXT,
ANDROID_HANDLE_PIXMAP,
};
extern jobject android_resolve_handle (android_handle,
enum android_handle_type);
extern unsigned char *android_lock_bitmap (android_window,
AndroidBitmapInfo *,
jobject *);
extern void android_damage_window (android_window,
struct android_rectangle *);
extern int android_get_screen_width (void);
extern int android_get_screen_height (void);
extern int android_get_mm_width (void);
extern int android_get_mm_height (void);
extern bool android_detect_mouse (void);
extern void android_set_dont_focus_on_map (android_window, bool);
extern void android_set_dont_accept_focus (android_window, bool);
extern jstring android_build_string (Lisp_Object);
extern jstring android_build_jstring (const char *);
extern void android_exception_check (void);
extern void android_get_keysym_name (int, char *, size_t);
extern void android_wait_event (void);
extern void android_toggle_on_screen_keyboard (android_window, bool);
extern _Noreturn void android_restart_emacs (void);
extern int android_get_current_api_level (void);
/* Directory listing emulation. */
struct android_dir;
extern struct android_dir *android_opendir (const char *);
extern int android_dirfd (struct android_dir *);
extern struct dirent *android_readdir (struct android_dir *);
extern void android_closedir (struct android_dir *);
/* Very miscellaneous functions. */
extern Lisp_Object android_browse_url (Lisp_Object);
#endif
/* JNI functions should not be built when Emacs is stubbed out for the
build. These should be documented in EmacsNative.java. */
#ifndef ANDROID_STUBIFY
#include <jni.h>
extern JNIEnv *android_java_env;
#define ANDROID_DELETE_LOCAL_REF(ref) \
((*android_java_env)->DeleteLocalRef (android_java_env, \
(ref)))
#define NATIVE_NAME(name) Java_org_gnu_emacs_EmacsNative_##name
#endif
#endif /* _ANDROID_H_ */