Respond to display configuration updates on Android

* java/org/gnu/emacs/EmacsNative.java
(sendConfigurationChanged): Declare function.

* java/org/gnu/emacs/EmacsSdk7FontDriver.java (Sdk7FontEntity)
(Sdk7FontObject): Do not access `metrics' field deleted from
`EmacsService'.

* java/org/gnu/emacs/EmacsService.java (EmacsService)
<metrics, resources>: Delete fields.
<dpiX, dpiY, dpiScaled>: New fields.
(onCreate): Adjust accordingly.  Record current display metrics
for subsequent comparison.
(onConfigurationChanged): New function.

* lisp/dynamic-setting.el (font-setting-change-default-font):
Enable on systems where font-get-system-font is not defined if
invoked with SET-FONT nil.

* src/android.c (sendConfigurationChanged): New function.

* src/androidgui.h (ANDROID_CONFIGURATION_CHANGED): New enumerator.
(struct android_configuration_changed): New structure.
(union android_event): Add `config' member.

* src/androidterm.c (handle_one_android_event): Handle
ANDROID_CONFIGURATION_CHANGED events.
(syms_of_androidterm): Define Qfont_render, and
Qdynamic_setting.  Provide the latter.
This commit is contained in:
Po Lu
2025-04-10 15:21:15 +08:00
parent cb339ad8f4
commit 884ede7c95
7 changed files with 132 additions and 17 deletions

View File

@@ -196,6 +196,10 @@ public final class EmacsNative
/* Send an ANDROID_NOTIFICATION_ACTION event. */
public static native void sendNotificationAction (String tag, String action);
/* Send an ANDROID_CONFIGURATION_CHANGED event. */
public static native void sendConfigurationChanged (float dpiX, float dpiY,
float dpiScaled);
/* Return the file name associated with the specified file
descriptor, or NULL if there is none. */
public static native byte[] getProcName (int fd);