unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 51794@debbugs.gnu.org, mark.t.kennedy@gmail.com
Subject: bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
Date: Sat, 20 Nov 2021 10:56:13 +0100	[thread overview]
Message-ID: <87028c49-bee3-4246-c812-f385124be815@gmx.at> (raw)
In-Reply-To: <838rxjtctn.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 484 bytes --]

> If you have problems, please post the patch and I will install it.

Attached.  ChangeLog would go as:


Report mouse events on tab or tool bar when 'track-mouse' is t (Bug#51794)

* lisp/mouse.el (mouse-drag-track)
* lisp/mouse-drag.el (mouse-drag-drag): Set 'track-mouse' to some
value neither t nor nil (Bug#51794).
* src/keyboard.c (make_lispy_position): If track_mouse is Qt,
report event on tool or tab bar (Bug#51794).


Please fix everything as you see fit.

Thanks, martin


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: track-mouse.diff --]
[-- Type: text/x-patch; name="track-mouse.diff", Size: 2899 bytes --]

diff --git a/lisp/mouse-drag.el b/lisp/mouse-drag.el
index ecfb359b36..0cdba6b4d0 100644
--- a/lisp/mouse-drag.el
+++ b/lisp/mouse-drag.el
@@ -282,6 +282,8 @@ mouse-drag-drag
     (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 7bac6dd07b..8497c50363 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1615,7 +1615,8 @@ mouse-drag-track
       (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 (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 a99d14cb4c..451863a28a 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

  reply	other threads:[~2021-11-20  9:56 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-12 20:49 bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar Mark Kennedy
2021-11-13  7:18 ` Eli Zaretskii
     [not found]   ` <CANru7VHKtNYZBwVHFEt-=25j7PGWkawdU+PWcdAPqdNaKSYP3w@mail.gmail.com>
2021-11-13 13:43     ` Eli Zaretskii
     [not found]       ` <CANru7VH29KdLB0-Bc-JoDB3x+_-M9irADdQ2=JVkupbLyW15DQ@mail.gmail.com>
2021-11-13 14:40         ` Eli Zaretskii
2021-11-13 14:52           ` Mark Kennedy
2021-11-13 15:29             ` Eli Zaretskii
2021-11-13 15:43               ` Mark Kennedy
2021-11-18 23:39                 ` Mark Kennedy
2021-11-19  7:01                   ` Eli Zaretskii
2021-11-19  7:54                     ` Eli Zaretskii
2021-11-19  9:26                     ` martin rudalics
2021-11-19 13:18                       ` Mark Kennedy
2021-11-20  8:03                       ` Eli Zaretskii
2021-11-20  8:48                         ` martin rudalics
2021-11-20  9:07                           ` Eli Zaretskii
2021-11-20  9:56                             ` martin rudalics [this message]
2021-11-20 10:08                               ` Eli Zaretskii
2021-11-21  9:12                                 ` martin rudalics
2021-11-21 14:56                                   ` Mark Kennedy
2021-11-21 15:00                                     ` Eli Zaretskii
2021-11-21 15:20                                       ` Mark Kennedy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87028c49-bee3-4246-c812-f385124be815@gmx.at \
    --to=rudalics@gmx.at \
    --cc=51794@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=mark.t.kennedy@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).