Adjust last change to Haiku as well
* lisp/term/haiku-win.el (haiku-dnd-selection-converters): Add text/uri-list. (haiku-dnd-convert-text-uri-list): New function. (x-begin-drag): Handle alternative data specified in selection local values.
This commit is contained in:
parent
f5fadbbfec
commit
495c93d015
1 changed files with 23 additions and 4 deletions
|
@ -52,7 +52,8 @@
|
|||
"The local value of the special `XdndSelection' selection.")
|
||||
|
||||
(defvar haiku-dnd-selection-converters '((STRING . haiku-dnd-convert-string)
|
||||
(FILE_NAME . haiku-dnd-convert-file-name))
|
||||
(FILE_NAME . haiku-dnd-convert-file-name)
|
||||
(text/uri-list . haiku-dnd-convert-text-uri-list))
|
||||
"Alist of X selection types to functions that act as selection converters.
|
||||
The functions should accept a single argument VALUE, describing
|
||||
the value of the drag-and-drop selection, and return a list of
|
||||
|
@ -148,6 +149,19 @@ VALUE as a unibyte string, or nil if VALUE was not a string."
|
|||
(file-exists-p value))
|
||||
(list "refs" (propertize (expand-file-name value) 'type 'ref))))
|
||||
|
||||
(defun haiku-dnd-convert-text-uri-list (value)
|
||||
"Convert VALUE to a list of URLs."
|
||||
(cond
|
||||
((stringp value) (list "text/uri-list"
|
||||
(concat (url-encode-url value) "\n")))
|
||||
((vectorp value) (list "text/uri-list"
|
||||
(with-temp-buffer
|
||||
(cl-loop for tem across value
|
||||
do (progn
|
||||
(insert (url-encode-url tem))
|
||||
(insert "\n")))
|
||||
(buffer-string))))))
|
||||
|
||||
(declare-function x-open-connection "haikufns.c")
|
||||
(declare-function x-handle-args "common-win")
|
||||
(declare-function haiku-selection-data "haikuselect.c")
|
||||
|
@ -341,12 +355,17 @@ take effect on menu items until the menu bar is updated again."
|
|||
(mouse-highlight nil)
|
||||
(haiku-signal-invalid-refs nil))
|
||||
(dolist (target targets)
|
||||
(let ((selection-converter (cdr (assoc (intern target)
|
||||
haiku-dnd-selection-converters))))
|
||||
(let* ((target-atom (intern target))
|
||||
(selection-converter (cdr (assoc target-atom
|
||||
haiku-dnd-selection-converters))))
|
||||
(when selection-converter
|
||||
(let ((selection-result
|
||||
(funcall selection-converter
|
||||
haiku-dnd-selection-value)))
|
||||
(if (stringp haiku-dnd-selection-value)
|
||||
(or (get-text-property 0 target-atom
|
||||
haiku-dnd-selection-value)
|
||||
haiku-dnd-selection-value)
|
||||
haiku-dnd-selection-value))))
|
||||
(when selection-result
|
||||
(let ((field (cdr (assoc (car selection-result) message))))
|
||||
(unless (cadr field)
|
||||
|
|
Loading…
Add table
Reference in a new issue