mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-17 08:31:09 -08:00
Fix menu and popup race conditions on Android
* java/org/gnu/emacs/EmacsActivity.java (onContextMenuClosed): * java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu) (onMenuItemClick, run): * java/org/gnu/emacs/EmacsDialog.java (EmacsDialog, onClick) (createDialog, onDismiss): Take menu event serial, and pass it along in context menu events. * java/org/gnu/emacs/EmacsNative.java (sendContextMenu): New argument. * src/android.c (sendContextMenu): Pass serial number in event. * src/androidgui.h (struct android_menu_event): New field `menu_event_serial'. * src/androidmenu.c (FIND_METHOD_STATIC) (android_init_emacs_context_menu): Adjust method declarations. (android_menu_show, android_dialog_show): * src/androidterm.c (handle_one_android_event): Expect serial in context menu events. * src/androidterm.h: Update prototypes.
This commit is contained in:
parent
745890de52
commit
e859a14bee
9 changed files with 66 additions and 18 deletions
|
|
@ -57,6 +57,9 @@ public final class EmacsDialog implements DialogInterface.OnDismissListener
|
|||
/* Dialog to dismiss after click. */
|
||||
private AlertDialog dismissDialog;
|
||||
|
||||
/* The menu serial associated with this dialog box. */
|
||||
private int menuEventSerial;
|
||||
|
||||
private class EmacsButton implements View.OnClickListener,
|
||||
DialogInterface.OnClickListener
|
||||
{
|
||||
|
|
@ -76,7 +79,7 @@ public final class EmacsDialog implements DialogInterface.OnDismissListener
|
|||
Log.d (TAG, "onClicked " + this);
|
||||
|
||||
wasButtonClicked = true;
|
||||
EmacsNative.sendContextMenu ((short) 0, id);
|
||||
EmacsNative.sendContextMenu ((short) 0, id, menuEventSerial);
|
||||
dismissDialog.dismiss ();
|
||||
}
|
||||
|
||||
|
|
@ -87,15 +90,16 @@ public final class EmacsDialog implements DialogInterface.OnDismissListener
|
|||
Log.d (TAG, "onClicked " + this);
|
||||
|
||||
wasButtonClicked = true;
|
||||
EmacsNative.sendContextMenu ((short) 0, id);
|
||||
EmacsNative.sendContextMenu ((short) 0, id, menuEventSerial);
|
||||
}
|
||||
};
|
||||
|
||||
/* Create a popup dialog with the title TITLE and the text TEXT.
|
||||
TITLE may be NULL. */
|
||||
TITLE may be NULL. MENUEVENTSERIAL is a number which will
|
||||
identify this popup dialog inside events it sends. */
|
||||
|
||||
public static EmacsDialog
|
||||
createDialog (String title, String text)
|
||||
createDialog (String title, String text, int menuEventSerial)
|
||||
{
|
||||
EmacsDialog dialog;
|
||||
|
||||
|
|
@ -103,6 +107,7 @@ public final class EmacsDialog implements DialogInterface.OnDismissListener
|
|||
dialog.buttons = new ArrayList<EmacsButton> ();
|
||||
dialog.title = title;
|
||||
dialog.text = text;
|
||||
dialog.menuEventSerial = menuEventSerial;
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
|
@ -330,6 +335,6 @@ public final class EmacsDialog implements DialogInterface.OnDismissListener
|
|||
if (wasButtonClicked)
|
||||
return;
|
||||
|
||||
EmacsNative.sendContextMenu ((short) 0, 0);
|
||||
EmacsNative.sendContextMenu ((short) 0, 0, menuEventSerial);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue