From 35a8911d3950448a8c199eec2030e2e2c066132f Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Wed, 24 Nov 1999 14:37:53 +0000 Subject: [PATCH] (w32-drag-n-drop): Load files in current window, if drop coords aren't over a specific window. --- lisp/term/w32-win.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index 5067b46d15b..a46f2334e9e 100644 --- a/lisp/term/w32-win.el +++ b/lisp/term/w32-win.el @@ -156,9 +156,17 @@ Switch to a buffer editing the last file dropped." (interactive "e") (save-excursion - (set-frame-selected-window nil (posn-window (event-start event))) - (mapcar 'find-file (car (cdr (cdr event))))) - (raise-frame)) + ;; Make sure the drop target has positive co-ords + ;; before setting the selected frame - otherwise it + ;; won't work. + (let* ((window (posn-window (event-start event))) + (coords (posn-x-y (event-start event))) + (x (car coords)) + (y (cdr coords))) + (if (and (> x 0) (> y 0)) + (set-frame-selected-window nil window)) + (mapcar 'find-file (car (cdr (cdr event))))) + (raise-frame))) (defun w32-drag-n-drop-other-frame (event) "Edit the files listed in the drag-n-drop event, in other frames. -- 2.39.5