diff options
| author | Po Lu | 2023-01-15 11:57:10 +0800 |
|---|---|---|
| committer | Po Lu | 2023-01-15 11:57:10 +0800 |
| commit | 6e2bc91d924fbeb0ad5728e0424eabc905c0d366 (patch) | |
| tree | f2835948a308d9d0898b9ef868893560048f6812 /src/androidgui.h | |
| parent | c02a7b2ff48746fab891db16f58ccdc11d161745 (diff) | |
| download | emacs-6e2bc91d924fbeb0ad5728e0424eabc905c0d366.tar.gz emacs-6e2bc91d924fbeb0ad5728e0424eabc905c0d366.zip | |
Implement toolkit menus on Android
* java/org/gnu/emacs/EmacsActivity.java (onContextMenuClosed):
New function.
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu):
New field `itemAlreadySelected'.
(onMenuItemClick): New function.
(inflateMenuItems): Attach onClickListener as appropriate.
(display1): Clear itemAlreadySelected.
(display): Fix runnable synchronization.
* java/org/gnu/emacs/EmacsNative.java (sendContextMenu): New
function.
* java/org/gnu/emacs/EmacsView.java (popupMenu):
(cancelPopupMenu): Set popupactive correctly.
* src/android.c (android_run_select_thread): Fix android_select
again.
(android_wait_event): New function.
* src/android.h: Update prototypes.
* src/androidgui.h (enum android_event_type): New
`ANDROID_CONTEXT_MENU' event.
(struct android_menu_event, union android_event): Add new event.
* src/androidmenu.c (struct android_emacs_context_menu): New
structure.
(android_init_emacs_context_menu): Add `dismiss' method.
(struct android_dismiss_menu_data): New structure.
(android_dismiss_menu, android_process_events_for_menu): New
functions.
(android_menu_show): Set an actual item ID.
(popup_activated): Define when stubify as well.
(Fmenu_or_popup_active_p): New function.
(syms_of_androidmenu): New function.
* src/androidterm.c (handle_one_android_event): Handle context
menu events.
* src/androidterm.h (struct android_display_info): New field for
menu item ID.
* src/emacs.c (android_emacs_init): Call syms_of_androidmenu.
* src/xdisp.c (note_mouse_highlight): Return if popup_activated
on Android as well.
Diffstat (limited to 'src/androidgui.h')
| -rw-r--r-- | src/androidgui.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/androidgui.h b/src/androidgui.h index 8450a1f637b..0e075fda95e 100644 --- a/src/androidgui.h +++ b/src/androidgui.h | |||
| @@ -233,6 +233,7 @@ enum android_event_type | |||
| 233 | ANDROID_WHEEL, | 233 | ANDROID_WHEEL, |
| 234 | ANDROID_ICONIFIED, | 234 | ANDROID_ICONIFIED, |
| 235 | ANDROID_DEICONIFIED, | 235 | ANDROID_DEICONIFIED, |
| 236 | ANDROID_CONTEXT_MENU, | ||
| 236 | }; | 237 | }; |
| 237 | 238 | ||
| 238 | struct android_any_event | 239 | struct android_any_event |
| @@ -371,6 +372,18 @@ struct android_iconify_event | |||
| 371 | android_window window; | 372 | android_window window; |
| 372 | }; | 373 | }; |
| 373 | 374 | ||
| 375 | struct android_menu_event | ||
| 376 | { | ||
| 377 | /* Type of the event. */ | ||
| 378 | enum android_event_type type; | ||
| 379 | |||
| 380 | /* Window associated with the event. Always None. */ | ||
| 381 | android_window window; | ||
| 382 | |||
| 383 | /* Menu event ID. */ | ||
| 384 | int menu_event_id; | ||
| 385 | }; | ||
| 386 | |||
| 374 | union android_event | 387 | union android_event |
| 375 | { | 388 | { |
| 376 | enum android_event_type type; | 389 | enum android_event_type type; |
| @@ -395,6 +408,9 @@ union android_event | |||
| 395 | /* This has no parallel in X because Android doesn't have window | 408 | /* This has no parallel in X because Android doesn't have window |
| 396 | properties. */ | 409 | properties. */ |
| 397 | struct android_iconify_event iconified; | 410 | struct android_iconify_event iconified; |
| 411 | |||
| 412 | /* This is only used to transmit selected menu items. */ | ||
| 413 | struct android_menu_event menu; | ||
| 398 | }; | 414 | }; |
| 399 | 415 | ||
| 400 | enum | 416 | enum |