diff options
| author | Po Lu | 2023-03-09 16:30:02 +0800 |
|---|---|---|
| committer | Po Lu | 2023-03-09 16:30:02 +0800 |
| commit | e859a14bee7a84a3aaed45770c89ef60c68b3e08 (patch) | |
| tree | 5f875640bc70b3726ad1a3d2f41732ecc54fbcdf /src/androidterm.c | |
| parent | 745890de5204850bb4173c19ceb79c698acb7a20 (diff) | |
| download | emacs-e859a14bee7a84a3aaed45770c89ef60c68b3e08.tar.gz emacs-e859a14bee7a84a3aaed45770c89ef60c68b3e08.zip | |
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.
Diffstat (limited to 'src/androidterm.c')
| -rw-r--r-- | src/androidterm.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/androidterm.c b/src/androidterm.c index b502b1c6de5..2e2bf86706c 100644 --- a/src/androidterm.c +++ b/src/androidterm.c | |||
| @@ -1457,7 +1457,12 @@ handle_one_android_event (struct android_display_info *dpyinfo, | |||
| 1457 | /* Context menu handling. */ | 1457 | /* Context menu handling. */ |
| 1458 | case ANDROID_CONTEXT_MENU: | 1458 | case ANDROID_CONTEXT_MENU: |
| 1459 | 1459 | ||
| 1460 | if (dpyinfo->menu_event_id == -1) | 1460 | if (dpyinfo->menu_event_id == -1 |
| 1461 | /* Previously displayed popup menus might generate events | ||
| 1462 | after dismissal, which might interfere. | ||
| 1463 | `current_menu_serial' is always set to an identifier | ||
| 1464 | identifying the last context menu to be displayed. */ | ||
| 1465 | && event->menu.menu_event_serial == current_menu_serial) | ||
| 1461 | dpyinfo->menu_event_id = event->menu.menu_event_id; | 1466 | dpyinfo->menu_event_id = event->menu.menu_event_id; |
| 1462 | 1467 | ||
| 1463 | goto OTHER; | 1468 | goto OTHER; |