Subject: Re: bug#45277: DND errors

From: Juri Linkov <[email-masked]>
Date: Mon, 21 Dec 2020 10:59:09 +0200

retitle 45277 DND errors
tags 45277 patch
quit

> Here's a test case for DND errors:
>
> Eval:
> (modify-frame-parameters nil '((undecorated . t)))
> (toggle-frame-maximized)
>
> (frame-parameter nil 'left)
> => (+ -1)
>
> Since it's not a number, x-dnd-handle-xdnd signals the error:
>
>   Bad data in VALUES, must be number, cons or string

I found that semantic-displayer-point-position checks for such syntax
and copied the same code to x-dnd-get-drop-x-y:

diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el
index 1d49f46253..5af5490360 100644
--- a/lisp/x-dnd.el
+++ b/lisp/x-dnd.el
@@ -411,8 +411,10 @@ x-dnd-get-drop-x-y
 FRAME is the frame and W is the window where the drop happened.
 If W is a window, return its absolute coordinates,
 otherwise return the frame coordinates."
-  (let* ((frame-left (frame-parameter frame 'left))
-	 (frame-top (frame-parameter frame 'top)))
+  (let* ((frame-left (or (car-safe (cdr-safe (frame-parameter frame 'left)))
+			 (frame-parameter frame 'left)))
+	 (frame-top (or (car-safe (cdr-safe (frame-parameter frame 'top)))
+			(frame-parameter frame 'top))))
     (if (windowp w)
 	(let ((edges (window-inside-pixel-edges w)))
 	  (cons