aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorPo Lu2022-04-03 09:59:14 +0800
committerPo Lu2022-04-03 09:59:14 +0800
commitf229710d41e85752bc1a835bae56c055a62813d9 (patch)
tree217d476c6209b4a014a1aa7a05293bb6c325d103 /lisp
parente9d4f119da48fe119d9d7a6d1b9a054c043bd517 (diff)
downloademacs-f229710d41e85752bc1a835bae56c055a62813d9.tar.gz
emacs-f229710d41e85752bc1a835bae56c055a62813d9.zip
Implement new DND features on GNUstep
* lisp/term/ns-win.el (ns-drag-n-drop): Handle special `lambda' drag-n-drop events. * src/nsterm.m: ([EmacsView wantsPeriodicDraggingUpdates]): ([EmacsView draggingUpdated:]): New functions.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/term/ns-win.el41
1 files changed, 22 insertions, 19 deletions
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index da6c5adee22..065ca235b40 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -508,25 +508,28 @@ unless the current buffer is a scratch buffer."
508Switch to a buffer editing the last file dropped, or insert the 508Switch to a buffer editing the last file dropped, or insert the
509string dropped into the current buffer." 509string dropped into the current buffer."
510 (interactive "e") 510 (interactive "e")
511 (let* ((window (posn-window (event-start event))) 511 (if (eq (car-safe (cdr-safe (cdr-safe event))) 'lambda)
512 (arg (car (cdr (cdr event)))) 512 (dnd-handle-movement (event-start event))
513 (type (car arg)) 513 (let* ((window (posn-window (event-start event)))
514 (operations (car (cdr arg))) 514 (arg (car (cdr (cdr event))))
515 (objects (cdr (cdr arg))) 515 (type (car arg))
516 (string (mapconcat 'identity objects "\n"))) 516 (operations (car (cdr arg)))
517 (set-frame-selected-window nil window) 517 (objects (cdr (cdr arg)))
518 (raise-frame) 518 (string (mapconcat 'identity objects "\n")))
519 (setq window (selected-window)) 519 (set-frame-selected-window nil window)
520 (cond ((or (memq 'ns-drag-operation-generic operations) 520 (raise-frame)
521 (memq 'ns-drag-operation-copy operations)) 521 (setq window (selected-window))
522 ;; Perform the default/copy action. 522 (goto-char (posn-point (event-start event)))
523 (dolist (data objects) 523 (cond ((or (memq 'ns-drag-operation-generic operations)
524 (dnd-handle-one-url window 'private (if (eq type 'file) 524 (memq 'ns-drag-operation-copy operations))
525 (concat "file:" data) 525 ;; Perform the default/copy action.
526 data)))) 526 (dolist (data objects)
527 (t 527 (dnd-handle-one-url window 'private (if (eq type 'file)
528 ;; Insert the text as is. 528 (concat "file:" data)
529 (dnd-insert-text window 'private string))))) 529 data))))
530 (t
531 ;; Insert the text as is.
532 (dnd-insert-text window 'private string))))))
530 533
531(global-set-key [drag-n-drop] 'ns-drag-n-drop) 534(global-set-key [drag-n-drop] 'ns-drag-n-drop)
532 535