emacs-diffs
[Top][All Lists]
Advanced

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

master 6230ed6d63 1/2: Fix announcements of XDND mouse rectangles


From: Po Lu
Subject: master 6230ed6d63 1/2: Fix announcements of XDND mouse rectangles
Date: Tue, 5 Jul 2022 21:01:24 -0400 (EDT)

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

    Fix announcements of XDND mouse rectangles
    
    * lisp/x-dnd.el (x-dnd-handle-xdnd): Use correct meaning of "2",
    which isn't well documented.
    * src/xterm.c (handle_one_xevent): Likewise.  Also fix unpacking
    of mouse rects.
---
 lisp/x-dnd.el | 14 +++++++-------
 src/xterm.c   |  9 +++++++--
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el
index 9c1c98a1bf..92899e7a0c 100644
--- a/lisp/x-dnd.el
+++ b/lisp/x-dnd.el
@@ -695,13 +695,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))
-                      (+ 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)))
+                       ;; 1 = accept, 0 = reject.  2 = "want position
+                       ;; updates even for movement inside the given
+                       ;; widget bounds".
+                      (+ (if dnd-indicate-insertion-point 2 0) accept)
+                      (x-dnd-get-drop-x-y frame window)
+                      (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
diff --git a/src/xterm.c b/src/xterm.c
index 4a47fdfd45..8373222cfc 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -16468,10 +16468,15 @@ handle_one_xevent (struct x_display_info *dpyinfo,
            if (x_dnd_last_protocol_version != -1
                && x_dnd_in_progress
                && target == x_dnd_last_seen_window
-               && event->xclient.data.l[1] & 2)
+               /* The XDND documentation is not very clearly worded.
+                  But this should be the correct behavior, since
+                  "kDNDStatusSendHereFlag" in the reference
+                  implementation is 2, and means the mouse rect
+                  should be ignored.  */
+               && !(event->xclient.data.l[1] & 2))
              {
                r1 = event->xclient.data.l[2];
-               r2 = event->xclient.data.l[2];
+               r2 = event->xclient.data.l[3];
 
                x_dnd_mouse_rect_target = target;
                x_dnd_mouse_rect.x = (r1 & 0xffff0000) >> 16;



reply via email to

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