diff options
author | Po Lu <luangruo@yahoo.com> | 2022-06-14 09:41:59 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-06-14 09:41:59 +0800 |
commit | 907f3a4f8d83c228a3be3772a3cb7d5079261752 (patch) | |
tree | 34117fb2bd59e1cdf3b4d55023491b22b88e79d9 /src/xselect.c | |
parent | 915b34d2800fe0014b12eda0bbf5def976c14c32 (diff) | |
download | emacs-907f3a4f8d83c228a3be3772a3cb7d5079261752.tar.gz |
Use coordinates provided by DND messages if available
This avoids an extra sync, which matters when dropping onto
Emacs running over a slow connection.
* src/xselect.c (x_handle_dnd_message): New args
`root_window_coords', `root_x' and `root_y'.
* src/xterm.c (x_coords_from_dnd_message): New function.
(handle_one_xevent): Pass root window coordinates to
x_handle_dnd_message.
* src/xterm.h: Update prototypes.
Diffstat (limited to 'src/xselect.c')
-rw-r--r-- | src/xselect.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/xselect.c b/src/xselect.c index 490a008dfcb..96c1e9830fb 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -2522,7 +2522,8 @@ FRAME is on. If FRAME is nil, the selected frame is used. */) bool x_handle_dnd_message (struct frame *f, const XClientMessageEvent *event, - struct x_display_info *dpyinfo, struct input_event *bufp) + struct x_display_info *dpyinfo, struct input_event *bufp, + bool root_window_coords, int root_x, int root_y) { Lisp_Object vec; Lisp_Object frame; @@ -2532,6 +2533,7 @@ x_handle_dnd_message (struct frame *f, const XClientMessageEvent *event, unsigned char *data = (unsigned char *) event->data.b; int idata[5]; ptrdiff_t i; + Window child_return; for (i = 0; i < dpyinfo->x_dnd_atoms_length; ++i) if (dpyinfo->x_dnd_atoms[i] == event->message_type) break; @@ -2563,7 +2565,15 @@ x_handle_dnd_message (struct frame *f, const XClientMessageEvent *event, event->format, size)); - x_relative_mouse_position (f, &x, &y); + if (!root_window_coords) + x_relative_mouse_position (f, &x, &y); + else + XTranslateCoordinates (dpyinfo->display, + dpyinfo->root_window, + FRAME_X_WINDOW (f), + root_x, root_y, + &x, &y, &child_return); + bufp->kind = DRAG_N_DROP_EVENT; bufp->frame_or_window = frame; bufp->timestamp = CurrentTime; |