emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 16b94888429: Fix mouse clicks on a non-selected frame


From: Eli Zaretskii
Subject: emacs-29 16b94888429: Fix mouse clicks on a non-selected frame
Date: Mon, 5 Dec 2022 14:56:34 -0500 (EST)

branch: emacs-29
commit 16b948884294d6081fbcdd734df06f3bb14da96d
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix mouse clicks on a non-selected frame
    
    * lisp/mouse-drag.el (mouse-drag-drag): Skip switch-frame events
    while tracking mouse.  (Bug#59785)
---
 lisp/mouse-drag.el | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/lisp/mouse-drag.el b/lisp/mouse-drag.el
index f515cc8aacf..81b699c0202 100644
--- a/lisp/mouse-drag.el
+++ b/lisp/mouse-drag.el
@@ -275,6 +275,7 @@ To test this function, evaluate:
         have-scrolled
         window-last-row
         col window-last-col
+         switch-frame-p
         (scroll-col-delta 0)
         ;; be conservative about allowing horizontal scrolling
         (col-scrolling-p (mouse-drag-should-do-col-scrolling)))
@@ -286,15 +287,21 @@ To test this function, evaluate:
       (setq track-mouse 'drag-dragging)
       (while (progn
               (setq event (read--potential-mouse-event)
-                    end (event-end event)
-                    row (cdr (posn-col-row end))
-                    col (car (posn-col-row end)))
-              (or (mouse-movement-p event)
-                  (eq (car-safe event) 'switch-frame)))
+                     switch-frame-p (eq (car-safe event) 'switch-frame))
+               ;; We want to skip switch-frame events and treat then
+               ;; as moves over a different window.  These events have
+               ;; no position spec, so all the posn-* accessor
+               ;; functions are likely to barf if passed such an
+               ;; event.
+               (or switch-frame-p
+                   (setq end (event-end event)
+                        row (cdr (posn-col-row end))
+                        col (car (posn-col-row end))))
+              (or (mouse-movement-p event) switch-frame-p))
        ;; Scroll if see if we're on the edge.
        ;; FIXME: should handle mouse-in-other window.
        (cond
-        ((not (eq start-window (posn-window end)))
+        ((or switch-frame-p (not (eq start-window (posn-window end))))
          t) ; wait for return to original window
         ((<= row 0) (mouse-drag-repeatedly-safe-scroll -1 0))
         ((>= row window-last-row) (mouse-drag-repeatedly-safe-scroll 1 0))



reply via email to

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