emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master e83919f721: Fix some bugs found while testing drag-and-drop


From: Po Lu
Subject: master e83919f721: Fix some bugs found while testing drag-and-drop
Date: Wed, 29 Jun 2022 09:16:49 -0400 (EDT)

branch: master
commit e83919f7214aad67995171b22dab8b76685943b9
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix some bugs found while testing drag-and-drop
    
    * lisp/x-dnd.el (x-dnd-get-drop-width-height):
    (x-dnd-get-drop-x-y): Fix doc string.
    (x-dnd-handle-xdnd): Don't set update rect if
    `dnd-indicate-insertion-point'.  Bug found testing with "JX
    Application Framework".
---
 lisp/x-dnd.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el
index b7a20d37ce..d92009f85c 100644
--- a/lisp/x-dnd.el
+++ b/lisp/x-dnd.el
@@ -522,7 +522,7 @@ message (format 32) that caused EVENT to be generated."
                            frame "ATOM" 32 t))
 
 (defun x-dnd-get-drop-width-height (frame w accept)
-  "Return the width/height to be sent in a XDndStatus message.
+  "Return the width/height to be sent in a XdndStatus message.
 FRAME is the frame and W is the window where the drop happened.
 If ACCEPT is nil return 0 (empty rectangle),
 otherwise if W is a window, return its width/height,
@@ -539,7 +539,7 @@ otherwise return the frame width/height."
     0))
 
 (defun x-dnd-get-drop-x-y (frame w)
-  "Return the x/y coordinates to be sent in a XDndStatus message.
+  "Return the x/y coordinates to be sent in a XdndStatus message.
 Coordinates are required to be absolute.
 FRAME is the frame and W is the window where the drop happened.
 If W is a window, return its absolute coordinates,
@@ -609,10 +609,13 @@ FORMAT is 32 (not used).  MESSAGE is the data part of an 
XClientMessageEvent."
                (list-to-send
                 (list (string-to-number
                        (frame-parameter frame 'outer-window-id))
-                      accept ;; 1 = Accept, 0 = reject.
-                      (x-dnd-get-drop-x-y frame window)
-                      (x-dnd-get-drop-width-height
-                       frame window (eq accept 1))
+                      (+ 2 accept) ;; 1 = accept, 0 = reject.  2 =
+                                    ;; "want position updates".
+                       (if dnd-indicate-insertion-point 0
+                        (x-dnd-get-drop-x-y frame window))
+                       (if dnd-indicate-insertion-point 0
+                        (x-dnd-get-drop-width-height
+                         frame window (eq accept 1)))
                        ;; The no-toolkit Emacs build can actually
                        ;; receive drops from programs that speak
                        ;; versions of XDND earlier than 3 (such as



reply via email to

[Prev in Thread] Current Thread [Next in Thread]