summaryrefslogtreecommitdiff
path: root/lisp/pgtk-dnd.el
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-06-23 13:57:23 +0800
committerPo Lu <luangruo@yahoo.com>2022-06-23 13:58:38 +0800
commit5cbe50a4fb9e13624ccd7082d20ab069558dca21 (patch)
tree95ab416b6d28f90352eda351deb4595e4476422b /lisp/pgtk-dnd.el
parent0b4db66a9deae682dc7d444f4ab8d0e49f15c3b9 (diff)
downloademacs-5cbe50a4fb9e13624ccd7082d20ab069558dca21.tar.gz
emacs-5cbe50a4fb9e13624ccd7082d20ab069558dca21.tar.bz2
emacs-5cbe50a4fb9e13624ccd7082d20ab069558dca21.zip
Make DND from other GTK programs work on Wayland
* lisp/pgtk-dnd.el (pgtk-dnd-handle-gdk): Try to keep the selection contents in extra-data during a motion event.
Diffstat (limited to 'lisp/pgtk-dnd.el')
-rw-r--r--lisp/pgtk-dnd.el22
1 files changed, 17 insertions, 5 deletions
diff --git a/lisp/pgtk-dnd.el b/lisp/pgtk-dnd.el
index 2aaf4c4e977..df267549d7c 100644
--- a/lisp/pgtk-dnd.el
+++ b/lisp/pgtk-dnd.el
@@ -373,15 +373,27 @@ message."
(time (nth 2 client-message))
(action-type (pgtk-dnd-maybe-call-test-function window
action)))
+ ;; Get the selection contents now. GdkWaylandSelection
+ ;; becomes unavailable immediately after `drag-drop' is sent.
+ (let* ((current-type (pgtk-dnd-current-type window))
+ (current-action-type (car-safe (aref state 6))))
+ (when (and current-type
+ (not (equal current-action-type action-type)))
+ (aset state 6 (cons action-type
+ (pgtk-get-selection-internal
+ (nth 1 client-message)
+ (intern current-type))))))
(pgtk-update-drop-status (car action-type) time)
(dnd-handle-movement (event-start event)))))
((eq (car client-message) 'quote) ; drag-drop
- (let* ((timestamp (nth 2 client-message))
+ (let* ((state (pgtk-dnd-get-state-for-frame frame))
+ (timestamp (nth 2 client-message))
(value (and (pgtk-dnd-current-type window)
- (pgtk-get-selection-internal
- (nth 1 client-message)
- (intern (pgtk-dnd-current-type window))
- timestamp)))
+ (or (cdr-safe (aref state 6))
+ (pgtk-get-selection-internal
+ (nth 1 client-message)
+ (intern (pgtk-dnd-current-type window))
+ timestamp))))
action)
(unwind-protect
(setq action (when value