mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-24 14:30:43 -08:00
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): <attachmentToken, preserve, previouslyAttached>: 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.
This commit is contained in:
parent
fa9791fe6a
commit
7df66b4762
7 changed files with 457 additions and 254 deletions
|
|
@ -112,7 +112,7 @@ public final class EmacsWindow extends EmacsHandleObject
|
|||
private SparseArray<Coordinate> pointerMap;
|
||||
|
||||
/* The window consumer currently attached, if it exists. */
|
||||
private EmacsWindowAttachmentManager.WindowConsumer attached;
|
||||
private EmacsWindowManager.WindowConsumer attached;
|
||||
|
||||
/* The window background scratch GC. foreground is always the
|
||||
window background. */
|
||||
|
|
@ -159,6 +159,16 @@ public final class EmacsWindow extends EmacsHandleObject
|
|||
values are -1 if no drag and drop operation is under way. */
|
||||
private int dndXPosition, dndYPosition;
|
||||
|
||||
/* Identifier binding this window to the activity created for it, or
|
||||
-1 if the window should be attached to system-created activities
|
||||
(i.e. the activity launched by the system at startup). Value is
|
||||
meaningless under API level 29 and earlier. */
|
||||
public long attachmentToken;
|
||||
|
||||
/* Whether this window should be preserved during window pruning,
|
||||
and whether this window has previously been attached to a task. */
|
||||
public boolean preserve, previouslyAttached;
|
||||
|
||||
public
|
||||
EmacsWindow (short handle, final EmacsWindow parent, int x, int y,
|
||||
int width, int height, boolean overrideRedirect)
|
||||
|
|
@ -255,12 +265,12 @@ public final class EmacsWindow extends EmacsHandleObject
|
|||
run ()
|
||||
{
|
||||
ViewManager parent;
|
||||
EmacsWindowAttachmentManager manager;
|
||||
EmacsWindowManager manager;
|
||||
|
||||
if (EmacsActivity.focusedWindow == EmacsWindow.this)
|
||||
EmacsActivity.focusedWindow = null;
|
||||
|
||||
manager = EmacsWindowAttachmentManager.MANAGER;
|
||||
manager = EmacsWindowManager.MANAGER;
|
||||
view.setVisibility (View.GONE);
|
||||
|
||||
/* If the window manager is set, use that instead. */
|
||||
|
|
@ -281,12 +291,12 @@ public final class EmacsWindow extends EmacsHandleObject
|
|||
}
|
||||
|
||||
public void
|
||||
setConsumer (EmacsWindowAttachmentManager.WindowConsumer consumer)
|
||||
setConsumer (EmacsWindowManager.WindowConsumer consumer)
|
||||
{
|
||||
attached = consumer;
|
||||
}
|
||||
|
||||
public EmacsWindowAttachmentManager.WindowConsumer
|
||||
public EmacsWindowManager.WindowConsumer
|
||||
getAttachedConsumer ()
|
||||
{
|
||||
return attached;
|
||||
|
|
@ -420,7 +430,7 @@ public final class EmacsWindow extends EmacsHandleObject
|
|||
public void
|
||||
run ()
|
||||
{
|
||||
EmacsWindowAttachmentManager manager;
|
||||
EmacsWindowManager manager;
|
||||
WindowManager windowManager;
|
||||
Activity ctx;
|
||||
Object tem;
|
||||
|
|
@ -431,7 +441,7 @@ public final class EmacsWindow extends EmacsHandleObject
|
|||
|
||||
if (!overrideRedirect)
|
||||
{
|
||||
manager = EmacsWindowAttachmentManager.MANAGER;
|
||||
manager = EmacsWindowManager.MANAGER;
|
||||
|
||||
/* If parent is the root window, notice that there are new
|
||||
children available for interested activities to pick
|
||||
|
|
@ -527,9 +537,9 @@ public final class EmacsWindow extends EmacsHandleObject
|
|||
public void
|
||||
run ()
|
||||
{
|
||||
EmacsWindowAttachmentManager manager;
|
||||
EmacsWindowManager manager;
|
||||
|
||||
manager = EmacsWindowAttachmentManager.MANAGER;
|
||||
manager = EmacsWindowManager.MANAGER;
|
||||
|
||||
view.setVisibility (View.GONE);
|
||||
|
||||
|
|
@ -809,20 +819,13 @@ public final class EmacsWindow extends EmacsHandleObject
|
|||
EmacsActivity.invalidateFocus (gainFocus ? 6 : 5);
|
||||
}
|
||||
|
||||
/* Notice that the activity has been detached or destroyed.
|
||||
|
||||
ISFINISHING is set if the activity is not the main activity, or
|
||||
if the activity was not destroyed in response to explicit user
|
||||
action. */
|
||||
/* Notice that the activity (or its task) has been detached or
|
||||
destroyed by explicit user action. */
|
||||
|
||||
public void
|
||||
onActivityDetached (boolean isFinishing)
|
||||
onActivityDetached ()
|
||||
{
|
||||
/* Destroy the associated frame when the activity is detached in
|
||||
response to explicit user action. */
|
||||
|
||||
if (isFinishing)
|
||||
EmacsNative.sendWindowAction (this.handle, 0);
|
||||
EmacsNative.sendWindowAction (this.handle, 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1312,13 +1315,17 @@ public final class EmacsWindow extends EmacsHandleObject
|
|||
public void
|
||||
run ()
|
||||
{
|
||||
EmacsWindowAttachmentManager manager;
|
||||
EmacsWindowManager manager;
|
||||
ViewManager parent;
|
||||
|
||||
/* First, detach this window if necessary. */
|
||||
manager = EmacsWindowAttachmentManager.MANAGER;
|
||||
manager = EmacsWindowManager.MANAGER;
|
||||
manager.detachWindow (EmacsWindow.this);
|
||||
|
||||
/* Reset window management state. */
|
||||
previouslyAttached = false;
|
||||
attachmentToken = false;
|
||||
|
||||
/* Also unparent this view. */
|
||||
|
||||
/* If the window manager is set, use that instead. */
|
||||
|
|
@ -1858,7 +1865,7 @@ public final class EmacsWindow extends EmacsHandleObject
|
|||
public void
|
||||
recreateActivity ()
|
||||
{
|
||||
final EmacsWindowAttachmentManager.WindowConsumer attached;
|
||||
final EmacsWindowManager.WindowConsumer attached;
|
||||
|
||||
attached = this.attached;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue