summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormartin rudalics <rudalics@gmx.at>2021-11-20 10:56:13 +0100
committerEli Zaretskii <eliz@gnu.org>2021-11-20 12:05:36 +0200
commitc22c988b1f3d9ae5d3f504100bf8e1cb79fab334 (patch)
tree0ca57dc84fd35de52e0cce83a8b233e79bee6b5d
parent354c834fba5806ba873b50bf900c42dce5d9da90 (diff)
downloademacs-c22c988b1f3d9ae5d3f504100bf8e1cb79fab334.tar.gz
Fix mouse events on tab bar or tool bar when 'track-mouse' is t
* lisp/mouse.el (mouse-drag-track): * lisp/mouse-drag.el (mouse-drag-drag): Set 'track-mouse' to some value neither t nor nil. * src/keyboard.c (make_lispy_position): If track_mouse is Qt, report event on tool or tab bar (Bug#51794).
-rw-r--r--lisp/mouse-drag.el2
-rw-r--r--lisp/mouse.el6
-rw-r--r--src/keyboard.c25
3 files changed, 20 insertions, 13 deletions
diff --git a/lisp/mouse-drag.el b/lisp/mouse-drag.el
index ecfb359b36f..0cdba6b4d01 100644
--- a/lisp/mouse-drag.el
+++ b/lisp/mouse-drag.el
@@ -282,6 +282,8 @@ To test this function, evaluate:
(setq window-last-row (- (window-height) 2)
window-last-col (- (window-width) 2))
(track-mouse
+ ;; Set 'track-mouse' to something neither nil nor t (Bug#51794).
+ (setq track-mouse 'drag-dragging)
(while (progn
(setq event (read--potential-mouse-event)
end (event-end event)
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 0a4ab2878ab..5c645a4b895 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1618,7 +1618,11 @@ The region will be defined with mark and point."
(goto-char (nth 1 range)))
(setf (terminal-parameter nil 'mouse-drag-start) start-event)
- (setq track-mouse t)
+ ;; Set 'track-mouse' to something neither nil nor t, so that mouse
+ ;; events are not reported to have happened on the tool bar or the
+ ;; tab bar, as that breaks drag events that originate on the window
+ ;; body below these bars; see make_lispy_position and bug#51794.
+ (setq track-mouse 'drag-tracking)
(setq auto-hscroll-mode nil)
(set-transient-map
diff --git a/src/keyboard.c b/src/keyboard.c
index c608c072f01..1d8d98c9419 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5124,19 +5124,20 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
#endif
)
{
- /* FIXME: While track_mouse is non-nil, we do not report this
+ /* While 'track-mouse' is neither nil nor t, do not report this
event as something that happened on the tool or tab bar since
- that would break mouse dragging operations that originate from
- an ordinary window beneath and expect the window to auto-scroll
- as soon as the mouse cursor appears above or beneath it
- (Bug#50993). Since this "fix" might break track_mouse based
- operations originating from the tool or tab bar itself, such
- operations should set track_mouse to some special value that
- would be recognized by the following check.
-
- This issue should be properly handled by 'mouse-drag-track' and
- friends, so the below is only a temporary workaround. */
- if (NILP (track_mouse))
+ that would break mouse drag operations that originate from an
+ ordinary window beneath that bar and expect the window to
+ auto-scroll as soon as the mouse cursor appears above or
+ beneath it (Bug#50993). We do allow reports for t, because
+ applications may have set 'track-mouse' to t and still expect a
+ click on the tool or tab bar to get through (Bug#51794).
+
+ FIXME: This is a preliminary fix for the bugs cited above and
+ awaits a solution that includes a convention for all special
+ values of 'track-mouse' and their documentation in the Elisp
+ manual. */
+ if (NILP (track_mouse) || EQ (track_mouse, Qt))
posn = EQ (window_or_frame, f->tab_bar_window) ? Qtab_bar : Qtool_bar;
/* Kludge alert: for mouse events on the tab bar and tool bar,
keyboard.c wants the frame, not the special-purpose window