1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-29 07:58:28 +00:00
emacs/ChangeLog.android

7280 lines
258 KiB
Plaintext

2023-08-07 Po Lu <luangruo@yahoo.com>
* nt/mingw-cfg.site: Remove additions for Gnulib printf.
* m4, lib: Update from Gnulib.
* msdos/sedlibmk.inp: Remove variables deleted as part of previous
change.
* admin/merge-gnulib (GNULIB_MODULES): Remove vasprintf and
printf-posix.
2023-08-06 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsService.java (readDirectoryEntry): Fix
potential NULL dereference.
* java/org/gnu/emacs/EmacsSafThread.java (openDocument1): If
initially opening with rwt, verify the file descriptor is really
writable; if not, resort to rw and truncating the file descriptor
by hand instead.
* src/androidvfs.c (NATIVE_NAME (ftruncate)): New function.
Truncate file descriptor and return whether that was successful.
* src/androidvfs.c (android_saf_tree_chmod): Repair file access
permissions allowed within FLAGS.
2023-08-05 Po Lu <luangruo@yahoo.com>
* doc/lispref/commands.texi (Touchscreen Events): Fix typo.
* lisp/subr.el (y-or-n-p): Don't call set-text-conversion-style
when not present.
2023-08-04 Po Lu <luangruo@yahoo.com>
* ChangeLog.android: New file.
2023-08-04 Po Lu <luangruo@yahoo.com>
* src/androidvfs.c (android_verify_jni_string): Move to
android.c.
* src/android.c (android_verify_jni_string): New function.
(android_build_string): Forgo encoding menu text if TEXT is a
multibyte string that's also a valid JNI string.
* src/android.h: Update prototypes.
* java/org/gnu/emacs/EmacsService.java (getDocumentTrees): Don't
encode some characters that need not be escaped within file
names.
2023-08-03 Po Lu <luangruo@yahoo.com>
* src/fileio.c (check_vfs_filename): Revert earlier change.
* src/android.h: Update prototypes.
* src/androidvfs.c (unix_vfs_ops, android_unix_chmod, afs_vfs_ops)
(android_afs_chmod, content_vfs_ops, android_content_chmod)
(authority_vfs_ops, android_authority_chmod, saf_root_vfs_ops)
(android_saf_root_chmod, saf_tree_vfs_ops, android_saf_tree_chmod)
(saf_file_vfs_ops, saf_new_vfs_ops, android_saf_new_chmod)
(root_vfs_ops): Add `chmod' to the list of functions implemented
by each vnode.
(android_fchmodat): New function.
* src/fileio.c (Fset_file_modes): Use `emacs_fchmodat'.
* src/lisp.h:
* src/sysdep.c (emacs_fchmodat): Delegate to android_fchmodat on
Android.
* java/org/gnu/emacs/EmacsSafThread.java (CacheToplevel)
(EmacsSafThread, DocIdEntry, getCache, pruneCache)
(cacheDirectoryFromCursor, run, documentIdFromName1)
(statDocument1, openDocumentDirectory1, openDocument1): Introduce
a file status cache and populate it with files within directories
as they are opened.
* java/org/gnu/emacs/EmacsService.java (createDocument)
(createDirectory, moveDocument): Invalidate the file status cache
wherever needed.
* src/fileio.c (check_vfs_filename):
(Fset_file_modes): Permit `set-file-modes' to silently fail
on asset and content files.
2023-08-02 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android, What is Android?)
(Android Startup, Android File System, Android Environment)
(Android Windowing, Android Fonts, Android Troubleshooting):
Improve section titles.
(Android Windowing): Describe the relation between keyboard
modifiers reported by Android and those in key events.
* java/org/gnu/emacs/EmacsWindow.java (onKeyDown, onKeyUp):
Clear META_SYM_ON and META_META_MASK when retrieving ASCII
characters.
* src/androidgui.h: Add ANDROID_META_MASK.
* src/androidterm.c (android_android_to_emacs_modifiers)
(android_emacs_to_android_modifiers): Transform META to Alt, and
vice versa.
2023-08-01 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android File System): Describe how to
access real files named /assets or /contents if so required.
* java/org/gnu/emacs/EmacsService.java (validAuthority):
* src/android.c (android_init_emacs_service):
* src/android.h: New function.
* src/androidvfs.c (android_saf_valid_authority_p): New
function. Wrap the Java function.
(android_saf_root_stat, android_saf_root_access): Don't return
success if no authority by vp->authority's name exists.
(android_saf_tree_from_name): Check validity of string data
before giving it to JNI.
* src/sfnt.c (CHECK_STACK_AVAILABLE): New macro.
(PUSH, PUSH_UNCHECKED): Always define to unchecked versions,
even if TEST.
(PUSH2_UNCHECKED): New macro.
(NPUSHB, NPUSHW, PUSHB, PUSHW): Check the number of remaining
stack elements once.
(stack_overflow_test_args): Expect zero stack arguments.
* src/android.c (ANDROID_THROW): Remove unused macro.
2023-07-31 Po Lu <luangruo@yahoo.com>
* src/sfnt.c (ISECT): Micro-optimize this instruction.
* src/sfntfont.c (sfnt_parse_style): Avoid GC safety problem.
(sfnt_parse_style): Fix misworded commentary.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative):
* java/org/gnu/emacs/EmacsNoninteractive.java (main):
* java/org/gnu/emacs/EmacsService.java (run):
* java/org/gnu/emacs/EmacsThread.java (run):
* src/android.c (initEmacs, setEmacsParams): Set
`android_api_level' within setEmacsParams, not in initEmacs.
* src/androidvfs.c: Pacify compiler warnings.
* java/org/gnu/emacs/EmacsService.java (renameDocument): Don't
catch UnsupportedOperationException; handle ENOSYS in
android_saf_rename_document instead.
(moveDocument): New function.
* lisp/subr.el (y-or-n-p): Always change the text conversion
style.
* src/android.c (android_init_emacs_service)
(android_exception_check_4): New function.
* src/android.h: Update Java function table.
* src/androidvfs.c (android_saf_rename_document): Handle ENOSYS
here by setting errno to EXDEV.
(android_saf_move_document): New function.
(android_document_id_from_name): Take const `dir_name'.
(android_saf_tree_rename): Use delete-move-rename to implement
cross-directory renames.
2023-07-30 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsSafThread.java
(postInvalidateCacheDir):
* java/org/gnu/emacs/EmacsService.java (renameDocument): New
functions.
* src/android.c (android_init_emacs_service):
* src/android.h (struct android_emacs_service): Link to new JNI
function.
* src/androidvfs.c (android_saf_rename_document): New function.
(android_saf_tree_rename): Implement in terms of that function
if possible.
2023-07-29 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsSafThread.java (statDocument1):
* src/androidvfs.c (android_afs_stat, android_content_stat)
(android_saf_root_stat): Report search permissions for files.
* src/androidvfs.c: Improve commentary.
2023-07-29 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsSafThread.java (postInvalidateCache):
New argument cacheName. Remove that file from the cache.
(accessDocument1): Consult the storage cache as well.
* java/org/gnu/emacs/EmacsService.java (deleteDocument): New
argument NAME.
* src/android.c (android_init_emacs_service): Add new argument.
* src/androidvfs.c (android_saf_delete_document)
(android_saf_tree_rmdir, android_saf_file_unlink): Pass name of
file being deleted to `deleteDocument'.
2023-07-29 Po Lu <luangruo@yahoo.com>
* src/androidvfs.c (android_saf_exception_check): Describe
exceptions earlier.
* java/org/gnu/emacs/EmacsSafThread.java (DocIdEntry)
(getCacheEntry, CacheEntry, documentIdFromName1): Fix earlier
change.
* java/org/gnu/emacs/EmacsSafThread.java (DocIdEntry)
(getCacheEntry, CacheEntry): Use `uptimeMillis' as the basis for
cache expiration.
* java/org/gnu/emacs/EmacsSafThread.java (EmacsSafThread, getCache)
(pruneCache1, pruneCache, cacheChild, cacheDirectoryFromCursor)
(documentIdFromName1, openDocumentDirectory1): Implement the
cache referred to by the commentary.
* java/org/gnu/emacs/EmacsService.java (deleteDocument):
Invalidate the cache upon document removal.
* src/androidvfs.c (android_saf_exception_check)
(android_document_id_from_name): Correctly preserve or set errno
in error cases.
2023-07-28 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsSafThread.java (documentIdFromName1):
Fix query argument placeholder string.
* src/androidvfs.c (android_document_id_from_name): Don't return
0 if an SAF exception occurs.
* src/androidselect.c (Fandroid_get_clipboard): Don't return
data if clipboard is empty. Reported by Johan Widén
<j.e.widen@gmail.com>.
2023-07-28 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android Document Providers): Say that
quitting is now possible.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): New
functions `safSyncAndReadInput', `safync' and `safPostRequest'.
* java/org/gnu/emacs/EmacsSafThread.java: New file. Move
cancel-able SAF operations here.
* java/org/gnu/emacs/EmacsService.java (EmacsService): Allow
quitting from most SAF operations.
* src/androidvfs.c (android_saf_exception_check): Return EINTR if
OperationCanceledException is received.
(android_saf_stat, android_saf_access)
(android_document_id_from_name, android_saf_tree_opendir_1)
(android_saf_file_open): Don't allow reentrant calls from async
input handlers.
(NATIVE_NAME): Implement new synchronization primitives for JNI.
(android_vfs_init): Initialize new class.
* src/dired.c (open_directory): Handle EINTR from opendir.
* src/sysdep.c: Describe which operations may return EINTR on
Android.
2023-07-28 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsDirectoryEntry.java
(EmacsDirectoryEntry): Make class final.
* java/org/gnu/emacs/EmacsService.java (accessDocument)
(openDocumentDirectory, openDocument, createDocument): Throw
access and IO error exceptions instead of catching them.
(createDirectory, deleteDocument): New functions.
* src/android.c (android_init_emacs_service): Add new functions.
* src/android.h (struct android_emacs_service): Likewise.
* src/androidvfs.c (android_saf_exception_check): New function.
Translate between Java exceptions and errno values.
(android_saf_stat, android_saf_access, android_saf_delete_document)
(struct android_saf_tree_vnode, android_document_id_from_name)
(android_saf_tree_name, android_saf_tree_rmdir)
(android_saf_tree_opendir_1, android_saf_tree_opendir)
(android_saf_file_open, android_saf_file_unlink)
(android_saf_new_open, android_saf_new_mkdir): Implement missing
VFS operations and derive errno values from the type of any
exceptions thrown.
(android_vfs_init): Initialize exception classes.
(android_mkdir, android_fstat): Remove trailing whitespace.
2023-07-27 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android Document Providers): Improve
wording of paragraph clarifying limits on subprocesses.
* java/org/gnu/emacs/EmacsService.java (getDocumentTrees): Use
Java standard US-ASCII coding standard instead of the
undocumented ``ASCII'' alias.
(decodeFileName): Remove unused function.
(documentIdFromName):
* src/android.c (android_init_emacs_service): Take a String for
NAME instead of a byte array.
* src/androidvfs.c (android_verify_jni_string): New function.
(android_document_id_from_name): Verify that STRING is a valid
Modified UTF-8 string.
* src/androidvfs.c (android_afs_initial)
(android_content_get_directory_name, android_saf_tree_name)
(android_saf_tree_from_name, android_vfs_init): Silence compiler
warnings.
* src/android.c (android_run_in_emacs_thread): Behave more
robustly if SIGIO arrives too late Emacs for Emacs to check for
signals, but too early to preempt a long running syscall.
* java/org/gnu/emacs/EmacsActivity.java (onActivityResult):
* src/androidvfs.c (android_renameat_noreplace, android_rename):
Free vdst using vdst->ops, not vp->ops.
2023-07-27 Po Lu <luangruo@yahoo.com>
* configure.ac (ANDROID_STUBIFY): Add androidvfs.o when building
libemacs.so.
* doc/emacs/android.texi (Android): Add `Android Document
Providers'.
(Android Startup): Update the location of the content identifier
directory.
(Android File System): Describe access to document provider
directories.
(Android Document Providers): New node.
* doc/emacs/emacs.texi (Top): Update the menu for the Android
appendix.
* java/Makefile.in (filename, install_temp/assets/build_info):
Make directory-tree depend on build_info.
* java/org/gnu/emacs/EmacsActivity.java (onActivityResult): New
function. When a document tree is accepted, persist access to it.
* java/org/gnu/emacs/EmacsDirectoryEntry.java
(EmacsDirectoryEntry): New struct.
* java/org/gnu/emacs/EmacsOpenActivity.java (checkReadableOrCopy):
Use EmacsService.buildContentName.
* java/org/gnu/emacs/EmacsService.java (getEmacsView)
(openContentUri)
(checkContentUri): Remove excessive debug logging.
(buildContentName, getDocumentAuthorities, requestDirectoryAccess)
(getDocumentTrees, decodeFileName, documentIdFromName, getTreeUri)
(statDocument, accessDocument, openDocumentDirectory)
(readDirectoryEntry)
(openDocument, createDocument): New functions.
* lib-src/asset-directory-tool.c: Improve commentary by
illustrating the difference between directory and ordinary files.
* src/android.c (ANDROID_THROW, enum android_fd_table_entry_flags)
(struct android_emacs_service, android_extract_long)
(android_scan_directory_tree, android_is_directory)
(android_get_asset_name, android_url_encode)
(android_content_name_p)
(android_get_content_name, android_check_content_access)
(android_fstat)
(android_fstatat, android_file_access_p)
(android_hack_asset_fd_fallback)
(android_detect_ashmem, android_hack_asset_fd)
(android_close_on_exec)
(android_open, android_close, android_fclose)
(android_create_lib_link)
(android_faccessat, struct android_dir, android_opendir)
(android_dirfd)
(android_readdir, android_closedir)
(android_lookup_asset_directory_fd)
(android_exception_check_3, android_get_current_api_level)
(android_open_asset, android_close_asset, android_asset_read_quit)
(android_asset_read, android_asset_lseek, android_asset_fstat):
Move content and asset related functions to androidvfs.c.
(android_init_emacs_service): Obtain handles for new JNI
functions.
(initEmacsParams): Initialize the VFS layer.
(android_request_directory_access): New function.
(android_display_toast): Remove unused function.
* src/android.h (android_get_current_api_level): Assume that
this function never returns less than __ANDROID_API__.
(struct android_emacs_service): Move `struct
android_emacs_service' here.
* src/androidfns.c (Fandroid_request_directory_access): New
interactive function.
(syms_of_androidfns): Register new subr.
* src/androidvfs.c (struct android_vdir, struct android_vops)
(struct android_vnode, struct android_special_vnode)
(enum android_vnode_type, struct android_cursor_class)
(struct emacs_directory_entry_class)
(struct android_parcel_file_descriptor_class)
(android_init_cursor_class, android_init_entry_class)
(android_init_fd_class, android_vfs_canonicalize_name)
(struct android_unix_vnode, struct android_unix_vdir)
(unix_vfs_ops)
(android_unix_name, android_unix_vnode, android_unix_open)
(android_unix_close, android_unix_unlink, android_unix_symlink)
(android_unix_rmdir, android_unix_rename, android_unix_stat)
(android_unix_access, android_unix_mkdir, android_unix_readdir)
(android_unix_closedir, android_unix_dirfd, android_unix_opendir)
(android_extract_long, android_scan_directory_tree)
(android_is_directory, android_init_assets)
(android_hack_asset_fd_fallback, android_detect_ashmem)
(android_hack_asset_fd, struct android_afs_vnode)
(struct android_afs_vdir, struct android_afs_open_fd, afs_vfs_ops)
(android_afs_name, android_afs_initial, android_close_on_exec)
(android_afs_open, android_afs_close, android_afs_unlink)
(android_afs_symlink, android_afs_rmdir, android_afs_rename)
(android_afs_stat, android_afs_access, android_afs_mkdir)
(android_afs_readdir, android_afs_closedir, android_afs_dirfd)
(android_afs_opendir, android_afs_get_directory_name)
(struct android_content_vdir, content_vfs_ops)
(content_directory_contents, android_content_name)
(android_content_open, android_content_close)
(android_content_unlink, android_content_symlink)
(android_content_rmdir, android_content_rename)
(android_content_stat, android_content_access)
(android_content_mkdir, android_content_readdir)
(android_content_closedir, android_content_dirfd)
(android_content_opendir, android_content_get_directory_name)
(android_content_initial, android_get_content_name)
(android_check_content_access, struct android_authority_vnode)
(authority_vfs_ops, android_authority_name)
(android_authority_open)
(android_authority_close, android_authority_unlink)
(android_authority_symlink, android_authority_rmdir)
(android_authority_rename, android_authority_stat)
(android_authority_access, android_authority_mkdir)
(android_authority_opendir, android_authority_initial)
(struct android_saf_root_vnode, struct android_saf_root_vdir)
(saf_root_vfs_ops, android_saf_root_name, android_saf_root_open)
(android_saf_root_close, android_saf_root_unlink)
(android_saf_root_symlink, android_saf_root_rmdir)
(android_saf_root_rename, android_saf_root_stat)
(androqid_saf_root_access, android_saf_root_mkdir)
(android_saf_root_readdir, android_saf_root_closedir)
(android_saf_root_dirfd, android_saf_root_opendir)
(android_saf_root_initial, android_saf_root_get_directory)
(android_saf_stat, android_saf_access)
(struct android_saf_tree_vnode, struct android_saf_tree_vdir)
(saf_tree_vfs_ops, android_document_id_from_name)
(android_saf_tree_name, android_saf_tree_open)
(android_saf_tree_close, android_saf_tree_unlink)
(android_saf_tree_symlink, android_saf_tree_rmdir)
(android_saf_tree_rename, android_saf_tree_stat)
(android_saf_tree_access, android_saf_tree_mkdir)
(android_saf_tree_opendir_1, android_saf_tree_readdir)
(android_saf_tree_closedir, android_saf_tree_dirfd)
(android_saf_tree_opendir, android_saf_tree_from_name)
(android_saf_tree_get_directory, android_saf_file_vnode)
(saf_file_vfs_ops, android_saf_file_name, android_saf_file_open)
(android_saf_file_unlink, android_saf_file_rmdir)
(android_saf_file_opendir, android_close_parcel_fd)
(android_saf_new_vnode, android_saf_new_name)
(android_saf_new_open)
(android_saf_new_unlink, android_saf_new_symlink)
(android_saf_new_rmdir, android_saf_new_rename)
(android_saf_new_stat, android_saf_new_access)
(android_saf_new_mkdir, android_saf_new_opendir, root_vfs_ops)
(special_vnodes, android_root_name, android_name_file)
(android_vfs_init, android_open, android_unlink, android_symlink)
(android_rmdir, android_mkdir, android_renameat_noreplace)
(android_rename, android_fstat, android_fstatat_1)
(android_fstatat)
(android_faccessat, android_fdopen, android_close, android_fclose)
(android_open_asset, android_close_asset, android_asset_read_quit)
(android_asset_read, android_asset_lseek, android_asset_fstat)
(android_opendir, android_dirfd, android_readdir)
(android_closedir): Move file system emulation routines here.
Introduce a new ``VFS'' layer for translating between
Emacs-specific file names and the various disparate interfaces
for accessing files on Android.
* src/callproc.c (delete_temp_file):
* src/charset.c (load_charset_map_from_file):
* src/dired.c:
* src/emacs.c (Fkill_emacs):
* src/fileio.c (check_mutable_filename, Fcopy_file)
(Fmake_directory_internal, Fdelete_directory_internal)
(Fdelete_file, Frename_file, Fadd_name_to_file)
(Fmake_symbolic_link, file_accessible_directory_p)
(Fset_file_modes)
(Fset_file_times, write_region):
* src/filelock.c (get_boot_time, rename_lock_file)
(create_lock_file, current_lock_owner, unlock_file):
* src/image.c (slurp_file, png_load_body, jpeg_load_body):
* src/keyboard.c (Fopen_dribble_file):
* src/lisp.h:
* src/lread.c (Fload):
* src/process.c (handle_child_signal):
* src/sysdep.c (init_standard_fds, emacs_fopen, emacs_fdopen)
(emacs_unlink, emacs_symlink, emacs_rmdir, emacs_mkdir)
(emacs_renameat_noreplace, emacs_rename):
* src/term.c (Fresume_tty, init_tty): Use and add new wrappers
for fopen, fdopen, unlink, symlink, rmdir, mkdir,
renameat_norepalce and rename.
2023-07-23 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android File System): Document where the
app library directory can probably be found.
* src/android.c (android_create_lib_link): New function. Try to
symlink `lib' in the directory holding the files directory to the
app library directory.
(setEmacsParams): Call that function if Emacs is being initialized
from an application context.
2023-07-22 Po Lu <luangruo@yahoo.com>
* lisp/touch-screen.el (touch-screen-drag): If
touch-screen-word-select, also keep the initial word within the
region while scrolling.
* src/window.h (WINDOW_MENU_BAR_P): Check for external menu bars
using HAVE_WINDOW_SYSTEM && HAVE_EXT_MENU_BAR instead of hard
coding X without Xt or GTK.
* doc/lispref/commands.texi (Key Sequence Input): Describe which
events receive imaginary prefix keys.
* lisp/touch-screen.el (touch-screen-translate-touch): Consider
`vertical-line' a virtual function key.
(function-key-map): Translate events on vertical window borders.
* etc/NEWS: Announce `current-key-remap-sequence'.
* src/androidfns.c (Fx_create_frame): Default
Qvertical_scroll_bars to Qnil, but set scroll-bar-width and
scroll-bar-height.
2023-07-21 Po Lu <luangruo@yahoo.com>
* doc/lispref/commands.texi (Key Sequence Input): Document new
argument to `read-key-sequence' etc.
* lisp/help-macro.el (make-help-screen):
* lisp/subr.el (read-key, read-char-choice-with-read-key): Disable
text conversion and display the OSK before reading a key sequence.
* lisp/touch-screen.el (touch-screen-window-selection-changed):
Only cancel the minibuffer OSK timer.
(touch-screen-handle-point-up): Update comment accordingly.
* src/keyboard.c (command_loop_1, read_menu_command)
(read_key_sequence, read_key_sequence_vs, Fread_key_sequence)
(Fread_key_sequence_vector): New arg DISABLE_TEXT_CONVERSION.
All callers changed.
* lisp/touch-screen.el (touch-screen-translate-touch): Check if a
prefix is specified separately from prefix being non-nil. Accept
`nil' as an imaginary prefix key.
(function-key-map): Register translation functions on the tab bar,
tab lines and internal border.
* lisp/touch-screen.el (touch-screen-preview-select): Avoid
unnecessary redisplays.
(touch-screen-drag): Scroll at window margins using window
scrolling functions instead of relying on redisplay to recenter
the window around point.
* doc/emacs/input.texi (Touchscreens): Document
`touch-screen-preview-select'.
* doc/lispref/commands.texi (Touchscreen Events): Fix typo in the
descriptions of two touch screen events.
* lisp/dired.el (dired-insert-set-properties): Adjust for changes
to file end computation.
* lisp/minibuffer.el (clear-minibuffer-message): Don't clear
minibuffer message if dragging.
* lisp/touch-screen.el (touch-screen-current-tool): Fix doc
string.
(touch-screen-preview-select): New function.
(touch-screen-drag): Call it if point changes.
2023-07-20 Po Lu <luangruo@yahoo.com>
* exec/trace.c (handle_readlinkat): Adjust commentary to match
behavior.
* src/android.c (android_get_keysym_name): NULL terminate
*NAME_RETURN.
* lisp/international/mule-cmds.el (set-coding-system-map): Don't
display `set-terminal-coding-system' on Android.
* lisp/cus-edit.el (custom-display): Add `android' display type.
* src/android.c (struct android_event_queue): Don't make
unnecessarily volatile.
* lisp/touch-screen.el (touch-screen-handle-touch): Don't restart
dragging if point is at ZV and the tap falls on a different row.
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu): New
field `title'.
(addSubmenu): New arg TITLE. Set that field.
(expandTo): Set MENU's header title if it's a context menu.
* src/androidmenu.c (android_init_emacs_context_menu): Adjust
signature of `createContextMenu'.
(android_menu_show): Use TITLE instead of pane titles if there's
only one pane.
* doc/emacs/dired.texi (Marks vs Flags): Document command bound
to `touchscreen-hold'.
* doc/lispref/commands.texi (Touchscreen Events): Describe
`touch-screen-inhibit-drag'.
* etc/NEWS: Improve description of changes to touch screen
support.
* lisp/dired-aux.el (dired-do-chxxx, dired-do-chmod)
(dired-do-print, dired-do-shell-command, dired-do-compress-to)
(dired-do-create-files, dired-do-rename, dired-do-isearch)
(dired-do-isearch-regexp, dired-do-search)
(dired-do-query-replace-regexp, dired-do-find-regexp)
(dired-vc-next-action): Disable ``click to select'' after
running this command.
* lisp/dired.el (dired-insert-set-properties): Attach
click-to-select keymap to file names if necessary.
(dired-mode-map): Bind `touchscreen-hold' to click to select
mode.
(dired-post-do-command): New function.
(dired-do-delete): Call it.
(dired-mark-for-click, dired-enable-click-to-select-mode): New
functions.
(dired-click-to-select-mode): New minor mode.
* lisp/touch-screen.el (touch-screen-current-tool): Fix doc
string.
(touch-screen-inhibit-drag): New function.
2023-07-19 Po Lu <luangruo@yahoo.com>
* src/sfnt.c (sfnt_infer_deltas): Improve commentary.
* lisp/touch-screen.el (touch-screen-handle-point-up): If what is
`restart-drag' (meaning that a drag has been restarted but the
touchpoint has not moved), translate the release into a regular
mouse click to deactivate the region.
* build-aux/makecounter.sh (curcount): Rename `counter' to
`emacs_shortlisp_counter'.
* doc/emacs/input.texi (Touchscreens): Document
`touch-screen-extend-selection'.
* doc/lispref/commands.texi (Touchscreen Events): Document
`touchscreen-restart-drag'.
* lisp/touch-screen.el (touch-screen-extend-selection): New user
option.
(touch-screen-restart-drag): New function.
(touch-screen-handle-point-update): Handle `restart-drag'
gestures.
(touch-screen-handle-touch): Check if the prerequisites for
extending a previous drag gesture are met, and generate such
events if so.
(touch-screen-translate-touch): Update doc string.
* src/Makefile.in (otherobj): Remove BUILD_COUNTER_OBJ.
($(lispsource)/international/charprop.el):
(%.elc): Don't depend on bootstrap-emacs if cross configuring for
Android.
(libemacs.so): Directly depend on and link with BUILD_COUNTER_OBJ.
* build-aux/makecounter.sh: New script.
* src/Makefile.in (abs_top_builddir): New variable.
(BUILD_COUNTER_OBJ): Define to build-counter.o
if compiling for Android.
(build-counter.c): New target. Generate this file using
makecounter.sh upon changes to lisp.mk or shortlisp.
(lisp.mk): Make and load relative to abs_top_builddir.
(emacs$(EXEEXT)): Adjust acordingly.
(mostlyclean): Remove build-counter.c.
2023-07-18 Po Lu <luangruo@yahoo.com>
* lisp/touch-screen.el (touch-screen-handle-point-update)
(touch-screen-handle-point-up): Fix typos.
* lisp/touch-screen.el (touch-screen-handle-point-update): Fix
typo.
* src/keyboard.c (make_lispy_event): Return nil if no menu item
is found.
* lisp/touch-screen.el (touch-screen-hold)
(touch-screen-handle-point-up): Don't select inactive minibuffer
windows.
(touch-screen-handle-point-update): Improve detection of left
and right edges.
* lisp/touch-screen.el (touch-screen-handle-touch): Fix treatment
of stray update events.
* src/frame.c (syms_of_frame): Default to nil if HAVE_ANDROID.
* src/keyboard.c (make_lispy_event): Fix botched merge.
* doc/lispref/commands.texi (Touchscreen Events): Describe
treatment of canceled touch sequences during touch event
translation.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Update JNI
prototypes.
* java/org/gnu/emacs/EmacsWindow.java (motionEvent): Set
cancelation flag in events sent where appropriate.
* lisp/touch-screen.el (touch-screen-handle-point-update):
Improve treatment of horizontal scrolling near window edges.
(touch-screen-handle-touch): Don't handle point up if the touch
sequence has been canceled.
* src/android.c (sendTouchDown, sendTouchUp, sendTouchMove): New
argument `flags'.
* src/androidgui.h (enum android_touch_event_flags): New enum.
(struct android_touch_event): New field `flags'.
* src/androidterm.c (handle_one_android_event): Report
cancelation in TOUCHSCREEN_END_EVENTs.
* src/keyboard.c (make_lispy_event): Fix botched merge.
2023-07-17 Po Lu <luangruo@yahoo.com>
* doc/lispref/commands.texi (Touchscreen Events): Document meaning
of `mouse-1-menu-command'.
* lisp/mouse.el (minor-mode-menu-from-indicator): New arg EVENT.
Give it to popup-menu.
(mouse-minor-mode-menu): Use posn specified within EVENT.
* lisp/touch-screen.el (touch-screen-handle-touch): Fix
interactive translation. Treat commands labeled
`mouse-1-menu-command' like ordinary keymaps.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to simple translation.
* lisp/touch-screen.el (touch-screen-handle-point-up): Generate
`down-mouse-1' if the current gesture is `mouse-1-menu'.
(touch-screen-handle-touch): If binding is a keymap, set state to
`mouse-1-menu' and wait for point to be released before generating
down-mouse-1.
* lisp/tab-bar.el (tab-bar-map): Don't bind touch-screen-drag.
* lisp/touch-screen.el (touch-screen-drag): Extend the region
based on the position of the mark, not the position of point
relative to EVENT.
(touch-screen-translate-touch): Don't generate virtual function
keys for non-mouse events.
(function-key-map): Remove redundant definitions.
* src/keyboard.c (read_key_sequence): Don't generate *-bar prefix
keys for mock input (such as input from function key translation.)
* doc/emacs/input.texi (Touchscreens): Document the new feature
for people who have trouble dragging to word boundaries.
* lisp/touch-screen.el (touch-screen-word-select): New defcustom.
(touch-screen-word-select-bounds)
(touch-screen-word-select-initial-word): New variable
definitions.
(touch-screen-hold): If `touch-screen-word-select', select the
word around EVENT.
(touch-screen-drag): If `touch-screen-word-select', extend the
region to the next word boundary if the character under point
constitutes a word.
(touch-screen-handle-point-update, touch-screen-handle-touch)
(touch-screen-translate-touch): Fix doc strings and fill
comments.
2023-07-16 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsService.java (displayToast):
* src/android.c (android_init_emacs_service): Remove unused
function.
* lisp/touch-screen.el (touch-screen-handle-point-up): Correctly
compute posn point.
(touch-screen-translate-touch): Update doc string.
(function-key-map): Define touch screen translation functions
within the internal border.
* doc/lispref/commands.texi (Touchscreen Events): Improve
documentation.
* lisp/tab-bar.el (tab-bar-map): Bind `[tab-bar
touchscreen-hold]'.
* lisp/touch-screen.el (touch-screen-hold, touch-screen-drag):
New functions.
(touch-screen-handle-timeout): Generate a `touchscreen-hold'
event instead.
(touch-screen-handle-point-update): Generate a
`touchscreen-drag' event upon dragging.
(touch-screen-translate-touch): Cancel touch screen timer upon
exit.
* src/keyboard.c (access_keymap_keyremap): Take unsigned int
start and end instead.
* doc/emacs/emacs.texi (Top):
* doc/emacs/input.texi (Other Input Devices): Correctly
capitalize subsection name.
(Touchscreens): Document additional translation.
* doc/lispref/commands.texi (Touchscreen Events): Document that
`touchscreen-end' events now have prefix keys. Also, describe
mouse emulation and `touchscreen-scroll' events.
* doc/lispref/keymaps.texi (Translation Keymaps): Document
`current-key-remap-sequence'.
* lisp/touch-screen.el (touch-screen-translate-prompt): New
function.
(touch-screen-scroll): New command. Bind to `touchscreen-scroll'.
(touch-screen-handle-point-update, touch-screen-handle-point-up)
(touch-screen-handle-touch): Refactor to actually translate touch
screen event sequences, as opposed to looking up commands and
executing them.
(touch-screen-translate-touch): New function. Bind in
function-key-map to all touch screen events.
(touch-screen-drag-mode-line-1, touch-screen-drag-mode-line)
(touch-screen-tap-header-line): Remove special commands for
dragging the mode line and clicking on the header line.
* lisp/wid-edit.el (widget-button-click): Adjust accordingly.
* src/keyboard.c (access_keymap_keyremap): Bind
`current-key-remap-sequence' to the key sequence being remapped.
(keyremap_step): Give fkey->start and fkey->end to
access_keymap_keyremap.
(head_table): Add imaginary prefix to touchscreen-end events as
well.
(syms_of_keyboard): New variable Vcurrent_key_remap_sequence.
2023-07-15 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android): Add new node to menu.
(Android Environment): Add footnote pointing to new node.
(Android Software): New node.
* doc/emacs/emacs.texi (Top): Add new node to menu.
* java/AndroidManifest.xml.in (manifest): Fix location of
sharedUserId property.
* java/INSTALL: Improve documentation of shared user ID
support.
2023-07-14 Po Lu <luangruo@yahoo.com>
* configure.ac (ANDROID_SHARED_USER_NAME): New variable.
Substitute it.
* java/AndroidManifest.xml.in: Set `sharedUserLabel' if a shared
user ID is enabled.
* java/res/values/strings.xml (shared_user_name): New string
resource.
* src/android.c (android_blit_copy): Don't check for overflow
where not required.
* java/org/gnu/emacs/EmacsInputConnection.java
(getSurroundingText): Don't print debug information if DEBUG_IC is
off.
* lisp/calc/calc.el (calc): Fix typo.
2023-07-13 Po Lu <luangruo@yahoo.com>
* etc/NEWS: Announce the new tool bar.
* etc/images/last-page.xpm:
* etc/images/last-page.pbm: New images. Mirrored from
next-page.xpm.
* lisp/doc-view.el (doc-view-menu): Use `doc-view-new-search'
instead of an anonymous function.
(doc-view-tool-bar-map): New keymap.
(doc-view-search): Update the tool bar after initiating a search.
(doc-view-new-search): New command.
(doc-view-mode): Set the tool bar map appropriately.
Restore hardware acceleration, as a small degree of tearing is
preferable towards large slowdowns on some specific devices. The
slight tearing remains, but a workaround for the GPU texture
remaining partially updated has been introduced.
* java/AndroidManifest.xml.in:
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog): Don't
change hardware acceleration state.
* java/org/gnu/emacs/EmacsNative.java (notifyPixelsChanged): New
function.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
New field `bitmapChanged'.
(copyToFrontBuffer): Signal that the bitmap has changed.
(onDraw): If the bitmap has changed, increment the generation ID.
* src/android.c (JNICALL): Implement new function.
2023-07-13 Po Lu <luangruo@yahoo.com>
Disable hardware acceleration on Android. It serves no purpose
and causes tearing. Uploading the bitmap to the GPU takes about
as long as it does to incrementally update the surface in
software.
* java/AndroidManifest.xml.in: Disable hardware acceleration.
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity): Make
lastClosedMenu static.
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog): Enable
hardware acceleration within alert dialogs.
* java/org/gnu/emacs/EmacsSurfaceView.java (onDraw): Describe
why hardware acceleration is disabled.
* java/org/gnu/emacs/EmacsWindow.java (run): Remove redundant
call.
2023-07-12 Po Lu <luangruo@yahoo.com>
* src/android.c (android_run_select_thread): Fix typo.
* src/android.c (android_run_select_thread): Correctly return the
set of ready read and write descriptors on __ANDROID_API__ < 16
systems.
(android_select): Clear the set of ready file descriptors if
events from the event queue are present despite pselect failing.
* src/androidterm.c (android_android_to_emacs_modifiers)
(android_emacs_to_android_modifiers): Fix statement precedence
bugs.
* src/doc.c (doc_close): Remove unused macro.
* java/org/gnu/emacs/EmacsWindow.java (whatButtonWasIt): Handle
back and forward buttons along with styluses.
* src/doc.c (close_file_unwind_android_fd): New function.
(get_doc_string, Fsnarf_documentation): Don't create a temporary
fd if it can be avoided.
2023-07-11 Po Lu <luangruo@yahoo.com>
* .gitignore: Ignore cross/etc/DOC.
* configure.ac: Make the directory `cross/etc'.
* cross/Makefile.in (CLEAN_SUBDIRS): Clean files inside `etc' as
well.
* java/Makefile.in (install_temp): Copy cross/etc/DOC to the
package if it is available.
* src/Makefile.in (SOME_MACHINE_OBJECTS): Add androidselect.c,
sfntfont-android.c and sfntfont.c.
(libemacs.so): Depend on $(etc)/DOC.
* src/sfnt.c (sfnt_fill_span): Correctly clip span to raster
width, ensuring that the last pixel is filled.
(main): Adjust test sizes.
* java/org/gnu/emacs/EmacsView.java (onGenericMotionEvent): Call
onGenericMotionEvent.
* java/org/gnu/emacs/EmacsWindow.java (Coordinate): New fields
`button' and `id'.
(<init>): Add new arguments to the construtor.
(whatButtonWasIt): Return 0 if the button state has not changed.
(buttonForEvent): New function.
(figureChange): Return the Coordinate object associated to EVENT.
Determine whether or not EVENT was accompanied by a change to the
button state, and ascertain which button that was.
(motionEvent): New function.
(onGenericMotionEvent, onTouchEvent): Factor out touch and mouse
event delivery to motionEvent.
2023-07-10 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsService.java (browseUrl): New argument
SEND. Choose from a list of applications that want to share the
URL if true.
* lisp/net/browse-url.el (browse-url-android-share): New user
option.
(browse-url-default-android-browser): Respect said user option.
* src/android.c (android_init_emacs_service, android_browse_url):
Expose new option.
* src/android.h: Update prototypes.
* src/androidselect.c (Fandroid_browse_url): Likewise.
* lib/vasnprintf.c:
* m4/printf.m4:
* m4/vasnprintf.m4: Update from Gnulib.
2023-07-09 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsWindow.java (eventModifiers)
(motionEventModifiers): New functions.
(onKeyDown, onKeyUp, onFocusChanged, onSomeKindOfMotionEvent):
Don't record the previous modifier mask; instead, always use the
modifier state specified in the event.
* src/androidterm.c (handle_one_android_event): Don't dispatch
button release events when a popup is active.
* java/org/gnu/emacs/EmacsService.java (onStartCommand): Fix typo
in notification message.
* java/org/gnu/emacs/EmacsWindow.java (onFocusChanged): Reset the
recorded modifier state upon a change to the window focus.
* java/org/gnu/emacs/EmacsService.java (onCreate): Fix typo.
* java/org/gnu/emacs/EmacsDrawPoint.java (perform): Don't fill an
extra pixel.
* java/org/gnu/emacs/EmacsService.java (onCreate): Make sure
scaledDensity is always at least 160 dpi.
2023-07-08 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsDrawLine.java (perform): Symmetrically
adjust coordinates to cover the last pixel. Then, fill the left
most pixel of the line.
* java/org/gnu/emacs/EmacsService.java (DEBUG_IC)
(DEBUG_THREADS): Improve commentary.
* src/androidterm.c (handle_one_android_event): Signal completion
of IME events that have lost their frames.
(requestCursorUpdates): Don't set an edit counter as this event
won't be passed to the text conversion machinery.
* src/android.c (android_blit_xor, android_check_query_urgent)
(android_run_in_emacs_thread, android_update_extracted_text): Fix
whitespace.
2023-07-07 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsSurfaceView.java (copyToFrontBuffer):
Use fallback bit blit function on Android 7.0 as well, as crashes
have been observed in drawBitmap.
2023-07-07 Po Lu <luangruo@yahoo.com>
* lisp/tool-bar.el (modifier-bar-modifier-list): New variable.
(modifier-bar-button): New function.
(tool-bar-event-apply-alt-modifier)
(tool-bar-event-apply-super-modifier)
(tool-bar-event-apply-hyper-modifier)
(tool-bar-event-apply-shift-modifier)
(tool-bar-event-apply-control-modifier)
(tool-bar-event-apply-meta-modifier): Factor out modifier bar
logic to that function, and redisplay the tool bar where
necessary.
(modifier-bar-available-p): New function.
(modifier-bar-mode): Disable tool bar items corresponding to
modifier keys that've already been pressed.
* etc/images/shift.pbm: Regenerate using the same font as the
other modifier button bitmaps.
2023-07-06 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsNative.java (scaledDensity): Announce
new argument `scaledDensity'.
* java/org/gnu/emacs/EmacsNoninteractive.java (main): Specify new
argument.
* java/org/gnu/emacs/EmacsService.java (onCreate): Compute an
adjusted DPI for the font size based on the ratio between density
and scaledDensity.
(run): Specify that adjusted density.
* src/android.c (setEmacsParams): Set
`android_scaled_pixel_density'.
* src/android.h (android_scaled_pixel_density) New variable.
* src/androidterm.c (android_term_init): Set `font_resolution'.
* src/androidterm.h (struct android_display_info): New field.
* src/font.c (font_pixel_size, font_find_for_lface)
(font_open_for_lface, Ffont_face_attributes, Fopen_font): Use
FRAME_RES instead of FRAME_RES_Y.
* src/frame.h (FRAME_RES): New macro. Use this to convert between
font point and pixel sizes as opposed to FRAME_RES_Y.
* src/w32font.c (fill_in_logfont):
* src/xfaces.c (Fx_family_fonts, set_lface_from_font): Use
FRAME_RES instead of FRAME_RES_Y. (bug#64444)
2023-07-05 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android Environment): Document that
Emacs also receives READ_EXTERNAL_STORAGE by default on old
versions of Android.
* java/AndroidManifest.xml.in: Request READ_EXTERNAL_STORAGE.
(bug#64445)
* doc/emacs/emacs.texi (Emacs and Android): Fix menu.
* doc/emacs/android.texi (Android): Fix discrepancies between menu
and sectioning.
* java/org/gnu/emacs/EmacsService.java (detectMouse): Don't use
function that is not present on Android 4.0.
* doc/lispref/commands.texi (Misc Events): Correctly index
`set-text-conversion-style'.
* lisp/tool-bar.el (tool-bar-event-apply-alt-modifier)
(tool-bar-event-apply-super-modifier)
(tool-bar-event-apply-hyper-modifier)
(tool-bar-event-apply-shift-modifier)
(tool-bar-event-apply-control-modifier)
(tool-bar-event-apply-meta-modifier): Pass t when restoring text
conversion style.
* src/keyboard.c (restore_reading_key_sequence): New function.
(read_key_sequence): Set `reading_key_sequence' where necessary.
* src/keyboard.h: Declare variable.
* src/textconv.c (check_postponed_buffers): New function.
(Fset_text_conversion_style): New argument. If set, and a key
sequence is being read, postpone resetting the IME until the key
sequence is read.
(syms_of_textconv): Clear new variable and add staticpro.
* src/textconv.h: Update prototypes.
2023-07-04 Po Lu <luangruo@yahoo.com>
* doc/emacs/frames.texi (Tool Bars): Describe modifier bars.
* doc/lispref/keymaps.texi (Extended Menu Items, Tool Bar):
Document changes to tool bar menu item handling and secondary tool
bars.
* etc/NEWS: Announce changes.
* lisp/simple.el (event-apply-modifier): Correctly apply Ctrl and
Shift modifiers to lower case ASCII key events that already have
other modifiers applied.
* lisp/tool-bar.el (tool-bar--cache-key)
(tool-bar--secondary-cache-key): New defsubsts.
(tool-bar--flush-cache): Flush secondary tool bar cache.
(tool-bar-make-keymap): Include secondary tool bar if necessary.
(tool-bar-make-keymap-1): New arg MAP. Generate a keymap for that
map if specified, else default to tool-bar-map.
(set-text-conversion-style, tool-bar-apply-modifiers)
(overriding-text-conversion-style)
(tool-bar-event-apply-alt-modifier)
(tool-bar-event-apply-super-modifier)
(tool-bar-event-apply-hyper-modifier)
(tool-bar-event-apply-shift-modifier)
(tool-bar-event-apply-control-modifier)
(tool-bar-event-apply-meta-modifier, modifier-bar-mode): New
functions.
* src/dispextern.h (enum tool_bar_item_idx): Add
TOOL_BAR_ITEM_WRAP.
* src/frame.c (make_frame): Clear new field `tool_bar_wraps_p'.
* src/frame.h (struct frame): New field `tool_bar_wraps_p'.
* src/keyboard.c (parse_tool_bar_item): Handle QCwrap properties
in tool bar menu items.
(syms_of_keyboard): New defsym QCwrap.
* src/xdisp.c (build_desired_tool_bar_string): Clear
f->tool_bar_wraps_p and set it appropriately. Insert new line
characters in the tool bar string upon encountering a wrap
character.
(display_tool_bar_line): Stop at EOB, not line end. Reseat on the
next line upon encountering EOL characters.
(redisplay_tool_bar): Allow rows to be different heights if
explicit new lines are present upon the tool bar string.
* src/sfnt.c (sfnt_decompose_compound_glyph): Pacify warning.
2023-06-30 Po Lu <luangruo@yahoo.com>
* src/android.c (android_query_tree): Correctly return children.
2023-06-27 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android Environment): Improve wording.
* doc/emacs/android.texi (Android Environment): Fix typos.
* src/android.c (android_exception_check)
(android_exception_check_1)
(android_exception_check_2)
(android_exception_check_nonnull)
(android_exception_check_nonnull_1): Tell the compiler to expect
that the object is non-NULL, or that no exception has been thrown.
* exec/loader-mips64el.s (rest_of_exec): Fix typo in comment.
2023-06-26 Po Lu <luangruo@yahoo.com>
* doc/lispref/commands.texi (Touchscreen Events): Fix typo.
2023-06-26 Po Lu <luangruo@yahoo.com>
* lisp/calc/calc.el (calc-mode, calc): Make sure the on-screen
keyboard is not hidden when a Calc buffer is created or a Calc
Trail window is being created for the first time.
* lisp/touch-screen.el (touch-screen-window-selection-changed):
Take touch-screen-display-keyboard in to account.
* src/sfnt.c (sfnt_decompose_compound_glyph)
(sfnt_interpret_compound_glyph_1): Reset `defer_offsets' before
processing each component.
(sfnt_lerp_half): Avoid undefined shift of negative value.
(sfnt_compute_tuple_scale): Pacify compiler warning.
2023-06-23 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java (Sdk7FontEntity):
(hasChar): Clean up dead stores.
* src/android.c (android_wc_lookup_string): Fix typo.
(android_wc_lookup_string): Check that GetStringChars returns
non-NULL, not if it throws an exception.
2023-06-21 Po Lu <luangruo@yahoo.com>
* src/androidfns.c (android_set_tool_bar_position)
(frame_geometry):
* src/androidterm.c (android_flash)
(android_clear_under_internal_border): Synchronize with X.
2023-06-20 Po Lu <luangruo@yahoo.com>
* src/androidfns.c (android_frame_parm_handlers): Fix typo.
(android_set_tool_bar_position): New function.
(android_frame_parm_handlers): Add new frame param handler.
2023-06-19 Po Lu <luangruo@yahoo.com>
* lib-src/Makefile.in (seccomp-filter$(EXEEXT)): Link with Gnulib.
* java/org/gnu/emacs/EmacsView.java (EmacsView, dimensionsLock):
New field.
(<init>): Create new lock object.
(handleDirtyBitmap, onLayout, onAttachedToWindow): Make sure
measuredWidth and measuredHeight are extracted and set atomically.
Send Expose upon layout changes if the view has grown.
* exec/Makefile.in (clean): Add `exec1'.
2023-06-18 Po Lu <luangruo@yahoo.com>
* src/window.h (struct window): Improve documentation of
`last_mark'.
* src/xdisp.c (mark_window_display_accurate_1): Don't set
`last_mark' to -1 if the mark is inactive.
* lisp/textmodes/conf-mode.el (conf-mode-initialize): Set
text-conversion-style.
2023-06-17 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsService.java (onCreate, run): Don't
initialize signal mask here.
* java/org/gnu/emacs/EmacsApplication.java (onCreate): Do it
here instead.
* src/android.c (JNICALL): Restore previous signal masks.
* java/README: More documentation.
2023-06-16 Po Lu <luangruo@yahoo.com>
* src/android.c (android_write_event, JNICALL)
(android_run_in_emacs_thread): Don't rely on raise to call
deliver_process_signal.
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity):
* java/org/gnu/emacs/EmacsApplication.java (findDumpFile):
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu)
(addSubmenu, display):
* java/org/gnu/emacs/EmacsDocumentsProvider.java
(getNotificationUri, queryChildDocuments, deleteDocument):
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform):
* java/org/gnu/emacs/EmacsFillRectangle.java (perform):
* java/org/gnu/emacs/EmacsOpenActivity.java (readEmacsClientLog)
(checkReadableOrCopy):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java
(EmacsSdk7FontDriver):
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
* java/org/gnu/emacs/EmacsView.java (EmacsView):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, onKeyUp):
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(EmacsWindowAttachmentManager): Remove various unused arguments
and variables, dead stores, and make minor cleanups and
performance improvements.
* src/androidmenu.c (FIND_METHOD_STATIC, android_menu_show):
Adjust accordingly.
2023-06-15 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsInputConnection.java
(EmacsInputConnection, beginBatchEdit, reset, endBatchEdit): Keep
track of the number of batch edits and return an appropriate
value.
(takeSnapshot): Implement function.
* java/org/gnu/emacs/EmacsNative.java (takeSnapshot): New
function.
* java/org/gnu/emacs/EmacsService.java (resetIC): Improve
debugging output.
* java/org/gnu/emacs/EmacsView.java (onCreateInputConnection):
Call `reset' to clear the UI side batch edit count.
* src/androidterm.c (struct android_get_surrounding_text_context):
New fields `conversion_start' and `conversion_end'.
(android_get_surrounding_text): Return the conversion region.
(android_get_surrounding_text_internal, NATIVE_NAME): Factor out
`getSurroundingText'.
(takeSnapshot): New function.
2023-06-14 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsInputConnection.java
(EmacsInputConnection): Reimplement as an InputConnection, not
BaseInputConnection.
* src/androidterm.c (performEditorAction): Sync prior to sending
keyboard events.
2023-06-13 Po Lu <luangruo@yahoo.com>
* etc/NEWS: Fix typo.
* lisp/gnus/gnus-score.el (gnus-read-char): New function.
(gnus-summary-increase-score): Use it to display a dialog box on
Android, where input methods have trouble with plain old
read-char.
2023-06-12 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog): Resolve
dialog button style and use it instead.
* java/org/gnu/emacs/EmacsView.java (EmacsView)
(showOnScreenKeyboard, hideOnScreenKeyboard): Don't synchronize.
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow)
(toggleOnScreenKeyboard): Revert to calling IMM functions from the
main thread.
* src/android.c (struct android_event_container)
(android_pselect_nfds, android_pselect_readfds)
(android_pselect_writefds, android_pselect_exceptfds)
(android_pselect_timeout): Don't make volatile.
(android_wait_event): Run queries if necessary.
2023-06-11 Po Lu <luangruo@yahoo.com>
* lisp/net/tramp.el (tramp-encoding-shell):
* lisp/obsolete/terminal.el (terminal-emulator):
* lisp/term.el (term-exec-1):
* lisp/textmodes/artist.el (artist-figlet-get-font-list):
* src/android.c (JNICALL): Where /bin/sh was previously used, use
/system/bin/sh on Android.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
Document member variables.
(onDraw): Use separate Paint object on the UI thread.
* src/textconv.c (really_commit_text, really_set_composing_text)
(really_delete_surrounding_text): Run modification hooks when
deleting text.
* java/org/gnu/emacs/EmacsView.java (EmacsView)
(showOnScreenKeyboard, hideOnScreenKeyboard)
(onCheckIsTextEditor): Make synchronized.
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow)
(toggleOnScreenKeyboard): Don't post to the main thread.
2023-06-10 Po Lu <luangruo@yahoo.com>
* src/keyboard.c (handle_input_available_signal): Don't generate
instructions not available in arm mode.
* src/android.c (android_select, android_check_query)
(android_check_query_urgent, android_answer_query)
(android_answer_query_spin, android_begin_query)
(android_end_query)
(android_run_in_emacs_thread): Use finer grained memory
synchronization semantics.
* src/androidterm.c (android_get_selection): Use the current
selection, not its value at the time of the last redisplay.
* src/keyboard.c (handle_input_available_signal): Place memory
barrier.
* src/textconv.c (really_commit_text)
(really_set_composing_text): Improve behavior of certain
fontification mechanisms by inheriting text properties from
surrounding text.
* src/android.c (android_select): Clear `android_urgent_query'.
(android_check_query): Make static. Clear `android_urgent_query'.
(android_check_query_urgent): New function; work like
`android_check_query', but only answer urgent queries.
(android_answer_query, android_end_query): Clear urgent query
flag.
(android_run_in_emacs_thread): Initially wait two seconds for the
query to run from the keyboard loop; upon a timeout, set
`android_urgent_query' to true and wait for it to run while
reading async input.
* src/android.h: Update prototypes.
* src/keyboard.c (handle_async_input): Call
`android_check_query_urgent'.
2023-06-09 Po Lu <luangruo@yahoo.com>
* src/textconv.c (really_commit_text)
(handle_pending_conversion_events): Fix minor typos.
* src/androidterm.c (handle_one_android_event): Don't answer
queries here; just rely on the event interrupting android_select.
This avoids exposing buffer contents to input methods while a
command is being executed.
* src/textconv.c (TEXTCONV_DEBUG, really_commit_text)
(really_finish_composing_text, really_set_composing_text)
(really_set_composing_region, really_delete_surrounding_text)
(really_set_point_and_mark, get_extracted_text): Add debugging
printouts.
* lisp/progmodes/cc-mode.el (c-initialize-cc-mode): Always add
text conversion hooks.
* src/android.c (android_get_gc_values): Remove redundancy.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): New
function `setupSystemThread'.
* java/org/gnu/emacs/EmacsService.java (onCreate): Block all
signals except for SIGBUS and SIGSEGV in the UI thread.
* src/android.c (setupSystemThread): New function.
* java/org/gnu/emacs/EmacsThread.java (run): Correct check
against extraStartupArgument when an initial file is specified.
2023-06-08 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu):
Make subclasses final.
* java/org/gnu/emacs/EmacsDialog.java (display1): Check if an
instance of EmacsOpenActivity is open; if it is, try using it to
display the pop up dialog.
* java/org/gnu/emacs/EmacsDialogButtonLayout.java
(EmacsDialogButtonLayout): Make final.
* java/org/gnu/emacs/EmacsHolder.java (EmacsHolder<T>): Likewise.
* java/org/gnu/emacs/EmacsOpenActivity.java (EmacsOpenActivity):
New field `currentActivity'.
(onCreate, onDestroy, onWindowFocusChanged, onPause): Set that
field as appropriate.
* src/android.c (android_is_special_directory): New function.
(android_get_asset_name, android_content_name_p)
(android_get_content_name):
* src/android.h (android_is_special_directory)
(JNI_STACK_ALIGNMENT_PROLOGUE):
* src/fileio.c (check_mutable_filename):
* src/filelock.c (WTMP_FILE, make_lock_file_name):
* src/inotify.c (IN_ONLYDIR, Finotify_add_watch): Factor out
checks against asset and content directories to that function.
2023-06-07 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android Startup): Fix reference to non
existent node.
* java/org/gnu/emacs/EmacsInputConnection.java (beginBatchEdit)
(endBatchEdit, commitCompletion, commitText)
(deleteSurroundingText)
(finishComposingText, getSelectedText, getTextAfterCursor)
(getTextBeforeCursor, setComposingText, setComposingRegion)
(performEditorAction, performContextMenuAction, getExtractedText)
(setSelection, sendKeyEvent, deleteSurroundingTextInCodePoints)
(requestCursorUpdates): Ensure that the input connection is up to
date.
(getSurroundingText): New function.
* java/org/gnu/emacs/EmacsNative.java (getSurroundingText): Export
new C function.
* java/org/gnu/emacs/EmacsService.java (resetIC): Invalidate
previously created input connections.
* java/org/gnu/emacs/EmacsView.java (EmacsView)
(onCreateInputConnection): Signify that input connections are
now up to date.
* src/androidterm.c (struct android_get_surrounding_text_context):
New structure.
(android_get_surrounding_text, NATIVE_NAME):
* src/textconv.c (get_surrounding_text):
* src/textconv.h: New functions.
2023-06-06 Po Lu <luangruo@yahoo.com>
* lisp/simple.el (analyze-text-conversion): Remove old workaround.
2023-06-06 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsContextMenu.java (display): Use
`EmacsHolder' instead of `Holder'.
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog): Use
`EmacsDialogButtonLayout' to ensure that buttons are wrapped
properly.
(display): Adjust for new holder class.
* java/org/gnu/emacs/EmacsDialogButtonLayout.java
(EmacsDialogButtonLayout, onMeasure, onLayout): New functions.
* java/org/gnu/emacs/EmacsDrawLine.java:
* java/org/gnu/emacs/EmacsFillPolygon.java: Remove redundant
imports.
* java/org/gnu/emacs/EmacsHolder.java (EmacsHolder<T>):
* java/org/gnu/emacs/EmacsService.java (class Holder<T>)
(getEmacsView, EmacsService): Rename `Holder' to `EmacsHolder'
and make it public.
2023-06-06 Po Lu <luangruo@yahoo.com>
* lisp/simple.el (undo-auto-amalgamate): Update doc string to
describe new amalgamating commands.
(analyze-text-conversion): Make this an amalgamating command by
default, unless a new line has been inserted. Also, shorten the
undo boundary timer.
* src/textconv.c (really_commit_text)
(really_set_composing_text): Correctly report ephemeral deletions.
(syms_of_textconv): Fix doc strings.
2023-06-05 Po Lu <luangruo@yahoo.com>
* src/androidterm.c (android_handle_ime_event): Clear batch edit
state, in case the previous input method forgot to do so.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): New
function clearInputFlags.
* java/org/gnu/emacs/EmacsView.java (onCreateInputConnection):
Stop reporting changes after a new input method connection is
established.
* src/androidterm.c (android_handle_ime_event): Implement that
change.
(JNICALL): New function.
2023-06-04 Po Lu <luangruo@yahoo.com>
* src/keyboard.c: Fix build without window system
* configure.ac: Tune pty detection for Android.
* java/debug.sh (gdbserver_cmd, is_root): Prefer TCP again.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): New function
`queryAndSpin'.
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(icBeginSynchronous, icEndSynchronous, viewGetSelection): New
synchronization functions.
(resetIC, updateCursorAnchorInfo): Call those instead.
* java/org/gnu/emacs/EmacsView.java (onCreateInputConnection):
Call viewGetSelection.
* src/android.c (JNICALL, android_answer_query_spin): New
functions.
2023-06-03 Po Lu <luangruo@yahoo.com>
* lisp/bindings.el (global-map): Bind cut, copy and paste.
* src/androidterm.c (JNICALL): Use key.
* src/textconv.c (really_commit_text)
(really_set_composing_text): Delete text between mark and point if
the mark is active. Don't record changes if the text is empty.
* src/androidterm.c (struct android_get_extracted_text_context):
New field `mark_active'.
(android_get_extracted_text): Set that field.
(struct android_extracted_text_class): New field `flags'.
(android_build_extracted_text): New argument `mark_active'. Set
flags appropriately.
(NATIVE_NAME, android_update_selection): Likewise.
* src/textconv.c (get_extracted_text): New argument
`mark_active'. Set it if the mark is active.
* src/textconv.h: Update prototypes.
* etc/MACHINES: Fix reference to obsolete file.
2023-06-02 Po Lu <luangruo@yahoo.com>
* lisp/emacs-lisp/eldoc.el ("back-to-indentation"): Register touch
screen and text conversion commands.
* lisp/progmodes/cc-cmds.el (c-post-text-conversion): New
function.
* lisp/progmodes/cc-mode.el (c-initialize-cc-mode): Add it as the
`post-texxt-conversion-hook'.
* lisp/simple.el (post-text-conversion-hook): New hook.
(analyze-text-conversion): Run it until success before trying post
insert functions.
* java/org/gnu/emacs/EmacsInputConnection.java
(EmacsInputConnection): Apply workarounds on Vivo devices as well.
* src/android.c (sendKeyPress, sendKeyRelease): Clear counter.
* src/androidgui.h (struct android_key_event): New field
`counter'.
* src/androidterm.c (handle_one_android_event): Generate barriers
as appropriate.
(JNICALL): Set `counter'.
* src/frame.h (enum text_conversion_operation):
* src/textconv.c (detect_conversion_events)
(really_set_composing_text, handle_pending_conversion_events_1)
(handle_pending_conversion_events, textconv_barrier):
* src/textconv.h: Implement text conversion barriers and fix
various typos.
2023-06-01 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsService.java (browseUrl): If uri's
scheme is `file', rewrite it into a content URI.
* java/org/gnu/emacs/EmacsInputConnection.java
(EmacsInputConnection, performContextMenuAction): New function.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative)
(performContextMenuAction): New function.
* src/android.c (android_get_gc_values): Implement more
efficiently.
* src/androidterm.c (android_handle_ime_event): Pass through
`update' argument to `finish_composing_text'. Fix thinko.
* src/textconv.c (really_finish_composing_text)
(really_set_composing_text, really_set_composing_region)
(handle_pending_conversion_events_1, finish_composing_text): New
argument `update'. Notify IME of conversion region changes if
set.
* src/textconv.h: Update structs and prototypes.
* java/org/gnu/emacs/EmacsInputConnection.java
(EmacsInputConnection): Add compatibility adjustments for Samsung
devices.
* src/androidterm.c (struct android_get_extracted_text_context):
New field `start_offset' and `end_offset'. Delete `offset'.
(android_get_extracted_text, android_build_extracted_text):
Replace `offset' with new args `start_offset' and `end_offset'.
(NATIVE_NAME): Set `start_offset' and `end_offset'.
(android_update_selection): Likewise.
* src/textconv.c (get_extracted_text): Likewise.
* src/textconv.h: Update prototypes.
2023-05-31 Po Lu <luangruo@yahoo.com>
* configure.ac: Pass through `--enable-check-lisp-object-type' on
Android.
* src/alloc.c (android_make_lisp_symbol):
* src/android.c:
* src/androidfns.c (android_set_no_focus_on_map)
(android_set_no_accept_focus):
* src/androidfont.c (androidfont_match, androidfont_open_font):
* src/androidselect.c (Fandroid_get_clipboard)
(Fandroid_get_clipboard_targets):
* src/keyboard.c (make_lispy_event, syms_of_keyboard):
* src/sfntfont.c (sfnt_enum_font_1, sfntfont_list_1):
* src/textconv.c (really_set_point_and_mark): Fix Lisp_Object and
integer screw-ups.
* doc/emacs/input.texi (Other Input Devices, Touchscreens)
(On-Screen Keyboards):
* doc/lispref/commands.texi (Misc Events):
* src/android.c (android_faccessat): Improve word choices and
commentary.
* lisp/touch-screen.el (touch-screen-handle-scroll): Make
precision scrolling work better with horizontal movement.
* src/android.c (android_copy_area): Pacify compiler warning.
* exec/exec.c (insert_args): New argument `arg3'. Replace argv[1]
with that argument.
(exec_0): Pass file name of script to `insert_args'.
* doc/emacs/android.texi (What is Android?, Android Startup)
(Android File System, Android Environment, Android Windowing)
(Android Troubleshooting): Improve wording and various other
issues.
* java/debug.sh (is_root): Go back to using unix sockets; allow
adb to forward them correctly.
* java/org/gnu/emacs/EmacsInputConnection.java
(getExtractedText): Don't print text if NULL.
* java/org/gnu/emacs/EmacsService.java (EmacsService): New field
`imSyncInProgress'.
(updateIC): If an IM sync might be in progress, avoid deadlocks.
* java/org/gnu/emacs/EmacsView.java (onCreateInputConnection):
Set `imSyncInProgress' across synchronization point.
* src/android.c (android_check_query): Use __atomic_store_n.
(android_answer_query): New function.
(android_begin_query): Set `android_servicing_query' to 2. Check
once, and don't spin waiting for query to complete.
(android_end_query): Use __atomic_store_n.
(android_run_in_emacs_thread): Compare-and-exchange flag. If
originally 1, fail.
* src/textconv.c (really_set_composing_text): Clear conversion
region if text is empty.
2023-05-29 Po Lu <luangruo@yahoo.com>
* src/android.c (android_blit_copy, android_blit_xor): Fix typos.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): New function
`blitRect'.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView): Use
it on Android 8.x.
* src/android.c (blitRect): Implement new function.
(android_neon_mask_line): Fix iteration over remainder.
(android_blit_copy): Be more paranoid.
* java/org/gnu/emacs/EmacsCopyArea.java: Remove file.
* java/org/gnu/emacs/EmacsService.java (copyArea): Delete
function.
* src/android.c (struct android_emacs_service)
(android_init_emacs_service): Remove `copy_area'.
(android_create_gc, android_change_gc, android_get_gc_values):
Record new GC values.
(android_neon_mask_line): New function.
(android_blit_copy, android_blit_xor): New functions.
(android_copy_area): Implement in C.
(android_lock_bitmap): Accept drawables instead of windows.
* src/android.h: Adjust prototype for `android_lock_bitmap'.
* src/androidgui.h (struct android_gc): Record last known GC
values.
2023-05-27 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(checkEmacsThread): New function.
(fillPolygon, drawRectangle, drawLine, drawPoint, copyArea)
(clearArea):
* java/org/gnu/emacs/EmacsThread.java (EmacsThread):
* java/org/gnu/emacs/EmacsView.java (EmacsView, swapBuffers): Call
where appropriate.
* java/org/gnu/emacs/EmacsView.java (EmacsView, swapBuffers):
Remove unnecessary documentation. `damageRegion' is only changed
from the Emacs thread.
2023-05-26 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android Troubleshooting): Document
`debug-init' option.
* java/AndroidManifest.xml.in
(EmacsLauncherPreferencesActivity): New activity. Export on
systems older than Android 7.0.
* java/org/gnu/emacs/EmacsActivity.java (onCreate): Adjust for
string startup argument.
* java/org/gnu/emacs/EmacsLauncherPreferencesActivity.java: New
file.
* java/org/gnu/emacs/EmacsPreferencesActivity.java
(EmacsPreferencesActivity): Don't make final.
(startEmacsQ): Give start-up argument as an argument, not as a
boolean.
(startEmacsDebugInit): New function.
(onCreate): Register new listener; make final.
* java/org/gnu/emacs/EmacsService.java (onCreate): Pass
extraStartupArgument.
* java/org/gnu/emacs/EmacsThread.java (EmacsThread): Rename
startDashQ to extraStartupArgument.
(run): Adjust accordingly.
* java/res/values-v24/bool.xml:
* java/res/values/bool.xml:
* java/res/values/strings.xml: New files.
* java/res/xml/preferences.xml: Add new option. Move string
resources around.
2023-05-24 Po Lu <luangruo@yahoo.com>
* src/sfnt.c (sfnt_decompose_compound_glyph): Allow decomposing up
to 16 nested components.
(CALL, LOOPCALL): Correctly error if no fdef storage exists.
(sfnt_interpret_run): New label `next_instruction', for CALL.
(sfnt_interpret_compound_glyph_1): Allow decomposing up to 16
nested components. Prevent crash if there are no end points or
points.
(sfnt_read_cvar_table): Prevent assigning uninitialized values.
(sfnt_vary_simple_glyph): Update commentary.
2023-05-23 Po Lu <luangruo@yahoo.com>
* exec/exec.c (exec_0): Use strcpy.
2023-05-20 Po Lu <luangruo@yahoo.com>
* exec/trace.c (handle_clone_prepare, handle_clone): When
!REENTRANT, use malloc to allocate tracees after running out of
static ones.
* java/org/gnu/emacs/EmacsView.java (swapBuffers): Restore missing
damage rect code.
(onDetachedFromWindow): Remove redundant synchronization.
2023-05-19 Po Lu <luangruo@yahoo.com>
* lisp/touch-screen.el (touch-screen-tap-header-line): New
function.
([header-line touchscreen-begin]): Define to
`touch-screen-tap-header-line'.
2023-05-18 Po Lu <luangruo@yahoo.com>
* make-dist (possibly_non_vc_files): Add Android-specific files.
* doc/emacs/frames.texi (Tab Bars): Explain how to interact with
the tab bar from a touch screen.
* doc/emacs/input.texi (Touchscreens): Document exactly what a
``long press'' is.
* doc/emacs/windows.texi (Tab Line): Likewise.
* lisp/tab-line.el (tab-line-tab-map, tab-line-add-map)
(tab-line-tab-close-map, tab-line-left-map, tab-line-right-map):
Bind `touchscreen-begin' to each command.
(tab-line-track-tap, tab-line-event-start): New functions.
(tab-line-hscroll-right, tab-line-hscroll-left, tab-line-new-tab)
(tab-line-select-tab, tab-line-close-tab): Use them.
2023-05-16 Po Lu <luangruo@yahoo.com>
* lisp/menu-bar.el (popup-menu-normalize-position): Normalize
`touchscreen-begin' events correctly.
* lisp/tab-bar.el (tab-bar-mouse-context-menu): New argument POSN.
Use it if specified.
(touch-screen-track-tap, tab-bar-handle-timeout)
(tab-bar-touchscreen-begin): New functions.
(tab-bar-map): Bind [tab-bar touchscreen-begin].
* lisp/touch-screen.el (touch-screen-track-drag): Fix doc
string.
* src/dispextern.h: Export `get_tab_bar_item_kbd'.
* src/keyboard.c (coords_in_tab_bar_window): New function.
(make_lispy_event): Adjust touchscreen begin event mouse
position list for tab bar.
* src/xdisp.c (tab_bar_item_info): Allow CLOSE_P to be NULL.
(get_tab_bar_item): Adjust doc string.
(get_tab_bar_item_kbd): New function.
2023-05-15 Po Lu <luangruo@yahoo.com>
* configure.ac: Also disable enable_year2038.
* msdos/sed1v2.inp: Fix removal of ANDROID_BUILD_CFLAGS.
* msdos/sedlibmk.inp: Clear DIR_HAS_FD_MEMBER and LOCALE_FR_UTF8.
2023-05-14 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsDocumentsProvider.java
(notifyChangeByName): New function.
(queryDocument1): Set FLAG_SUPPORTS_MOVE where necessary.
(moveDocument): Implement new function.
2023-05-08 Po Lu <luangruo@yahoo.com>
* java/Makefile.in (install_temp/assets/version): Fix generation
in out of tree builds.
2023-05-07 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsInputConnection.java
(requestCursorUpdates):
* java/org/gnu/emacs/EmacsNative.java (requestCursorUpdates):
* java/org/gnu/emacs/EmacsService.java (updateCursorAnchorInfo):
New functions.
* src/android.c (struct android_emacs_service)
(android_init_emacs_service): Add new method.
(android_update_cursor_anchor_info): New function.
* src/androidfns.c (android_set_preeditarea): New function.
* src/androidgui.h (enum android_ime_operation): New operation
`REQUEST_CURSOR_UPDATES'.
(struct android_ime_event): Document new meaning of `length'.
* src/androidterm.c (android_request_cursor_updates): New
function.
(android_handle_ime_event): Handle new operations.
(handle_one_android_event, android_draw_window_cursor): Update
the preedit area if needed, like on X.
(requestCursorUpdates): New function.
* src/androidterm.h (struct android_output): New field
`need_cursor_updates'.
2023-05-06 Po Lu <luangruo@yahoo.com>
* configure.ac (LIBGMP_CFLAGS): Avoid non portable test
expression.
* cross/verbose.mk.android (AM_V_CC): Get rid of badly aligned
ANDROID_CC messages.
* java/org/gnu/emacs/EmacsInputConnection.java (syncAfterCommit)
(extractAbsoluteOffsets): Add workarounds for several kinds of
machines.
(commitText, getExtractedText): Likewise.
* src/textconv.c (really_commit_text): Improve definition of
POSITION.
(get_extracted_text): Default to providing at least 4 characters.
2023-05-05 Po Lu <luangruo@yahoo.com>
* exec/exec.h (struct exec_tracee): New field `new_child'. Also
make `waiting_for_syscall' a bitfield.
* exec/trace.c (PTRACE_GETEVENTMSG): New declaration.
(MAX_TRACEES): Bump to 4096.
(handle_clone_prepare): New function.
(handle_clone): If required, set `new_child' and wait for a ptrace
event describing the parent to arrive.
(after_fork): Clear new field.
(exec_waitpid): Upon a ptrace event describing a clone, create the
child's tracee if it doesn't already exist. Otherwise, copy over
the parent's cmdline and start running it.
* doc/emacs/android.texi (Android Environment): Document lossage
with SIGSTOP.
* exec/exec.c (exec_0): Check X_OK on file being opened. Also
handle /proc/self/exe.
* exec/trace.c (SYS_SECCOMP): Define when not present.
2023-05-04 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android Environment): Describe how to
turn off process killing.
* exec/trace.c (check_signal): New function.
(handle_exec, process_system_call): Handle signal-delivery-stop
while waiting synchronously for syscall completion.
2023-05-03 Po Lu <luangruo@yahoo.com>
* exec/config.h.in: Update from new automatically generated
headers.
* exec/configure.ac: Check for siginfo_t.si_syscall.
* exec/trace.c (exec_waitpid): If SIGSYS is received, and caused
by seccomp, drop it should the call number be the invalid system
call used by Emacs.
* exec/configure.ac: Use system extensions.
(HAVE_PROCESS_VM): Define if process_vm_readv and
process_vm_writev are available.
* exec/trace.c (read_memory, user_copy): Implement in terms of
process_vm if possible.
* exec/loader-mipsel.s (__start): Remove extraneous debugging
code.
* exec/Makefile.in: (.PHONY): Add `bootstrap-clean' and
`extraclean'.
(bootstrap-clean): New rule.
* java/Makefile.in (FIND_DELETE): New substitution.
(clean): Use FIND_DELETE.
2023-05-02 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android Environment): Improve doc.
* exec/config.h.in (__bool_true_false_are_defined):
* exec/configure.ac (REENTRANT): New definitions.
(READLINKAT_SYSCALL, READLINK_SYSCALL): New defines. Set on all
hosts.
* exec/exec.c (MIN, MAX): Remove redundant declarations. Move to
config.h.
(exec_0): Copy name of executable into NAME when !REENTRANT.
* exec/exec.h (struct exec_tracee): New struct `exec_file'.
* exec/trace.c (remove_tracee, handle_exec, handle_readlinkat)
(process_system_call, after_fork): Handle readlinkat system calls.
* exec/Makefile.in (.SUFFIXES): Include ., then `srcdir'.
* exec/loader-aarch64.s (_start):
* exec/loader-armeabi.s (_start):
* exec/loader-mips64el.s (__start):
* exec/loader-mipsel.s (__start):
* exec/loader-x86.s (_start):
* exec/loader-x86_64.s (_start): Get basename of opened exec file
and make it the command name. Fix envp skipping on x86 and
various leaks.
* exec/configure.ac: Check for declarations of stpcpy and stpncpy.
* exec/exec.c (stpcpy, stpncpy): Use replacements if declarations
are not present; this happens when a new Android NDK is building
for an old version of Android.
2023-05-01 Po Lu <luangruo@yahoo.com>
* exec/config.h.in: Update config.h.in.
* exec/configure.ac: Check for stpcpy and stpncpy.
* exec/exec.c (rpl_stpcpy, rpl_stpncpy): Define replacements when
they are not present on the system.
(process_program_header): Fill comment.
* src/term.c (syms_of_term): Pretend Android uses TERMINFO.
* exec/exec.c (format_pid): New function.
(exec_0): Make cwd relative file names relative to /proc/pid/cwd.
* exec/trace.c (handle_exec): Handle EINTR.
(process_system_call): Report failure without clobbering x0.
* README: Describe `exec' directory.
* lisp/subr.el (use-dialog-box-p): Always prefer dialog boxes.
* src/android.c (android_write_event, JNICALL): Raise SIGIO on key
press and window action events.
* exec/trace.c (process_system_call): Save and restore x0, x1 and
x2 regs after replacing them with an invalid file descriptor.
* Makefile.in (extraclean): Clean in exec as well.
* configure.ac: Fix detection of absolute srcdir. Also, pass
CFLAGS.
* exec/Makefile.in: (.c.o): Add -I. so config.h can be found.
(.s.o): Don't create m4 temporary in srcdir.
* exec/config-mips.m4.in (DADDI2, DADDI3): New macros. Define to
substitute if as cannot assemble daddi.
* exec/configure.ac (user_h): Look for user.h in asm/ as well.
Use new user.h. Also look in ptrace.h on arm systems. Check if
as supports daddi on mips64.
* exec/exec.c (check_interpreter): Fix char signedness bug.
* exec/loader-mips64el.s (__start): Use DADDI2 and DADDI3 for two-
and 3-operand daddi.
* exec/mipsel-user.h: Don't include sgidefs.h.
* java/INSTALL: Document that m4 is now required.
* src/android.c (android_rewrite_spawn_argv): Add missing NULL.
* doc/emacs/android.texi (Android Environment): Document
`android-use-exec-loader'.
* exec/exec1.c (main): Set program group of child process.
* src/android.c (android_rewrite_spawn_argv): New function.
* src/android.h: Update prototypes.
* src/androidfns.c (syms_of_androidfns): New variable
`android_use_exec_loader'.
* src/callproc.c (emacs_spawn): Rewrite the argument vector to use
exec1 if necessary.
* .gitignore: Add exec/configure.
2023-04-30 Po Lu <luangruo@yahoo.com>
* .gitignore: New files.
* Makefile.in (mostlyclean_dirs): Add libexec, if its Makefile
exists.
* autogen.sh (do_git): Autoreconf in exec as well.
* configure.ac: Configure libexec on Android.
* exec/Makefile.in:
* exec/README:
* exec/config-mips.m4.in:
* exec/config.guess:
* exec/config.h.in:
* exec/config.sub:
* exec/configure:
* exec/configure.ac:
* exec/deps.mk:
* exec/exec.c (MIN, struct exec_open_command)
(struct exec_map_command, struct exec_jump_command)
(write_open_command, write_load_command, process_interpreter_1)
(process_interpreter, process_program_header, insert_args)
(exec_0):
* exec/exec.h (_EXEC_H_, struct elf_header_32)
(struct program_header_32, struct dt_entry_32)
(struct elf_header_64, struct program_header_64)
(struct dt_entry_64, struct exec_tracee):
* exec/exec1.c (main):
* exec/install-sh (scriptversion):
* exec/loader-aarch64.s (_start):
* exec/loader-armeabi.s (_start):
* exec/loader-mips64el.s (__start):
* exec/loader-mipsel.s (__start):
* exec/loader-x86.s (_start):
* exec/loader-x86_64.s (_start):
* exec/mipsel-user.h (_MIPSEL_USER_H_):
* exec/mipsfpu.c (MIPS_ABI_FP_ANY, fpu_reqs, valid_abi_p)
(fp_mode_for_abi, cpu_supports_fr0_p, determine_fpu_mode):
* exec/mipsfpu.h (_MIPSFPU_H_, FP_FR0):
* exec/test.c (print_usage, main):
* exec/trace.c (MAX_TRACEES, aarch64_set_regs, read_memory)
(user_alloca, user_copy, remove_tracee, handle_clone)
(syscall_trap_p, handle_exec, process_system_call, tracing_execve)
(after_fork, find_tracee, exec_waitpid, exec_init): New files.
* java/Makefile.in (CROSS_EXEC_BINS): Add exec1 and loader.
($(CROSS_EXEC_BINS) &): New target.
2023-04-29 Po Lu <luangruo@yahoo.com>
* build-aux/ndk-build-helper.mk (TARGET_ARCH): Define variable.
* configure.ac (ENABLE_CHECKING, CHECK_STRUCTS)
(GC_CHECK_STRING_OVERRUN, GC_CHECK_STRING_FREE_LIST, GLYPH_DEBUG)
(GC_CHECK_STRING_BYTES): Enable checking correctly on Android.
* java/README: Fix typos.
* m4/ndk-build.m4 (ndk_run_test): Pass target arch.
* src/android.c (android_get_content_name, android_close)
(android_fclose, android_check_string): Fix various typos caught
by checking.
* src/charset.c (load_charset_map_from_file): Call emacs_fclose,
not fclose.
* src/image.c (image_set_transform): Fix thinko.
(png_load_body, jpeg_load_body, gif_load): Call emacs_fclose, not
fclose. Use open instead of fdopen.
* src/xfaces.c (Fx_load_color_file): Likewise.
2023-04-27 Po Lu <luangruo@yahoo.com>
* src/image.c (image_create_bitmap_from_data): Fix typo in
preprocessor conditionals.
* doc/emacs/android.texi (Android File System, Android Windowing):
Make Emacs manual more portable.
* doc/lispref/commands.texi (Misc Events):
* doc/lispref/frames.texi (Accessing Selections, X Selections):
Fix pieces of the Info manual.
2023-04-26 Po Lu <luangruo@yahoo.com>
* lisp/play/doctor.el (text-conversion-style, doctor-mode):
* lisp/play/dunnet.el (text-conversion-style, dun-mode): Set
`text-conversion-style' to `action'.
2023-04-13 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android Fonts): Update documentation.
* doc/lispref/frames.texi (Accessing Selections, X Selections):
Fix typos.
* src/sfntfont-android.c (system_font_directories)
(init_sfntfont_android): Add `/product/fonts'.
2023-04-08 Po Lu <luangruo@yahoo.com>
* doc/lispref/elisp.texi (Top):
* doc/lispref/frames.texi (Frames): Add ``Accessing Selections''
to menu.
(Accessing Selections, X Selections, Other Selections): New nodes.
2023-04-06 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android Windowing): Update selection
restrictions.
* java/org/gnu/emacs/EmacsClipboard.java (EmacsClipboard): New
functions `getClipboardTargets' and `getClipboardData'.
* java/org/gnu/emacs/EmacsSdk11Clipboard.java
(EmacsSdk11Clipboard, getClipboardTargets, getClipboardData):
Implement these virtual functions defined in EmacsClipboard.
* java/org/gnu/emacs/EmacsSdk8Clipboard.java: Stub out new
functions.
* lisp/term/android-win.el (android-get-clipboard-1): Implement
MIME type targets.
* src/android.c (android_exception_check)
(android_exception_check_1, android_exception_check_2): Fix
punctuation in warning message.
(android_exception_check_nonnull_1): New function.
* src/android.h: Update prototypes.
* src/androidselect.c (struct android_emacs_clipboard): New
methods.
(android_init_emacs_clipboard): Initialize new methods.
(Fandroid_get_clipboard_targets, android_xfree_inside)
(Fandroid_get_clipboard_data): New functions.
(syms_of_androidselect): Define new subrs.
2023-04-04 Po Lu <luangruo@yahoo.com>
* lisp/subr.el (read-char-from-minibuffer): Don't use undefined
variable. Reported by Robert Pluim.
2023-04-03 Po Lu <luangruo@yahoo.com>
* src/sfnt.c (sfnt_normalize_vector): Don't rely on undefined
sign extension semantics.
2023-03-30 Po Lu <luangruo@yahoo.com>
* src/sfntfont.c: Adjust font cache size constants.
* src/sfnt.c (GETINFO): Fix typo.
* src/sfnt.h: Fix typo.
* src/sfnt.c (sfnt_make_interpreter): New argument `fvar'. Set
axis count.
(SCANCTRL): Implement selector bit 8.
(GXAXIS): New instruction.
(SFVTPV): Validate graphics state after changing freedom vector.
(sfnt_line_to_vector): Implement `original'.
(sfnt_move): Remove redundant division.
(sfnt_interpret_run): Implement distortable font related GXAXIS
instruction (0x91).
(sfnt_vary_interpreter): Set naxis and norm_coords.
(sfnt_make_test_interpreter, pushb_test_args, pushw_test_args)
(sfnt_name_instruction, main): Adjust accordingly.
* src/sfnt.h (struct sfnt_interpreter):
* src/sfntfont.c (sfntfont_setup_interpreter, sfntfont_open): Set
up distortion information.
2023-03-29 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android Fonts): Document distortable
font replacement rules.
* src/sfntfont.c (sfnt_replace_fonts_p): New function.
(sfnt_enum_font_1): Call it.
* src/sfnt.c (sfnt_move_x, sfnt_move_y, sfnt_move): Set N flags
and don't forget to set N points too.
(sfnt_read_avar_table): Fix sequencing problem.
* src/sfntfont.c (sfntfont_setup_interpreter): Don't create
interpreter for blatently broken fonts.
(sfntfont_open): Avoid specifying redundant blends.
* src/sfnt.c (sfnt_validate_gs): Fix validation of projection
vector.
2023-03-28 Po Lu <luangruo@yahoo.com>
* src/sfnt.c (sfnt_vary_compound_glyph):
* src/sfntfont.c (sfntfont_get_glyph)
(sfntfont_get_glyph_outline): Avoid clobbering offset size flag
when varying compound glyph.
* src/sfnt.c (sfnt_vary_simple_glyph, sfnt_vary_compound_glyph):
Fix application of intermediate tuples.
* src/sfntfont.c (sfntfont_open): Set xlfd name after applying
distortion.
* src/sfnt.h (SFNT_ROUND_FIXED):
* src/sfntfont.c (sfntfont_probe_widths):
(sfntfont_measure_pcm): Round lbearing properly.
(sfnt_open_tables): Fix typos in non-HarfBuzz code.
* src/androidterm.c (android_draw_image_glyph_string): Restore
potentially clobbered GC clipping.
* src/sfnt.c (sfnt_large_integer_add, sfnt_multiply_divide_round)
(sfnt_mul_fixed_round): New functions.
(sfnt_build_glyph_outline): Take unscaled glyph metrics.
(sfnt_prepare_raster, sfnt_vary_simple_glyph)
(sfnt_vary_compound_glyph, sfnt_vary_interpreter): Use rounding
multiplication to scale deltas.
(main): Adjust tests.
* src/sfntfont.c (sfntfont_get_glyph_outline)
(sfntfont_probe_widths, sfntfont_open, sfntfont_measure_pcm)
(sfntfont_draw): More minor fixes to variable fonts.
2023-03-27 Po Lu <luangruo@yahoo.com>
* src/sfnt.c (sfnt_normalize_blend): Don't crash when axis
variations are not present.
* configure.ac (HAVE_OTF_GET_VARIATION_GLYPHS): Check for
`hb_font_set_var_named_instance'.
* src/sfnt.c (main): Update tests.
* src/sfntfont-android.c (Fandroid_enumerate_fonts): Blacklist
bad font.
* src/sfntfont.c (struct sfnt_font_tables, struct sfnt_font_desc)
(sfnt_decode_instance_name, sfnt_weight_descriptions)
(sfnt_enum_font_1, sfntfont_list_1, sfntfont_desc_to_entity)
(sfntfont_list, struct sfntfont_get_glyph_outline_dcontext)
(sfntfont_get_glyph, sfntfont_get_glyph_outline)
(struct sfnt_font_info, sfnt_close_tables, sfnt_open_tables)
(sfntfont_open, sfntfont_measure_pcm, sfntfont_close)
(sfntfont_draw, sfntfont_begin_hb_font, syms_of_sfntfont)
(mark_sfntfont): Handle variable fonts correctly.
* src/sfnt.c (sfnt_build_glyph_outline): Take scale, not head
and pixel size.
(sfnt_scale_metrics_to_pixel_size): Delete function.
(sfnt_get_scale): New function.
(main): Update tests.
* src/sfnt.h: Update prototypes.
* src/sfntfont.c (struct sfnt_outline_cache)
(sfntfont_get_glyph_outline, struct sfnt_font_info)
(sfntfont_open): Save scale in font information and use it.
(sfntfont_measure_instructed_pcm): Delete function.
(sfntfont_measure_pcm): Make this the only ``measure pcm''
function.
(sfntfont_draw): Rely on sfntfont_get_glyph_outline for the scale.
(struct sfnt_font_tables): New structure.
(struct sfnt_font_desc): New field `tables'.
(struct sfnt_font_info): New field `desc'.
(sfntfont_setup_interpreter): Drop fd arguments and don't try to
load interpreter tables.
(sfnt_open_tables, sfnt_close_tables): New functions.
(sfnt_reference_font_tables, sfnt_dereference_font_tables): New
functions.
(sfntfont_open, sfntfont_close): Implement in terms of those
functions in order to share tables.
2023-03-26 Po Lu <luangruo@yahoo.com>
* src/sfnt.c (sfnt_table_names): Add avar.
(sfnt_read_glyph): Clear distortion fields.
(sfnt_build_glyph_outline): Calculate the outline origin point.
(sfnt_prepare_raster): Apply the origin point to the X axis
offset.
(sfnt_scale_metrics_to_pixel_size): New function.
(sfnt_build_instructed_outline): Use instructed origin phantom
point to determine the outline origin.
(sfnt_compute_phantom_points): Apply origin and advance
distortion.
(struct sfnt_variation_axis, struct sfnt_instance)
(struct sfnt_fvar_table, sfnt_read_fvar_table)
(struct sfnt_gvar_table, sfnt_read_gvar_table)
(sfnt_read_avar_table, struct sfnt_blend, sfnt_init_blend)
(sfnt_free_blend, sfnt_normalize_blend, struct sfnt_tuple_header)
(struct sfnt_gvar_glyph_header, sfnt_read_packed_deltas)
(sfnt_compute_tuple_scale, sfnt_read_cvar_table)
(sfnt_infer_deltas_1, sfnt_vary_simple_glyph, sfnt_infer_deltas)
(sfnt_vary_glyph, sfnt_vary_compound_glyph)
(sfnt_vary_interpreter): New functions. Add structs to
sfntfont.h.
(struct sfnt_test_dcontext, sfnt_test_get_glyph, main): Test
distortable font handling.
* src/sfnt.h (SFNT_ENABLE_HINTING, enum sfnt_table)
(struct sfnt_glyph, struct sfnt_glyph_outline, struct sfnt_raster)
(struct sfnt_default_uvs_table, struct sfnt_unicode_value_range)
(struct sfnt_nondefault_uvs_table, struct sfnt_uvs_mapping)
(struct sfnt_mapped_variation_selector_record)
(struct sfnt_table_offset_rec, struct sfnt_uvs_context)
(struct sfnt_mapped_table, struct sfnt_variation_axis)
(struct sfnt_instance, struct sfnt_fvar_table)
(struct sfnt_short_frac_correspondence)
(struct sfnt_short_frac_segment, struct sfnt_avar_table)
(struct sfnt_tuple_variation, struct sfnt_cvar_table)
(struct sfnt_gvar_table, struct sfnt_blend)
(struct sfnt_metrics_distortion): Update prototypes.
* src/sfntfont.c (sfntfont_get_glyph_outline)
(sfntfont_measure_pcm): Adjust calls.
2023-03-24 Po Lu <luangruo@yahoo.com>
* src/sfnt.c (sfnt_table_names): Add fvar, gvar, cvar.
(sfnt_read_maxp_table): Call xmalloc, not malloc.
(sfnt_read_simple_glyph): Avoid use-after-free if simple is
invalid.
(sfnt_fill_span): Fix max coverage.
(sfnt_normalize_vector): Fail if magnitude is zero.
(sfnt_measure_distance): Fix opcode order.
(sfnt_dot_fix_14): Fix implementation.
(struct sfnt_variation_axis, struct sfnt_instance)
(struct sfnt_fvar_table, struct sfnt_gvar_table)
(sfnt_read_fvar_table, sfnt_read_gvar_table, struct sfnt_blend)
(sfnt_init_blend, sfnt_free_blend, sfnt_normalize_blend)
(struct sfnt_tuple_header, struct sfnt_gvar_glyph_header)
(sfnt_read_packed_points, sfnt_read_packed_deltas)
(sfnt_compute_tuple_scale, sfnt_infer_deltas_1, sfnt_infer_deltas)
(sfnt_vary_glyph): Add WIP variation glyph implementation.
* src/sfnt.h (enum sfnt_table, struct sfnt_simple_glyph):
Likewise.
2023-03-20 Po Lu <luangruo@yahoo.com>
* java/INSTALL: Fix typo.
* configure.ac: Add support for HarfBuzz on Android.
* java/INSTALL: Document where to get Emacs with HarfBuzz.
* lisp/subr.el (overriding-text-conversion-style, y-or-n-p):
Correctly set text conversion style if y-or-n-p is called inside
the minibuffer.
* src/sfnt.c (sfnt_read_cmap_format_8)
(sfnt_read_cmap_format_12): Fix typos.
(sfnt_read_24, sfnt_read_cmap_format_14): New function.
(sfnt_read_cmap_table_1, sfnt_read_cmap_table): Handle format 14
cmap tables.
(sfnt_read_default_uvs_table, sfnt_read_nondefault_uvs_table)
(sfnt_compare_table_offsets, sfnt_create_uvs_context)
(sfnt_free_uvs_context, sfnt_compare_uvs_mapping)
(sfnt_variation_glyph_for_char, sfnt_map_table, sfnt_unmap_table)
(sfnt_read_table, sfnt_test_uvs): New functions.
(main): Add UVS tests.
* src/sfnt.h (struct sfnt_cmap_format_14)
(struct sfnt_variation_selector_record)
(struct sfnt_default_uvs_table, struct sfnt_unicode_value_range)
(struct sfnt_nondefault_uvs_table, struct sfnt_uvs_mapping)
(struct sfnt_mapped_variation_selector_record)
(struct sfnt_table_offset_rec, struct sfnt_uvs_context)
(struct sfnt_mapped_table): New structures. Update prototypes.
* src/sfntfont-android.c (android_sfntfont_driver): Register
HarfBuzz callbacks where required.
* src/sfntfont.c (sfntfont_select_cmap): Look for a format 14
table. Save it in new arg FORMAT14.
(sfntfont_read_cmap): Adjust accordingly.
(struct sfnt_font_info): New field `uvs'. New fields `hb_font',
`fd' and `directory'.
(sfntfont_open): Open uvs context. Under HarfBuzz, don't close
the fd or subtable, but save them in the font info instead.
(sfntfont_close): Free UVS context. Close font fd and table
directory and HarfBuzz font.
(sfntfont_draw): Handle case where s->padding_p.
(sfntfont_get_variation_glyphs): New function.
(sfntfont_unmap_blob, sfntfont_get_font_table)
(sfntfont_begin_hb_font): New functions.
* src/sfntfont.h: Update prototypes.
* src/textconv.c (Fset_text_conversion_style): Fix doc string.
2023-03-18 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsView.java (onAttachedToWindow): Send
measured width and height in exposures again.
* src/androidterm.c (handle_one_android_event): Don't log expose
events.
* src/android.c (android_run_select_thread): New flag. Use it
rather than the rc of pselect and errno to determine whether or
not it has been interrupted.
(android_handle_sigusr1): Set said flag.
* java/org/gnu/emacs/EmacsView.java (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.
2023-03-17 Po Lu <luangruo@yahoo.com>
* src/androidfns.c (Fx_server_vendor, Fx_server_version): New
functions.
(syms_of_androidfns): Define new functions.
* src/androidterm.c (android_set_build_fingerprint)
(syms_of_androidterm): Set new variable
Vandroid_build_manufacturer.
* src/xfns.c (Fx_server_vendor, Fx_server_version): Update doc
strings.
* src/fileio.c (emacs_fd_to_int): Don't define on WINDOWSNT.
* src/image.c (image_create_bitmap_from_data): Don't abort if
!defined HAVE_ANDROID.
* configure.ac:
* m4/ndk-build.m4 (ndk_INIT, ndk_LATE): Avoid AC_REQUIRE magic.
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu): New
field `lastGroupId'.
(Item): New field `isRadio'.
(addItem): New arg `isRadio'.
(inflateMenuItems): Apply an empty radio button group if required.
* src/androidmenu.c (android_init_emacs_context_menu): Adjust
accordingly.
(android_menu_show): Likewise.
* java/org/gnu/emacs/EmacsView.java (cancelPopupMenu): Dismiss
context menu correctly.
(isOpaque): New function.
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java: Make
consumer list public.
* configure.ac: Add missing precious variable.
2023-03-16 Po Lu <luangruo@yahoo.com>
* lisp/frame.el (android-detect-mouse):
* lisp/term/android-win.el (android-get-connection): Add function
declarations.
* configure.ac: Remove unnecessary escape.
* configure.ac (AUTO_DEPEND, ANDROID_STUBIFY, ANDROID_LDFLAGS):
* lib/Makefile.in (ANDROID_CFLAGS, ANDROID_BUILD_CFLAGS)
(ALL_CFLAGS):
* lib/gnulib.mk.in (AM_DEFAULT_VERBOSITY):
* msdos/sed1v2.inp:
* msdos/sedlibmk.inp:
* src/Makefile.in (ANDROID_OBJ, EMACS_CFLAGS): Make those
variables precious. Rename ANDROID_CFLAGS substitution to
ANDROID_BUILD_CFLAGS.
* nt/mingw-cfg.site: Suppress build of Gnulib printf.
* java/org/gnu/emacs/EmacsDocumentsProvider.java (queryRoots): Add
icon to document root.
* lisp/loadup.el (current-load-list): Set to empty load list after
startup.
* src/lread.c (build_load_history): Revert earlier changes.
2023-03-15 Po Lu <luangruo@yahoo.com>
* configure.ac: Improve portability.
2023-03-15 Robert Pluim <rpluim@gmail.com>
* src/fileio.c (Finsert_file_contents):
* src/window.c (replace_buffer_in_windows): Call Fboundp, not
boundp.
2023-03-15 Po Lu <luangruo@yahoo.com>
* cross/Makefile.in (lib/gnulib.mk): Edit out build-aux stuff.
* m4/ndk-build.m4: Also look for cross ranlib.
* src/sfntfont.c (sfntfont_close): Fix warning w/o mmap.
* lib-src/asset-directory-tool.c (main_2): Port to systems without
htole32.
2023-03-15 Po Lu <luangruo@yahoo.com>
* configure.ac (XCONFIGURE): Disable NS.
* cross/Makefile.in (lib-src/config.h, lib/libgnu.a)
(src/android-emacs): Port sed invocation to Mac OS without GNU
sed.
2023-03-15 Po Lu <luangruo@yahoo.com>
* doc/lispref/commands.texi (Misc Events): Document variable
`disable-inhibit-text-conversion'.
* java/org/gnu/emacs/EmacsDialog.java (display1): Try an activity
that is certain to be focused first.
* lisp/touch-screen.el (touch-screen-track-tap)
(touch-screen-track-drag): Bind `disable-inhibit-text-conversion'.
* src/keyboard.c (read_key_sequence): Only disable text conversion
if an actual function or numeric key is found in the key sequence.
(syms_of_keyboard): New variable
`disable-inhibit-text-conversion'.
* src/lread.c (read_filtered_event): Check new variable.
* src/textconv.c (textconv_query): Remove unused label.
* nt/gnulib-cfg.mk: Omit new gnulib modules.
2023-03-14 Po Lu <luangruo@yahoo.com>
* lisp/minibuffer.el (minibuffer-setup-on-screen-keyboard): Handle
cases where last-event-frame is a kbd macro.
* src/keyboard.c (lispy_function_keys): Remove duplicates.
* msdos/sed1v2.inp:
* msdos/sed3v2.inp:
* msdos/sedlibcf.inp:
* msdos/sedlibmk.inp: Update for Android port and new Gnulib
modules.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Detect mice
on up events as well.
(onSomeKindOfMotionEvent): Work past framework bug.
* src/androidterm.c (android_perform_conversion_query):
* src/textconv.c (textconv_query):
* src/textconv.h (TEXTCONV_SKIP_ACTIVE_REGION): Remove unused
code.
* doc/emacs/android.texi (Android Windowing): Document how to
display dialogs when Emacs is in the background.
* java/org/gnu/emacs/EmacsDialog.java (display1): Use system
dialogs if possible.
2023-03-13 Po Lu <luangruo@yahoo.com>
* etc/NEWS: Announce new option.
* lisp/menu-bar.el (menu-bar-close-window): New option.
(kill-this-buffer, kill-this-buffer-enabled-p): Adjust
accordingly.
* src/keyboard.c (lispy_function_keys): Add more silly keys.
* src/android.c (android_check_string, android_build_string):
Reduce consing when building menu bar strings.
* etc/MACHINES (Android): Update with more recent information.
* doc/emacs/android.texi (Android Startup): Document changes to
emacsclient wrapper.
* java/org/gnu/emacs/EmacsOpenActivity.java (EmacsOpenActivity)
(startEmacsClient): Open EmacsActivity if the service is not
running.
* java/org/gnu/emacs/EmacsService.java (onCreate):
* java/org/gnu/emacs/EmacsThread.java (run): Pass any file to open
to Emacs.
* lisp/term/android-win.el (handle-args-function): Implement.
* src/image.c (image_create_bitmap_from_file, image_find_image_fd)
(close_android_fd, slurp_file): Return and use `struct
android_fd_or_asset' on Android.
(xbm_load, xpm_load, pbm_load, png_load_body, jpeg_load_body)
(webp_load, svg_load): Adjust accordingly.
2023-03-12 Po Lu <luangruo@yahoo.com>
* src/android.c (android_get_screen_width)
(android_get_screen_height, android_get_mm_width)
(android_get_mm_height, android_detect_mouse): Correctly handle
Java exceptions.
* src/android.c (android_check_if_event): New function.
* src/androidgui.h: Update prototypes.
* src/androidterm.c (android_event_is_for_frame): New function.
(android_reset_conversion): Free and unqueue all text conversion
events for the given frame.
* src/androidterm.c (NATIVE_NAME, JNICALL)
(android_build_extracted_text, android_update_selection): Use
0-based indices for Android buffer positions. Also, report
surrounding text relative to the region, not to the cursor.
* src/textconv.c (textconv_query): Accept new values of position.
(really_set_composing_text): Use ephemeral last point.
* java/org/gnu/emacs/EmacsOpenActivity.java (onCancel): New
function.
(displayFailureDialog): Handle dialog cancellation.
* src/sfntfont.c (sfnt_parse_languages): Look for SLNG tag if
DLNG is not present.
* src/androidgui.h (enum android_modifier_mask): New modifier
ANDROID_SUPER_MASK.
* src/androidterm.c (android_android_to_emacs_modifiers)
(android_emacs_to_android_modifiers): Add new modifier.
* src/androidterm.c (syms_of_androidterm): Initialize
Vandroid_build_fingerprint in case GC happens.
* src/emacs-module.c (module_reset_handlerlist): Fix macro
conflict.
* src/emacs-module.c (MODULE_HANDLE_NONLOCAL_EXIT)
(module_make_global_ref, module_free_global_ref)
(module_make_function, module_get_function_finalizer)
(module_set_function_finalizer, module_make_interactive)
(module_funcall, module_intern, module_type_of)
(module_extract_integer, module_make_integer, module_extract_float)
(module_make_float, module_copy_string_contents)
(module_make_string, module_make_unibyte_string)
(module_make_user_ptr, module_get_user_ptr, module_set_user_ptr)
(module_get_user_finalizer, module_set_user_finalizer)
(module_vec_set, module_vec_get, module_vec_size)
(module_process_input, module_extract_time, module_make_time)
(module_extract_big_integer, module_make_big_integer)
(module_open_channel, module_reset_handlerlist): Adjust as
recommended by Paul Eggert <eggert@cs.ucla.edu>.
* configure.ac: Take option `--with-shared-user-id' and give it to
AndroidManifest.xml.in.
* java/AndroidManifest.xml.in: Substitute that into the
application info.
* java/INSTALL (BUILDING WITH A SHARED USER ID): New section.
2023-03-11 Po Lu <luangruo@yahoo.com>
* configure.ac (with_mailutils): Default to off on Android.
(HAVE_MAILUTILS, with_mailutils, ANDROID_SDK_8_OR_EARLIER)
(XCONFIGURE): Fix POP and mailutils configuration on Android.
* java/Makefile.in:
* src/callproc.c (syms_of_callproc): Avoid using built-in movemail
when --with-mailutils.
* src/android.c (android_resolve_handle)
(android_resolve_handle2): Don't perform checking done by CheckJNI
by default.
(android_copy_area): Check for errors here because CopyArea can
perform a lot of consing.
(android_define_cursor): Remove redundant code.
* java/org/gnu/emacs/EmacsActivity.java (onContextMenuClosed):
Process submenu closing normally if it happens more than 300 ms
after a submenu item was selected.
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu)
(onMenuItemClick, display1): Give `wasSubmenuSelected' different
values depending on how the submenu was selected.
* lib/gnulib.mk.in: Update from gnulib.
* configure.ac: Default modules to on. Remove check for
__attribute__((cleanup)). However, keep the new `ifavailable'
value for systems without dlopen.
* src/emacs-module.c (MODULE_HANDLE_NONLOCAL_EXIT): Don't rely on
cleanup attribute and correctly reset handlerlist upon longjmp.
(MODULE_INTERNAL_CLEANUP): New macro.
(module_make_global_ref, module_free_global_ref)
(module_make_function, module_get_function_finalizer)
(module_set_function_finalizer, module_make_interactive)
(module_funcall, module_intern, module_type_of)
(module_extract_integer, module_make_integer, module_extract_float)
(module_make_float, module_copy_string_contents)
(module_make_string, module_make_unibyte_string)
(module_make_user_ptr, module_get_user_ptr, module_set_user_ptr)
(module_get_user_finalizer, module_set_user_finalizer)
(module_vec_set, module_vec_get, module_vec_size)
(module_process_input, module_extract_time, module_make_time)
(module_extract_big_integer, module_make_big_integer)
(module_open_channel): Call MODULE_INTERNAL_CLEANUP prior to
returning.
* lisp/term/android-win.el (x-pointer-arrow, x-pointer-left-ptr)
(x-pointer-left-side, x-pointer-sb-h-double-arrow)
(x-pointer-sb-v-double-arrow, x-pointer-watch, x-pointer-xterm)
(x-pointer-invisible): New constants.
* src/androidterm.c (android_show_hourglass)
(android_hide_hourglass): New functions.
(android_toggle_visible_pointer, android_define_frame_cursor):
Define or don't define hourglass cursor if x->hourglass.
(android_redisplay_interface): Add new functions.
* src/androidterm.h (struct android_output): New field
`hourglass'.
2023-03-10 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android Windowing): Document how to pass
multimedia keys to the system.
* java/org/gnu/emacs/EmacsNative.java
(shouldForwardMultimediaButtons): New function.
* java/org/gnu/emacs/EmacsView.java (onKeyDown, onKeyMultiple)
(onKeyUp): Check that function.
* java/org/gnu/emacs/EmacsWindow.java (defineCursor): Handle cases
where cursor is NULL.
* src/android.c (NATIVE_NAME): New function.
* src/androidfns.c (syms_of_androidfns): New variable.
* src/keyboard.c (lispy_function_keys): Add volume keys.
* java/org/gnu/emacs/EmacsCursor.java: New file.
* java/org/gnu/emacs/EmacsWindow.java (defineCursor): New
function.
* src/android.c (struct android_emacs_cursor): New struct.
(android_init_emacs_cursor): New function.
(initEmacs): Call it.
(android_create_font_cursor, android_define_cursor)
(android_free_cursor): New functions.
* src/android.h (enum android_handle_type): Add cursor handle
type.
* src/androidfns.c (Fx_create_frame, android_create_tip_frame)
(enum mouse_cursor, struct mouse_cursor_types, mouse_cursor_types)
(struct mouse_cursor_data, android_set_mouse_color)
(syms_of_androidfns):
* src/androidgui.h (enum android_cursor_shape):
* src/androidterm.c (make_invisible_cursor)
(android_toggle_invisible_pointer, android_free_frame_resources)
(android_define_frame_cursor):
* src/androidterm.h (struct android_display_info)
(struct android_output): Port mouse cursor code over from X.
* java/org/gnu/emacs/EmacsNative.java: Add missing dependency.
* lisp/battery.el (battery-status-function): Don't look for /sys
or /proc* on Android. Explain why.
* java/org/gnu/emacs/EmacsService.java (queryBattery19): New
function.
(queryBattery): Call it on old systems. Also, return AC line
status and temperature.
* lisp/battery.el (battery-android): Implement more format
directives.
* src/android.c (android_query_battery): Handle new status fields.
* src/android.h (struct android_battery_state): Add `plugged' and
`temperature'.
* src/androidfns.c (Fandroid_query_battery): Return new fields.
2023-03-09 Po Lu <luangruo@yahoo.com>
* src/android.c (android_destroy_handle): Handle OOM errors in
android_destroy_handle.
* textconv.c: Remove out-of-date comment.
* java/org/gnu/emacs/EmacsActivity.java (onContextMenuClosed):
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu)
(onMenuItemClick, run):
* java/org/gnu/emacs/EmacsDialog.java (onClick, createDialog)
(onDismiss): Take menu event serial, and pass it along in context
menu events.
* java/org/gnu/emacs/EmacsNative.java (sendContextMenu): New
argument.
* src/android.c (sendContextMenu): Pass serial number in event.
* src/androidgui.h (struct android_menu_event): New field
`menu_event_serial'.
* src/androidmenu.c (android_init_emacs_dialog): Adjust method
declarations.
(android_menu_show, android_dialog_show):
* src/androidterm.c (handle_one_android_event): Expect serial in
context menu events.
* src/androidterm.h: Update prototypes.
* configure.ac (HAVE_WEBP): Disable WebPGetInfo check when
REALLY_ANDROID.
* java/debug.sh (is_root): Port to Android versions which don't
support `chmod +x'.
* src/android.c (android_content_name_p): Disable before API level
19.
* java/org/gnu/emacs/EmacsContextMenu.java (addItem): New argument
`tooltip'.
* src/android.c (android_build_string): Convert the text to
UTF-16, and create the Java string using that.
(android_build_jstring): Update comment.
* src/androidmenu.c (android_init_emacs_context_menu): Add String
argument to `addItem'.
(android_menu_show): Correctly pass help strings in regular menu
items.
* src/sfnt.c (_sfnt_swap16, _sfnt_swap32): Avoid reserved names.
* src/android.c (android_set_input_focus): Don't call method on
window using service class.
* src/sfnt.c (ODD): Use PUSH_UNCHECKED.
2023-03-08 Po Lu <luangruo@yahoo.com>
* src/fileio.c (Fcopy_file): On Android, ignore ENOSYS and ENOTSUP
when restoring file times, as many old kernel versions encountered
on Android devices omit support for the relevant system calls.
* src/androidterm.c (android_build_extracted_text): Return NULL if
text class not initialized.
(android_update_selection): Check that EXTRACTED is not NULL.
* doc/emacs/android.texi (Android File System): Document what
`temp~unlinked' means in the temporary files directory.
* java/org/gnu/emacs/EmacsService.java (updateExtractedText): New
function.
* java/org/gnu/emacs/EmacsView.java (onCreateInputConnection): Ask
the input method nicely to not display the extracted text UI.
* src/android.c (struct android_emacs_service): New method
`updateExtractedText'.
(android_hack_asset_fd_fallback): Improve naming convention. Fix
typo.
(android_init_emacs_service): Add new method.
(android_update_extracted_text): New function.
(android_open_asset): Fix typo.
* src/androidgui.h: Update prototypes.
* src/androidterm.c (struct android_get_extracted_text_context):
New field `flags'.
(android_get_extracted_text): Set flags on the frame's output
data.
(android_build_extracted_text): New function.
(getExtractedText): Move out class structures.
(android_update_selection): Send updates to extracted text if the
input method asked for them.
(android_reset_conversion): Clear extracted text flags.
* src/androidterm.h (struct android_output): New fields for
storing extracted text data.
* src/sfnt.c (sfnt_read_cmap_table): Don't allocate too big data.
Also, free elements of (*data), not offsets into data itself.
2023-03-07 Po Lu <luangruo@yahoo.com>
* java/Makefile.in (install_temp/assets/build_info): New rule.
(emacs.apk-in): Depend on that file.
* lisp/version.el (android-read-build-system)
(android-read-build-time): New functions.
(emacs-build-system, emacs-build-time): Use those functions on
Android, as dumping is done after installation on Android.
* src/fileio.c (Finsert_file_contents):
* src/window.c (replace_buffer_in_windows): Don't call functions
if they are not defined, which can happen during loadup.
* java/org/gnu/emacs/EmacsWindow.java (onSomeKindOfMotionEvent):
Dismiss splurious LeaveNotify events from button presses.
* src/android.c (android_change_window_attributes)
(android_change_gc, android_set_clip_rectangles)
(android_reparent_window, android_clear_window)
(android_map_window, android_unmap_window, android_resize_window)
(android_move_window, android_swap_buffers)
(android_fill_rectangle, android_copy_area)
(android_fill_polygon, android_draw_rectangle, android_draw_point)
(android_draw_line, android_clear_area, android_bell)
(android_set_input_focus, android_raise_window)
(android_lower_window, android_set_dont_focus_on_map)
(android_set_dont_accept_focus, android_get_keysym_name)
(android_toggle_on_screen_keyboard, android_restart_emacs)
(android_display_toast, android_update_ic, android_reset_ic)
(android_set_fullscreen): Optimize by specifying the class
explicitly when calling a method.
* src/lread.c (lread_fd, file_tell, infile, skip_dyn_bytes)
(skip_dyn_eof, readbyte_from_stdio, safe_to_load_version)
(close_infile_unwind, close_file_unwind_android_fd): New function.
(Fload, Flocate_file_internal, openp): New argument PLATFORM. All
callers changed.
(skip_lazy_string): Add optimized versions of various functions
for accessing Android assets.
2023-03-06 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): New function
requestSelectionUpdate.
* java/org/gnu/emacs/EmacsView.java (onCreateInputConnection):
Call it instead of losing if getting the current selection fails.
* src/android-asset.h (AAsset_seek): Define stub.
* src/android.c (android_open): Take mode_t MODE instead of int.
(android_open_asset, android_close_asset, android_asset_read_quit)
(android_asset_read, android_asset_lseek, android_asset_fstat):
New functions.
* src/android.h (struct android_fd_or_asset): Update prototypes.
* src/androidgui.h (enum android_ime_operation): Add new operation
to update the selection position.
* src/androidterm.c (android_handle_ime_event): Handle new
operation.
(requestSelectionUpdate): New function.
* src/fileio.c (close_file_unwind_emacs_fd): New function.
(Fcopy_file, union read_non_regular, read_non_regular)
(Finsert_file_contents): Use optimized codepath to insert Android
asset files.
* src/frame.h (enum text_conversion_operation): New operation.
* src/textconv.c (really_request_point_update)
(handle_pending_conversion_events_1, request_point_update): New
functions.
* src/textconv.h: Update prototypes.
* src/conf_post.h: Avoid macro redeclaration.
* java/org/gnu/emacs/EmacsService.java (sync): Delete function.
* java/org/gnu/emacs/EmacsView.java (handleDirtyBitmap): Erase
with window background.
(onDetachedFromWindow): Only recycle bitmap if non-NULL.
* java/org/gnu/emacs/EmacsWindow.java (background): New field.
(changeWindowBackground): Set it.
* src/android.c (struct android_emacs_service): Remove `sync'.
(android_init_emacs_service): Likewise.
(android_sync): Delete function.
* src/androidfns.c (android_create_tip_frame): Set frame
background color correctly.
(Fx_show_tip): Make the tip frame visible.
* src/androidgui.h: Update prototypes.
* src/androidterm.c (handle_one_android_event): Handle tooltip
movement correctly.
2023-03-05 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsActivity.java (onCreate):
* java/org/gnu/emacs/EmacsContextMenu.java:
* java/org/gnu/emacs/EmacsDocumentsProvider.java (getMimeType):
* java/org/gnu/emacs/EmacsDrawLine.java (perform):
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform):
* java/org/gnu/emacs/EmacsFillPolygon.java:
* java/org/gnu/emacs/EmacsFontDriver.java:
* java/org/gnu/emacs/EmacsHandleObject.java:
* java/org/gnu/emacs/EmacsInputConnection.java:
* java/org/gnu/emacs/EmacsMultitaskActivity.java:
* java/org/gnu/emacs/EmacsNative.java:
* java/org/gnu/emacs/EmacsNoninteractive.java (main):
* java/org/gnu/emacs/EmacsOpenActivity.java (startEmacsClient):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java:
* java/org/gnu/emacs/EmacsSdk8Clipboard.java:
* java/org/gnu/emacs/EmacsService.java (onCreate):
* java/org/gnu/emacs/EmacsView.java (onLayout):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow):
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java: Remove
redundant includes. Reorganize some functions, remove duplicate
`getLibDir' functions, and remove unused local variables.
* java/org/gnu/emacs/EmacsOpenActivity.java (onCreate): Don't set
the style here.
* java/res/values-v11/style.xml:
* java/res/values-v14/style.xml:
* java/res/values-v29/style.xml:
* java/res/values/style.xml: Define styles for the emacsclient
wrapper.
* src/keyboard.c (read_key_sequence): Don't disable text
conversion if use_mouse_menu or if a menu bar prefix key is being
displayed.
* etc/PROBLEMS: Document problem with default monospace font.
* src/fileio.c (check_mutable_filename): Check if the file is a
constituent of /content as well.
(Fcopy_file, Fdelete_directory_internal, Fdelete_file)
(Frename_file, Fadd_name_to_file, Fmake_symbolic_link)
(Fset_file_modes, Fset_file_times, Ffile_newer_than_file_p)
(write_region): Adjust accordingly.
(Fset_visited_file_modtime): Remove unnecessary restriction.
* src/filelock.c (make_lock_file_name): Don't interlock files
under /assets and /content.
* src/inotify.c (Finotify_add_watch): Fix typo.
* cross/Makefile.in (config.status): Depend on
top_builddir/config.status instead.
* configure.ac: Fix another typo.
* cross/Makefile.in (builddir): Define.
* cross/README: Update.
* cross/lib: Delete. Make configure generate it instead.
* .gitignore: Simplify cross/lib rule.
* admin/merge-gnulib (avoided_flags): Stop copying to cross/lib.
* configure.ac: Link gnulib source and header files to cross/lib.
* cross/Makefile.in (LIB_SRCDIR): Make relative to builddir.
(maintainer-clean): Merge with distclean. Remove links created
by configure.
2023-03-04 Po Lu <luangruo@yahoo.com>
* cross/ndk-build/ndk-build-shared-library.mk:
* cross/ndk-build/ndk-build-static-library.mk: Specify right ELF
format for 64 bit executables.
* cross/ndk-build/ndk-build-shared-library.mk:
* cross/ndk-build/ndk-build-static-library.mk: Ensure nasm
generates ELF objects.
* src/sfnt.c (sfnt_fill_span): Specifically handle spans that span
a single pixel by computing the coverage in the center.
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity): New field
`lastClosedMenu'.
(onContextMenuClosed): Don't send event if a menu is closed twice
in a row. Also, clear wasSubmenuSelected immediately.
* java/org/gnu/emacs/EmacsContextMenu.java: Display submenus
manually in Android 6.0 and earlier.
* java/org/gnu/emacs/EmacsView.java (onCreateContextMenu)
(popupMenu): Adjust accordingly.
* configure.ac: Check for __ctype_get_mb_cur_max. Then see if
MB_CUR_MAX is defined to it, and define REPLACEMENT_MB_CUR_MAX if
so and it does not link.
* java/INSTALL: Update documentation.
* src/conf_post.h (MB_CUR_MAX): Define replacement if
necessary.
* m4/ndk-build.m4 (ndk_INIT): Fix typo.
* configure.ac: Call ndk_LATE after gl_EARLY.
* cross/ndk-build/Makefile.in (NDK_BUILD_CXX): New variable.
* cross/ndk-build/ndk-build-shared-library.mk:
* cross/ndk-build/ndk-build-static-library.mk: Use it.
* java/INSTALL: Describe how to build C++ dependencies.
* m4/ndk-build.m4 (ndk_LATE): New macro.
(ndk_INIT): Try to find a suitable C++ compiler.
(ndk_CHECK_MODULES): Make sure the C++ compiler works before
allowing C++ dependencies.
* cross/ndk-build/Makefile.in (NDK_BUILD_CFLAGS_CXX): New
variable.
* cross/ndk-build/ndk-build-shared-library.mk
($(call objname,$(LOCAL_MODULE),$(basename $(1)))):
* cross/ndk-build/ndk-build-static-library.mk
($(call objname,$(LOCAL_MODULE),$(basename $(1)))): Use it to
build C++ code.
2023-03-03 Po Lu <luangruo@yahoo.com>
* configure.ac (ANDROID_SDK_8_OR_EARLIER): Pass through
`--with-ndk-cxx-shared'.
* m4/ndk-build.m4 (ndk_INIT): Fix quoting of $CC.
* cross/ndk-build/ndk-build-shared-library.mk:
* cross/ndk-build/ndk-build-static-library.mk: Include
ndk-resolve.mk in srcdir.
* cross/ndk-build/README: Update accordingly.
* build-aux/ndk-build-helper.mk: Define in terms of BUILD_AUXDIR.
* m4/ndk-build.m4 (ndk_INIT): Find right build-aux directory.
Remove uses of unportable shell constructs.
* java/org/gnu/emacs/EmacsService.java (checkContentUri): Improve
debug output.
* lisp/files.el (basic-save-buffer): Check whether or not file
itself exists before checking for the existence of the directory
containing it.
* src/android.c (android_open): Don't forget to set errno after
open_content_uri fails.
* java/org/gnu/emacs/EmacsActivity.java (onCreate): Add view tree
observer.
(onGlobalLayout): Sync fullscreen state.
(syncFullscreenWith): Improve visibility flag setting.
* src/textconv.c (select_window): New function.
(textconv_query, restore_selected_window, really_commit_text)
(really_set_composing_text, really_set_composing_region)
(really_delete_surrounding_text, really_set_point_and_mark)
(get_extracted_text): Call it instead of Fselect_window to avoid
selecting the mini window if it is no longer active.
2023-03-02 Po Lu <luangruo@yahoo.com>
* doc/emacs/input.texi (On-Screen Keyboards): Fix indexing.
* INSTALL: Document where to find Android installation
instructions.
* configure.ac (CHECK_LISP_OBJECT_TYPE): Pacify
-Wsuggest-attribute=noreturn only on Android.
* cross/ndk-build/README: New file.
* doc/emacs/android.texi (Android):
* doc/emacs/emacs.texi (Top):
* doc/emacs/input.texi (Other Input Devices): Untabify menus.
* etc/NEWS: Move INSTALL.android to java/INSTALL.
* java/INSTALL: New file.
* java/README:
* src/coding.c (from_unicode_buffer): Make Android specific code
only build on Android.
* INSTALL.android: Remove file.
* configure.ac: Make cross/* and related directories.
* cross/Makefile.in (src/verbose.mk, lib/libgnu.a)
(src/config.h): Stop making directories here.
(lib-src/config.h): New config.h rule.
($(LIBSRC_BINARIES)): Add it.
(clean): Don't remove CLEAN_SUBDIRS, but clean inside.
* src/android.c (android_alloc_id): Return correct values upon
wraparound.
* java/Makefile.in ($(CLASS_FILES) &): Touch all class files, even
those the Java compiler elected not to rebuild.
* java/org/gnu/emacs/EmacsActivity.java (onWindowFocusChanged):
Restore fullscreen state here.
(onResume): And not here.
* doc/emacs/android.texi (Android):
* doc/emacs/emacs.texi (Top, GNU Free Documentation License):
Rearrange menu and sectioning.
* doc/emacs/android.texi (Android Windowing): Reword
documentation.
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity):
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu):
* java/org/gnu/emacs/EmacsFontDriver.java (EmacsFontDriver):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java
(EmacsSdk7FontDriver):
* java/org/gnu/emacs/EmacsService.java (queryBattery):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow): Make
functions final and classes static where possible. This
subsequently brings a small speed-up as the JVM can optimize
vtable dispatch away at run-time.
* src/android.c (struct android_emacs_service): New method
`display_toast'.
(android_init_emacs_service): Load new method.
(android_display_toast): New function.
* src/android.h (android_display_toast): Export that new function.
* src/androidfns.c (Fandroid_detect_mouse):
* src/androidselect.c (Fandroid_clipboard_owner_p)
(Fandroid_set_clipboard, Fandroid_get_clipboard)
(Fandroid_browse_url): Prevent crashes when called from
libandroid-emacs.so, where the Emacs service object is not
present.
* src/androidterm.c (handle_one_android_event): Fix out of date
commentary.
2023-03-01 Po Lu <luangruo@yahoo.com>
* configure.ac (JAVA_PUSH_LINT): Push to WARN_JAVAFLAGS instead of
JAVAFLAGS.
(cross/lib): Always AS_MKDIR_P.
* cross/Makefile.in (srcdir): New variable.
(LIB_SRCDIR): Take realpath relative to srcdir, not.
(src/verbose.mk): Depend on verbose.mk.android in srcdir.
(lib/Makefile): Edit srcdir and VPATH to LIB_SRCDIR.
(src/Makefile): Edit -I$$(top_srcdir) to -I../$(srcdir)/lib,
instead of ommitting it.
(clean): Allow ndk-build clean to fail.
* java/Makefile.in (builddir): New variable.
(WARN_JAVAFLAGS): Likewise.
(JAVAFLAGS): Define in terms of WARN_JAVAFLAGS.
(SIGN_EMACS, SIGN_EMACS_V2): Use emacs.keystore relative to
srcdir. Allow inclusion of ndk-build.mk to fail.
(install_temp, emacs.apk-in)
(../config.status): Depend relative to top_srcdir.
(AndroidManifest.xml, $(APK_NAME)): Likewise.
(RESOURCE_FILE, CLASS_FILES, classes.dex): Output class files to
$(srcdir); these are arch independents, so this is okay.
2023-03-01 Po Lu <luangruo@yahoo.com>
* cross/Makefile.in: Remove outdated comment.
* src/Makefile.in (.PHONY): Clean android-emacs and libemacs.so,
not emacs.so and aemacs.
* doc/emacs/android.texi (Android File System): Document new
behavior of starting a subprocess from /assets.
* java/org/gnu/emacs/EmacsWindow.java (onSomeKindOfMotionEvent):
Don't use isFromSource where not present.
* src/androidterm.c (android_scroll_run): Avoid undefined behavior
writing to bitfields.
* src/callproc.c (get_current_directory): When trying to run a
subprocess inside /assets, run it from the home directory instead.
* java/AndroidManifest.xml.in: Specify @style/EmacsStyle.
* java/org/gnu/emacs/EmacsActivity.java (onCreate): Stop setting
the theme here.
* java/res/values-v11/style.xml:
* java/res/values-v14/style.xml:
* java/res/values-v29/style.xml:
* java/res/values/style.xml: Extract style resources into
res/values.
* java/Makefile.in (ETAGS, clean): New rules to generate tags.
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity):
* java/org/gnu/emacs/EmacsApplication.java (EmacsApplication):
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu):
* java/org/gnu/emacs/EmacsCopyArea.java (EmacsCopyArea):
* java/org/gnu/emacs/EmacsDialog.java (EmacsDialog):
* java/org/gnu/emacs/EmacsDocumentsProvider.java
(EmacsDocumentsProvider):
* java/org/gnu/emacs/EmacsDrawLine.java (EmacsDrawLine):
* java/org/gnu/emacs/EmacsDrawPoint.java (EmacsDrawPoint):
* java/org/gnu/emacs/EmacsDrawRectangle.java
(EmacsDrawRectangle):
* java/org/gnu/emacs/EmacsFillPolygon.java (EmacsFillPolygon):
* java/org/gnu/emacs/EmacsFillRectangle.java
(EmacsFillRectangle):
* java/org/gnu/emacs/EmacsGC.java (EmacsGC):
* java/org/gnu/emacs/EmacsInputConnection.java
(EmacsInputConnection):
* java/org/gnu/emacs/EmacsNative.java (EmacsNative):
* java/org/gnu/emacs/EmacsNoninteractive.java
(EmacsNoninteractive):
* java/org/gnu/emacs/EmacsOpenActivity.java (EmacsOpenActivity):
* java/org/gnu/emacs/EmacsPixmap.java (EmacsPixmap):
* java/org/gnu/emacs/EmacsPreferencesActivity.java
(EmacsPreferencesActivity):
* java/org/gnu/emacs/EmacsSdk11Clipboard.java
(EmacsSdk11Clipboard):
* java/org/gnu/emacs/EmacsSdk23FontDriver.java
(EmacsSdk23FontDriver):
* java/org/gnu/emacs/EmacsSdk8Clipboard.java
(EmacsSdk8Clipboard):
* java/org/gnu/emacs/EmacsService.java (EmacsService):
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
* java/org/gnu/emacs/EmacsView.java (EmacsView):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow):
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(EmacsWindowAttachmentManager): Make classes final where
appropriate. The Java virtual machine is capable of removing
vtable dispatch when a virtual function call is being performed on
an instance of a final class.
* src/android.c (android_query_tree, android_get_geometry)
(android_translate_coordinates, android_query_battery): Correctly
verify the results of calls to JNI Get<Type>ArrayElements
functions.
(android_exception_check_nonnull): New function.
* src/androidselect.c (Fandroid_get_clipboard): Also check the
return values of calls to JNI array extraction functions.
2023-02-28 Po Lu <luangruo@yahoo.com>
* src/sfnt.c (main):
* src/sfntfont.c (sfntfont_get_glyph_outline): Remove outdated
commentary.
2023-02-26 Po Lu <luangruo@yahoo.com>
* src/android.c (struct android_emacs_window): New methods.
(android_init_emacs_window): Add new methods.
(android_lookup_method): Delete now-unused function.
(android_change_window_attributes, android_reparent_window)
(android_map_window, android_unmap_window, android_resize_window)
(android_move_window, android_set_input_focus)
(android_raise_window, android_lower_window, android_get_geometry)
(android_translate_coordinates, android_set_dont_focus_on_map)
(android_set_dont_accept_focus): Don't look up the class and
method each time when calling a function; that's just wasteful.
* cross/lib/unistd.in.h:
* lib/gnulib.mk.in:
* m4/gnulib-comp.m4: Update from gnulib.
* doc/lispref/commands.texi (Misc Events): Update documentation.
* java/org/gnu/emacs/EmacsService.java (onStartCommand): Improve
notification message.
* src/android.c (android_hack_asset_fd): Detect if ashmem is
available dynamically.
(android_detect_ashmem): New function.
* src/textconv.c (record_buffer_change): Use markers to
represent BEG and END instead.
(syms_of_textconv): Update doc string.
2023-02-25 Po Lu <luangruo@yahoo.com>
* java/debug.sh (is_root): Fix tee detection again for old systems
which don't return exit codes from adb shell.
* src/android.c (android_run_select_thread, initEmacs):
* src/android.h:
* src/androidterm.c: Apply stack alignment to all JNICALL
functions.
* src/android.c (android_open): Clean up unused variables.
* java/org/gnu/emacs/EmacsNoninteractive.java (main): Port to
Android 2.2.
* src/android-asset.h (AAsset_openFileDescriptor): Delete stub
function.
* src/android.c (android_check_compressed_file): Delete function.
(android_open): Stop trying to find compressed files or to use the
system provided file descriptor. Explain why.
* doc/emacs/android.texi (Android Startup, Android File System)
(Android Environment, Android Windowing, Android Troubleshooting):
Improve documentation; fix typos.
* doc/lispref/commands.texi (Misc Events): Likewise.
* java/org/gnu/emacs/EmacsService.java (queryBattery): New
function.
* lisp/battery.el (battery-status-function): Set appropriately
for Android.
(battery-android): New function.
* src/android.c (struct android_emacs_service): New method
`query_battery'.
(android_check_content_access): Improve exception checking.
(android_init_emacs_service): Look up new method.
(android_destroy_handle, android_create_window)
(android_init_android_rect_class, android_init_emacs_gc_class)
(android_set_clip_rectangles)
(android_create_pixmap_from_bitmap_data, android_fill_polygon)
(android_get_image, android_put_image, android_bell)
(android_set_input_focus, android_raise_window)
(android_lower_window, android_query_tree, android_get_geometry)
(android_translate_coordinates, android_wc_lookup_string)
(android_damage_window, android_build_string)
(android_build_jstring, android_exception_check_1)
(android_exception_check_2): New functions.
(android_browse_url): Improve exception handling. Always use
android_exception_check and don't leak local refs.
(android_query_battery): New function.
* src/android.h (struct android_battery_state): New struct.
* src/androidfns.c (Fandroid_query_battery, syms_of_androidfns):
New functions.
* src/androidfont.c (androidfont_from_lisp, DO_SYMBOL_FIELD)
(DO_CARDINAL_FIELD, androidfont_list, androidfont_match)
(androidfont_draw, androidfont_open_font)
(androidfont_close_font):
* src/androidselect.c (Fandroid_set_clipboard)
(Fandroid_get_clipboard):
* src/sfnt.c (sfnt_map_glyf_table):
* src/sfntfont.c (sfntfont_free_outline_cache)
(sfntfont_free_raster_cache, sfntfont_close): Allow calling font
close functions twice.
2023-02-24 Po Lu <luangruo@yahoo.com>
* configure.ac (JAVA_PUSH_LINT): New macro.
(JAVAFLAGS): New variable. Check for various lint flags and
macros and enable them.
* java/Makefile.in (ANDROID_ABI):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java: Remove compiler
warning.
* lisp/frame.el (display-symbol-keys-p):
* lisp/simple.el (normal-erase-is-backspace-setup-frame): Return
appropriate values on Android.
* src/inotify.c (Finotify_add_watch): Handle asset files by
returning nil.
* src/keyboard.c (lispy_function_keys): Add missing delete key.
2023-02-23 Po Lu <luangruo@yahoo.com>
* lisp/loadup.el: Update commentary.
* src/androidterm.c (syms_of_androidterm): Define
Vx_toolkit_scroll_bars.
* src/xterm.c (syms_of_xterm): Update doc string.
* INSTALL.android:
* build-aux/ndk-build-helper-1.mk:
(NDK_$(LOCAL_MODULE)_STATIC_LIBRARIES)
(NDK_CXX_FLAG_$(LOCAL_MODULE)):
* build-aux/ndk-build-helper-2.mk:
(NDK_$(LOCAL_MODULE)_STATIC_LIBRARIES)
(NDK_CXX_FLAG_$(LOCAL_MODULE)):
* cross/ndk-build/ndk-build-shared-library.mk (objname)
($(call objname,$(LOCAL_MODULE),$(basename $(1))))
(ALL_OBJECT_FILES$(LOCAL_MODULE)):
* cross/ndk-build/ndk-build-static-library.mk (objname)
($(call objname,$(LOCAL_MODULE),$(basename $(1))))
(ALL_OBJECT_FILES$(LOCAL_MODULE)):
(ALL_SOURCE_FILES): Update ImageMagick build instructions and C++
module detection.
* src/android.c (android_run_select_thread): Fix typos.
(android_run_select_thread): Lock select_mutex before signalling
condition variable.
(android_select): Unlock event queue mutex prior to waiting for
it.
2023-02-22 Po Lu <luangruo@yahoo.com>
* cross/ndk-build/ndk-build-shared-library.mk: Fix typo.
* src/image.c (imagemagick_load_image): Check HAVE_DECL_xxx.
* INSTALL.android: Document ImageMagick and caveats.
* build-aux/ndk-build-helper-1.mk (NDK_SO_NAMES):
* build-aux/ndk-build-helper-2.mk (NDK_A_NAMES):
* build-aux/ndk-build-helper.mk (TARGET_ARCH_ABI): Define
architecture and don't respect explicitly specified library names.
* configure.ac: Enable ImageMagick and lcms2 on Android.
* cross/ndk-build/ndk-build-shared-library.mk (objname)
($(call objname,$(LOCAL_MODULE),$(basename $(1))))
(ALL_OBJECT_FILES$(LOCAL_MODULE)):
* cross/ndk-build/ndk-build-static-library.mk (objname)
($(call objname,$(LOCAL_MODULE),$(basename $(1))))
(NDK_CFLAGS, ALL_SOURCE_FILES): Handle source files whose names
begin with $(LOCAL_PATH).
* cross/ndk-build/ndk-clear-vars.mk: Don't undefine; clear
variables instead.
* m4/ndk-build.m4 (ndk_SEARCH_MODULE): Redirect make stderr to
config.log.
* src/androidmenu.c (android_menu_show): Fix typo.
* doc/emacs/input.texi (On-Screen Keyboards): Document changes to
text conversion.
* java/org/gnu/emacs/EmacsInputConnection.java (getExtractedText):
* src/keyboard.c (read_key_sequence): Disable text conversion
after reading prefix key.
* src/textconv.c (get_extracted_text): Fix returned value when
request length is zero.
* configure.ac: Per title.
* INSTALL.android: Port to MIPS.
* configure.ac (modules): Default to ifavailable. Write actual
test for __attribute__((cleanup)).
* m4/ndk-build.m4: Recognize mips and mips64.
* src/emacs-module.c: Remove broken HAS_ATTRIBUTE test.
2023-02-21 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsContextMenu.java (addSubmenu)
(inflateMenuItems): Handle tooltips correctly.
* src/android.c (android_scan_directory_tree): Fix limit
generation for root directory.
* src/androidmenu.c (android_init_emacs_context_menu)
(android_menu_show): Implement menu item help text on Android 8.0
and later.
* admin/merge-gnulib (GNULIB_MODULES): Add gnulib module stpncpy.
* m4, lib: Update from Gnulib.
* src/android.c: Include string.h.
* doc/emacs/android.texi (Android Startup): Document `content'
special directory.
* java/debug.sh (is_root): Improve /bin/tee detection.
* java/org/gnu/emacs/EmacsNative.java (dup): New function.
* java/org/gnu/emacs/EmacsOpenActivity.java (checkReadableOrCopy)
(onCreate): Create content directory names when the file is not
readable.
* java/org/gnu/emacs/EmacsService.java (openContentUri)
(checkContentUri): New functions.
* src/android.c (struct android_emacs_service): New methods.
(android_content_name_p, android_get_content_name)
(android_check_content_access): New function.
(android_fstatat, android_open): Implement opening content URIs.
(dup): Export to Java.
(android_init_emacs_service): Initialize new methods.
(android_faccessat): Implement content file names.
2023-02-20 Po Lu <luangruo@yahoo.com>
* INSTALL.android: Explain where to get tree-sitter.
* configure.ac: Add support for dynamic modules and tree-sitter.
* doc/emacs/android.texi (Android Windowing):
* java/org/gnu/emacs/EmacsSdk11Clipboard.java
(ownsClipboard): Enhance the treatment of the clipboard and the
documentation addressing that subject.
2023-02-20 Po Lu <luangruo@yahoo.com>
* src/androidfont.c (androidfont_list_family): Don't
unconditionally initialize the Android font driver.
* src/fontset.c (fontset_find_font): Add compatibility test to
registry strangeness case.
* src/sfnt.c (sfnt_read_cmap_table): Don't read subtable data if
DATA is NULL.
* src/sfntfont.c (struct sfnt_font_desc): New field `registry'.
(sfnt_registry_for_subtable): New function.
(sfntfont_identify_cmap): Move above sfnt_grok_registry.
(sfnt_grok_registry): New function.
(sfnt_enum_font_1): Call it.
(sfntfont_registries_compatible_p): New function.
(sfntfont_list_1): Check registry compatibility.
(sfntfont_registry_for_desc): New function.
(mark_sfntfont): Mark desc->registry.
* java/Makefile.in ($(CLASS_FILES)): Depend on the Java compiler's
internal dependency tracking.
* src/fontset.c (fontset_find_font): Work around TrueType
performance problem.
* cross/Makefile.in (src/libemacs.so): Depend on libgnu.a.
* cross/ndk-build/ndk-build.mk.in (NDK_BUILD_MODULES)
(NDK_BUILD_SHARED, NDK_BUILD_STATIC): Define group rule to build
all files so that they are built within one make process.
* java/Makefile.in: Reorganize cross compilation and make sure
there is only one make subprocess for each subdirectory of cross.
* cross/Makefile.in (.PHONY):
* java/Makefile.in (.PHONY):
* src/Makefile.in (libemacs.so): Avoid calling ndk-build from two
places at once. Build android-emacs separately from libemacs.so.
* cross/Makefile.in ($(top_builddir)/lib/libgnu.a):
* java/Makefile.in (CROSS_LIBS): Explicitly depend on Gnulib to
prevent it from being built at the same time from different jobs.
* src/sfntfont.c (sfntfont_close): Don't unlink font if mmap is
not available.
* INSTALL.android: Say where building Emacs is supported.
* doc/emacs/android.texi (Android Startup): Describe how to
connect via ADB.
* java/org/gnu/emacs/EmacsNative.java (getSelection): Return array
of ints.
* java/org/gnu/emacs/EmacsView.java (onCreateInputConnection):
Adjust accordingly.
* src/androidterm.c (struct android_get_selection_context): New
field `mark'.
(android_get_selection): Set the mark field as appropriate.
(getSelection): Adjust accordingly.
* lisp/play/gamegrid.el (gamegrid-setup-default-font): Clamp font
size at eight.
* java/org/gnu/emacs/EmacsOpenActivity.java (checkReadableOrCopy):
New function.
(onCreate): If the file specified is not readable from C, read it
into a temporary file and ask Emacs to open that.
* doc/emacs/android.texi (Android Windowing): Document what new
frame parameters are now supported.
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity): New field
`isFullscreen'.
(detachWindow, attachWindow): Sync fullscreen state.
(onWindowFocusChanged): Add more logging.
(onResume): Restore previous fullscreen state.
(syncFullscreen): New function.
* java/org/gnu/emacs/EmacsWindow.java (setFullscreen): New
function.
* src/android.c (struct android_emacs_window): Add new method.
(android_init_emacs_window): Look up new method.
(android_set_fullscreen): New function.
* src/androidgui.h:
* src/androidterm.c (android_fullscreen_hook): Implement
accordingly.
* lisp/subr.el (overriding-text-conversion-style, y-or-n-p):
Disable text conversion when reading from minibuffer.
* src/androidfns.c (android_make_monitor_attribute_list): New
function.
(Fandroid_display_monitor_attributes_list): Call it to set
monitor_frames, which avoids a NULL pointer dereference.
Reported by Angelo Graziosi <angelo.g0@libero.it>.
2023-02-18 Po Lu <luangruo@yahoo.com>
* lisp/loadup.el: Fix merge typos.
* doc/emacs/input.texi (On-Screen Keyboards): Document
`touch-screen-always-display'.
* doc/lispref/commands.texi (Misc Events): Improve documentation
of text conversion events.
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog, display1):
Reorder buttons to make more sense.
* lisp/elec-pair.el (electric-pair-analyze-conversion): New
function.
* lisp/simple.el (analyze-text-conversion): Improve integration
with electric pair modes.
* lisp/term.el (term-mode): Always display the onscreen keyboard.
* lisp/touch-screen.el (touch-screen-display-keyboard)
(touch-screen-handle-point-up): Respect new options.
* src/textconv.c (really_set_composing_text): Stop widenining
unnecessarily.
(really_delete_surrounding_text): Really delete surrounding text.
Give text conversion analyzers the buffer text.
(syms_of_textconv): Update doc string.
* INSTALL.android: Clarify build instructions.
* src/textconv.c (struct complete_edit_check_context): New
structure.
(complete_edit_check): New function.
(handle_pending_conversion_events_1): If the window is known, then
ensure that any editing failures are reported to the input method.
* configure.ac: Fix typo. Check for madvise.
* lisp/international/fontset.el (script-representative-chars):
Improve detection of CJK fonts.
* src/pdumper.c (dump_discard_mem): Use madvise if possible.
* src/sfnt.c (sfnt_map_glyf_table, sfnt_unmap_glyf_table): New
functions.
* src/sfnt.h (struct sfnt_glyf_table): New field.
* src/sfntfont.c (struct sfnt_font_info, sfntfont_open)
(sfntfont_close, sfntfont_detect_sigbus): Map fonts into memory if
possible.
* src/sfntfont.h: Update prototypes.
* src/sysdep.c (handle_sigbus, init_sigbus, init_signals):
Initialize SIGBUS correctly.
2023-02-17 Po Lu <luangruo@yahoo.com>
* src/androidterm.c (android_get_selection): Use ephemeral last
point.
* src/textconv.c (report_selected_window_change): Set
w->ephemeral_last_point to the window's point now.
* java/Makefile.in (install_temp/assets/version): New generated
file.
* lisp/loadup.el: Set Emacs versions appropriately prior to
dumping on Android.
* lisp/mail/emacsbug.el (emacs-build-description): Insert Android
build fingerprint.
* lisp/version.el (emacs-repository-version-android)
(emacs-repository-get-version, emacs-repository-get-branch):
Implement for Android.
* src/androidterm.c (android_set_build_fingerprint): New function.
(syms_of_androidterm): New variable `android-build-fingerprint'.
* src/android.c (android_exception_check): Fix typo.
(android_exception_check): Print more detailed information.
* java/org/gnu/emacs/EmacsService.java (nameKeysym): Implement
stub on Android 3.0 and earlier.
* INSTALL.android: Document that Android 2.2 is now supported)
(with caveats.
* configure.ac (ANDROID_MIN_SDK, ANDROID_SDK_18_OR_EARLIER)
(SYSTEM_TYPE, ANDROID_STUBIFY, SIZEOF_LONG): Correctly detect
things missing on Android 2.2.
* java/Makefile.in (ANDROID_JAR, JARSIGNER_FLAGS):
* java/debug.sh (jdb, gdbserver, line):
* java/org/gnu/emacs/EmacsApplication.java (findDumpFile):
* java/org/gnu/emacs/EmacsService.java (onCreate):
* java/org/gnu/emacs/EmacsThread.java (run): Run parameter
initialization on main thread.
* src/android-asset.h (struct android_asset_manager)
(struct android_asset, AAssetManager_fromJava, AAssetManager_open)
(AAsset_close, android_asset_create_stream)
(android_asset_read_internal, AAsset_openFileDescriptor)
(AAsset_getLength, AAsset_getBuffer, AAsset_read): New file.
Write substitutes for functions that aren't present within the NDK
on Android 2.2.
* src/android.c: Arrange to include android-asset.h if the minimum
supported Android version is 2.2.
(android_user_full_name, android_hack_asset_fd)
(android_check_compressed_file): Implement for Android 2.2.
* src/process.c (Fprocess_send_eof): Don't call tcdrain if
unavailable.
* src/sfntfont-android.c (system_font_directories): Fix compiler
warning.
* src/sfntfont.c (sfntfont_read_cmap): Correctly test rc of
emacs_open.
* src/textconv.c (handle_pending_conversion_events_1): Mark buffer
UNINIT.
2023-02-16 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android Fonts):
* doc/emacs/input.texi (On-Screen Keyboards):
* doc/lispref/commands.texi (Misc Events): Update documentation.
* java/org/gnu/emacs/EmacsInputConnection.java (setSelection): New
function.
* java/org/gnu/emacs/EmacsSurfaceView.java
(reconfigureFrontBuffer): Make bitmap references weak references.
* java/org/gnu/emacs/EmacsView.java (handleDirtyBitmap): Don't
clear surfaceView bitmap.
* lisp/comint.el (comint-mode): Set text-conversion-style to
`action' so on screen keyboards' Return buttons send an actual key
press event.
* lisp/international/fontset.el (script-representative-chars)
(setup-default-fontset): Improve detection of CJK fonts.
* lisp/isearch.el (set-text-conversion-style): New variable.
(isearch-mode, isearch-done): Save and restore the text conversion
style.
* lisp/minibuffer.el (minibuffer-mode): Set an appropriate text
conversion style.
* lisp/simple.el (analyze-text-conversion): Run
post-self-insert-hook properly.
* lisp/subr.el (read-char-from-minibuffer): Disable text
conversion when reading character.
* src/androidterm.c (show_back_buffer): Don't check that F is not
garbaged.
(android_update_selection, android_reset_conversion): Use the
ephemeral last point and handle text conversion being disabled.
* src/buffer.c (syms_of_buffer): Convert old style DEFVAR.
* src/keyboard.c (kbd_buffer_get_event): Handle text conversion
first.
* src/lisp.h: Update prototypes.
* src/lread.c (read_filtered_event): Temporarily disable text
conversion.
* src/sfnt.c (sfnt_decompose_glyph_1, sfnt_decompose_glyph_2): New
functions.
(sfnt_decompose_glyph, sfnt_decompose_instructed_outline):
Refactor contour decomposition to those two functions.
(main): Update tests.
* src/sfntfont-android.c (system_font_directories): Add empty
field.
(Fandroid_enumerate_fonts, init_sfntfont_android): Enumerate fonts
in a user fonts directory.
* src/sfntfont.c (struct sfnt_font_desc): New field `num_glyphs'.
(sfnt_enum_font_1): Set num_glyphs and avoid duplicate fonts.
(sfntfont_glyph_valid): New function.
(sfntfont_lookup_char, sfntfont_list_1): Make sure glyphs found
are valid.
* src/textconv.c (sync_overlay, really_commit_text)
(really_set_composing_text, really_set_composing_region)
(really_delete_surrounding_text, really_set_point_and_mark)
(handle_pending_conversion_events_1)
(handle_pending_conversion_events, conversion_disabled_p)
(disable_text_conversion, resume_text_conversion)
(Fset_text_conversion_style, syms_of_textconv): Update to respect
new options.
* src/window.h (GCALIGNED_STRUCT): New field
`ephemeral_last_point'.
* src/xdisp.c (mark_window_display_accurate_1): Set it.
2023-02-15 Po Lu <luangruo@yahoo.com>
* doc/emacs/input.texi (On-Screen Keyboards):
* doc/lispref/commands.texi (Misc Events): Improve documentation
of text conversion stuff.
* java/org/gnu/emacs/EmacsInputConnection.java (beginBatchEdit)
(endBatchEdit, commitCompletion, commitText)
(deleteSurroundingText)
(finishComposingText, getSelectedText, getTextAfterCursor)
(EmacsInputConnection, setComposingRegion, performEditorAction)
(getExtractedText): Condition debug code on DEBUG_IC.
* java/org/gnu/emacs/EmacsService.java (EmacsService, updateIC):
Likewise.
* lisp/bindings.el (global-map):
* lisp/electric.el (global-map): Make `text-conversion'
`analyze-text-conversion'.
* lisp/progmodes/prog-mode.el (prog-mode): Enable text conversion
in input methods.
* lisp/simple.el (analyze-text-conversion): New function.
* lisp/textmodes/text-mode.el (text-conversion-style)
(text-mode): Likewise.
* src/androidterm.c (android_handle_ime_event): Handle
set_point_and_mark.
(android_sync_edit): Give Emacs 100 ms instead.
(android_perform_conversion_query): Skip the active region, not
the conversion region.
(getSelectedText): Implement properly.
(android_update_selection): Expose mark to input methods.
(android_reset_conversion): Handle `text-conversion-style'.
* src/buffer.c (init_buffer_once, syms_of_buffer): Add buffer
local variable `text-conversion-style'.
* src/buffer.h (struct buffer, bset_text_conversion_style): New
fields.
* src/emacs.c (android_emacs_init): Call syms_of_textconv.
* src/frame.h (enum text_conversion_operation): Rename
TEXTCONV_SET_POINT.
* src/lisp.h (syms_of_textconv): Export syms_of_textconv.
* src/marker.c (set_marker_internal): Force redisplay when the
mark is set and the buffer is visible on builds that use text
conversion. Explain why.
* src/textconv.c (copy_buffer): Fix copying past gap.
(get_mark): New function.
(textconv_query): Implement new flag.
(sync_overlay): New function. Display conversion text in an
overlay.
(record_buffer_change, really_commit_text)
(really_set_composing_text, really_set_composing_region)
(really_delete_surrounding_text, really_set_point)
(handle_pending_conversion_events_1, decrement_inside)
(handle_pending_conversion_events, textconv_set_point)
(get_extracted_text, register_textconv_interface): Various fixes
and improvements.
* src/textconv.h (struct textconv_interface): Update
documentation.
* src/window.h (GCALIGNED_STRUCT): New field `prev_mark'.
* src/xdisp.c (mark_window_display_accurate_1): Handle prev_mark.
* java/debug.sh: Run gdbserver directly if possible.
* src/androidterm.c (android_handle_ime_event): Pacify compiler
warnings.
* src/textconv.c (really_set_composing_text)
(handle_pending_conversion_events, get_extracted_text): Fix
reentrancy problems and uses of uninitialized values.
* configure.ac (HAVE_TEXT_CONVERSION): Define on Android.
* doc/emacs/input.texi (On-Screen Keyboards): Document ``text
conversion'' slightly.
* doc/lispref/commands.texi (Misc Events): Document new
`text-conversion' event.
* java/org/gnu/emacs/EmacsContextMenu.java (display): Use
`syncRunnable'.
* java/org/gnu/emacs/EmacsDialog.java (display): Likewise.
* java/org/gnu/emacs/EmacsEditable.java: Delete file.
* java/org/gnu/emacs/EmacsInputConnection.java
(EmacsInputConnection): Reimplement from scratch.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Add new
functions.
* java/org/gnu/emacs/EmacsService.java (getEmacsView)
(getLocationOnScreen, sync, getClipboardManager, restartEmacs):
Use syncRunnable.
(syncRunnable): New function.
(updateIC, resetIC): New functions.
* java/org/gnu/emacs/EmacsView.java (EmacsView): New field
`inputConnection' and `icMode'.
(onCreateInputConnection): Update accordingly.
(setICMode, getICMode): New functions.
* lisp/bindings.el (global-map): Ignore text conversion events.
* src/alloc.c (mark_frame): Mark text conversion data.
* src/android.c (struct android_emacs_service): New fields
`update_ic' and `reset_ic'.
(event_serial): Export.
(android_query_sem): New function.
(android_init_events): Initialize new semaphore.
(android_write_event): Export.
(android_select): Check for UI thread code.
(setEmacsParams, android_init_emacs_service): Initialize new
methods.
(android_check_query, android_begin_query, android_end_query)
(android_run_in_emacs_thread):
(android_update_ic, android_reset_ic): New functions for managing
synchronous queries from one thread to another.
* src/android.h: Export new functions.
* src/androidgui.h (enum android_event_type): Add input method
events.
(enum android_ime_operation, struct android_ime_event)
(union android_event, enum android_ic_mode): New structs and
enums.
* src/androidterm.c (android_window_to_frame): Allow DPYINFO to be
NULL.
(android_decode_utf16, android_handle_ime_event)
(handle_one_android_event, android_sync_edit)
(android_copy_java_string, beginBatchEdit, endBatchEdit)
(commitCompletion, deleteSurroundingText, finishComposingText)
(getSelectedtext, getTextAfterCursor, getTextBeforeCursor)
(setComposingText, setComposingRegion, setSelection, getSelection)
(performEditorAction, getExtractedText): New functions.
(struct android_conversion_query_context)
(android_perform_conversion_query, android_text_to_string)
(android_get_selection_context, android_get_selection)
(android_get_extracted_text_context, android_get_extracted_text)
(android_extracted_text_request_class)
(android_extracted_text_class, android_update_selection)
(android_reset_conversion, android_set_point)
(android_compose_region_changed, android_notify_conversion)
(text_conversion_interface): New functions and structures.
(android_term_init): Initialize text conversion.
* src/coding.c (syms_of_coding): Define Qutf_16le on Android.
* src/frame.c (make_frame): Clear conversion data.
(delete_frame): Reset conversion state.
* src/frame.h (enum text_conversion_operation)
(struct text_conversion_action, struct text_conversion_state)
(GCALIGNED_STRUCT): Update structures.
* src/keyboard.c (read_char, readable_events, kbd_buffer_get_event)
(syms_of_keyboard): Handle text conversion events.
* src/lisp.h:
* src/process.c: Fix includes.
* src/textconv.c (enum textconv_batch_edit_flags, textconv_query)
(reset_frame_state, detect_conversion_events)
(restore_selected_window, really_commit_text)
(really_finish_composing_text, really_set_composing_text)
(really_set_composing_region, really_delete_surrounding_text)
(really_set_point, complete_edit)
(handle_pending_conversion_events_1)
(handle_pending_conversion_events, start_batch_edit)
(end_batch_edit, commit_text, finish_composing_text)
(set_composing_text, set_composing_region, textconv_set_point)
(delete_surrounding_text, get_extracted_text)
(report_selected_window_change, report_point_change)
(register_texconv_interface): New functions.
* src/textconv.h (struct textconv_interface)
(TEXTCONV_SKIP_CONVERSION_REGION): Update prototype.
* src/xdisp.c (mark_window_display_accurate_1):
* src/xfns.c (xic_string_conversion_callback):
* src/xterm.c (init_xterm): Adjust accordingly.
2023-02-12 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android Environment): Mention that Emacs
also requests the notifications permission.
* java/org/gnu/emacs/EmacsEditable.java:
* java/org/gnu/emacs/EmacsInputConnection.java: New files.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Load library
dependencies in a less verbose fashion.
* java/org/gnu/emacs/EmacsView.java (EmacsView): Make imManager
public.
(onCreateInputConnection): Set InputType to TYPE_NULL for now.
* java/org/gnu/emacs/EmacsWindow.java (onKeyDown, onKeyUp)
(getEventUnicodeChar): Correctly handle key events with strings.
* lisp/term/android-win.el (android-clear-preedit-text)
(android-preedit-text): New special event handlers.
* src/android.c (struct android_emacs_window): Add function
lookup_string.
(android_init_emacs_window): Adjust accordingly.
(android_wc_lookup_string): New function.
* src/androidgui.h (struct android_key_event): Improve commentary.
(enum android_lookup_status): New enum.
* src/androidterm.c (handle_one_android_event): Synchronize IM
lookup code with X.
* src/coding.c (from_unicode_buffer): Implement on Android.
* src/coding.h:
* src/sfnt.c: Fix commentary.
2023-02-11 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsActivity.java (onDestroy)
(onWindowFocusChanged): Keep track of the last focused activity.
* java/org/gnu/emacs/EmacsDialog.java (display1): Use it if there
is no current focus.
2023-02-10 Po Lu <luangruo@yahoo.com>
* .gitignore: Add org/gnu/emacs/R.java.
* cross/Makefile.in (top_builddir): Include verbose.mk. Rewrite
rules to print nice looking statements.
* doc/emacs/android.texi (Android, Android Startup)
(Android Environment, Android Windowing, Android Fonts):
* doc/emacs/emacs.texi (Top): Add an extra ``Android
Troubleshooting'' node and move troubleshooting details there.
* java/Makefile.in: Generate R.java; improve appearance by using
verbose.mk.
* java/org/gnu/emacs/EmacsPreferencesActivity.java: Reimplement in
terms of PreferencesActivity.
* java/org/gnu/emacs/EmacsView.java (handleDirtyBitmap): Avoid
flicker.
* java/res/xml/preferences.xml: New file.
* src/verbose.mk.in (AM_V_AAPT, AM_V_SILENT): New variables.
* java/org/gnu/emacs/EmacsDocumentsProvider.java (queryRoots):
Implement isChild.
(getNotificationUri, notifyChange): New functions.
(queryDocument1): Set rename and remove flags.
(queryDocument, queryChildDocuments): Allow the requester to
detect changes in the directory hierarchy.
(createDocument, deleteDocument, removeDocument): Signal changes
to the directory hierarchy.
* java/org/gnu/emacs/EmacsCopyArea.java (perform): Fix typo.
* java/org/gnu/emacs/EmacsSurfaceView.java
(reconfigureFrontBuffer): Don't use function only present on
Android 8.0 and later.
* doc/emacs/android.texi (Android Windowing): Remove yet another
limitation.
* java/debug.sh: Make this work on systems which prohibit
attaching to app processes from adbd.
* java/org/gnu/emacs/EmacsCopyArea.java (perform): Avoid creating
copies whenever possible.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
Remove SurfaceView based implementation and use manual double
buffering with invalidate instead.
* java/org/gnu/emacs/EmacsView.java (EmacsView, handleDirtyBitmap)
(raise, lower, onDetachedFromWindow): Adjust accordingly.
* java/org/gnu/emacs/EmacsWindow.java (windowUpdated): Remove
function.
* src/sfntfont.c (sfntfont_open): Set font->max_width correctly.
* src/sfnt.c (IUP_SINGLE_PAIR): If i is initially more than end,
make it start.
(sfnt_verbose): Handle cases where interpreter->glyph_zone is
NULL.
(main): Update tests.
(sfnt_read_cmap_table): Fix typo.
(main): Update tests.
2023-02-09 Po Lu <luangruo@yahoo.com>
* java/AndroidManifest.xml.in: Declare the new documents provider.
* java/README: Describe the meaning of files in res/values.
* java/org/gnu/emacs/EmacsDocumentsProvider.java: New file.
* java/res/values-v19/bool.xml:
* java/res/values/bool.xml: New files.
* src/sfnt.c (main): Update tests.
* src/sfnt.c (sfnt_read_simple_glyph, sfnt_read_compound_glyph)
(sfnt_read_glyph): Take size_t offsets.
(struct sfnt_compound_glyph_context)
(sfnt_expand_compound_glyph_context)
(sfnt_decompose_compound_glyph): Take size_t contour offsets.
(sfnt_decompose_glyph): Always close contour even if the first
point isn't on-curve.
(sfnt_build_outline_edges): Fix coding style.
(sfnt_interpret_iup): Skip phantom points during IUP.
(sfnt_decompose_instructed_outline): Clarify documentation.
Always close contour even if the first point isn't on-curve.
(struct sfnt_test_dcontext, sfnt_test_move_to, sfnt_test_line_to)
(sfnt_test_curve_to, sfnt_transform_f26dot6, sfnt_test_get_glyph)
(sfnt_test_free_glyph, sfnt_test_span, sfnt_test_edge_ignore)
(sfnt_interpret_compound_glyph_2, sfnt_test_edges, main): Update
tests.
* src/sfnt.h: Export new function.
* src/sfntfont.c (sfntfont_get_glyph_outline): Handle compound
glyphs.
(sfntfont_measure_instructed_pcm, sfntfont_measure_pcm)
(sfntfont_draw): Update accordingly.
2023-02-08 Po Lu <luangruo@yahoo.com>
* src/sfnt.c (SCFS): Fix order of arguments.
(sfnt_normalize_vector): Make sure vx and vy are within a
reasonable range.
(sfnt_move): Don't move when vectors are orthogonal.
(main): Update.
* doc/emacs/android.texi (Android Startup): Fix typos.
* src/sfnt.c (sfnt_interpret_msirp): Fix order in which operands
to MSIRP are popped.
(main): Reduce ppem values.
* doc/lispref/frames.texi (On-Screen Keyboards): Describe return
value of `frame-toggle-on-screen-keyboard'.
* java/org/gnu/emacs/EmacsSurfaceView.java (surfaceChanged)
(surfaceCreated): Remove purposeless synchronization code. The
framework doesn't seem to consult this at all.
* java/org/gnu/emacs/EmacsView.java (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.
* src/sfntfont.c (sfntfont_get_glyph_outline): Take new argument
STATE and restore it prior to instructing the glyph.
(sfntfont_measure_instructed_pcm, sfntfont_measure_pcm)
(sfntfont_draw): Adjust accordingly.
(sfntfont_measure_instructed_pcm)
(sfntfont_measure_pcm): Ceil rbearing value.
* src/sfnt.c (sfnt_build_glyph_outline): Clear
build_outline_context.
(sfnt_poly_coverage): Extend coverage map.
(sfnt_prepare_raster): Always floor coordinates, since the
increase in coverage makes this hack unnecessary.
(sfnt_build_outline_edges): Likewise.
(sfnt_compare_edges): Remove function.
(sfnt_edge_sort): New function. Since edges are already partially
sorted, and there are not many, insertion sort suffices.
(sfnt_poly_edges): Use sfnt_edge_sort.
(sfnt_fill_span): Stop rounding x0 and x1 to the grid, and make
coverage computation static.
(sfnt_lookup_glyph_metrics): Fix return code for unscaled metrics.
(sfnt_scale_metrics): New function.
(SFNT_ENABLE_HINTING): Remove define.
(struct sfnt_cvt_table, struct sfnt_fpgm_table)
(struct sfnt_prep_table): Move to sfnt.h.
(sfnt_read_cvt_table, sfnt_read_fpgm_table, sfnt_read_prep_table):
Make TEST_STATIC.
(struct sfnt_unit_vector, struct sfnt_interpreter_definition)
(struct sfnt_interpreter_zone, struct sfnt_graphics_state):
(struct sfnt_interpreter): Move to sfnt.h.
(sfnt_make_interpreter): Make TEST_STATIC.
(POP, PUSH, DELTAP1, DELTAP2, DELTAP3): When TEST, define to
regular push and pop.
(sfnt_deltac, sfnt_deltap): Fix order of arguments.
(IUP_SINGLE_PAIR): Fix interpolation loop wraparound.
(sfnt_interpret_font_program)
(sfnt_interpret_control_value_program): Make TEST_STATIC.
(struct sfnt_instructed_outline): Move to sfnt.h.
(sfnt_build_instructed_outline): Make TEST_STATIC.
(sfnt_interpret_simple_glyph, sfnt_x_raster, sfnt_test_raster)
(all_tests, sfnt_verbose, main): Improve test code.
* src/sfnt.h (SFNT_ENABLE_HINTING, struct sfnt_cvt_table)
(struct sfnt_fpgm_table, struct sfnt_prep_table)
(struct sfnt_unit_vector, struct sfnt_interpreter_definition)
(struct sfnt_interpreter_zone, struct sfnt_graphics_state)
(struct sfnt_interpreter, struct sfnt_instructed_outline)
(PROTOTYPE): New definitions.
* src/sfntfont-android.c (sfntfont_android_put_glyphs): Make
coordinate generation more straightforward.
* src/sfntfont.c (sfntfont_get_glyph_outline): New arguments
INTERPRETER and METRICS.
(struct sfnt_font_info): New tables.
(sfntfont_setup_interpreter): New function.
(sfntfont_open): Avoid memory leak. Set up interpreter.
(sfntfont_measure_instructed_pcm): New function.
(sfntfont_measure_pcm): Delegate to measure_instructed_pcm where
appropriate.
(sfntfont_close): Free new tables.
(sfntfont_draw): Scale metrics properly.
2023-02-07 Po Lu <luangruo@yahoo.com>
* src/sfnt.c (sfnt_name_instruction): Remove junk from instruction
table.
(sfnt_step_edge, sfnt_step_edge_n)
(sfnt_build_outline_edges, sfnt_test_edge, main):
* src/sfnt.h (struct sfnt_edge): Stop using error corrected line
drawing, as it's actually slower.
* INSTALL.android: Describe patches for BoringSSL on ARM.
* src/sfnt.c (sfnt_build_glyph_outline): Remove redundant
multiplication.
(sfnt_prepare_raster): Update offset calculation for changes.
(sfnt_step_edge, sfnt_step_edge_n): Handle bresenham terms.
(sfnt_build_outline_edges): Don't subtract floored xmin, just
xmin.
(sfnt_saturate_short): Make clang generate better code.
(sfnt_fill_span): Stop rounding coordinates.
(sfnt_poly_span): Poly consecutive on transitions all in one go.
(sfnt_lookup_glyph_metrics): Remove redundant multiplication.
(struct sfnt_interpreter): New hooks for debugging.
(sfnt_large_integer_add): New function.
(sfnt_mul_f26dot6_fixed): Round product.
(sfnt_make_interpreter): Remove redundant multiplication.
(CHECK_STACK_ELEMENTS, POP_UNCHECKED, PUSH_UNCHECKED): New macros.
(MOVE, POP, SWAP, CINDEX, RS, RCVT, LT, LTEQ, GT, GTEQ, EQ, NEQ)
(EVEN, AND, OR, NOT, ADD, SUB, DIV, MUL, ABS, NEG, FLOOR, CEILING)
(GETINFO, ROLL, _MAX, _MIN, ROUND, NROUND, GC, MD): Don't check SP
redundantly, especially when pushing an element right after
popping one.
(sfnt_move_glyph_zone): Don't touch points by passing NULL as
flags.
(sfnt_direct_move_zp2): Touch P in the directions of the movement.
(sfnt_interpret_scfs): Fix coding style.
(sfnt_interpret_simple_glyph): Don't round Y coordinates.
(sfnt_test_span, sfnt_test_edges, sfnt_debug_edges)
(sfnt_test_edge)
(sfnt_x_raster, sfnt_test_raster, rcvt_test_args)
(deltac1_test_args, deltac2_test_args, deltac3_test_args)
(roll_1_test_args, sfnt_run_hook, sfnt_identify_instruction)
(sfnt_verbose, main): Improve debug code and tests.
* src/sfnt.h (struct sfnt_edge): Add bresenham terms.
2023-02-06 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsNative.java
(EmacsNative) <static constructor>: Load every native library on
which Emacs depends prior to loading libemacs itself.
* java/org/gnu/emacs/EmacsOpenActivity.java (readEmacsClientLog)
(startEmacsClient): Don't use redirectError on Android 7.1 and
earlier.
* configure.ac: Pass ANDROID_CFLAGS to ndk_INIT.
* cross/ndk-build/Makefile.in (NDK_BUILD_CFLAGS):
* cross/ndk-build/ndk-build-shared-library.mk
($(call objname,$(LOCAL_MODULE),$(basename $(1)))):
($$(error Unsupported suffix):
* cross/ndk-build/ndk-build-static-library.mk
($(call objname,$(LOCAL_MODULE),$(basename $(1)))):
($$(error Unsupported suffix): Use NDK_BUILD_CFLAGS.
* m4/ndk-build.m4 (ndk_INIT): Accept cflags.
(ndk_CONFIG_FILES): Export NDK_BUILD_CFLAGS.
* java/AndroidManifest.xml.in: Prevent the Emacs activity from
being overlayed by the emacsclient wrapper.
* java/org/gnu/emacs/EmacsOpenActivity.java (run): Likewise.
(onCreate): Set an appropriate theme on ICS and up.
* java/org/gnu/emacs/EmacsWindow.java (onTouchEvent): Handle
ACTION_CANCEL correctly.
* src/sfnt.c (struct sfnt_build_glyph_outline_context)
(sfnt_build_glyph_outline, sfnt_fill_span): Improve glyph
appearance by rounding coordinate values.
(struct sfnt_interpreter): New fields `twilight_original_x',
`twilight_original_y'.
(sfnt_make_interpreter): Set new fields.
(DELTAP1, DELTAP2, DELTAP3, SVTCAy, SPVTL, SFVTL, MD): Implement
instructions.
(sfnt_save_projection_vector): New argument `dual_only'. All
callers changed.
(sfnt_address_zp2, sfnt_address_zp1, sfnt_address_zp0): Obtain
original positions in the twilight zone as well.
(sfnt_check_zp1, sfnt_interpret_fliprgoff)
(sfnt_interpret_fliprgon)
(sfnt_interpret_flippt, sfnt_interpret_scfs, sfnt_interpret_miap)
(sfnt_interpret_alignrp, sfnt_line_to_vector, P)
(sfnt_interpret_msirp, sfnt_interpret_ip, sfnt_interpret_call)
(load_point, sfnt_interpret_iup_1, sfnt_interpret_iup)
(sfnt_interpret_run, struct sfnt_scaled_outline)
(struct sfnt_instructed_outline)
(sfnt_decompose_instructed_outline)
(sfnt_build_instructed_outline, sfnt_compute_phantom_points)
(sfnt_interpret_simple_glyph, all_tests, sfnt_setup_debugger)
(sfnt_name_instruction, sfnt_draw_debugger, sfnt_run_hook)
(sfnt_verbose, main): Make glyph instructing work.
* src/sfnt.h (SFNT_POLY_ROUND): New enumerator.
2023-02-05 Po Lu <luangruo@yahoo.com>
* INSTALL.android: Explain how to build selinux.
* configure.ac: Enable selinux on Android.
* cross/ndk-build/ndk-build-shared-library.mk
($(call objname,$(LOCAL_MODULE),$(basename $(1))))
($$(error Unsupported suffix))
(NDK_CFLAGS_$(LOCAL_MODULE)):
* cross/ndk-build/ndk-build-static-library.mk
($(call objname,$(LOCAL_MODULE),$(basename $(1))))
($$(error Unsupported suffix))
(NDK_CFLAGS_$(LOCAL_MODULE)): Correctly handle files with a .cc
suffix, and clang-specific asflags.
* cross/ndk-build/ndk-clear-vars.mk: Handle AOSP extensions
LOCAL_ADDITIONAL_DEPENDENCIES,
LOCAL_CLANG_ASFLAGS_$(NDK_BUILD_ARCH) and LOCAL_IS_HOST_MODULE.
* doc/emacs/android.texi (Android Startup): Explain emacsclient
wrapper.
* java/org/gnu/emacs/EmacsView.java (EmacsView): New flag
`isCurrentlyTextEditor'.
(showOnScreenKeyboard, hideOnScreenKeyboard): Set as appropriate.
(onCheckIsTextEditor): Return its value.
* lisp/touch-screen.el (touch-screen-handle-scroll): Don't ding
at buffer limits.
* m4/ndk-build.m4: Improve doc.
* src/Makefile.in (LIBSELINUX_CFLAGS): New variable.
(EMACS_CFLAGS): Add it.
2023-02-05 Po Lu <luangruo@yahoo.com>
* m4, lib: Update from Gnulib.
* src/sfnt.c (struct sfnt_graphics_state, LOOPCALL, DELTAC3)
(PROJECT, SHPIX, sfnt_save_projection_vector, sfnt_check_zp0)
(sfnt_dual_project_vector, sfnt_interpret_scfs)
(sfnt_round_symmetric, sfnt_interpret_miap)
(sfnt_interpret_alignrp_1, sfnt_interpret_alignrp)
(sfnt_measure_distance, sfnt_interpret_msirp, sfnt_interpret_ip)
(sfnt_interpret_mdap, sfnt_deltap)
(sfnt_dual_project_onto_any_vector, sfnt_validate_gs)
(sfnt_set_projection_vector, sfnt_interpret_shp)
(sfnt_interpret_run, sfnt_check_sloop, main): Check in more WIP
font code.
2023-02-04 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android File System):
* java/AndroidManifest.xml.in: Update with new activity. Remove
Android 10 restrictions through a special flag.
* java/org/gnu/emacs/EmacsNative.java (getProcName): New
function.
* java/org/gnu/emacs/EmacsOpenActivity.java: New file.
* java/org/gnu/emacs/EmacsService.java (getLibraryDirection):
Remove unused annotation.
* lib-src/emacsclient.c (decode_options): Set alt_display on
Android.
* src/android.c (android_proc_name): New function.
(getProcName): Export via JNI.
* doc/emacs/android.texi (Android Environment):
* java/AndroidManifest.xml.in: Add network state permissions.
* src/sfnt.c (sfnt_multiply_divide_signed)
(struct sfnt_interpreter_zone, struct sfnt_graphics_state)
(struct sfnt_interpreter, sfnt_mul_f2dot14)
(sfnt_interpret_trap, WCVTF)
(ALIGNPTS, sfnt_scale_by_freedom_vector, sfnt_interpret_utp)
(sfnt_address_zp2, sfnt_address_zp1, sfnt_address_zp0)
(sfnt_check_zp2, sfnt_move_zp0, sfnt_move_zp1)
(sfnt_move_glyph_zone, sfnt_move_twilight_zone)
(sfnt_direct_move_zp2, sfnt_interpret_alignpts)
(sfnt_interpret_isect, sfnt_line_to_vector, sfnt_deltac)
(sfnt_interpret_mdap, sfnt_interpret_call, sfnt_dot_fix_14)
(sfnt_move_x, sfnt_move_y, sfnt_move, sfnt_validate_gs)
(sfnt_interpret_shz, sfnt_interpret_shc, sfnt_interpret_shp)
(sfnt_interpret_iup_1, sfnt_interpret_iup, sfnt_interpret_run)
(sfnt_interpret_font_program)
(sfnt_interpret_control_value_program)
(sfnt_interpret_simple_glyph, jrot_test_args, jrof_test_args)
(all_tests, main): Check in more WIP code.
2023-02-02 Po Lu <luangruo@yahoo.com>
* java/AndroidManifest.xml.in: Add new icon.
* java/Makefile.in (srcdir): New variable.
(JAVA_FILES, RESOURCE_FILES): Update variables.
(emacs.apk-in): Apply resources.
* java/README: Describe directory tree.
* java/res/drawable/emacs.png: New file.
* src/android.c (android_get_current_api_level): New function.
* src/android.h: Export it.
* src/sfntfont-android.c (init_sfntfont_android): Make device API
level detection always work.
* src/sfnt.c (sfnt_multiply_divide_signed): Add MAYBE_UNUSED.
* src/sfnt.c (xmalloc, xrealloc): Improve behavior upon allocation
failures during test.
(sfnt_table_names): Add prep.
(sfnt_transform_coordinates): Allow applying offsets during
coordinate transform.
(sfnt_decompose_compound_glyph): Defer offset computation until
any component compound glyph is loaded, then apply it during the
transform process.
(sfnt_multiply_divide): Make available everywhere. Implement on
64 bit systems.
(sfnt_multiply_divide_signed): New function.
(sfnt_mul_fixed): Fix division overflow.
(sfnt_curve_to_and_build_1, sfnt_build_glyph_outline): Remove
outdated comment.
(sfnt_build_outline_edges): Fix coding style.
(sfnt_lookup_glyph_metrics): Allow looking up metrics without
scaling.
(struct sfnt_cvt_table): Fix type of cvt values.
(struct sfnt_prep_table): New structure.
(sfnt_read_cvt_table): Read cvt values in terms of fwords, not
longs (as Apple's doc seems to say).
(sfnt_read_fpgm_table): Fix memory allocation for font program
table.
(sfnt_read_prep_table): New function.
(struct sfnt_interpreter_zone): New structure.
(struct sfnt_interpreter_graphics_state): New fields `project',
`move', `vector_dot_product'. Rename to `sfnt_graphics_state'.
(struct sfnt_interpreter, sfnt_mul_f26dot6): Stop doing rounding
division.
(sfnt_init_graphics_state, sfnt_make_interpreter, MOVE, SSW, RAW)
(SDS, ADD, SUB, ABS, NEG, WCVTF, _MIN, S45ROUND, SVTCAx)
(sfnt_set_srounding_state, sfnt_skip_code)
(sfnt_interpret_unimplemented, sfnt_interpret_fdef)
(sfnt_interpret_idef, sfnt_interpret_if, sfnt_interpret_else)
(sfnt_round_none, sfnt_round_to_grid, sfnt_round_to_double_grid)
(sfnt_round_down_to_grid, sfnt_round_up_to_grid)
(sfnt_round_to_half_grid, sfnt_round_super, sfnt_validate_gs)
(sfnt_interpret_run, sfnt_interpret_font_program)
(struct sfnt_test_dcontext, sfnt_test_move_to, sfnt_test_line_to)
(sfnt_test_curve_to, sfnt_test_get_glyph, sfnt_test_free_glyph)
(sfnt_test_span, sfnt_test_edge_ignore, sfnt_test_edge)
(sfnt_test_raster, test_interpreter_profile, test_cvt_values)
(test_interpreter_cvt, test_interpreter_head)
(sfnt_make_test_interpreter, struct sfnt_interpreter_test)
(sfnt_run_interpreter_test, struct sfnt_generic_test_args)
(sfnt_generic_check, sfnt_check_srp0, sfnt_check_szp0)
(sfnt_check_sloop, struct sfnt_rounding_test_args)
(sfnt_check_rounding, sfnt_check_smd, sfnt_check_scvtci)
(sfnt_check_sswci, sfnt_check_ssw, sfnt_check_flipon)
(sfnt_check_flipoff, npushb_test_args, npushw_test_args)
(pushb_test_args, pushw_test_args, stack_overflow_test_args)
(stack_underflow_test_args, rtg_test_args)
(rtg_symmetric_test_args, rtg_1_test_args)
(rtg_1_symmetric_test_args, rthg_test_args, rthg_1_test_args)
(rtdg_test_args, rtdg_1_test_args, rtdg_2_test_args)
(rtdg_3_test_args, else_test_args, jmpr_test_args, dup_test_args)
(pop_test_args, clear_test_args, swap_test_args, depth_test_args)
(cindex_test_args, mindex_test_args, raw_test_args)
(loopcall_test_args, call_test_args, fdef_test_args)
(fdef_1_test_args, endf_test_args, ws_test_args, rs_test_args)
(wcvtp_test_args, rcvt_test_args, mppem_test_args, mps_test_args)
(debug_test_args, lt_test_args, all_tests, main): Implement more
instructions.
* src/sfnt.h (enum sfnt_table, struct sfnt_glyph_metrics): Add new
tables. Add comment.
2023-01-30 Po Lu <luangruo@yahoo.com>
* cross/ndk-build/ndk-build-shared-library.mk
($(call objname,$(LOCAL_MODULE),$(basename $(1)))):
* cross/ndk-build/ndk-build-static-library.mk
($(call objname,$(LOCAL_MODULE),$(basename $(1)))): Revert broken
typo fixes.
* src/sfnt.c (TEST_STATIC): Define ARRAYELTS.
(sfnt_table_names): New CVT and FPGM tables.
(sfnt_decompose_compound_glyph, sfnt_decompose_glyph)
(struct sfnt_large_integer, sfnt_multiply_divide_1)
(sfnt_count_leading_zero_bits, sfnt_multiply_divide_2)
(sfnt_multiply_divide, sfnt_mul_fixed, sfnt_div_fixed)
(sfnt_ceil_fixed, sfnt_build_glyph_outline): Fix fixed point
multiplication routines on systems without 64 bit long long
type.
(SFNT_ENABLE_HINTING, struct sfnt_test_dcontext, sfnt_test_move_to)
(sfnt_test_line_to, sfnt_test_curve_to, sfnt_test_get_glyph)
(sfnt_test_free_glyph, sfnt_test_span, sfnt_test_edge_ignore)
(sfnt_read_cvt_table, sfnt_test_edge, sfnt_test_raster)
(sfnt_read_fpgm_table, struct sfnt_unit_vector)
(struct sfnt_interpreter_definition)
(struct sfnt_interpreter_graphics_state, struct sfnt_interpreter)
(sfnt_div_f26dot6, sfnt_mul_f26dot6, sfnt_floor_f26dot6)
(sfnt_ceil_f26dot6, sfnt_round_f26dot6, sfnt_init_graphics_state)
(sfnt_make_interpreter, enum sfnt_interpreter_run_context)
(sfnt_interpret_trap, STACKSIZE, sfnt_set_srounding_state)
(sfnt_skip_code, sfnt_interpret_unimplemented, sfnt_interpret_fdef)
(sfnt_interpret_idef, sfnt_interpret_if, sfnt_interpret_else)
(sfnt_round_none, sfnt_round_to_grid, sfnt_round_to_double_grid)
(sfnt_round_down_to_grid, sfnt_round_up_to_grid)
(sfnt_round_to_half_grid, sfnt_round_super, sfnt_validate_gs)
(sfnt_interpret_run, sfnt_interpret_font_program)
(test_interpreter_profile, test_cvt_values, test_interpreter_cvt)
(test_interpreter_head, sfnt_make_test_interpreter)
(struct sfnt_interpreter_test, sfnt_run_interpreter_test)
(struct sfnt_generic_test_args, sfnt_generic_check)
(sfnt_check_srp0, sfnt_check_szp0, sfnt_check_sloop)
(struct sfnt_rounding_test_args, sfnt_check_rounding)
(sfnt_check_smd, sfnt_check_scvtci, sfnt_check_sswci)
(sfnt_check_ssw, sfnt_check_flipon, sfnt_check_flipoff)
(npushb_test_args, npushw_test_args, pushb_test_args)
(pushw_test_args, stack_overflow_test_args)
(stack_underflow_test_args, rtg_test_args, rtg_symmetric_test_args)
(rtg_1_test_args, rtg_1_symmetric_test_args, rthg_test_args)
(rthg_1_test_args, rtdg_test_args, rtdg_1_test_args)
(rtdg_2_test_args, rtdg_3_test_args, else_test_args)
(jmpr_test_args, dup_test_args, pop_test_args, clear_test_args)
(swap_test_args, depth_test_args, cindex_test_args)
(mindex_test_args, raw_test_args, loopcall_test_args)
(call_test_args, fdef_test_args, fdef_1_test_args, endf_test_args)
(ws_test_args, rs_test_args, wcvtp_test_args, rcvt_test_args)
(mppem_test_args, mps_test_args, debug_test_args, lt_test_args)
(all_tests, main): Check in WIP hinting code.
* src/sfnt.h (enum sfnt_table): Add `cvt ' and `fpgm' tables.
2023-01-29 Po Lu <luangruo@yahoo.com>
* .gitignore: Add missing Gnulib files.
* INSTALL.android (module_target): Clarify documentation.
* cross/ndk-build/ndk-build-shared-library.mk:
* cross/ndk-build/ndk-build-static-library.mk: Fix building Neon
objects.
* java/AndroidManifest.xml.in: Add a version code.
2023-01-28 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsService.java (restartEmacs): New
function.
* src/android.c (struct android_emacs_service)
(android_init_emacs_service): Add new method.
(android_restart_emacs): New function.
* src/android.h: Update prototypes.
* src/emacs.c (Fkill_emacs): Call android_restart_emacs whenever
appropriate.
* INSTALL.android: Document how to build with libtiff.
* build-aux/ndk-build-helper-1.mk (NDK_SO_NAME):
* build-aux/ndk-build-helper-2.mk (NDK_A_NAME):
* build-aux/ndk-build-helper-4.mk: Decrease number of duplicate
dependencies found.
* configure.ac (ANDROID_SDK_18_OR_EARLIER, XCONFIGURE, PNG_CFLAGS)
(HAVE_TIFF): Allow using libtiff on Android.
* cross/ndk-build/ndk-clear-vars.mk: Undefine additional
variables.
* cross/ndk-build/ndk-resolve.mk: Split CFLAGS resolution from
a-name resolution, and do not recursively add archive or shared
object names for dependencies of shared libraries.
* src/Makefile.in (TIFF_CFLAGS): New variable.
(EMACS_CFLAGS): Use it.
2023-01-28 Po Lu <luangruo@yahoo.com>
* src/image.c (syms_of_image): Fix typo.
* doc/emacs/android.texi (Android File System): Describe an easier
way to disable scoped storage.
* java/AndroidManifest.xml.in: Add new permission to allow that.
* java/README: Add more text describing Java.
* java/org/gnu/emacs/EmacsContextMenu.java (Item): New fields
`isCheckable' and `isChecked'.
(EmacsContextMenu, addItem): New arguments.
(inflateMenuItems): Set checked status as appropriate.
* java/org/gnu/emacs/EmacsCopyArea.java (perform): Disallow
operations where width and height are less than or equal to zero.
* lisp/menu-bar.el (menu-bar-edit-menu): Make
execute-extended-command available as a menu item.
* src/androidmenu.c (android_init_emacs_context_menu)
(android_menu_show): Implement menu check boxes.
* src/menu.c (have_boxes): Treat Android builds as providing menu
checkboxes.
2023-01-28 Po Lu <luangruo@yahoo.com>
* lisp/term/android-win.el (window-system-initialization): Create
default fontset.
* src/sfntfont.c (sfntfont_read_cmap, sfntfont_open): Fix leaks of
file descriptors.
* m4, lib: Update from Gnulib.
* INSTALL.android: Document support for gnutls and libgmp.
* build-aux/ndk-build-helper-1.mk (NDK_SO_NAMES, NDK_INCLUDES)
(SYSTEM_LIBRARIES):
* build-aux/ndk-build-helper-2.mk: Recursively resolve and add
shared library dependencies; even those of static libraries.
* build-aux/ndk-module-extract.awk: Fix makefile_imports code.
* configure.ac (ANDROID_SDK_18_OR_EARLIER, XCONFIGURE)
(LIBGMP_CFLAGS): Enable GMP and gnutls on Android.
* cross/ndk-build/Makefile.in (LOCAL_EXPORT_C_INCLUDES):
* cross/ndk-build/ndk-build-shared-library.mk:
* cross/ndk-build/ndk-clear-vars.mk:
* cross/ndk-build/ndk-resolve.mk (NDK_SYSTEM_LIBRARIES):
(NDK_LOCAL_EXPORT_C_INCLUDES_$(LOCAL_MODULE)):
(NDK_SO_EXTRA_FLAGS_$(LOCAL_MODULE)): Implement ``LOCAL_ASM_RULE''
and ``LOCAL_C_ADDITIONAL_FLAGS'' extensions for libgmp.
* doc/emacs/input.texi (Touchscreens): Document how to
horizontally scroll.
* java/org/gnu/emacs/EmacsActivity.java (attachWindow): Give the
view focus again if necessary.
(onPause): Call right super function.
* java/org/gnu/emacs/EmacsPreferencesActivity.java (onClick):
Clear dumpFileName lest Emacs try to load a nonexistent dump file.
* java/org/gnu/emacs/EmacsView.java (onDetachedFromWindow)
(onAttachedToWindow): Call super functions.
(onCreateInputConnection): Make sure the IME never obscures Emacs.
* java/org/gnu/emacs/EmacsWindow.java (onKeyDown, onKeyUp):
Improve tracking of quit keys.
* lisp/isearch.el (isearch-mode): Bring up the onscreen keyboard.
* lisp/touch-screen.el (touch-screen-current-tool): Add three
fields.
(touch-screen-handle-scroll): Allow hscrolling as well.
(touch-screen-handle-touch): Add additional fields to
`touch-screen-current-tool'.
* src/Makefile.in (LIBGMP_CFLAGS, EMACS_CFLAGS): Add new variable.
* src/android.c (android_run_select_thread, android_write_event):
Use pthread_cond_broadcast because pthread_cond_signal does
nothing on some Android versions/devices?
2023-01-26 Po Lu <luangruo@yahoo.com>
* doc/emacs/input.texi (On-Screen Keyboards): Fix typo.
* INSTALL.android: Mention that apksigner is also required.
* configure.ac: Correctly add cross/Makefile to SUBDIR_MAKEFILES.
* cross/Makefile.in (config.status): Depend on
$(top_srcdir)/config.status.
* doc/emacs/input.texi (On-Screen Keyboards): Document how to quit
without a physical keyboard.
* java/org/gnu/emacs/EmacsNative.java (quit): New function `quit'.
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow): New field
`lastVolumeButtonPress'.
(onKeyDown): Quit if necessary.
* m4/ndk-build.m4 (ndk_where_cc): Fix search if CC is not a single
word.
* src/android.c (android_open): Remove unused variable.
(quit): New function.
* src/androidmenu.c (android_process_events_for_menu): Allow
quitting the menu.
* src/xterm.c (handle_one_xevent, x_term_init, syms_of_xterm):
Implement features illustrated above, so they work on free
operating systems.
* src/xterm.h (struct x_display_info): New fields `quit_keysym',
`quit_keysym_time'.
2023-01-26 Po Lu <luangruo@yahoo.com>
* INSTALL.android: Document how to install sqlite3.
* build-aux/ndk-build-helper-1.mk (SYSTEM_LIBRARIES):
* build-aux/ndk-build-helper-2.mk (SYSTEM_LIBRARIES): Add liblog
and libandroid.
* configure.ac (SQLITE3_LIBS, HAVE_SQLITE3)
(HAVE_SQLITE3_LOAD_EXTENSION): Support on Android.
(APKSIGNER): Look for this new required binary.
* cross/ndk-build/ndk-build-shared-library.mk (objname):
* cross/ndk-build/ndk-build-static-library.mk (objname): Avoid
duplicate rules by prefixing objects with module type.
* cross/ndk-build/ndk-build.mk.in (NDK_BUILD_SHARED): Fix
definition.
* cross/ndk-build/ndk-resolve.mk
(NDK_SO_EXTRA_FLAGS_$(LOCAL_MODULE)): Handle new system libraries.
* doc/emacs/android.texi (Android File System): Document Android
10 system restriction.
* java/AndroidManifest.xml.in: Target Android API 33, not 28.
* java/Makefile.in (SIGN_EMACS_V2, APKSIGNER): New variables.
($(APK_NAME)): Make sure to apply a ``version 2 signature'' to the
package as well.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): New
argument apiLevel.
* java/org/gnu/emacs/EmacsNoninteractive.java (main):
* java/org/gnu/emacs/EmacsThread.java (run): Pass API level.
* m4/ndk-build.m4 (ndk_package_mape): Add package mapping for
sqlite3.
* src/Makefile.in (SQLITE3_CFLAGS): New substition.
(EMACS_CFLAGS): Add that variable.
* src/android.c (android_api_level): New variable.
(initEmacs): Set it.
(android_file_access_p): Make static.
(android_hack_asset_fd): Adjust for restrictions in Android 29 and
later.
(android_close_on_exec): New function.
(android_open): Adjust to not duplicate file descriptor even if
CLOEXEC.
(android_faccessat): Use fstatat at-func emulation.
* src/android.h: Update prototypes.
* src/dired.c (file_name_completion_dirp):
* src/fileio.c (file_access_p, Faccess_file): Now that
sys_faccessat takes care of everything, stop calling
android_file_access_p.
2023-01-26 Po Lu <luangruo@yahoo.com>
* .gitignore: Ignore lib/math.h.
* INSTALL.android: Update accordingly.
* build-aux/ndk-build-helper-1.mk:
* build-aux/ndk-build-helper-2.mk:
* build-aux/ndk-build-helper.mk:
* build-aux/ndk-module-extract.awk: Handle C++ modules.
* configure.ac: Enable libxml2 on Android.
* cross/ndk-build/Makefile.in:
* cross/ndk-build/ndk-build-shared-library.mk:
* cross/ndk-build/ndk-build-static-library.mk:
* cross/ndk-build/ndk-build.mk.in:
* cross/ndk-build/ndk-resolve.mk: Fix dependency resolution of
includes.
* java/org/gnu/emacs/EmacsView.java (popupMenu): Fix minimum SDK
version for actual popup menus.
* lib/math.h: Delete file.
* m4/ndk-build.m4 (ndk_SEARCH_MODULE, ndk_CHECK_MODULES): Look for
nasm and C++ libraries.
* src/android.c (faccessat): Rename to `android_faccessat'.
* src/android.h: Update prototypes.
* src/dired.c (file_name_completion_dirp):
* src/fileio.c (file_access_p, Faccess_file, file_directory_p):
* src/lisp.h:
* src/lread.c (openp):
* src/process.c (allocate_pty): Use sys_faccessat.
* src/sysdep.c (sys_faccessat): New function.
2023-01-26 Po Lu <luangruo@yahoo.com>
* cross/ndk-build/ndk-build.in: Delete unused file.
2023-01-25 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsDrawLine.java: Fix this again.
* java/org/gnu/emacs/EmacsNoninteractive.java (main): Port to
Android 2.3.3.
* java/org/gnu/emacs/EmacsSdk11Clipboard.java: Port to Android
4.0.3.
* java/org/gnu/emacs/EmacsService.java (getClipboardManager): New
function.
* src/alloc.c (find_string_data_in_pure): Fix Android alignment
issue.
* src/android-emacs.c (main): Port to Android 4.4.
* src/android.c (initEmacs): Align stack to 32 bytes, so it ends
up aligned to 16 even though gcc thinks the stack is already
aligned to 16 bytes.
* src/callproc.c (init_callproc): Use /system/bin/sh instead of
/bin/sh by default.
* cross/lib/math.h: Delete header.
* java/Makefile.in (emacs.apk-in): Don't call cp with empty args.
* java/org/gnu/emacs/EmacsDrawLine.java (perform): Fix for
PostScript filling semantics.
* src/Makefile.in (android-emacs): Build android-emacs directly.
* doc/emacs/android.texi (Android Startup, Android Environment):
Document that restrictions on starting Emacs have been lifted.
* java/README: Document Java for Emacs developers and how the
Android port works.
* java/org/gnu/emacs/EmacsApplication.java (EmacsApplication)
(findDumpFile): New function.
(onCreate): Factor out dump file finding functions to there.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Update
function declarations.
* java/org/gnu/emacs/EmacsNoninteractive.java: New class.
* java/org/gnu/emacs/EmacsService.java (getApkFile)
(onCreate): Pass classpath to setEmacsParams.
* java/org/gnu/emacs/EmacsThread.java (run): Label as an
@Override.
* lisp/loadup.el: Don't dump on Android when noninteractive.
* lisp/shell.el (shell--command-completion-data): Handle
inaccessible directories.
* src/Makefile.in (android-emacs): Link with Gnulib.
* src/android-emacs.c (main): Implement to launch app-process and
then EmacsNoninteractive.
* src/android.c (setEmacsParams): New argument `class_path'.
Don't set stuff up when running noninteractive.
* src/android.h (initEmacs): Likewise.
* src/androidfont.c (init_androidfont):
* src/androidselect.c (init_androidselect): Don't initialize when
running noninteractive.
* src/emacs.c (load_pdump): New argument `dump_file'.
(android_emacs_init): Give new argument `dump_file' to
`load_pdump'.
* src/sfntfont-android.c (init_sfntfont_android): Don't initialize
when running noninteractive.
* admin/merge-gnulib (GNULIB_MODULES): Add printf-posix and
vasprintf-posix.
* m4, lib: Update from Gnulib.
* configure.ac (CFLAGS): Add -DHAVE_CONFIG_H.
2023-01-24 Po Lu <luangruo@yahoo.com>
* doc/lispref/processes.texi (Subprocess Creation): Document
variables containing program names.
* etc/NEWS: Document new variables.
* java/Makefile.in (CROSS_BINS): Add missing etags binary.
* lisp/cedet/semantic/db-ebrowse.el
(semanticdb-create-ebrowse-database):
* lisp/gnus/mail-source.el (mail-source-movemail-program):
* lisp/hexl.el (hexl-program):
* lisp/htmlfontify.el (hfy-etags-bin):
* lisp/ielm.el (inferior-emacs-lisp-mode):
* lisp/mail/rmail.el (rmail-autodetect):
(rmail-insert-inbox-text):
* lisp/org/org-ctags.el (org-ctags-path-to-ctags):
* lisp/progmodes/cperl-mode.el (cperl-etags):
* lisp/speedbar.el (speedbar-fetch-etags-command):
* lisp/textmodes/reftex-global.el (reftex-create-tags-file): Use
new variables.
* src/callproc.c (syms_of_callproc): Introduce new variables
naming binaries redistributed with Emacs.
* INSTALL.android: Update documentation.
* build-aux/ndk-build-helper-1.mk: When building shared
libraries, do not link libemacs.so with dependent archive files.
* build-aux/ndk-build-helper-2.mk: Add whole archive dependencies
as well.
* configure.ac (HAVE_JPEG): Enable on Android.
* cross/ndk-build/ndk-build-shared-library.mk: Link the shared
object with archive file dependencies.
* cross/ndk-build/ndk-build-static-library.mk: Build all code
position-independently.
* cross/ndk-build/ndk-resolve.mk: Separately resolve a names of
archive and whole archive dependencies.
* src/Makefile.in (JPEG_CFLAGS): New variable.
(EMACS_CFLAGS): Add it.
2023-01-24 Po Lu <luangruo@yahoo.com>
* INSTALL.android: Update.
* build-aux/ndk-build-helper-1.mk: Fix typo.
* configure.ac: Enable --with-json on Android.
* cross/ndk-build/ndk-build-shared-library.mk:
(NDK_CFLAGS_$(LOCAL_MODULE)):
(LOCAL_MODULE_FILENAME):
* cross/ndk-build/ndk-build-static-library.mk:
(ALL_OBJECT_FILES$(LOCAL_MODULE)):
(LOCAL_MODULE_FILENAME): Recursively resolve dependencies.
* cross/ndk-build/ndk-resolve.mk: New function.
* doc/emacs/android.texi (Android Startup): Document how Emacs is
dumped during initial startup.
* java/Makefile.in (filename): Fix build with multiple shared
libraries.
* java/README: Improve commentary.
* java/org/gnu/emacs/EmacsApplication.java (onCreate): Look and
set dump file.
* java/org/gnu/emacs/EmacsNative.java (getFingerprint): New
function getFingerprint.
* java/org/gnu/emacs/EmacsPreferencesActivity.java (onCreate):
Add option to erase the dump file.
* java/org/gnu/emacs/EmacsService.java (browseUrl): New function.
* java/org/gnu/emacs/EmacsThread.java (run): Specify dump file if
found.
* lisp/loadup.el: Always dump during loadup on Android.
* lisp/net/browse-url.el (browse-url--browser-defcustom-type)
(browse-url-default-browser, browse-url-default-android-browser):
New browse url type.
* m4/ndk-build.m4 (ndk_package_map): Map jansson to libjansson.
* src/android.c (struct android_emacs_service): New method
`browse_url'.
(getFingerprint): New function.
(android_init_emacs_service): Initialize new method.
(android_browse_url): New function.
* src/android.h: Update prototypes.
* src/androidselect.c (Fandroid_browse_url): New function.
(syms_of_androidselect): Define it.
* src/emacs.c (load_pdump): Eschew excessively elaborate dump file
location code on on Android.
* src/pdumper.c (Fdump_emacs_portable): Allow dumping while
interactive on Android.
(syms_of_pdumper): New variable `pdumper-fingerprint'.
* src/sfntfont-android.c (sfntfont_android_composite_bitmap): Fix
unused variables.
2023-01-24 Po Lu <luangruo@yahoo.com>
* admin/merge-gnulib: Fix paths for rename.
* lib-src/Makefile.in (DONT_INSTALL, clean): Correctly define
asset-directory-tool.
* cross/Makefile.in (distclean bootstrap-clean): Remove Makefile.
2023-01-24 Po Lu <luangruo@yahoo.com>
* .gitignore: Update with new files. Do not ignore std*.in.h.
* INSTALL.android: Explain how to build Emacs with external
dependencies.
* Makefile.in (xcompile, cross): Rename to `cross'.
(clean_dirs): Clean cross, not xcompile.
* README: Document new directories.
* build-aux/ndk-build-helper-1.mk:
* build-aux/ndk-build-helper-2.mk:
* build-aux/ndk-build-helper-3.mk:
* build-aux/ndk-build-helper-4.mk:
* build-aux/ndk-build-helper.mk (NDK_BUILD_DIR, my-dir):
* build-aux/ndk-module-extract.awk: New files.
* configure.ac: Set up libgif, libwebp, and libpng for ndk-build.
* cross/ndk-build/Makefile.in:
* cross/ndk-build/ndk-build-executable.mk:
* cross/ndk-build/ndk-build-shared-library.mk:
* cross/ndk-build/ndk-build-static-library.mk:
* cross/ndk-build/ndk-build.in:
* cross/ndk-build/ndk-build.mk.in:
* cross/ndk-build/ndk-clear-vars.mk:
* cross/ndk-build/ndk-prebuilt-shared-library.mk:
* cross/ndk-build/ndk-prebuilt-static-library.mk: New files.
* doc/emacs/android.texi (Android, Android Environment): Document
clipboard support on Android.
* doc/emacs/emacs.texi (Top): Update menus.
* etc/MACHINES: Document Android.
* java/AndroidManifest.xml.in: Respect new `--with-android-debug'
option.
* java/Makefile.in (CROSS_BINS, CROSS_LIBS): Adjust for rename.
Include ndk-build.mk.
(emacs.apk-in): Depend on shared libraries. Then, package shared
libraries.
* java/org/gnu/emacs/EmacsClipboard.java: New file.
* java/org/gnu/emacs/EmacsFontDriver.java: Update comment to say
this is unused.
* java/org/gnu/emacs/EmacsNative.java (sendExpose): New function
`sendExpose'.
* java/org/gnu/emacs/EmacsSdk11Clipboard.java:
* java/org/gnu/emacs/EmacsSdk8Clipboard.java: New files.
* java/org/gnu/emacs/EmacsView.java (handleDirtyBitmap)
(onDetachedFromWindow): When window is reattached, expose the
frame.
* lib/Makefile.in (VPATH, ALL_CFLAGS): Adjust for rename.
* lisp/term/android-win.el (android-clipboard-exists-p)
(android-get-clipboard, android-set-clipboard)
(android-clipboard-owner-p, android-primary-selection)
(android-get-clipboard-1, android-get-primary)
(android-selection-bounds, android-encode-select-string)
(gui-backend-get-selection, gui-backend-selection-exists-p)
(gui-backend-selection-owner-p, gui-backend-set-selection): New
functions.
* m4/ndk-build.m4: New file.
* src/Makefile.in (GIF_CFLAGS, ANDROID_LDFLAGS): New variables.
(EMACS_CFLAGS): Add GIF_CFLAGS. Include ndk-build.mk.
(libemacs.so): Depend on and link with required libraries.
* src/android.c (android_check_compressed_file): New function.
(android_open): Work around Android platform bug.
(sendExpose): New function.
(android_readdir): Set d_type if this is a directory.
* src/androidgui.h (enum android_event_type)
(struct android_expose_event, union android_event): Add expose
events.
* src/androidselect.c: New file.
* src/androidterm.c (handle_one_android_event) <ANDROID_EXPOSE>:
Handle exposures.
* src/androidterm.h: Update prototypes.
* src/emacs.c (android_emacs_init): Initialize androidselect.
* xcompile: Move to cross.
* cross: New directory.
2023-01-21 Po Lu <luangruo@yahoo.com>
* doc/lispref/commands.texi (Touchscreen Events): Document
changes.
* lisp/touch-screen.el (touch-screen-current-tool): Update doc
string.
(touch-screen-precision-scroll): New user option.
(touch-screen-handle-scroll): Use traditional scrolling by
default.
(touch-screen-handle-touch): Adust format of
touch-screen-current-tool.
(touch-screen-track-tap): Don't print waiting for events.
(touch-screen-track-drag): Likewise. Also, don't call UPDATE
until threshold is reached.
(touch-screen-drag-mode-line-1, touch-screen-drag-mode-line):
Improve window dragging.
* src/fileio.c (Fverify_visited_file_modtime): Fix fs check.
2023-01-21 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android File System): Document that
ls-lisp is now used by default.
* java/org/gnu/emacs/EmacsThread.java (EmacsThread): Name the
thread something meaningful.
* lisp/loadup.el (featurep): Load ls-lisp on Android.
* lisp/ls-lisp.el (ls-lisp-use-insert-directory-program): Default
to off on Android.
* src/android.c (android_is_directory): New fucntion.
(android_fstatat): Handle directories created by
`android_opendir'.
(android_open): Return meaningful file mode.
(struct android_dir): New fields `next', `asset_file' and `fd'.
(android_opendir): Populate those fields.
(android_dirfd): New function.
(android_closedir): Close file descriptor if set.
(android_lookup_asset_directory_fd): New function.
* src/android.h: Update prototypes.
* src/androidfont.c (androidfont_check_init): New function.
(androidfont_list, androidfont_match, androidfont_draw)
(androidfont_open_font, androidfont_close_font)
(androidfont_has_char, androidfont_encode_char)
(androidfont_text_extents, androidfont_list_family): Initialize
font driver if necessary.
(init_androidfont): Don't initialize Java font if necessary.
* src/dired.c (open_directory): Return android_dirfd if
appropriate.
(directory_files_internal, file_name_completion_dirp): Implement
correctly for Android.
* src/fileio.c (check_mutable_filename): New function.
(Fcopy_file, Fdelete_directory_internal, Fdelete_file)
(Frename_file, Fadd_name_to_file, Fmake_symbolic_link)
(Fset_file_modes, Fset_file_times, Ffile_newer_than_file_p)
(Fverify_visited_file_modtime, Fset_visited_file_modtime): Check
that files being written to do not lie in /assets.
* src/sfntfont-android.c (GET_SCANLINE_BUFFER)
(sfntfont_android_u255to256, sfntfont_android_over_8888_1)
(sfntfont_android_over_8888, sfntfont_android_composite_bitmap):
Optimize for 64-bit ARM devices.
(sfntfont_android_put_glyphs): Optimize away memset if background
need not be filled.
2023-01-20 Po Lu <luangruo@yahoo.com>
* src/android.c (android_run_select_thread, android_select)
(android_ftruncate):
* src/android.h (ftruncate): Fix compilation on Android 16 and up.
* src/android.c (android_run_select_thread, android_init_events)
(android_select): Add alternative android_select implementation
for API 16 and lower.
* src/androidterm.c (handle_one_android_event): Fix
use-after-frees.
* xcompile/lib/gnulib.mk.in: Delete.
2023-01-20 Po Lu <luangruo@yahoo.com>
* .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 circumvents 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: New fle.
* 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 (run):
* java/org/gnu/emacs/EmacsView.java (onLayout)
(onDetachedFromWindow):
* java/org/gnu/emacs/EmacsWindow.java (viewLayout):
Implement frame resize synchronization.
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(removeWindowConsumer): Adjust accordingly for changes to frame
deletion behavior.
* lisp/frame.el (android-toggle-on-screen-keyboard)
(frame-toggle-on-screen-keyboard): New functions.
* 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 functions.
* 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.
* xcompile/verbose.mk.android: New file.
2023-01-19 Po Lu <luangruo@yahoo.com>
* .gitignore: Add new files.
* INSTALL.android: Explain how to build Emacs for ancient versions
of Android.
* admin/merge-gnulib (GNULIB_MODULES): Add getdelim.
* build-aux/config.guess (timestamp, version):
* build-aux/config.sub (timestamp, version): Autoupdate.
* configure.ac (BUILD_DETAILS, ANDROID_MIN_SDK):
(ANDROID_STUBIFY): Allow specifying CFLAGS via ANDROID_CFLAGS.
Add new configure tests for Android API version when not
explicitly specified.
* doc/emacs/android.texi (Android): Add reference to ``Other
Input Devices''.
(Android File System): Remove restrictions on directory-files on
the assets directory.
* doc/emacs/emacs.texi (Top): Add Other Input Devices to menu.
* doc/emacs/input.texi (Other Input Devices): New node.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen input events.
* doc/lispref/frames.texi (Pop-Up Menus): Likewise.
* etc/NEWS: Announce changes.
* java/Makefile.in: Use lib-src/asset-directory-tool to generate
an `directory-tree' file placed in /assets.
* java/debug.sh: Large adjustments to support Android 2.2 and
later.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
* java/org/gnu/emacs/EmacsCopyArea.java (perform):
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog):
* java/org/gnu/emacs/EmacsDrawLine.java (perform):
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform):
* java/org/gnu/emacs/EmacsDrawable.java (EmacsDrawable):
* java/org/gnu/emacs/EmacsFillPolygon.java (perform):
* java/org/gnu/emacs/EmacsFillRectangle.java (perform):
* java/org/gnu/emacs/EmacsGC.java:
* java/org/gnu/emacs/EmacsPixmap.java (destroyHandle):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java (draw): Avoid
redundant canvas saves and restores.
* java/org/gnu/emacs/EmacsService.java (run):
* java/org/gnu/emacs/EmacsView.java (EmacsView):
(handleDirtyBitmap):
* java/org/gnu/emacs/EmacsWindow.java (changeWindowBackground)
(EmacsWindow): Make compatible with Android 2.2 and later.
* lib-src/Makefile.in (DONT_INSTALL): Add asset-directory-tool
on Android.
(asset-directory-tool${EXEEXT}): New target.
* lib-src/asset-directory-tool.c (struct directory_tree, xmalloc)
(main_1, main_2, main): New file.
* lib, m4: Merge from gnulib. This will be reverted before
merging to master.
* lisp/button.el (button-map, push-button):
* lisp/frame.el (display-popup-menus-p): Improve touchscreen
support.
* lisp/subr.el (event-start, event-end): Handle touchscreen
events.
* lisp/touch-screen.el (touch-screen-handle-timeout)
(touch-screen-handle-point-update, touch-screen-handle-point-up)
(touch-screen-track-tap, touch-screen-track-drag)
(touch-screen-drag-mode-line-1, touch-screen-drag-mode-line): New
function
([mode-line touchscreen-begin])
([bottom-divider touchscreen-begin]): Bind new events.
* lisp/wid-edit.el (widget-event-point, widget-keymap)
(widget-event-start, widget-button--check-and-call-button)
(widget-button-click): Improve touchscreen support.
* src/alloc.c (make_lisp_symbol): Avoid ICE on Android NDK GCC.
(mark_pinned_symbols): Likewise.
* src/android.c (struct android_emacs_window): New struct.
(window_class): New variable.
(android_run_select_thread): Add workaround for Android platform
bug.
(android_extract_long, android_scan_directory_tree): New
functions.
(android_file_access_p): Use those functions instead.
(android_init_emacs_window): New function.
(android_init_emacs_gc_class): Update signature of `markDirty'.
(android_change_gc, android_set_clip_rectangles): Tell the GC
whether or not clip rects were dirtied.
(android_swap_buffers): Do not look up method every time.
(struct android_dir): Adjust for new directory tree lookup.
(android_opendir, android_readdir, android_closedir): Likewise.
(android_four_corners_bilinear): Fix coding style.
(android_ftruncate): New function.
* src/android.h: Update prototypes. Replace ftruncate with
android_ftruncate when necessary.
* src/androidterm.c (handle_one_android_event): Pacify GCC. Fix
touch screen tool bar bug.
* src/emacs.c (using_utf8): Fix compilation error.
* src/fileio.c (Ffile_system_info): Return Qnil when fsusage.o
is not built.
* src/filelock.c (BOOT_TIME_FILE): Fix definition for Android.
* src/frame.c (Fx_parse_geometry): Fix uninitialized variable
uses.
* src/keyboard.c (lispy_function_keys): Fix `back'.
* src/menu.c (x_popup_menu_1): Handle touch screen events.
(Fx_popup_menu): Document changes.
* src/sfnt.c (main): Improve tests.
* src/sfntfont-android.c (sfntfont_android_put_glyphs): Fix
minor problem.
(init_sfntfont_android): Check for
HAVE_DECL_ANDROID_GET_DEVICE_API_LEVEL.
* src/sfntfont.c (struct sfnt_font_desc): New fields `adstyle' and
`languages'.
(sfnt_parse_style): Append tokens to adstyle.
(sfnt_parse_languages): New function.
(sfnt_enum_font_1): Parse supported languages and adstyle.
(sfntfont_list_1): Handle new fields.
(sfntfont_text_extents): Fix uninitialized variable use.
(syms_of_sfntfont, mark_sfntfont): Adjust accordingly.
2023-01-17 Po Lu <luangruo@yahoo.com>
* doc/emacs/android.texi (Android Fonts): Document that TTC format
fonts are now supported.
* doc/emacs/emacs.texi (Top): Fix menus.
* doc/lispref/commands.texi (Touchscreen Events)
(Key Sequence Input): Document changes to touchscreen events.
* etc/DEBUG: Describe how to debug 64 bit binaries on Android.
* java/org/gnu/emacs/EmacsCopyArea.java (perform): Explicitly
recycle copy bitmap.
* java/org/gnu/emacs/EmacsDialog.java (EmacsDialog): New class.
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform): Use 5
point PolyLine like X, because Android behaves like Postscript on
some devices and X elsewhere.
* java/org/gnu/emacs/EmacsFillRectangle.java (perform): Explicitly
recycle copy bitmap.
* java/org/gnu/emacs/EmacsPixmap.java (destroyHandle): Explicitly
recycle bitmap and GC if it is big.
* java/org/gnu/emacs/EmacsView.java (EmacsView): Make
`bitmapDirty' a boolean.
(handleDirtyBitmap): Reimplement in terms of that boolean.
Explicitly recycle old bitmap and GC.
(onLayout): Fix lock up.
(onDetachedFromWindow): Recycle bitmap and GC.
* java/org/gnu/emacs/EmacsWindow.java (requestViewLayout):
Update call to explicitlyDirtyBitmap.
* src/android.c (android_run_select_thread, android_select):
Really fix android_select.
(android_build_jstring): New function.
* src/android.h: Update prototypes.
* src/androidmenu.c (android_process_events_for_menu): Totally
unblock input before process_pending_signals.
(android_menu_show): Remove redundant unblock_input and debugging
code.
(struct android_emacs_dialog, android_init_emacs_dialog)
(android_dialog_show, android_popup_dialog, init_androidmenu):
Implement popup dialogs on Android.
* src/androidterm.c (android_update_tools)
(handle_one_android_event, android_frame_up_to_date): Allow
tapping tool bar items.
(android_create_terminal): Add dialog hook.
(android_wait_for_event): Adjust call to android_select.
* src/androidterm.h (struct android_touch_point): New field
`tool_bar_p'.
* src/keyboard.c (read_key_sequence, head_table)
(syms_of_keyboard): Prefix touchscreen events with posn.
* src/keyboard.h (EVENT_HEAD): Handle touchscreen events.
* src/process.c (wait_reading_process_output): Adjust call to
android_select.
* src/sfnt.c (sfnt_read_table_directory): If the first long turns
out to be ttcf, return -1.
(sfnt_read_ttc_header): New function.
(main): Test TTC support.
* src/sfnt.h (struct sfnt_ttc_header): New structure.
(enum sfnt_ttc_tag): New enum.
* src/sfntfont-android.c
(struct sfntfont_android_scanline_buffer): New structure.
(GET_SCANLINE_BUFFER): New macro. Try to avoid so much malloc
upon accessing the scanline buffer.
(sfntfont_android_put_glyphs): Do not use SAFE_ALLOCA to allocate
the scaline buffer.
(Fandroid_enumerate_fonts): Enumerate ttc fonts too.
* src/sfntfont.c (struct sfnt_font_desc): New field `offset'.
(sfnt_enum_font_1): Split out enumeration code from
sfnt_enum_font.
(sfnt_enum_font): Read TTC tables and enumerate each font therein.
(sfntfont_open): Seek to the offset specified.
* xcompile/Makefile.in (maintainer-clean): Fix depends here.
2023-01-16 Po Lu <luangruo@yahoo.com>
* src/sfnt.c (sfnt_decompose_compound_glyph): Correct treatment of
the Y offset in components with ARG_1_AND_2_ARE_WORDS.
(main): Update debugging code.
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document changes
to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout)
(Font and Color Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove obsolete
TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Prevent redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-15 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsActivity.java (onCreate): Set the
default theme to Theme.DeviceDefault.NoActionBar if possible.
(onContextMenuClosed): Add hack for Android bug.
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu)
(onMenuItemClick): Set flag upon submenu selection.
(inflateMenuItems): Set onClickListener for submenus as well.
(display1): Clear new flag.
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform): Fix
rectangle bounds.
* java/org/gnu/emacs/EmacsNative.java (setEmacsParams): New
argument for the cache directory.
* java/org/gnu/emacs/EmacsService.java (onCreate): Pass cache
directory.
(sync): New function.
* src/android.c (struct android_emacs_service): New method `sync'.
(setEmacsParams, initEmacs): Handle cache directory.
(android_init_emacs_service): Initialize new method `sync'.
(android_sync): New function.
* src/androidfns.c (Fx_show_tip): Call both functions.
* src/androidgui.h: Update prototypes.
* src/androidmenu.c (struct android_menu_subprefix)
(android_free_subprefixes, android_menu_show): Handle submenu
prefixes correctly.
* src/androidterm.c (handle_one_android_event): Clear help echo
on MotionNotify like on X.
* src/menu.c (single_menu_item): Enable submenus on Android.
2023-01-15 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsActivity.java (onContextMenuClosed):
New function.
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu): New
field `itemAlreadySelected'.
(onMenuItemClick): New function.
(inflateMenuItems): Attach onClickListener as appropriate.
(display1): Clear itemAlreadySelected.
(display): Fix runnable synchronization.
* java/org/gnu/emacs/EmacsNative.java (sendContextMenu): New
function.
* java/org/gnu/emacs/EmacsView.java (popupMenu):
(cancelPopupMenu): Set popupactive correctly.
* src/android.c (android_run_select_thread): Fix android_select
again.
(android_wait_event): New function.
* src/android.h: Update prototypes.
* src/androidgui.h (enum android_event_type): New
`ANDROID_CONTEXT_MENU' event.
(struct android_menu_event, union android_event): Add new event.
* src/androidmenu.c (struct android_emacs_context_menu): New
structure.
(android_init_emacs_context_menu): Add `dismiss' method.
(struct android_dismiss_menu_data): New structure.
(android_dismiss_menu, android_process_events_for_menu): New
functions.
(android_menu_show): Set an actual item ID.
(popup_activated): Define when stubify as well.
(Fmenu_or_popup_active_p): New function.
(syms_of_androidmenu): New function.
* src/androidterm.c (handle_one_android_event): Handle context
menu events.
* src/androidterm.h (struct android_display_info): New field for
menu item ID.
* src/emacs.c (android_emacs_init): Call syms_of_androidmenu.
* src/xdisp.c (note_mouse_highlight): Return if popup_activated on
Android as well.
2023-01-14 Po Lu <luangruo@yahoo.com>
* src/android.c (android_run_select_thread, android_select):
Handle EINTR in sem_wait and fix sigsets.
* xcompile/lib/fpending.c (__fpending): Fix gnulib problem.
* xcompile/lib/fpending.c (__fpending):
* xcompile/lib/open.c:
* xcompile/lib/unistd.c (_GL_UNISTD_INLINE): Remove Android
patches.
2023-01-14 Po Lu <luangruo@yahoo.com>
* java/Makefile.in (clean): Fix distclean and bootstrap-clean
rules.
* java/debug.sh (jdb_port, attach_existing, num_pids, line): Add
new options to upload a gdbserver binary to the device.
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity): Make
focusedActivities public.
* java/org/gnu/emacs/EmacsContextMenu.java: New file.
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform): Fix
bounds computation.
* java/org/gnu/emacs/EmacsGC.java (markDirty): Expressly provide
stroke width.
* java/org/gnu/emacs/EmacsService.java (getLocationOnScreen)
(nameKeysym): New functions.
* java/org/gnu/emacs/EmacsView.java (<init>): Disable focus
highlight.
(onCreateContextMenu, popupMenu, cancelPopupMenu): New functions.
* java/org/gnu/emacs/EmacsWindow.java: Implement a kind of
``override redirect'' window for tooltips.
* src/android.c (struct android_emacs_service): New method
`name_keysym'.
(android_run_select_thread, android_init_events):
(android_select): Release select thread on semaphores instead of
signals to avoid one nasty race on SIGUSR2 delivery.
(android_init_emacs_service): Initialize new method.
(android_create_window): Handle CW_OVERRIDE_REDIRECT.
(android_move_resize_window, android_map_raised)
(android_translate_coordinates, android_get_keysym_name)
(android_build_string, android_exception_check): New functions.
* src/android.h: Update prototypes.
* src/androidfns.c (android_set_parent_frame, Fx_create_frame)
(unwind_create_tip_frame, android_create_tip_frame)
(android_hide_tip, compute_tip_xy, Fx_show_tip, Fx_hide_tip)
(syms_of_androidfns): Implement tooltips and iconification
reporting.
* src/androidgui.h (enum android_window_value_mask): Add
CWOverrideRedirect.
(struct android_set_window_attributes): Add `override_redirect'.
(ANDROID_IS_MODIFIER_KEY): Recognize Caps Lock.
* src/androidmenu.c (struct android_emacs_context_menu): New
struct.
(android_init_emacs_context_menu, android_unwind_local_frame)
(android_push_local_frame, android_menu_show, init_androidmenu):
New functions.
* src/androidterm.c (handle_one_android_event): Fix NULL pointer
dereference.
(android_fullscreen_hook): Handle fullscreen correctly.
(android_draw_box_rect): Fix top line.
(get_keysym_name): Implement function.
(android_create_terminal): Remove scroll bar stubs and add menu
hook.
* src/androidterm.h: Update prototypes.
* src/emacs.c (android_emacs_init): Initialize androidmenu.c.
* xcompile/Makefile.in: Fix clean rules.
2023-01-14 Po Lu <luangruo@yahoo.com>
* .gitignore: Add new files.
* INSTALL.android: New file.
* Makefile.in (clean_dirs): Clean xcompile as well.
* admin/merge-gnulib (avoided_flags): Import Gnulib into Android
directory as well.
* doc/emacs/android.texi (Android):
* doc/emacs/emacs.texi (Top): New node `Android'.
* java/org/gnu/emacs/EmacsThread.java (run): Use right executable
name.
* lib/Makefile.in (ANDROID_CFLAGS): Use better way to refer to
/src.
(vpath): Delete ugly block of vpath statements.
(mostlyclean): Remove Makefile.android.
* lib/fpending.c (__fpending):
* lib/open.c:
* lib/unistd.c (_GL_UNISTD_INLINE): Revert changes to gnulib in
lib/.
* src/android.h:
* src/androidterm.c: Fix build.
* xcompile/Makefile.in (LIB_SRCDIR, LIBSRC_BINARIES)
(src/verbose.mk, PRE_BUILD_DEPS, PHONY): Use gnulib in
xcompile/lib/ as opposed to lib/.
* xcompile/README: Adjust README.
* xcompile/lib: Check-in Gnulib with patches for Android.
2023-01-13 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsService.java (queryTree): Fix NULL
pointer dereference.
* src/android.c (android_query_tree): Set *nchildren_return.
* .gitignore: Add AndroidManifest.xml.
* java/AndroidManifest.xml: Remove file that is now generated.
* src/frame.c (make_monitor_attribute_list): Allow source to be NULL.
* configure.ac (ANDROID_MIN_SDK): New variable.
(DX): Remove and replace with D8.
(XCONFIGURE): Check for the minimum version of Android the cross
compiler compiles for. Generate java/AndroidManifest.xml from
java/AndroidManifest.xml.in. Allow using Zlib on Android.
* java/AndroidManifest.xml.in: New file. Use the minimum SDK
detected by configure.
* java/Makefile.in (top_srcdir, version): New variables.
(DX, D8): Replace with D8.
(ANDROID_MIN_SDK, APK_NAME): New variables.
(.PHONY, .PRECIOUS, classes.dex, emacs.apk): Generate $(APK_NAME)
rather than `emacs.apk'.
* java/debug.sh: New option --attach-existing. Attach to an
existing Emacs instance when specified.
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity): New field
`isPaused'.
(invalidateFocus1): Fix infinite recursion.
(detachWindow): Deiconify window.
(attachWindow): Iconify the window if the activity is paused.
(onCreate): Use the ``no title bar'' theme.
(onPause, onResume): New functions.
* java/org/gnu/emacs/EmacsNative.java (sendTouchUp, sendTouchDown)
(sendTouchMove, sendWheel, sendIconified, sendDeiconified): New
functions.
* java/org/gnu/emacs/EmacsSdk7FontDriver.java (Sdk7Typeface):
(list): Remove logging for code that is mostly going to be unused.
* java/org/gnu/emacs/EmacsService.java (ringBell, queryTree)
(getScreenWidth, getScreenHeight, detectMouse): New functions.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView)
(surfaceChanged, surfaceCreated, surfaceDestroyed): Add extra
debug logging. Avoid deadlock in surfaceCreated.
* java/org/gnu/emacs/EmacsView.java (EmacsView): Try very hard to
make the SurfaceView respect Z order. It didn't work.
(handleDirtyBitmap): Copy over the contents from the old bitmap.
(explicitlyDirtyBitmap): New function.
(onLayout): Don't dirty bitmap if unnecessary.
(damageRect, swapBuffers): Don't synchronize so hard.
(onTouchEvent): Call window.onTouchEvent instead.
(moveChildToBack, raise, lower): New functions.
* java/org/gnu/emacs/EmacsWindow.java (Coordinate): New
subclass.
(pointerMap, isMapped, isIconified, dontFocusOnMap)
(dontAcceptFocus): New fields.
(EmacsWindow): Don't immediately register unmapped window.
(viewLayout): Send configure event outside the lock.
(requestViewLayout): Explicitly dirty the bitmap.
(mapWindow): Register the window now. Respect dontFocusOnMap.
(unmapWindow): Unregister the window now.
(figureChange, onTouchEvent): New functions.
(onSomeKindOfMotionEvent): Handle scroll wheel events.
(reparentTo, makeInputFocus, raise, lower, getWindowGeometry)
(noticeIconified, noticeDeiconified, setDontAcceptFocus)
(setDontFocusOnMap, getDontFocusOnMap): New functions.
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(registerWindow, detachWindow): Synchronize.
(noticeIconified, noticeDeiconified): New functions.
(copyWindows): New function.
* lisp/frame.el (frame-geometry, frame-edges)
(mouse-absolute-pixel-position, set-mouse-absolute-pixel-position)
(frame-list-z-order, frame-restack, display-mouse-p)
(display-monitor-attributes-list): Implement on Android.
* lisp/mwheel.el (mouse-wheel-down-event, mouse-wheel-up-event)
(mouse-wheel-left-event, mouse-wheel-right-event): Define on
Android.
* src/android.c (struct android_emacs_service): New methods
`ringBell', `queryTree', `getScreenWidth', `getScreenHeight',
and `detectMouse'.
(struct android_event_queue, android_init_events)
(android_next_event, android_write_event): Remove write limit.
(android_file_access_p): Handle directories correcty.
(android_close): Fix coding style.
(android_fclose): New function.
(android_init_emacs_service): Initialize new methods.
(android_reparent_window): Implement function.
(android_bell, android_set_input_focus, android_raise_window)
(android_lower_window, android_query_tree, android_get_geometry)
(android_get_screen_width, android_get_screen_height)
(android_get_mm_width, android_get_mm_height)
(android_detect_mouse)
(android_set_dont_focus_on_map, android_set_dont_accept_focus):
New functions.
(struct android_dir): New structure.
(android_opendir, android_readdir, android_closedir): New
functions.
(emacs_abort): Implement here on Android and poke debuggerd into
generating a tombstone.
* src/android.h: Update prototypes.
* src/androidfns.c (android_set_parent_frame): New function.
(android_default_font_parameter): Use sane font size by default.
(Fx_display_pixel_width, Fx_display_pixel_height)
(Fx_display_mm_width, Fx_display_mm_height)
(Fx_display_monitor_attributes_list): Rename to start with
`android-'. Implement. Fiddle with documentation to introduce
Android specific nuances.
(Fandroid_display_monitor_attributes_list): New function.
(Fx_frame_geometry, frame_geometry): New function.
(Fandroid_frame_geometry): Implement correctly.
(Fx_frame_list_z_order): Rename to start with `android-'.
(android_frame_list_z_order, Fandroid_frame_list_z_order):
Implement.
(Fx_frame_restack): Rename to start with `android-'.
(Fandroid_frame_restack): ``Implement''.
(Fx_mouse_absolute_pixel_position): Rename to start with
`android-'.
(Fandroid_mouse_absolute_pixel_position): ``Implement''.
(Fx_set_mouse_absolute_pixel_position): Rename to start with
`android-'.
(Fandroid_set_mouse_absolute_pixel_position): ``Implement''.
(Fandroid_detect_mouse): New function.
(android_set_menu_bar_lines): Use FRAME_ANDROID_DRAWABLE when
clearing area.
(android_set_no_focus_on_map, android_set_no_accept_focus): New
functions.
(android_frame_parm_handlers): Register new frame parameter
handlers.
(syms_of_androidfns): Update appropriately.
* src/androidfont.c (androidfont_draw): Use FRAME_ANDROID_DRAWABLE
instead of FRAME_ANDROID_WINDOW.
* src/androidgui.h (enum android_event_type): New events.
(struct android_touch_event, struct android_wheel_event)
(struct android_iconify_event): New structures.
(union android_event): Add new events.
* src/androidterm.c (android_clear_frame): Use
FRAME_ANDROID_DRAWABLE instead of FRAME_ANDROID_WINDOW.
(android_flash, android_ring_bell): Implement bell ringing.
(android_toggle_invisible_pointer): Don't TODO function that can't
be implemented.
(show_back_buffer, android_flush_dirty_back_buffer_on): Check if a
buffer flip is required before doing the flip.
(android_lower_frame, android_raise_frame): Implement functions.
(android_update_tools, android_find_tool): New functions.
(handle_one_android_event): Handle new iconification, wheel and
touch events.
(android_read_socket): Implement pending-autoraise-frames.
(android_frame_up_to_date): Implement bell ringing.
(android_buffer_flipping_unblocked_hook): Check if a buffer flip
is required before doing the flip.
(android_focus_frame, android_frame_highlight)
(android_frame_unhighlight): New function.
(android_frame_rehighlight): Implement functions.
(android_iconify_frame): Always display error.
(android_set_alpha): Update commentary.
(android_free_frame_resources): Free frame touch points.
(android_scroll_run, android_flip_and_flush)
(android_clear_rectangle, android_draw_fringe_bitmap)
(android_draw_glyph_string_background, android_fill_triangle)
(android_clear_point, android_draw_relief_rect)
(android_draw_box_rect, android_draw_glyph_string_bg_rect)
(android_draw_image_foreground, android_draw_stretch_glyph_string)
(android_draw_underwave, android_draw_glyph_string_foreground)
(android_draw_composite_glyph_string_foreground)
(android_draw_glyphless_glyph_string_foreground)
(android_draw_glyph_string, android_clear_frame_area)
(android_clear_under_internal_border, android_draw_hollow_cursor)
(android_draw_bar_cursor, android_draw_vertical_window_border)
(android_draw_window_divider): Use FRAME_ANDROID_DRAWABLE instead
of FRAME_ANDROID_WINDOW for drawing operations.
* src/androidterm.h (struct android_touch_point): New structure.
(struct android_output): New fields.
(FRAME_ANDROID_NEED_BUFFER_FLIP): New macro.
* src/dired.c (emacs_readdir, open_directory)
(directory_files_internal_unwind, read_dirent)
(directory_files_internal, file_name_completion): Add indirection
over readdir and opendir. Use android variants on Android.
* src/dispnew.c (Fopen_termscript):
* src/fileio.c (fclose_unwind): Use emacs_fclose.
(Faccess_file): Call android_file_access_p.
(file_accessible_directory_p): Append right suffix to Android
assets directory.
(do_auto_save_unwind): Use emacs_fclose.
* src/keyboard.c (lispy_function_keys): Use right function key for
page up and page down.
(Fopen_dribble_file): Use emacs_fclose.
* src/lisp.h: New prototype emacs_fclose.
* src/lread.c (close_infile_unwind): Use emacs_fclose.
* src/sfnt.c (sfnt_curve_is_flat): Fix area-squared computation.
(sfnt_prepare_raster): Compute raster width and height
consistently with outline building.
(sfnt_build_outline_edges): Use the same offsets used to set offy
and offx.
(main): Adjust debug code.
* src/sfntfont-android.c (sfntfont_android_saturate32): Delete
function.
(sfntfont_android_blend, sfntfont_android_blendrgb): Remove
unnecessary debug code.
(sfntfont_android_composite_bitmap): Prevent out of bounds write.
(sfntfont_android_put_glyphs): Use FRAME_ANDROID_DRAWABLE.
(init_sfntfont_android): Initialize Monospace Serif font to
something sensible.
* src/sfntfont.c (sfntfont_text_extents): Clear glyph metrics
before summing up pcm.
(sfntfont_draw): Use s->font instead of s->face->font.
* src/sysdep.c (emacs_fclose): Wrap around android_fclose on
Android.
* src/term.c (Fsuspend_tty, delete_tty): Use emacs_fclose.
* src/verbose.mk.in (AM_V_DX): Replace with D8 version.
2023-01-11 Po Lu <luangruo@yahoo.com>
Bring up the sfnt-android font driver
* configure.ac (ANDROID_CFLAGS): Add sfnt-related font objects
to ANDROID_OBJ when not building stubs.
* lisp/startup.el (android-fonts-enumerated): New variable.
(normal-top-level): Set it. Also enumerate fonts as early as
possible upon startup.
* src/alloc.c (cleanup_vector): Only finalize Android font
entities.
(garbage_collect): Mark sfntfont.c.
* src/android.c (struct android_emacs_drawable): New field
`damage_rect'.
(android_init_emacs_drawable): Initialize
Lorg/gnu/emacs/EmacsDrawable;#damageRect(Landroid/graphics/rect;)V.
(android_create_gc): Initialize cached GC fields.
(android_free_gc): Free cached GC clip rectangles.
(android_change_gc): Cache fields as appropriate.
(android_set_clip_rectangles): Set cached clip rectangles for
easy access from C.
(android_get_gc_values): Use cached values.
(android_get_image): Remove obsolete comment.
(android_lock_bitmap, android_damage_window): New functions that
don't parallel anything on X.
* src/android.h: Update prototypes.
* src/androidfns.c (android_default_font_parameter): Set Droid
Sans Mono as the default monospace font.
(Fx_create_frame): Register the sfntfont driver.
* src/androidgui.h (struct android_gc): Add C side caches for
clip rectangles and the foreground and background colors.
* src/androidterm.h: Update prototypes.
* src/dispextern.h (struct gui_box): New struct.
(gui_union_rectangles): New function.
* src/emacs.c (android_emacs_init): Initialize Android font
stuff late.
* src/font.c (font_make_entity): Clear `is_android' field on
Android.
(font_make_entity_android): Set `is_android' field.
* src/font.h (struct font_entity): New field `is_android'.
* src/print.c (print_vectorlike): Don't print private data,
which could include Lisp_Misc.
* src/sfnt.c (sfnt_read_cmap_format_0, sfnt_read_cmap_format_2)
(sfnt_read_cmap_format_4, sfnt_read_cmap_format_6)
(sfnt_read_cmap_format_8, sfnt_read_cmap_format_12): Remove
buggy pragmas.
(sfnt_lookup_glyph_4_1): New function.
(sfnt_lookup_glyph_4): Handle malformed lookup tables found on
Android.
(sfnt_lookup_glyph): Fix overflow problems in glyph checks.
(sfnt_read_glyph): Handle empty glyphs. This implements some
behavior which everyone else seems to as well, but I can't find
documented in the TrueType Reference Manual.
(sfnt_free_glyph): Export correctly.
(sfnt_transform_coordinates): Make faster.
(sfnt_lerp_half): Fix lerping in some cases.
(sfnt_decompose_glyph): Handle empty glyphs correctly. Close
contours manually instead of waiting for the edge building
process to do that. This lets curves be handled correctly.
(struct sfnt_build_glyph_outline_context): Move internal struct
back to sfnt.c.
(sfnt_build_append): Fix detection of initial entry.
(sfnt_curve_to_and_build_1): Fix De Casteljau implementation.
(sfnt_curve_to_and_build): Use fixed point arithmetic to scale
outlines.
(sfnt_build_glyph_outline): Clear reference counts. Use fixed
point arithmetic.
(sfnt_prepare_raster): Align rasters to 4 bytes,
SFNT_POLY_ALIGNMENT. Fix calculation of offx and offy.
(sfnt_step_edge_by): Step edge by previously computed step_x.
(sfnt_build_outline_edges): Adjust for already closed contours.
Ignore edges abandoned after grid fit. Also precompute step_x
to avoid multiplication on each span rastered.
(sfnt_poly_edges): Improve alignment.
(sfnt_fill_span): Rewrite to avoid control flow in while loop.
(sfnt_poly_span): Remove unnecessary code.
(sfnt_raster_glyph_outline): Use raster stride instead of width.
(sfnt_test_edge, sfnt_test_raster, main): Improve debugging
code.
* src/sfnt.h (struct sfnt_glyph_outline): Add refcount field to
outline.
(struct sfnt_build_glyph_outline_context): Remove private
struct.
(struct sfnt_raster): Add refcount field to raster.
(struct sfnt_edge): Improve doc. Add `source_x' field used when
built with TEST.
(SFNT_CEIL_FIXED): New macro.
* src/sfntfont-android.c (sfntfont_android_saturate32)
(sfntfont_android_scale32, sfntfont_android_mul8x2)
(sfntfont_android_blend, U255TO256)
(sfntfont_android_composite_bitmap, sfntfont_android_union_boxes)
(sfntfont_android_put_glyphs, sfntfont_android_get_cache): New
functions.
(android_sfntfont_driver): New font driver.
(Fandroid_enumerate_fonts): New function.
(syms_of_sfntfont_android_for_pdumper, init_sfntfont_android)
(syms_of_sfntfont_android): Initialize default fonts, special
family mapping and font driver.
* src/sfntfont.c (struct sfnt_font_desc): New fields
`char_cache', `cmap_invalid' and `subtable'.
(sfnt_setup_coding_system): Improve commentary. Add default
branch. Fix return value.
(sfnt_safe_encode_coding_object_1)
(sfnt_safe_encode_coding_object_2):
(sfnt_safe_encode_coding_object): Use decode_coding_object
instead of encode_coding_object.
(sfnt_decode_font_string): Adjust for rename.
(sfnt_decode_foundry_name): New function.
(sfnt_weight_descriptions, sfnt_slant_descriptions)
(sfnt_width_descriptions): Fix definitions.
(sfnt_parse_style): Make function work.
(sfnt_enum_font): Initialize designer, char-cache and subtable
platform ID.
(sfntfont_charset_for_name, mark_sfntfont)
(sfntfont_charset_for_cmap): New functions.
(syms_of_sfntfont): New variable `sfnt-default-family-alist'.
* src/sfntfont.h (_SFNTFONT_H_): Update prototypes.
* src/xdisp.c (gui_union_rectangles): New function.
2023-01-08 Po Lu <luangruo@yahoo.com>
* configure.ac (ANDROID_OBJS): Add sfntfont files.
* src/sfnt.h:
* src/sfntfont-android.c:
* src/sfntfont.c:
* src/sfntfont.h: New files.
2023-01-08 Po Lu <luangruo@yahoo.com>
* src/android.c (android_change_gc): Fix situations where clip
rects are cleared.
(android_create_pixmap_from_bitmap_data): Fix bitmap data
iteration.
* src/androidfns.c (Fx_show_tip, Fx_hide_tip): Remove annoying
errors.
* src/androidgui.h (enum android_event_type)
(struct android_crossing_event)
(struct android_motion_event)
(struct android_button_event, union android_event): New crossing,
motion and button events.
* src/androidterm.c (android_note_mouse_movement)
(mouse_or_wdesc_frame, android_construct_mouse_click)
(handle_one_android_event, android_mouse_position)
(android_wait_for_event, android_set_window_size_1)
(android_bitmap_icon, android_free_frame_resources)
(syms_of_androidterm): New functions. Handle crossing, motion and
button events.
* src/androidterm.h (struct android_display_info): New field
`last_mouse_movement_time'.
(struct android_output): Remove unused `need_buffer_flip' field.
* src/emacs.c (android_emacs_init): Initialize sfntfont.
* src/frame.c (syms_of_frame): Set frame_inhibit_implied_resize
to some reasonable value.
* src/frame.h (GCALIGNED_STRUCT): Set wait_event_type on Android.
* src/sfnt.c (eassert, TEST_STATIC, available, enum sfnt_table)
(sfnt_table_names, SFNT_ENDOF, struct sfnt_table_directory)
(sfnt_scaler_type, sfnt_coerce_fixed, struct sfnt_hhea_table)
(struct sfnt_cmap_table, enum sfnt_platform_id)
(enum sfnt_unicode_platform_specific_id)
(enum sfnt_macintosh_platform_specific_id)
(enum sfnt_microsoft_platform_specific_id)
(struct sfnt_cmap_encoding_subtable)
(struct sfnt_cmap_encoding_subtable_data)
(struct sfnt_cmap_format_0)
(struct sfnt_cmap_format_2_subheader, struct sfnt_cmap_format_2)
(struct sfnt_cmap_format_4, struct sfnt_cmap_format_6)
(struct sfnt_cmap_format_8_or_12_group, struct sfnt_cmap_format_8)
(struct sfnt_cmap_format_12, struct sfnt_maxp_table)
(struct sfnt_loca_table_short, struct sfnt_loca_table_long)
(struct sfnt_glyf_table, struct sfnt_simple_glyph)
(struct sfnt_compound_glyph_component, struct sfnt_compound_glyph)
(struct sfnt_glyph, sfnt_read_table_directory, file)
(sfnt_read_cmap_table)
(sfnt_read_head_table, success, sfnt_read_hhea_table)
(sfnt_read_loca_table_short, sfnt_read_loca_table_long)
(sfnt_read_maxp_table, sfnt_read_glyf_table)
(sfnt_read_compound_glyph, sfnt_read_glyph, struct sfnt_point)
(sfnt_expand_compound_glyph_context)
(sfnt_decompose_compound_glyph, struct sfnt_glyph_outline)
(enum sfnt_glyph_outline_flags)
(struct sfnt_build_glyph_outline_context)
(sfnt_build_append, sfnt_build_glyph_outline, struct sfnt_raster)
(struct sfnt_edge, sfnt_prepare_raster, sfnt_build_outline_edges)
(sfnt_raster_glyph_outline): Move structures to sfnt.h.
(struct sfnt_long_hor_metric, sfnt_read_hmtx_table)
(sfnt_lookup_glyph_metrics, sfnt_read_name_table, sfnt_find_name)
(sfnt_read_meta_table, sfnt_find_metadata, sfnt_test_edge_ignore):
New functions.
(main): Add new tests.
2023-01-08 Po Lu <luangruo@yahoo.com>
* java/org/gnu/emacs/EmacsPaintQueue.java
* java/org/gnu/emacs/EmacsPaintReq.java: Remove files.
* java/org/gnu/emacs/EmacsCopyArea.java (perform, paintTo):
* java/org/gnu/emacs/EmacsDrawLine.java:
* java/org/gnu/emacs/EmacsDrawPoint.java:
* java/org/gnu/emacs/EmacsDrawRectangle.java (paintTo):
* java/org/gnu/emacs/EmacsDrawable.java:
* java/org/gnu/emacs/EmacsFillPolygon.java:
* java/org/gnu/emacs/EmacsFillRectangle.java:
* java/org/gnu/emacs/EmacsFontDriver.java:
* java/org/gnu/emacs/EmacsGC.java:
* java/org/gnu/emacs/EmacsNative.java:
* java/org/gnu/emacs/EmacsPixmap.java:
* java/org/gnu/emacs/EmacsSdk23FontDriver.java:
* java/org/gnu/emacs/EmacsSdk7FontDriver.java (textExtents1)
(textExtents, draw):
* java/org/gnu/emacs/EmacsService.java (copyArea):
* java/org/gnu/emacs/EmacsSurfaceView.java:
* java/org/gnu/emacs/EmacsView.java (onLayout, onFocusChanged):
* java/org/gnu/emacs/EmacsWindow.java (run, resizeWindow)
(lockCanvas, getBitmap, onKeyDown, onKeyUp)
(onActivityDetached): Move rendering to main thread. Make
drawing operations completely static.
* src/androidmenu.c: New file.
2023-01-07 Po Lu <luangruo@yahoo.com>
* src/sfnt.c (xmalloc, xrealloc, xfree, eassert, MIN)
(sfnt_table_names, SFNT_ENDOF, struct sfnt_table_directory)
(enum sfnt_scaler_type, sfnt_coerce_fixed, struct sfnt_hhea_table)
(struct sfnt_cmap_table, enum sfnt_platform_id)
(enum sfnt_unicode_platform_specific_id)
(enum sfnt_macintosh_platform_specific_id)
(enum sfnt_microsoft_platform_specific_id)
(struct sfnt_cmap_encoding_subtable)
(struct sfnt_cmap_encoding_subtable_data)
(struct sfnt_cmap_format_0, struct sfnt_cmap_format_2_subheader)
(struct sfnt_cmap_format_2, struct sfnt_cmap_format_4)
(struct sfnt_cmap_format_6, struct sfnt_cmap_format_8_or_12_group)
(struct sfnt_cmap_format_8, struct sfnt_cmap_format_12)
(struct sfnt_maxp_table, struct sfnt_loca_table_short)
(struct sfnt_loca_table_long, struct sfnt_glyf_table)
(struct sfnt_simple_glyph, struct sfnt_compound_glyph_component)
(struct sfnt_compound_glyph, struct sfnt_glyph, _sfnt_swap16)
(_sfnt_swap32, sfnt_swap16, sfnt_find_table)
(sfnt_read_cmap_format_0, sfnt_read_cmap_format_2)
(sfnt_read_cmap_format_4, sfnt_read_cmap_format_6)
(sfnt_read_cmap_format_8, sfnt_read_cmap_format_12)
(sfnt_read_cmap_table_1, sfnt_read_cmap_table)
(sfnt_lookup_glyph_0)
(sfnt_lookup_glyph_2, sfnt_bsearch_above, sfnt_compare_uint16)
(sfnt_lookup_glyph_4, sfnt_lookup_glyph_6, sfnt_lookup_glyph_8)
(sfnt_lookup_glyph_12, sfnt_lookup_glyph, sfnt_read_head_table)
(sfnt_read_hhea_table, sfnt_read_loca_table_short)
(sfnt_read_loca_table_long, sfnt_read_maxp_table)
(sfnt_read_glyf_table, sfnt_read_simple_glyph)
(sfnt_read_compound_glyph, sfnt_read_glyph, sfnt_free_glyph)
(struct sfnt_point, sfnt_transform_coordinates)
(struct sfnt_compound_glyph_context)
(sfnt_expand_compound_glyph_context, sfnt_round_fixed)
(sfnt_decompose_compound_glyph, sfnt_lerp_half)
(sfnt_decompose_glyph, struct sfnt_glyph_outline)
(enum sfnt_glyph_outline_flags)
(struct sfnt_build_glyph_outline_context, sfnt_build_append)
(sfnt_move_to_and_build, sfnt_line_to_and_build, sfnt_mul_fixed)
(sfnt_div_fixed, sfnt_ceil_fixed, sfnt_floor_fixed)
(sfnt_curve_is_flat, sfnt_curve_to_and_build_1)
(sfnt_curve_to_and_build, sfnt_build_glyph_outline)
(struct sfnt_raster, struct sfnt_edge, sfnt_poly_coverage)
(sfnt_poly_grid_ceil, sfnt_prepare_raster, sfnt_step_edge_by)
(sfnt_build_outline_edges, sfnt_compare_edges, sfnt_poly_edges)
(sfnt_saturate_short, sfnt_fill_span, sfnt_poly_span)
(sfnt_raster_span, sfnt_raster_edge, sfnt_raster_glyph_outline)
(struct sfnt_long_hor_metric, struct sfnt_hmtx_table)
(struct sfnt_glyph_metrics, sfnt_read_hmtx_table)
(sfnt_lookup_glyph_metrics, struct sfnt_test_dcontext)
(sfnt_test_move_to, sfnt_test_line_to, sfnt_test_curve_to)
(sfnt_test_get_glyph, sfnt_test_free_glyph, sfnt_test_span)
(sfnt_test_edge, sfnt_test_raster, main): New file, meant to read
TrueType fonts and OpenType fonts using TrueType outlines.
2023-01-02 Po Lu <luangruo@yahoo.com>
* Makefile.in (java): Depend on info.
(MAKEFILE_NAME, config.status): Remove unneeded changes.
* configure.ac (BUILD_DETAILS, ANDROID_STUBIFY): Don't require a
C++ compiler on Android.
* java/AndroidManifest.xml <EmacsActivity>: Set launchMode
appropriately.
<EmacsMultitaskActivity>: New activity.
* java/Makefile.in (CROSS_BINS): Add Emacsclient to the list of
binaries that will be copied into the app package.
* java/org/gnu/emacs/EmacsActivity.java (onCreate): Use the window
attachment manager.
* java/org/gnu/emacs/EmacsCopyArea.java (paintTo): Implement clip
masks correctly.
* java/org/gnu/emacs/EmacsDrawRectangle.java (getRect, paintTo):
Fix damage tracking rectangles.
* java/org/gnu/emacs/EmacsFontDriver.java (toString): New
function.
(FontMetrics): Fix signature of textExtents.
* java/org/gnu/emacs/EmacsMultitaskActivity.java: New file.
* java/org/gnu/emacs/EmacsNative.java (sendFocusIn, sendFocusOut)
(sendWindowAction): New functions.
* java/org/gnu/emacs/EmacsPaintQueue.java (run): Correct treatment
of the clip rectangle list.
* java/org/gnu/emacs/EmacsPixmap.java: Add constructor for mutable
pixmaps.
* java/org/gnu/emacs/EmacsSdk23FontDriver.java: New file.
* java/org/gnu/emacs/EmacsSdk7FontDriver.java (Sdk7Typeface)
(Sdk7FontEntity, Sdk7FontObject, checkMatch, hasChar, encodeChar):
Implement text display and fix font metrics semantics.
* java/org/gnu/emacs/EmacsService.java (EmacsService): Remove
availableChildren.
(getLibraryDirectory, onCreate): Pass pixel density to Emacs.
(clearArea): Fix arguments. Switch to using the window attachment
manager.
* java/org/gnu/emacs/EmacsSurfaceView.java (surfaceChanged)
(surfaceCreated): Flip buffers on surface attachment.
* java/org/gnu/emacs/EmacsView.java (swapBuffers): New argument
FORCE. Always swap if it is true.
(onKeyMultiple, onFocusChanged): New functions.
* java/org/gnu/emacs/EmacsWindow.java (destroyHandle, run): Switch
to using the window attachment manager.
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java: New file.
* lisp/cus-edit.el (custom-button, custom-button-mouse)
(custom-button-pressed):
* lisp/faces.el (tool-bar): Define faces correctly on Android.
* src/android.c (struct android_emacs_pixmap): Add mutable
constructor.
(struct android_emacs_drawable): New structure.
(android_write_event): Check if event queue hasn't yet been
initialized.
(android_select): Set errno to EINTR if pselect fails.
(android_close): Remove unused debugging code.
(android_get_home_directory): New function.
(Java_org_gnu_emacs_EmacsNative_setEmacsParams): Set pixel density
and compute game path.
(android_init_emacs_drawable): New function.
(Java_org_gnu_emacs_EmacsNative_sendKeyPress): New argument
`unicode_char'. Pass it in events.
(Java_org_gnu_emacs_EmacsNative_sendKeyRelease): Likewise.
(Java_org_gnu_emacs_EmacsNative_sendFocusIn)
(Java_org_gnu_emacs_EmacsNative_sendFocusOut)
(Java_org_gnu_emacs_EmacsNative_sendWindowAction): New functions.
(android_resolve_handle): Export function.
(android_change_gc): Clear clip rects under the right
circumstances. Set right clip mask field.
(android_create_pixmap_from_bitmap_data): Use correct alpha
channels.
(android_create_pixmap): Create mutable pixmap and avoid redundant
color array allocation.
(android_create_bitmap_from_data, android_create_image)
(android_destroy_image, android_put_pixel, android_get_pixel)
(android_get_image, android_put_image, faccessat): New functions.
* src/android.h: Update prototypes.
* src/androidfns.c (android_default_font_parameter): Prefer
monospace to Droid Sans Mono.
* src/androidfont.c (struct android_emacs_font_driver): New method
`draw'.
(struct android_emacs_font_spec): New field `dpi'.
(struct androidfont_info): Add font metrics cache.
(android_init_font_driver, android_init_font_spec): Adjust
accordingly.
(androidfont_from_lisp, androidfont_from_java): Handle new fields.
(androidfont_draw): Implement function.
(androidfont_open_font): Set pixel size correctly.
(androidfont_close_font): Free metrics cache.
(androidfont_cache_text_extents)
(androidfont_check_cached_extents): New functions.
(androidfont_text_extents): Cache glyph metrics somewhere for
future use.
(androidfont_list_family): Implement function.
* src/androidgui.h (enum android_event_type): New focus and window
action events.
(enum android_modifier_mask): New masks.
(struct android_key_event): New field `unicode_char'.
(ANDROID_IS_MODIFIER_KEY): Newmacro.
(struct android_focus_event, struct android_window_action_event):
New structs.
(union android_event): Add new fields.
(enum android_image_format, struct android_image): New enums and
structs.
* src/androidterm.c (android_android_to_emacs_modifiers)
(android_emacs_to_android_modifiers, android_lower_frame)
(android_raise_frame, android_new_focus_frame)
(android_focus_changed, android_detect_focus_change): New
functions.
(handle_one_android_event): Implement focus and key event
handling.
(android_frame_rehighlight): New function.
(android_frame_raise_lower): Implement accordingly.
(android_make_frame_invisible): Clear highlight_frame if required.
(android_free_frame_resources): Clear x_focus_event_frame if
required.
(android_draw_fringe_bitmap, android_draw_image_foreground)
(android_draw_image_foreground_1)
(android_draw_image_glyph_string): Remove unnecessary code.
(android_create_terminal, android_term_init): Set the baud rate to
something sensible.
* src/androidterm.h (struct android_bitmap_record): Make structure
the same as on X.
(struct android_display_info): New focus tracking fields.
(struct android_output): Likewise.
* src/dispextern.h (struct image): Add ximg and mask_img on
Android.
* src/emacs.c (android_emacs_init): Fix argc sorting iteration.
* src/fileio.c (user_homedir, get_homedir): Implement correctly on
Android.
* src/font.h (PT_PER_INCH): Define correctly on Android.
* src/fringe.c (X, swap_nibble, init_fringe_bitmap): Swap fringe
bitmaps correctly on Android.
* src/image.c (GET_PIXEL, image_create_bitmap_from_data)
(image_create_bitmap_from_file, free_bitmap_record)
(image_unget_x_image_or_dc, struct image_type)
(prepare_image_for_display, image_clear_image_1)
(image_size_in_bytes, x_check_image_size)
(x_create_x_image_and_pixmap, x_destroy_x_image)
(image_check_image_size, image_create_x_image_and_pixmap_1)
(image_destroy_x_image, gui_put_x_image, image_put_x_image)
(image_get_x_image, image_unget_x_image)
(Create_Pixmap_From_Bitmap_Data, image_pixmap_draw_cross)
(MaskForeground, image_types, syms_of_image): Implement all of the
above on Android in terms of an API very similar to X.
* src/keyboard.c (FUNCTION_KEY_OFFSET, lispy_function_keys):
Define to something sensible under Android.
* src/lread.c (build_load_history): Fix problem.
2022-12-31 Po Lu <luangruo@yahoo.com>
* .dir-locals.el (c-mode): Add ANDROID_EXPORT noise macro.
* .gitignore: Add new files to ignore.
* Makefile.in: Adjust for Android.
* admin/merge-gnulib: Add new warning.
* configure.ac: Detect Android. Run cross-configuration for
Android when appropriate.
* etc/DEBUG: Document how to debug Emacs on Android.
* java/AndroidManifest.xml:
* java/Makefile.in:
* java/README:
* java/debug.sh:
* java/org/gnu/emacs/EmacsActivity.java:
* java/org/gnu/emacs/EmacsApplication.java:
* java/org/gnu/emacs/EmacsCopyArea.java:
* java/org/gnu/emacs/EmacsDrawLine.java:
* java/org/gnu/emacs/EmacsDrawPoint.java:
* java/org/gnu/emacs/EmacsDrawRectangle.java:
* java/org/gnu/emacs/EmacsDrawable.java:
* java/org/gnu/emacs/EmacsFillPolygon.java:
* java/org/gnu/emacs/EmacsFillRectangle.java:
* java/org/gnu/emacs/EmacsFontDriver.java:
* java/org/gnu/emacs/EmacsGC.java:
* java/org/gnu/emacs/EmacsHandleObject.java:
* java/org/gnu/emacs/EmacsNative.java:
* java/org/gnu/emacs/EmacsPaintQueue.java:
* java/org/gnu/emacs/EmacsPaintReq.java:
* java/org/gnu/emacs/EmacsPixmap.java:
* java/org/gnu/emacs/EmacsSdk7FontDriver.java:
* java/org/gnu/emacs/EmacsService.java:
* java/org/gnu/emacs/EmacsSurfaceView.java:
* java/org/gnu/emacs/EmacsThread.java:
* java/org/gnu/emacs/EmacsView.java:
* java/org/gnu/emacs/EmacsWindow.java: New files and classes.
* lib-src/Makefile.in (srcdir):
* lib/Makefile.in (VPATH, HAVE_NATIVE_COMP, libgnu_a_SOURCES):
(DEPFLAGS): Configure correctly for cross-compiling.
* lib/faccessat.c:
* lib/fpending.c (__fpending):
* lib/open.c:
* lib/unistd.c (_GL_UNISTD_INLINE): Temporary adjustments to
Gnulib.
* lisp/frame.el (display-graphic-p, display-screens)
(display-pixel-height, display-pixel-width, display-mm-height)
(display-mm-width, display-backing-store, display-save-under)
(display-planes, display-color-cells, display-visual-class):
Adjust for new window system `android'.
* lisp/image/wallpaper.el (x-open-connection): Add declaration.
* lisp/loadup.el (featurep): Load files for Android.
* lisp/net/eww.el (eww-form-submit, eww-form-file)
(eww-form-checkbox, eww-form-select): Adjust faces for android.
* lisp/term/android-win.el: New file.
* src/Makefile.in: Add new targets emacs.so and android-emacs,
then adjust for cross compilation.
* src/alloc.c (cleanup_vector): Clean up Android font entities
as well.
(garbage_collect): Mark androidterm.
* src/android-emacs.c (main):
* src/android.c (ANDROID_THROW, enum android_fd_table_entry_flags)
(struct android_emacs_service, struct android_emacs_pixmap)
(struct android_graphics_point, struct android_event_container)
(struct android_event_queue, android_run_select_thread)
(android_handle_sigusr1, android_init_events, android_pending)
(android_next_event, android_write_event, android_select)
(android_run_debug_thread, android_user_full_name)
(android_get_asset_name, android_fstat, android_fstatat)
(android_file_access_p, android_hack_asset_fd, android_open)
(android_close, JNICALL, android_init_emacs_service)
(android_init_emacs_pixmap, android_init_graphics_point)
(MAX_HANDLE, struct android_handle_entry, android_alloc_id)
(android_destroy_handle, android_resolve_handle)
(android_resolve_handle2, android_change_window_attributes)
(android_create_window, android_set_window_background)
(android_destroy_window, android_init_android_rect_class)
(android_init_emacs_gc_class, android_create_gc, android_free_gc)
(android_change_gc, android_set_clip_rectangles)
(android_reparent_window, android_lookup_method)
(android_clear_window, android_map_window, android_unmap_window)
(android_resize_window, android_move_window, android_swap_buffers)
(android_get_gc_values, android_set_foreground)
(android_fill_rectangle, android_create_pixmap_from_bitmap_data)
(android_set_clip_mask, android_set_fill_style, android_copy_area)
(android_free_pixmap, android_set_background)
(android_fill_polygon)
(android_draw_rectangle, android_draw_point, android_draw_line)
(android_create_pixmap, android_set_ts_origin)
(android_clear_area):
* src/android.h (ANDROID_EXPORT):
* src/androidfns.c (android_display_info_for_name)
(check_android_display_info, check_x_display_info, gamma_correct)
(android_defined_color, android_decode_color)
(android_implicitly_set_name, android_explicitly_set_name)
(android_set_tool_bar_lines, android_change_tool_bar_height)
(android_set_tab_bar_lines, android_change_tab_bar_height)
(android_set_scroll_bar_default_height)
(android_set_scroll_bar_default_width, android_icon_verify)
(android_icon, android_make_gc, android_free_gcs)
(unwind_create_frame, do_unwind_create_frame)
(android_default_font_parameter, android_create_frame_window)
(Fx_create_frame, Fxw_color_defined_p, Fxw_color_values)
(Fxw_display_color_p, Fx_display_grayscale_p)
(Fx_display_pixel_width, Fx_display_pixel_height)
(Fx_display_planes, Fx_display_color_cells, Fx_display_screens)
(Fx_display_mm_width, Fx_display_mm_height)
(Fx_display_backing_store, Fx_display_visual_class)
(Fx_display_monitor_attributes_list, Fx_frame_geometry)
(Fx_frame_list_z_order, Fx_frame_restack)
(Fx_mouse_absolute_pixel_position)
(Fx_set_mouse_absolute_pixel_position, Fandroid_get_connection)
(Fx_display_list, Fx_show_tip, Fx_hide_tip)
(android_set_background_color, android_set_border_color)
(android_set_cursor_color, android_set_cursor_type)
(android_set_foreground_color)
(android_set_child_frame_border_width)
(android_set_internal_border_width, android_set_menu_bar_lines)
(android_set_mouse_color, android_set_title, android_set_alpha)
(android_frame_parm_handlers, syms_of_androidfns):
* src/androidfont.c (struct android_emacs_font_driver)
(struct android_emacs_font_spec)
(struct android_emacs_font_metrics)
(struct android_emacs_font_object, struct android_integer)
(struct androidfont_info, struct androidfont_entity)
(android_init_font_driver, android_init_font_spec)
(android_init_font_metrics, android_init_integer)
(android_init_font_object, androidfont_get_cache)
(androidfont_from_lisp, androidfont_from_java, androidfont_list)
(androidfont_match, androidfont_draw, androidfont_open_font)
(androidfont_close_font, androidfont_has_char)
(androidfont_encode_char, androidfont_text_extents)
(androidfont_list_family, androidfont_driver)
(syms_of_androidfont_for_pdumper, syms_of_androidfont)
(init_androidfont, android_finalize_font_entity):
* src/androidgui.h (_ANDROID_GUI_H_, struct android_rectangle)
(struct android_point, enum android_gc_function)
(enum android_gc_value_mask, enum android_fill_style)
(enum android_window_value_mask)
(struct android_set_window_attributes, struct android_gc_values)
(struct android_gc, enum android_swap_action, enum android_shape)
(enum android_coord_mode, struct android_swap_info)
(NativeRectangle, struct android_any_event)
(struct android_key_event, struct android_configure_event)
(union android_event):
* src/androidterm.c (android_window_to_frame, android_clear_frame)
(android_ring_bell, android_toggle_invisible_pointer)
(android_update_begin, android_update_end, show_back_buffer)
(android_flush_dirty_back_buffer_on, handle_one_android_event)
(android_read_socket, android_frame_up_to_date)
(android_buffer_flipping_unblocked_hook)
(android_query_frame_background_color, android_parse_color)
(android_alloc_nearest_color, android_query_colors)
(android_mouse_position, android_get_focus_frame)
(android_focus_frame, android_frame_rehighlight)
(android_frame_raise_lower, android_make_frame_visible)
(android_make_frame_invisible)
(android_make_frame_visible_invisible, android_fullscreen_hook)
(android_iconify_frame, android_set_window_size_1)
(android_set_window_size, android_set_offset, android_set_alpha)
(android_new_font, android_bitmap_icon, android_free_pixmap_hook)
(android_free_frame_resources, android_delete_frame)
(android_delete_terminal, android_scroll_run)
(android_after_update_window_line, android_flip_and_flush)
(android_clear_rectangle, android_reset_clip_rectangles)
(android_clip_to_row, android_draw_fringe_bitmap)
(android_set_cursor_gc, android_set_mouse_face_gc)
(android_set_mode_line_face_gc, android_set_glyph_string_gc)
(android_set_glyph_string_clipping)
(android_set_glyph_string_clipping_exactly)
(android_compute_glyph_string_overhangs)
(android_clear_glyph_string_rect)
(android_draw_glyph_string_background, android_fill_triangle)
(android_make_point, android_inside_rect_p, android_clear_point)
(android_draw_relief_rect, android_draw_box_rect)
(HIGHLIGHT_COLOR_DARK_BOOST_LIMIT, android_setup_relief_color)
(android_setup_relief_colors, android_draw_glyph_string_box)
(android_draw_glyph_string_bg_rect, android_draw_image_relief)
(android_draw_image_foreground, android_draw_image_foreground_1)
(android_draw_image_glyph_string)
(android_draw_stretch_glyph_string, android_draw_underwave)
(android_draw_glyph_string_foreground)
(android_draw_composite_glyph_string_foreground)
(android_draw_glyphless_glyph_string_foreground)
(android_draw_glyph_string, android_define_frame_cursor)
(android_clear_frame_area, android_clear_under_internal_border)
(android_draw_hollow_cursor, android_draw_bar_cursor)
(android_draw_window_cursor, android_draw_vertical_window_border)
(android_draw_window_divider, android_redisplay_interface)
(frame_set_mouse_pixel_position, get_keysym_name)
(android_create_terminal, android_term_init, syms_of_androidterm)
(mark_androidterm):
* src/androidterm.h (_ANDROID_TERM_H_)
(struct android_display_info)
(struct android_output, FRAME_ANDROID_OUTPUT, XSCROLL_BAR): New
files.
* src/dired.c (file_attributes): Do not use openat on Android.
* src/dispextern.h (No_Cursor): Define appropriately on Android.
(struct glyph_string, struct face): Make gc field of type struct
android_gc on Android.
* src/dispnew.c (clear_current_matrices, clear_desired_matrices)
(adjust_frame_glyphs_for_window_redisplay, free_glyphs)
(update_frame, scrolling, char_ins_del_cost, update_frame_line)
(init_display_interactive): Disable text terminal support
completely on Android. Fix non-toolkit menus for non-X systems.
* src/editfns.c (Fuser_full_name): Call android_user_full_name.
* src/emacs.c (android_emacs_init): Make main this on Android.
Prohibit argv sorting from exceeding end of argv.
* src/epaths.in: Add path definitions for Android.
* src/fileio.c (file_access_p): Call android_file_access_p.
(file_name_directory): Avoid using openat on Android.
(Fcopy_file): Adjust to call sys_fstat instead.
(file_directory_p, Finsert_file_contents, write_region): Likewise.
* src/filelock.c:
* src/fns.c (Flocale_info): Pacify warning on Android.
* src/font.c (font_make_entity_android): New function.
* src/font.h:
* src/frame.c (Fframep, Fwindow_system): Handle new window system
`android'. Update doc strings.
(Fmake_terminal_frame): Disable on Android.
(gui_display_get_resource): Disable get_string_resource_hook on
Android.
(syms_of_frame): New defsym `android'.
* src/frame.h (GCALIGNED_STRUCT): Add new output data for Android.
(ENUM_BF): Expand enumerator size.
(FRAME_ANDROID_P, FRAME_WINDOW_P, MOUSE_HL_INFO): Add definitions
for Android.
* src/image.c (GET_PIXEL, image_create_bitmap_from_file)
(image_create_x_image_and_pixmap_1, image_get_x_image, slurp_file)
(lookup_rgb_color, image_to_emacs_colors, image_from_emacs_colors)
(image_pixmap_draw_cross, image_disable_image, MaskForeground)
(gif_load): Add stubs for Android.
* src/lisp.h:
* src/lread.c (safe_to_load_version, maybe_swap_for_eln1, openp):
* src/pdumper.c (pdumper_load): Call sys_fstat instead of fstat.
* src/process.c (wait_reading_process_output): Use android_select
instead of pselect.
* src/scroll.c: Disable on Android.
* src/sysdep.c (widen_foreground_group, reset_sys_modes)
(init_signals, emacs_fstatat, sys_fstat): New function.
(emacs_open, emacs_open_noquit, emacs_close): Implement
differently on Android.
(close_output_streams): Disable what is not required on Android.
* src/term.c (OUTPUT1_IF, encode_terminal_code, string_cost)
(string_cost_one_line, per_line_cost, calculate_costs)
(struct fkey_table, tty_append_glyph, produce_glyphs)
(tty_capable_p, Fsuspend_tty, Fresume_tty, device, init_tty)
(maybe_fatal, syms_of_term): Disable text terminal support on
Android.
* src/termhooks.h (enum output_method): Add android output method.
(GCALIGNED_STRUCT, TERMINAL_FONT_CACHE): Define for Android.
* src/terminal.c (Fterminal_live_p): Implement for Android.
* src/verbose.mk.in (AM_V_GLOBALS): Add JAVAC and DX.
* src/xdisp.c (redisplay_internal): Disable text terminals on
Android.
(display_menu_bar, display_tty_menu_item)
(draw_row_with_mouse_face, expose_frame): Make the non toolkit
menu bar work on Android.
* src/xfaces.c (GCGraphicsExposures, x_create_gc, x_free_gc)
(Fx_load_color_file): Define for Android.
* xcompile/Makefile.in:
* xcompile/README:
* xcompile/langinfo.h (nl_langinfo): New files.
2022-12-29 Po Lu <luangruo@yahoo.com>
Development of the Android port starts...
This ChangeLog only chronicles changes constituting the initial
development of the Android port. Refer to other ChangeLog files for a
narrative of unrelated modifications made to Emacs during that time,
and those made after the Android port was installed.
;; Local Variables:
;; coding: utf-8
;; End:
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/>.