mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-12 22:40:46 -08:00
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.
This commit is contained in:
parent
b1bd40dce1
commit
1661762784
5 changed files with 85 additions and 8 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue