diff options
| author | Po Lu | 2024-03-11 21:40:47 +0800 |
|---|---|---|
| committer | Po Lu | 2024-03-11 21:41:14 +0800 |
| commit | a7a37341cad230448e487d0ffa343eeeb8a66a65 (patch) | |
| tree | ab06b5826c5ae7bdd5b3dcc85b3ecba8dbee8c84 /src/androidgui.h | |
| parent | 75cfc6c73faa1561018b1212156964a7919c69fe (diff) | |
| download | emacs-a7a37341cad230448e487d0ffa343eeeb8a66a65.tar.gz emacs-a7a37341cad230448e487d0ffa343eeeb8a66a65.zip | |
Implement notification callbacks on Android
* doc/lispref/os.texi (Desktop Notifications): Document that
:on-cancel, :on-action and :actions are now supported on
Android.
* java/org/gnu/emacs/EmacsActivity.java (onNewIntent): New
function.
* java/org/gnu/emacs/EmacsDesktopNotification.java
(NOTIFICATION_ACTION, NOTIFICATION_TAG, NOTIFICATION_DISMISSED):
New constants. <actions, titles>: New fields.
(insertActions): New function.
(display1, display): Insert actions on Jelly Bean and up, and
arrange to be notified when the notification is dismissed.
(CancellationReceiver): New class.
* java/org/gnu/emacs/EmacsNative.java (sendNotificationDeleted)
(sendNotificationAction): New functions.
* src/android.c (sendDndDrag, sendDndUri, sendDndText): Correct
return types.
(sendNotificationDeleted, sendNotificationAction)
(android_exception_check_5, android_exception_check_6): New
functions.
* src/android.h:
* src/androidgui.h (struct android_notification_event): New
structure.
(union android_event): New member for notification events.
* src/androidselect.c (android_init_emacs_desktop_notification):
Update JNI signatures.
(android_notifications_notify_1, Fandroid_notifications_notify):
New arguments ACTIONS, ACTION_CB and CANCEL_CB. Convert and
record them as appropriate.
(android_notification_deleted, android_notification_action): New
functions.
(syms_of_androidselect): Prepare a hash table of outstanding
notifications.
<QCactions, QCon_action, QCon_cancel> New defsyms.
* src/androidterm.c (handle_one_android_event)
<ANDROID_NOTIFICATION_DELETED>
<ANDROID_NOTIFICATION_ACTION>: Dispatch event contents to
androidselect.c for processing.
* src/androidterm.h:
* src/androidvfs.c (java_string_class): Export.
* src/keyboard.c (kbd_buffer_get_event) <NOTIFICATION_EVENT>:
Call callback specified by the event.
* src/termhooks.h (enum event_kind) [HAVE_ANDROID]: New
enum NOTIFICATION_EVENT.
Diffstat (limited to 'src/androidgui.h')
| -rw-r--r-- | src/androidgui.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/androidgui.h b/src/androidgui.h index 73b60c483d3..d89aee51055 100644 --- a/src/androidgui.h +++ b/src/androidgui.h | |||
| @@ -251,6 +251,8 @@ enum android_event_type | |||
| 251 | ANDROID_DND_DRAG_EVENT, | 251 | ANDROID_DND_DRAG_EVENT, |
| 252 | ANDROID_DND_URI_EVENT, | 252 | ANDROID_DND_URI_EVENT, |
| 253 | ANDROID_DND_TEXT_EVENT, | 253 | ANDROID_DND_TEXT_EVENT, |
| 254 | ANDROID_NOTIFICATION_DELETED, | ||
| 255 | ANDROID_NOTIFICATION_ACTION, | ||
| 254 | }; | 256 | }; |
| 255 | 257 | ||
| 256 | struct android_any_event | 258 | struct android_any_event |
| @@ -535,6 +537,29 @@ struct android_dnd_event | |||
| 535 | size_t length; | 537 | size_t length; |
| 536 | }; | 538 | }; |
| 537 | 539 | ||
| 540 | struct android_notification_event | ||
| 541 | { | ||
| 542 | /* Type of the event. */ | ||
| 543 | enum android_event_type type; | ||
| 544 | |||
| 545 | /* The event serial. */ | ||
| 546 | unsigned long serial; | ||
| 547 | |||
| 548 | /* The window that gave rise to the event (None). */ | ||
| 549 | android_window window; | ||
| 550 | |||
| 551 | /* The identifier of the notification whose status changed. | ||
| 552 | Must be deallocated with `free'. */ | ||
| 553 | char *tag; | ||
| 554 | |||
| 555 | /* The action that was activated, if any. Must be deallocated with | ||
| 556 | `free'. */ | ||
| 557 | unsigned short *action; | ||
| 558 | |||
| 559 | /* Length of that data. */ | ||
| 560 | size_t length; | ||
| 561 | }; | ||
| 562 | |||
| 538 | union android_event | 563 | union android_event |
| 539 | { | 564 | { |
| 540 | enum android_event_type type; | 565 | enum android_event_type type; |
| @@ -571,6 +596,10 @@ union android_event | |||
| 571 | protocol, whereas there exist several competing X protocols | 596 | protocol, whereas there exist several competing X protocols |
| 572 | implemented in terms of X client messages. */ | 597 | implemented in terms of X client messages. */ |
| 573 | struct android_dnd_event dnd; | 598 | struct android_dnd_event dnd; |
| 599 | |||
| 600 | /* X provides no equivalent interface for displaying | ||
| 601 | notifications. */ | ||
| 602 | struct android_notification_event notification; | ||
| 574 | }; | 603 | }; |
| 575 | 604 | ||
| 576 | enum | 605 | enum |