From 7df66b4762ff51e394b8db03dfffe888bdba0a67 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 3 Apr 2024 20:29:10 +0800 Subject: Better align Emacs window management with Android task lifecycles * java/org/gnu/emacs/EmacsActivity.java (onCreate): Permit overriding by child classes. (onDestroy): Minor stylistic adjustments. (getAttachmentToken): New function. * java/org/gnu/emacs/EmacsMultitaskActivity.java (onCreate) (getAttachmentToken): New functions. * java/org/gnu/emacs/EmacsWindow.java (EmacsWindow): : New variables. (onActivityDetached): Remove redundant isFinishing argument. (reparentTo): Reset the foregoing fields before registering with the window manager. * java/org/gnu/emacs/EmacsWindowManager.java (EmacsWindowManager): Rename from EmacsWindowAttachmentManager. (WindowConsumer): New function getAttachmentToken. (isWindowEligible): New function. (registerWindowConsumer, registerWindow, removeWindowConsumer) (detachWindow): Implement a new window management strategy on API 29 and subsequent releases where both varieties of toplevel window are permanently, except when reparented, bound to the activities to which they attach, and Emacs establishes at strategic junctures whether those activities remain present. (getTaskToken, pruneWindows): New functions. --- java/org/gnu/emacs/EmacsView.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'java/org/gnu/emacs/EmacsView.java') diff --git a/java/org/gnu/emacs/EmacsView.java b/java/org/gnu/emacs/EmacsView.java index 109208b2518..37aeded9938 100644 --- a/java/org/gnu/emacs/EmacsView.java +++ b/java/org/gnu/emacs/EmacsView.java @@ -511,6 +511,8 @@ public final class EmacsView extends ViewGroup && !EmacsNative.shouldForwardMultimediaButtons ()) return false; + Log.d (TAG, "onKeyDown: " + event.toString ()); + window.onKeyDown (keyCode, event); return true; } @@ -708,12 +710,12 @@ public final class EmacsView extends ViewGroup contextMenu = null; popupActive = false; - /* It is not possible to know with 100% certainty which activity - is currently displaying the context menu. Loop through each - activity and call `closeContextMenu' instead. */ + /* It is not possible to know with 100% certainty which activity is + currently displaying the context menu. Loop over each activity + and call `closeContextMenu' instead. */ - for (EmacsWindowAttachmentManager.WindowConsumer consumer - : EmacsWindowAttachmentManager.MANAGER.consumers) + for (EmacsWindowManager.WindowConsumer consumer + : EmacsWindowManager.MANAGER.consumers) { if (consumer instanceof EmacsActivity) ((EmacsActivity) consumer).closeContextMenu (); -- cgit v1.3