[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 495c93d015: Adjust last change to Haiku as well
From: |
Po Lu |
Subject: |
master 495c93d015: Adjust last change to Haiku as well |
Date: |
Wed, 1 Jun 2022 04:40:16 -0400 (EDT) |
branch: master
commit 495c93d015534d6c8b6940623c5cbb0b2b493b2e
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
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.
---
lisp/term/haiku-win.el | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/lisp/term/haiku-win.el b/lisp/term/haiku-win.el
index a8cc1da731..2a31dd38c8 100644
--- a/lisp/term/haiku-win.el
+++ b/lisp/term/haiku-win.el
@@ -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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 495c93d015: Adjust last change to Haiku as well,
Po Lu <=