summaryrefslogtreecommitdiff
path: root/src/androidgui.h
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2023-10-14 10:15:20 +0800
committerPo Lu <luangruo@yahoo.com>2023-10-14 10:15:42 +0800
commit03f5a06a052ee0b4b8b77b4460ead717b87c4798 (patch)
treec047e2c53e56e6c6e20b5475a6e33fd1b25ece96 /src/androidgui.h
parent0dd7e6e3aeac1ab0a03f2ed2ad108deecde82447 (diff)
downloademacs-03f5a06a052ee0b4b8b77b4460ead717b87c4798.tar.gz
Implement multi-window drag-and-drop under Android
* java/org/gnu/emacs/EmacsNative.java (sendDndDrag, sendDndUri) (sendDndText): Declare new event-sending functions. * java/org/gnu/emacs/EmacsView.java (onDragEvent): New function. * java/org/gnu/emacs/EmacsWindow.java (onDragEvent): New function; respond to each drag and drop event, request permissions if necessary and transfer dropped data to Lisp. * lisp/dnd.el (dnd-unescape-file-uris): New variable. (dnd-get-local-file-name): If that variable is nil, refrain from unescaping URLs provided. * lisp/term/android-win.el (android-handle-dnd-event): New function. (special-event-map): Bind drag-n-drop-event. * src/android.c (sendDndDrag, sendDndUri, sendDndText): New functions. * src/androidgui.h (enum android_event_type): New event types ANDROID_DND_DRAG_EVENT, ANDROID_DND_URI_EVENT, ANDROID_DND_TEXT_EVENT. (struct android_dnd_event): New structure. (union android_event) <dnd>: New field. * src/androidterm.c (handle_one_android_event) <ANDROID_DND_..._EVENT>: Generate drag-n-drop events for each of these types. (syms_of_androidterm) <Quri, Qtext>: New defsyms.
Diffstat (limited to 'src/androidgui.h')
-rw-r--r--src/androidgui.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/androidgui.h b/src/androidgui.h
index b58c39a5276..5fab5023ba4 100644
--- a/src/androidgui.h
+++ b/src/androidgui.h
@@ -248,6 +248,9 @@ enum android_event_type
ANDROID_CONTEXT_MENU,
ANDROID_EXPOSE,
ANDROID_INPUT_METHOD,
+ ANDROID_DND_DRAG_EVENT,
+ ANDROID_DND_URI_EVENT,
+ ANDROID_DND_TEXT_EVENT,
};
struct android_any_event
@@ -510,6 +513,28 @@ struct android_ime_event
unsigned long counter;
};
+struct android_dnd_event
+{
+ /* Type of the event. */
+ enum android_event_type type;
+
+ /* The event serial. */
+ unsigned long serial;
+
+ /* The window that gave rise to the event. */
+ android_window window;
+
+ /* X and Y coordinates of the event. */
+ int x, y;
+
+ /* Data tied to this event, such as a URI or clipboard string.
+ Must be deallocated with `free'. */
+ unsigned short *uri_or_string;
+
+ /* Length of that data. */
+ size_t length;
+};
+
union android_event
{
enum android_event_type type;
@@ -541,6 +566,11 @@ union android_event
/* This is used to dispatch input method editing requests. */
struct android_ime_event ime;
+
+ /* There is no analog under X because Android defines a strict DND
+ protocol, whereas there exist several competing X protocols
+ implemented in terms of X client messages. */
+ struct android_dnd_event dnd;
};
enum