unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Cecilio Pardo <cpardo@imayhem.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 73258@debbugs.gnu.org
Subject: bug#73258: 31.0.50; w32 drag-n-dropping multiple files is broken
Date: Sun, 15 Sep 2024 21:22:32 +0200	[thread overview]
Message-ID: <a6079881-26c6-4d7b-89c4-1d2e20846ffc@imayhem.com> (raw)
In-Reply-To: <86a5g9e32p.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 590 bytes --]


On 15/09/2024 10:25, Eli Zaretskii wrote:
> We cannot remove or make backward-incompatible changes in a public
> API.  So removing/renaming w32-handle-dropped-file and/or changing its
> signature is out of the question.  Can you rewrite the patch such that
> it keeps this function and its arguments, and just change the
> implementation to fix the problem?
>
> Also, please accompany your changes with a ChangeLog-style description
> (see CONTRIBUTE for the details), to make the job of installing the
> changes easier.

See the attached patch. Hope I did it right, let me know.

Thanks.

[-- Attachment #2: 0001-Fix-multifile-drag-n-drop-on-win32.patch --]
[-- Type: text/plain, Size: 1716 bytes --]

From 3fece1ca8d89258c0a02897110e2f9d4c31eb36a Mon Sep 17 00:00:00 2001
From: Cecilio Pardo <cpardo@imayhem.com>
Date: Sun, 15 Sep 2024 21:06:00 +0200
Subject: [PATCH] Fix multifile drag-n-drop on win32

Pass all dropped files to dnd-handle-multiple-urls
on one call instead on doing multiple calls (Bug#73258).
* lisp/term/w32-win.el (w32-dropped-file-to-url): New function to
convert file name to a url for dnd
(w32-handle-dropped-file): Changed to use w32-dropped-file-to-url
(w32-drag-n-drop): Changed to pass al files to
dnd-handle-multiple-urls
---
 lisp/term/w32-win.el | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index 3c0acf368f4..95c2b357666 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -101,6 +101,13 @@ w32-color-map
 ;;   (princ event))
 
 (defun w32-handle-dropped-file (window file-name)
+  (dnd-handle-multiple-urls
+   window
+   (list
+    (w32-dropped-file-to-url file-name))
+   'private))
+
+(defun w32-dropped-file-to-url (file-name)
   (let ((f (if (eq system-type 'cygwin)
                (cygwin-convert-file-name-from-windows file-name t)
              (subst-char-in-string ?\\ ?/ file-name)))
@@ -146,8 +153,11 @@ w32-drag-n-drop
       (raise-frame)
       (setq window (selected-window))
 
-      (mapc (apply-partially #'w32-handle-dropped-file window)
-            (car (cdr (cdr event)))))))
+      (dnd-handle-multiple-urls
+       window
+       (mapcar #'w32-dropped-file-to-url
+               (car (cdr (cdr event))))
+       'private))))
 
 (defun w32-drag-n-drop-other-frame (event)
   "Edit the files listed in the drag-n-drop EVENT, in other frames.
-- 
2.35.1.windows.2


  reply	other threads:[~2024-09-15 19:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-14 19:33 bug#73258: 31.0.50; w32 drag-n-dropping multiple files is broken Cecilio Pardo
2024-09-15  8:25 ` Eli Zaretskii
2024-09-15 19:22   ` Cecilio Pardo [this message]
2024-09-20 11:20     ` Cecilio Pardo
2024-09-20 13:26       ` Eli Zaretskii
2024-09-21 10:11     ` Eli Zaretskii
2024-09-21 13:41       ` Cecilio Pardo
2024-09-22  9:49         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a6079881-26c6-4d7b-89c4-1d2e20846ffc@imayhem.com \
    --to=cpardo@imayhem.com \
    --cc=73258@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).