diff options
| author | Po Lu <luangruo@yahoo.com> | 2023-06-08 20:50:02 +0800 |
|---|---|---|
| committer | Po Lu <luangruo@yahoo.com> | 2023-06-08 20:50:02 +0800 |
| commit | 1661762784520eb6834aa9831dcb646396efde73 (patch) | |
| tree | 3ae23231862b09b568956948595d7b902e770da8 /java/org/gnu/emacs/EmacsDialog.java | |
| parent | b1bd40dce197d2938426d1ec33cebd3d51ccc8cf (diff) | |
Correctly display popup dialogs from Emacsclient
* 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.
Diffstat (limited to 'java/org/gnu/emacs/EmacsDialog.java')
| -rw-r--r-- | java/org/gnu/emacs/EmacsDialog.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/java/org/gnu/emacs/EmacsDialog.java b/java/org/gnu/emacs/EmacsDialog.java index afdce3c50ec..3f8fe0109c0 100644 --- a/java/org/gnu/emacs/EmacsDialog.java +++ b/java/org/gnu/emacs/EmacsDialog.java @@ -68,8 +68,8 @@ public final class EmacsDialog implements DialogInterface.OnDismissListener /* The menu serial associated with this dialog box. */ private int menuEventSerial; - private class EmacsButton implements View.OnClickListener, - DialogInterface.OnClickListener + private final class EmacsButton implements View.OnClickListener, + DialogInterface.OnClickListener { /* Name of this button. */ public String name; @@ -244,13 +244,22 @@ public final class EmacsDialog implements DialogInterface.OnDismissListener if (EmacsActivity.focusedActivities.isEmpty ()) { /* If focusedActivities is empty then this dialog may have - been displayed immediately after a popup dialog is + been displayed immediately after another popup dialog was dismissed. Or Emacs might legitimately be in the - background. Try the service context first if possible. */ + background, possibly displaying this popup in response to + an Emacsclient request. Try the service context if it will + work, then any focused EmacsOpenActivity, and finally the + last EmacsActivity to be focused. */ + + Log.d (TAG, "display1: no focused activities..."); + Log.d (TAG, ("display1: EmacsOpenActivity.currentActivity: " + + EmacsOpenActivity.currentActivity)); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M || Settings.canDrawOverlays (EmacsService.SERVICE)) context = EmacsService.SERVICE; + else if (EmacsOpenActivity.currentActivity != null) + context = EmacsOpenActivity.currentActivity; else context = EmacsActivity.lastFocusedActivity; |
