aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2022-04-10 09:31:24 +0800
committerPo Lu2022-04-10 09:31:42 +0800
commitfea97e29895ebe7ca1cc17095766d7c30f9884ac (patch)
treef3be62047422dd6a9e7cdaaf099eee7cb130dac2
parentb69e8bade635e73cf9be994879230c03248a8224 (diff)
downloademacs-fea97e29895ebe7ca1cc17095766d7c30f9884ac.tar.gz
emacs-fea97e29895ebe7ca1cc17095766d7c30f9884ac.zip
Try harder to own DND selections
* src/xterm.c (x_dnd_do_unsupported_drop): Fix computation of local value. (x_dnd_begin_drag_and_drop): Try to own the selection if we do have a local value.
-rw-r--r--src/xterm.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 0a2c3c58634..14a15066044 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2856,10 +2856,11 @@ x_dnd_do_unsupported_drop (struct x_display_info *dpyinfo,
2856 root_y = dest_y; 2856 root_y = dest_y;
2857 } 2857 }
2858 2858
2859 x_own_selection (QPRIMARY, 2859 if (CONSP (value))
2860 assq_no_quit (QPRIMARY, 2860 x_own_selection (QPRIMARY, Fnth (make_fixnum (1), value),
2861 dpyinfo->terminal->Vselection_alist), 2861 frame);
2862 frame); 2862 else
2863 x_own_selection (QPRIMARY, Qnil, frame);
2863 2864
2864 event.xbutton.window = child; 2865 event.xbutton.window = child;
2865 event.xbutton.x = dest_x; 2866 event.xbutton.x = dest_x;
@@ -9369,20 +9370,27 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction,
9369 ptrdiff_t i, end, fill; 9370 ptrdiff_t i, end, fill;
9370 XTextProperty prop; 9371 XTextProperty prop;
9371 xm_drop_start_message dmsg; 9372 xm_drop_start_message dmsg;
9372 Lisp_Object frame_object, x, y; 9373 Lisp_Object frame_object, x, y, frame, local_value;
9373 9374
9374 if (!FRAME_VISIBLE_P (f)) 9375 if (!FRAME_VISIBLE_P (f))
9375 error ("Frame is invisible"); 9376 error ("Frame is invisible");
9376 9377
9378 XSETFRAME (frame, f);
9379 local_value = assq_no_quit (QXdndSelection,
9380 FRAME_TERMINAL (f)->Vselection_alist);
9381
9377 if (x_dnd_in_progress || x_dnd_waiting_for_finish) 9382 if (x_dnd_in_progress || x_dnd_waiting_for_finish)
9378 error ("A drag-and-drop session is already in progress"); 9383 error ("A drag-and-drop session is already in progress");
9379 9384
9385 if (CONSP (local_value))
9386 x_own_selection (QXdndSelection,
9387 Fnth (make_fixnum (1), local_value), frame);
9388 else
9389 error ("No local value for XdndSelection");
9390
9380 ltimestamp = x_timestamp_for_selection (FRAME_DISPLAY_INFO (f), 9391 ltimestamp = x_timestamp_for_selection (FRAME_DISPLAY_INFO (f),
9381 QXdndSelection); 9392 QXdndSelection);
9382 9393
9383 if (NILP (ltimestamp))
9384 error ("No local value for XdndSelection");
9385
9386 if (BIGNUMP (ltimestamp)) 9394 if (BIGNUMP (ltimestamp))
9387 x_dnd_selection_timestamp = bignum_to_intmax (ltimestamp); 9395 x_dnd_selection_timestamp = bignum_to_intmax (ltimestamp);
9388 else 9396 else