1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-02 08:22:22 +00:00
Commit Graph

112 Commits

Author SHA1 Message Date
Po Lu
3b07a4b315 Implement `yank-media' on Android
* 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.
* 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-06 09:56:23 +08:00
Po Lu
b26b4c537b ; * java/INSTALL: Fix typo. 2023-03-20 15:37:11 +08:00
Po Lu
6bd1cfa24f Update Android port
* 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-20 14:47:39 +08:00
Po Lu
f3dd887d18 Update Android port
* java/org/gnu/emacs/EmacsView.java (onAttachedToWindow): Send
measured width and height in exposures again.
2023-03-18 20:05:38 +08:00
Po Lu
634e3fcc20 Update Android port
* java/org/gnu/emacs/EmacsView.java (EmacsView)
(prepareForLayout): New function.  Call this prior to mapping
the view.
(onGlobalLayout): New function.  Register as global layout
listener.
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow)
(notifyContentRectPosition): New function.  Use specified
xPosition and yPosition when reporting the offsets of children
of the root window.
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(registerWindow): Specify activity launch bounds if necessary.
* src/androidterm.c (handle_one_android_event): Send
MOVE_FRAME_EVENT where necessary.
2023-03-18 10:54:26 +08:00
Po Lu
45b5c9b8b7 Improve radio button appearance in Android menus
* 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.
2023-03-17 13:10:23 +08:00
Po Lu
da660a1ffa Update Android port
* java/org/gnu/emacs/EmacsView.java (cancelPopupMenu): Dismiss
context menu correctly.
(isOpaque): New function.
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java: Make
consumer list public.
2023-03-17 10:38:09 +08:00
Po Lu
ce66228ac5 Update Android port
* java/org/gnu/emacs/EmacsDocumentsProvider.java (queryRoots): Add
icon to document root.
2023-03-16 14:13:21 +08:00
Po Lu
c74bab6067 Update Android port
* 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.
2023-03-15 09:46:01 +08:00
Po Lu
d6bddca26c Update Android port
* 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.
2023-03-14 13:19:01 +08:00
Po Lu
5964051fce Update Android port
* 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-14 09:48:02 +08:00
Po Lu
b776feb7f2 Update Android port
* 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 (EmacsThread, run): Pass
any file to open to Emacs.
* lisp/term/android-win.el (handle-args-function): Implement.
2023-03-13 13:25:02 +08:00
Po Lu
a17380e80d Update Android port
* java/org/gnu/emacs/EmacsOpenActivity.java (EmacsOpenActivity)
(onCancel): New function.
(displayFailureDialog): Handle dialog cancellation.
* src/sfntfont.c (sfnt_parse_languages): Look for SLNG tag if
DLNG is not present.
2023-03-12 15:43:14 +08:00
Po Lu
b83324d1bd Update Android port
* 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-12 09:53:41 +08:00
Po Lu
c4b77b82de Update Android port
* configure.ac (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.
2023-03-11 17:42:24 +08:00
Po Lu
4a328b8578 Fix problems with the menu bar on large screen Android devices
* 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.
2023-03-11 11:35:59 +08:00
Po Lu
1eb546309b Update Android port
* doc/emacs/android.texi (Android Windowing): Document how to
pass multimedia keys to the system.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): 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.
2023-03-10 19:13:22 +08:00
Po Lu
98d43dbef5 * java/org/gnu/emacs/EmacsCursor.java: New file. 2023-03-10 15:16:13 +08:00
Po Lu
ae5513ede5 Implement mouse cursors on Android 7.0 and later
* java/org/gnu/emacs/EmacsWindow.java (defineCursor): New
function.
* src/android.c (struct android_emacs_cursor): New struct.
(android_init_emacs_cursor): New function.
(JNICALL): 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.
2023-03-10 15:16:05 +08:00
Po Lu
a7c8ae7d67 ; * java/org/gnu/emacs/EmacsNative.java: Add missing dependency. 2023-03-10 11:39:30 +08:00
Po Lu
488a75f2e2 Port Android battery status to Android 4.4 and earlier
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(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-10 09:40:41 +08:00
Po Lu
e859a14bee Fix menu and popup race conditions on Android
* java/org/gnu/emacs/EmacsActivity.java (onContextMenuClosed):
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu)
(onMenuItemClick, run):
* java/org/gnu/emacs/EmacsDialog.java (EmacsDialog, 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 (FIND_METHOD_STATIC)
(android_init_emacs_context_menu): 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.
2023-03-09 16:30:02 +08:00
Po Lu
682a6542cd Update Android port
* 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.
2023-03-09 14:50:32 +08:00
Po Lu
dcc3c63c6e Update Android port
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu)
(addItem): New argument `tooltip'.
2023-03-09 11:27:00 +08:00
Po Lu
bb55528c7b Update Android port
* 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.
2023-03-08 15:04:49 +08:00
Po Lu
84d27fe53b Save build timestamps in Android builds
* 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.
2023-03-07 20:18:02 +08:00
Po Lu
83c29bd40e Update Android port
* 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.
2023-03-07 16:49:45 +08:00
Po Lu
c0a6f14f4a Update Android port
* 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.
(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.
2023-03-06 15:30:29 +08:00
Po Lu
97ca0a8551 Update Android port
* 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-06 11:25:51 +08:00
Po Lu
1cae464859 Update Android port
* 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
(EmacsMultitaskActivity):
* java/org/gnu/emacs/EmacsNative.java:
* java/org/gnu/emacs/EmacsNoninteractive.java
(EmacsNoninteractive, main):
* java/org/gnu/emacs/EmacsOpenActivity.java (EmacsOpenActivity)
(startEmacsClient):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java:
* java/org/gnu/emacs/EmacsSdk8Clipboard.java:
* java/org/gnu/emacs/EmacsService.java (EmacsService, onCreate):
* java/org/gnu/emacs/EmacsView.java (EmacsView, onLayout):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow):
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(EmacsWindowAttachmentManager): Remove redundant includes.
Reorganize some functions around, remove duplicate `getLibDir'
functions, and remove unused local variables.
2023-03-05 19:58:28 +08:00
Po Lu
26b3b8433d Update Android port
* 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.
2023-03-05 15:55:24 +08:00
Po Lu
2634765bc3 Improve context menus on old versions of Android
* 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.
2023-03-04 15:55:09 +08:00
Po Lu
39a7e6b79f Port to broken Android NDK version
* 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.
2023-03-04 13:38:00 +08:00
Po Lu
0e995d06a8 Improve support for building Android C++ dependencies
* 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.
2023-03-04 11:19:25 +08:00
Po Lu
48b5a770f2 Fix visiting and saving writable content provider files
* 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.
2023-03-03 16:00:27 +08:00
Po Lu
bc9239eb51 Update Android port
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity)
(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-03 15:23:21 +08:00
Po Lu
960230d88d Summary: Update Android port
* 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.
2023-03-02 18:31:35 +08:00
Po Lu
09aa948ab4 Improve criteria for restoring fullscreen state on Android
* java/Makefile.in ($(CLASS_FILES) &): Touch all class files,
even those javac chose not to rebuild.

* java/org/gnu/emacs/EmacsActivity.java (onWindowFocusChanged):
Restore fullscreen state here.
(onResume): And not here.
2023-03-02 12:30:36 +08:00
Po Lu
7fb3c0d039 Update Android port
* 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 necessary.
* 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: Export.
* 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.
* src/androidterm.c (handle_one_android_event): Fix out of date
commentary.
2023-03-02 09:27:37 +08:00
Po Lu
daf9c62871 Fix out-of-tree Android builds
* 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 19:35:19 +08:00
Po Lu
ad8e12b9f9 Update Android port
* 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.
2023-03-01 15:49:02 +08:00
Po Lu
194b3f948c Update Android port
* 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.
2023-03-01 14:31:57 +08:00
Po Lu
15bcb446be Update Android port
* 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)::(dialog.
Then):
* 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)
(buffers):
* java/org/gnu/emacs/EmacsView.java (EmacsView, ViewGroup):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, drawables):
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(EmacsWindowAttachmentManager): Make classes final where
appropriate.
2023-03-01 12:00:46 +08:00
Po Lu
39ddf1855b Update Android port
* doc/lispref/commands.texi (Misc Events): Update documentation.
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(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-26 10:33:41 +08:00
Po Lu
8fa86cc7cd Update Android port
* 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, NATIVE_NAME,
JNICALL):
* src/android.h (NATIVE_NAME):
* src/androidterm.c (JNICALL, NATIVE_NAME): Apply stack
alignment to all JNICALL functions.
2023-02-25 21:52:11 +08:00
Po Lu
df29bb71fc Update Android port
* 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.
2023-02-25 20:11:48 +08:00
Po Lu
8e4c5db193 Update Android port
* 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 function.
* 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 font close
functions to be called twice.
2023-02-25 19:11:07 +08:00
Po Lu
ea74f3c067 Improve Android configury
* 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.
2023-02-24 22:25:48 +08:00
Po Lu
1e6f957c0d Update Android port
* doc/emacs/input.texi (On-Screen Keyboards): Document changes
to text conversion.
* java/org/gnu/emacs/EmacsInputConnection.java (getExtractedText)
(EmacsInputConnection):
* 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.
2023-02-22 14:59:27 +08:00
Po Lu
77feba7456 Update Android port
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu)
(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.
2023-02-21 21:07:57 +08:00