aboutsummaryrefslogtreecommitdiffstats
path: root/src/xselect.c
diff options
context:
space:
mode:
authorPo Lu2022-07-09 16:18:35 +0800
committerPo Lu2022-07-09 16:18:35 +0800
commitbab449f034f44657ff3ed1bf533be6a27f4dafd6 (patch)
tree107dfc478b04d3ba772f8ef36a4670846b2bebd9 /src/xselect.c
parentedabfe4ff66090b3b2c433962df4cfe1a68259fd (diff)
downloademacs-bab449f034f44657ff3ed1bf533be6a27f4dafd6.tar.gz
emacs-bab449f034f44657ff3ed1bf533be6a27f4dafd6.zip
Improve drag-and-drop emulation time handling
* src/xselect.c (x_handle_selection_request): Use display-specific pending DND time. (x_set_pending_dnd_time): Delete function. * src/xterm.c (x_dnd_do_unsupported_drop, handle_one_xevent): Set dpyinfo->pending_dnd_time instead. * src/xterm.h (struct x_display_info): New field `pending_dnd_time'. Make handling pending drops display-specific to avoid interference when there are multiple displays.
Diffstat (limited to 'src/xselect.c')
-rw-r--r--src/xselect.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/xselect.c b/src/xselect.c
index d1b6d454abd..80db0d1fe2a 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -40,8 +40,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
40 40
41#include <X11/Xproto.h> 41#include <X11/Xproto.h>
42 42
43static Time pending_dnd_time;
44
45struct prop_location; 43struct prop_location;
46struct selection_data; 44struct selection_data;
47 45
@@ -265,7 +263,7 @@ x_atom_to_symbol (struct x_display_info *dpyinfo, Atom atom)
265 TIMESTAMP should be the timestamp where selection ownership will be 263 TIMESTAMP should be the timestamp where selection ownership will be
266 assumed. 264 assumed.
267 DND_DATA is the local value that will be used for selection requests 265 DND_DATA is the local value that will be used for selection requests
268 with `pending_dnd_time'. 266 with `dpyinfo->pending_dnd_time'.
269 Update the Vselection_alist so that we can reply to later requests for 267 Update the Vselection_alist so that we can reply to later requests for
270 our selection. */ 268 our selection. */
271 269
@@ -855,8 +853,11 @@ x_handle_selection_request (struct selection_input_event *event)
855 853
856 /* This is how the XDND protocol recommends dropping text onto a 854 /* This is how the XDND protocol recommends dropping text onto a
857 target that doesn't support XDND. */ 855 target that doesn't support XDND. */
858 if (SELECTION_EVENT_TIME (event) == pending_dnd_time + 1 856 if (dpyinfo->pending_dnd_time
859 || SELECTION_EVENT_TIME (event) == pending_dnd_time + 2) 857 && ((SELECTION_EVENT_TIME (event)
858 == dpyinfo->pending_dnd_time + 1)
859 || (SELECTION_EVENT_TIME (event)
860 == dpyinfo->pending_dnd_time + 2)))
860 use_alternate = true; 861 use_alternate = true;
861 862
862 block_input (); 863 block_input ();
@@ -2884,12 +2885,6 @@ x_timestamp_for_selection (struct x_display_info *dpyinfo,
2884 return value; 2885 return value;
2885} 2886}
2886 2887
2887void
2888x_set_pending_dnd_time (Time time)
2889{
2890 pending_dnd_time = time;
2891}
2892
2893static void syms_of_xselect_for_pdumper (void); 2888static void syms_of_xselect_for_pdumper (void);
2894 2889
2895void 2890void