1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-12 06:21:02 -08:00

Fix displaying popup menus from a menu entry on Android

* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity, onDestroy)
(onWindowFocusChanged): Keep track of the last focused activity.
* java/org/gnu/emacs/EmacsDialog.java (display1): Use it if
there is no current focus.
This commit is contained in:
Po Lu 2023-02-11 10:26:34 +08:00
parent c4c34f72a1
commit ab48881a2f
2 changed files with 35 additions and 4 deletions

View file

@ -230,11 +230,31 @@ public class EmacsDialog implements DialogInterface.OnDismissListener
AlertDialog dialog;
if (EmacsActivity.focusedActivities.isEmpty ())
return false;
{
/* If focusedActivities is empty then this dialog may have
been displayed immediately after a popup dialog is
dismissed. */
activity = EmacsActivity.lastFocusedActivity;
if (activity == null)
return false;
}
else
activity = EmacsActivity.focusedActivities.get (0);
activity = EmacsActivity.focusedActivities.get (0);
dialog = dismissDialog = toAlertDialog (activity);
dismissDialog.show ();
try
{
dismissDialog.show ();
}
catch (Exception exception)
{
/* This can happen when the system decides Emacs is not in the
foreground any longer. */
return false;
}
/* If there are less than four buttons, then they must be
individually enabled or disabled after the dialog is