aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2022-12-05 21:55:25 +0200
committerEli Zaretskii2022-12-05 21:55:25 +0200
commit16b948884294d6081fbcdd734df06f3bb14da96d (patch)
tree08773c8ef129b8d4044bfaad33c8cd63267468a6
parentca0da3b83dfc4a366978c9cd17db7a212a83f6d3 (diff)
downloademacs-16b948884294d6081fbcdd734df06f3bb14da96d.tar.gz
emacs-16b948884294d6081fbcdd734df06f3bb14da96d.zip
Fix mouse clicks on a non-selected frame
* lisp/mouse-drag.el (mouse-drag-drag): Skip switch-frame events while tracking mouse. (Bug#59785)
-rw-r--r--lisp/mouse-drag.el19
1 files 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:
275 have-scrolled 275 have-scrolled
276 window-last-row 276 window-last-row
277 col window-last-col 277 col window-last-col
278 switch-frame-p
278 (scroll-col-delta 0) 279 (scroll-col-delta 0)
279 ;; be conservative about allowing horizontal scrolling 280 ;; be conservative about allowing horizontal scrolling
280 (col-scrolling-p (mouse-drag-should-do-col-scrolling))) 281 (col-scrolling-p (mouse-drag-should-do-col-scrolling)))
@@ -286,15 +287,21 @@ To test this function, evaluate:
286 (setq track-mouse 'drag-dragging) 287 (setq track-mouse 'drag-dragging)
287 (while (progn 288 (while (progn
288 (setq event (read--potential-mouse-event) 289 (setq event (read--potential-mouse-event)
289 end (event-end event) 290 switch-frame-p (eq (car-safe event) 'switch-frame))
290 row (cdr (posn-col-row end)) 291 ;; We want to skip switch-frame events and treat then
291 col (car (posn-col-row end))) 292 ;; as moves over a different window. These events have
292 (or (mouse-movement-p event) 293 ;; no position spec, so all the posn-* accessor
293 (eq (car-safe event) 'switch-frame))) 294 ;; functions are likely to barf if passed such an
295 ;; event.
296 (or switch-frame-p
297 (setq end (event-end event)
298 row (cdr (posn-col-row end))
299 col (car (posn-col-row end))))
300 (or (mouse-movement-p event) switch-frame-p))
294 ;; Scroll if see if we're on the edge. 301 ;; Scroll if see if we're on the edge.
295 ;; FIXME: should handle mouse-in-other window. 302 ;; FIXME: should handle mouse-in-other window.
296 (cond 303 (cond
297 ((not (eq start-window (posn-window end))) 304 ((or switch-frame-p (not (eq start-window (posn-window end))))
298 t) ; wait for return to original window 305 t) ; wait for return to original window
299 ((<= row 0) (mouse-drag-repeatedly-safe-scroll -1 0)) 306 ((<= row 0) (mouse-drag-repeatedly-safe-scroll -1 0))
300 ((>= row window-last-row) (mouse-drag-repeatedly-safe-scroll 1 0)) 307 ((>= row window-last-row) (mouse-drag-repeatedly-safe-scroll 1 0))