unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
@ 2021-11-12 20:49 Mark Kennedy
  2021-11-13  7:18 ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Mark Kennedy @ 2021-11-12 20:49 UTC (permalink / raw)
  To: 51794

CAVEAT: this has not been reproduced under an "emacs -Q"

1) launch an emacs with two windows
2) one window has a number of tabs with text files in each
3) the other window has at least one tab with a scala source file,
in scala mode, using LSP
4) the emacs instance is configured to use lsp-metals
5) clicking on the tabs in the text file window works as expected
(e.g. selection, closing)
6) clicking on a tab in the window with the scala source file triggers
the message "<nil> <mouse-1> is undefined".
7) switching from scala mode to fundamental mode restores the correct
tab behavior.
8) switching back to scala mode from fundamental mode restores the
failing behavior

as you can see from the generated environment info below, the
environment is *compilicated*.  bisecting this is out of the question.
i'm hoping that someone could focus on the presence of the "<nil>" in
the generated input sequence since it implies that the lisp symbol nil
was somehow passed into the input event queue.





In GNU Emacs 29.0.50 (build 6, x86_64-pc-linux-gnu, GTK+ Version
3.24.30, cairo version 1.17.4)
 of 2021-11-12 built on new.mofjwutu.com
Repository revision: 12d554e5c54487d753a133c048e262f3d54019bd
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Fedora Linux 35 (Workstation Edition)

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP
SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: Scala

Minor modes in effect:
  lsp-headerline-breadcrumb-mode: t
  lsp-diagnostics-mode: t
  lsp-modeline-workspace-status-mode: t
  lsp-modeline-diagnostics-mode: t
  lsp-modeline-code-actions-mode: t
  lsp-completion-mode: t
  indent-guide-mode: t
  subword-mode: t
  save-place-mode: t
  desktop-save-mode: t
  global-display-line-numbers-mode: t
  display-line-numbers-mode: t
  beacon-mode: t
  pyvenv-mode: t
  shell-dirtrack-mode: t
  pcre-mode: t
  dynamic-completion-mode: t
  msb-mode: t
  winner-mode: t
  savehist-mode: t
  which-function-mode: t
  global-page-break-lines-mode: t
  global-hi-lock-mode: t
  hi-lock-mode: t
  icomplete-mode: t
  dap-tooltip-mode: t
  dap-ui-many-windows-mode: t
  dap-ui-controls-mode: t
  dap-ui-mode: t
  which-key-mode: t
  lsp-ui-mode: t
  lsp-ui-doc-mode: t
  lsp-ui-sideline-mode: t
  company-mode: t
  treemacs-filewatch-mode: t
  treemacs-follow-mode: t
  treemacs-git-mode: t
  treemacs-fringe-indicator-mode: t
  lsp-lens-mode: t
  dap-auto-configure-mode: t
  dap-mode: t
  lsp-managed-mode: t
  lsp-mode: t
  yas-minor-mode: t
  flycheck-mode: t
  override-global-mode: t
  hl-todo-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  tab-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/mtk/.emacs.d/elpa/teco-20200707.2309/teco hides
/usr/local/share/emacs/site-lisp/teco
/home/mtk/.emacs.d/elpa/transient-20211105.100/transient hides
/usr/local/share/emacs/29.0.50/lisp/transient

Features:
(shadow sort mail-extr emacsbug sendmail names edebug autoload tar-mode
arc-mode archive-mode cl-print debug backtrace teco magit-utils crm
jka-compr apropos cus-start eieio-opt speedbar ezimage dframe shortdoc
misearch multi-isearch add-log mm-archive message yank-media dired
dired-loaddefs rfc822 mml mml-sec epa derived gnus-util rmail
rmail-loaddefs mailabbrev gmm-utils mm-decode mm-bodies mm-encode
lsp-headerline lsp-icons url-http url-gw url-cache url-auth mule-util
lsp-diagnostics lsp-modeline company-oddmuse company-keywords
company-etags company-gtags company-dabbrev-code company-dabbrev
company-files company-clang company-cmake company-semantic
company-template company-bbdb vc-git vc-dispatcher lsp-zig lsp-steep
lsp-svelte lsp-sqls lsp-yaml lsp-xml lsp-vimscript lsp-vhdl lsp-vetur
lsp-html lsp-verilog lsp-vala lsp-v lsp-toml lsp-terraform lsp-tex
lsp-sorbet lsp-solargraph lsp-rust lsp-rf lsp-r lsp-purescript lsp-pylsp
lsp-pyls lsp-pwsh lsp-php lsp-perl lsp-ocaml lsp-nix lsp-nim
lsp-markdown lsp-lua lsp-kotlin lsp-json lsp-javascript lsp-haxe
lsp-groovy lsp-hack lsp-graphql lsp-go lsp-completion lsp-gdscript
lsp-fsharp lsp-fortran lsp-eslint lsp-erlang lsp-elixir lsp-elm
lsp-dockerfile lsp-dhall lsp-d lsp-css lsp-csharp gnutls lsp-crystal
lsp-cmake lsp-clojure lsp-semantic-tokens lsp-clangd dom lsp-beancount
lsp-bash lsp-angular lsp-ada lsp-actionscript ccls ccls-member-hierarchy
ccls-inheritance-hierarchy ccls-call-hierarchy ccls-tree ccls-code-lens
ccls-semantic-highlight ccls-common scala-mode
scala-mode-prettify-symbols scala-mode-imenu scala-mode-map
scala-mode-fontlock scala-mode-indent scala-mode-paragraph
scala-mode-syntax scala-mode-lib disp-table indent-guide hlinum linum
cap-words superword subword saveplace desktop frameset
display-line-numbers beacon highlight-indentation flymake-proc flymake
warnings company-capf help-fns radix-tree elpy elpy-rpc pyvenv eshell
esh-cmd esh-ext esh-opt esh-proc esh-io esh-arg esh-module esh-groups
esh-util elpy-shell elpy-profile elpy-django elpy-refactor diff-mode
python tramp-sh tramp tramp-loaddefs trampver tramp-integration
tramp-compat shell pcomplete parse-time iso8601 time-date ls-lisp
format-spec ido files-x etags fileloop generator pcre2el rxt re-builder
completion msb winner savehist which-func page-break-lines hi-lock avoid
icomplete server use-package-delight lsp-pyright dap-mouse dap-ui gdb-mi
gud bui bui-list bui-info bui-entry bui-core bui-history bui-button
bui-utils cus-edit pp cus-load dap-java lsp-java request mailheader
autorevert mail-utils cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs which-key lsp-ui
lsp-ui-flycheck lsp-ui-doc goto-addr lsp-ui-imenu lsp-ui-peek
lsp-ui-sideline lsp-ui-util face-remap company hydra flycheck-package
package-lint let-alist finder finder-inf projectile lisp-mnt mail-parse
rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr grep ibuf-ext
ibuffer ibuffer-loaddefs lsp-metals view lsp-metals-treeview
lsp-treemacs lsp-treemacs-themes treemacs treemacs-header-line
treemacs-compatibility treemacs-mode treemacs-interface
treemacs-extensions treemacs-mouse-interface treemacs-tags
treemacs-persistence treemacs-filewatch-mode treemacs-follow-mode
treemacs-rendering treemacs-async treemacs-workspaces treemacs-dom
treemacs-visuals treemacs-fringe-indicator treemacs-scope pulse
treemacs-faces treemacs-icons treemacs-themes treemacs-core-utils
pfuture hl-line treemacs-logging treemacs-customization treemacs-macros
lsp-metals-protocol lsp-lens dap-mode dap-launch posframe dap-overlays
lsp-mode lsp-protocol aws-snippets go-snippets yasnippet-snippets
yasnippet xref project tree-widget wid-edit spinner pcase network-stream
puny nsm rmc markdown-mode color thingatpt noutline outline lv inline
imenu ht filenotify ewoc epg rfc6068 epg-config compile
text-property-search comint ring flycheck-eldev flycheck ansi-color
find-func use-package-bind-key bind-key easy-mmode importmagic f dash s
epc ctable edmacro kmacro concurrent deferred hl-todo use-package-ensure
ialign align cl-extra use-package-core tab-line trim page-menu
cperl-mode facemenu help-mode rx cl advice info package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json map url-vars
seq gv subr-x byte-opt bytecomp byte-compile cconv cl-loaddefs cl-lib
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 2036788 1830354)
 (symbols 48 68716 737)
 (strings 32 376913 356206)
 (string-bytes 1 16103230)
 (vectors 16 171799)
 (vector-slots 8 2498201 708904)
 (floats 8 877 5477)
 (intervals 56 205896 121072)
 (buffers 992 50))





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  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>
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2021-11-13  7:18 UTC (permalink / raw)
  To: Mark Kennedy; +Cc: 51794

> From: Mark Kennedy <mark.t.kennedy@gmail.com>
> Date: Fri, 12 Nov 2021 15:49:45 -0500
> 
> 1) launch an emacs with two windows
> 2) one window has a number of tabs with text files in each
> 3) the other window has at least one tab with a scala source file,
> in scala mode, using LSP
> 4) the emacs instance is configured to use lsp-metals
> 5) clicking on the tabs in the text file window works as expected
> (e.g. selection, closing)
> 6) clicking on a tab in the window with the scala source file triggers
> the message "<nil> <mouse-1> is undefined".
> 7) switching from scala mode to fundamental mode restores the correct
> tab behavior.
> 8) switching back to scala mode from fundamental mode restores the
> failing behavior

Does scala mode rebind mouse clicks to some of its commands?  If so,
please show those rebindings.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
       [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>
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2021-11-13 13:43 UTC (permalink / raw)
  To: Mark Kennedy; +Cc: 51794

[Please use Reply All to reply, so that the bug tracker is CC'ed.]

> From: Mark Kennedy <mark.t.kennedy@gmail.com>
> Date: Sat, 13 Nov 2021 08:37:37 -0500
> 
> it doesn't rebind anything significant.  but i'm not sure that theory
> could explain the key sequence '<nil> <mouse-1>' unless it had
> mistakenly bound it to a keyboard macro?  what do you think the
> presence of the '<nil>' as a keyboard event means?  from where could
> that originate?

That nil means Emacs didn't recognize the part of the window/frame
where you clicked.

Is it possible to provide a complete recipe for reproducing the
problem, starting from "emacs -Q" and loading the minimum number of
additional features required for seeing the problem?





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
       [not found]       ` <CANru7VH29KdLB0-Bc-JoDB3x+_-M9irADdQ2=JVkupbLyW15DQ@mail.gmail.com>
@ 2021-11-13 14:40         ` Eli Zaretskii
  2021-11-13 14:52           ` Mark Kennedy
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2021-11-13 14:40 UTC (permalink / raw)
  To: Mark Kennedy; +Cc: 51794

[PLEASE USE REPLY ALL TO REPLY, SO THAT THE BUG TRACKER IS CC'ED.]

> From: Mark Kennedy <mark.t.kennedy@gmail.com>
> Date: Sat, 13 Nov 2021 08:50:08 -0500
> 
> reproducing from -Q is a nightmare.  your comment that it did not
> recognize the part of the window frame is what i want to focus on.
> the window containing the scala mode buffer contains tab-bar tabs.  i
> am clicking in either a tab (on the close icon) or to the right of the
> tab list on the "open new empty tab" icon (still within the tab bar).
> how could that generate the <nil> input event?

I don't know.  That's why I asked for a recipe: to try debugging it
myself.  If it isn't practical to provide a recipe, you will have to
debug it on your system.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  2021-11-13 14:40         ` Eli Zaretskii
@ 2021-11-13 14:52           ` Mark Kennedy
  2021-11-13 15:29             ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Mark Kennedy @ 2021-11-13 14:52 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 51794

i'm willing to attempt to debug it myself but not via the -Q route.  i
prefer to focus on where the bad input event stream is being created.
any suggestions about where to put an elisp or C breakpoint to go
after this?
/mark

On Sat, Nov 13, 2021 at 9:41 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> [PLEASE USE REPLY ALL TO REPLY, SO THAT THE BUG TRACKER IS CC'ED.]
>
> > From: Mark Kennedy <mark.t.kennedy@gmail.com>
> > Date: Sat, 13 Nov 2021 08:50:08 -0500
> >
> > reproducing from -Q is a nightmare.  your comment that it did not
> > recognize the part of the window frame is what i want to focus on.
> > the window containing the scala mode buffer contains tab-bar tabs.  i
> > am clicking in either a tab (on the close icon) or to the right of the
> > tab list on the "open new empty tab" icon (still within the tab bar).
> > how could that generate the <nil> input event?
>
> I don't know.  That's why I asked for a recipe: to try debugging it
> myself.  If it isn't practical to provide a recipe, you will have to
> debug it on your system.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  2021-11-13 14:52           ` Mark Kennedy
@ 2021-11-13 15:29             ` Eli Zaretskii
  2021-11-13 15:43               ` Mark Kennedy
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2021-11-13 15:29 UTC (permalink / raw)
  To: Mark Kennedy; +Cc: 51794

> From: Mark Kennedy <mark.t.kennedy@gmail.com>
> Date: Sat, 13 Nov 2021 09:52:21 -0500
> Cc: 51794@debbugs.gnu.org
> 
> i'm willing to attempt to debug it myself but not via the -Q route.  i
> prefer to focus on where the bad input event stream is being created.
> any suggestions about where to put an elisp or C breakpoint to go
> after this?

In keyboard.c, under "case MOUSE_CLICK_EVENT:", step through the
code until you get to this line:

	    position = make_lispy_position (f, event->x, event->y,
					    event->timestamp);

then step into make_lispy_position, and see what it produces.

(I hope I got the code right; apologies if not.)





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  2021-11-13 15:29             ` Eli Zaretskii
@ 2021-11-13 15:43               ` Mark Kennedy
  2021-11-18 23:39                 ` Mark Kennedy
  0 siblings, 1 reply; 21+ messages in thread
From: Mark Kennedy @ 2021-11-13 15:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 51794

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

Thanks, I'll check it out.

On Sat, Nov 13, 2021, 10:30 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Mark Kennedy <mark.t.kennedy@gmail.com>
> > Date: Sat, 13 Nov 2021 09:52:21 -0500
> > Cc: 51794@debbugs.gnu.org
> >
> > i'm willing to attempt to debug it myself but not via the -Q route.  i
> > prefer to focus on where the bad input event stream is being created.
> > any suggestions about where to put an elisp or C breakpoint to go
> > after this?
>
> In keyboard.c, under "case MOUSE_CLICK_EVENT:", step through the
> code until you get to this line:
>
>             position = make_lispy_position (f, event->x, event->y,
>                                             event->timestamp);
>
> then step into make_lispy_position, and see what it produces.
>
> (I hope I got the code right; apologies if not.)
>

[-- Attachment #2: Type: text/html, Size: 1372 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  2021-11-13 15:43               ` Mark Kennedy
@ 2021-11-18 23:39                 ` Mark Kennedy
  2021-11-19  7:01                   ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Mark Kennedy @ 2021-11-18 23:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 51794

bug fix #50993 is the bug.  it made make_lispy_position skip setting
posn to the tab_bar if track_mouse is non-nil.  why track_mouse is nil
for some frames and not for others i didn't look into.
thoughts/comments?

/mark

On Sat, Nov 13, 2021 at 10:43 AM Mark Kennedy <mark.t.kennedy@gmail.com> wrote:
>
> Thanks, I'll check it out.
>
> On Sat, Nov 13, 2021, 10:30 AM Eli Zaretskii <eliz@gnu.org> wrote:
>>
>> > From: Mark Kennedy <mark.t.kennedy@gmail.com>
>> > Date: Sat, 13 Nov 2021 09:52:21 -0500
>> > Cc: 51794@debbugs.gnu.org
>> >
>> > i'm willing to attempt to debug it myself but not via the -Q route.  i
>> > prefer to focus on where the bad input event stream is being created.
>> > any suggestions about where to put an elisp or C breakpoint to go
>> > after this?
>>
>> In keyboard.c, under "case MOUSE_CLICK_EVENT:", step through the
>> code until you get to this line:
>>
>>             position = make_lispy_position (f, event->x, event->y,
>>                                             event->timestamp);
>>
>> then step into make_lispy_position, and see what it produces.
>>
>> (I hope I got the code right; apologies if not.)





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  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
  0 siblings, 2 replies; 21+ messages in thread
From: Eli Zaretskii @ 2021-11-19  7:01 UTC (permalink / raw)
  To: Mark Kennedy, martin rudalics; +Cc: 51794

> From: Mark Kennedy <mark.t.kennedy@gmail.com>
> Date: Thu, 18 Nov 2021 18:39:23 -0500
> Cc: 51794@debbugs.gnu.org
> 
> bug fix #50993 is the bug.  it made make_lispy_position skip setting
> posn to the tab_bar if track_mouse is non-nil.  why track_mouse is nil
> for some frames and not for others i didn't look into.
> thoughts/comments?

Please do look into that last part, because we need to understand the
situations in which this happens well enough to devise a solution.  We
don't want to revert that fix because it will re-introduce a larger
problem.  Specifically, why does this happen to you only under those
customizations and not in "emacs -Q"?

Martin, any suggestions?





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  2021-11-19  7:01                   ` Eli Zaretskii
@ 2021-11-19  7:54                     ` Eli Zaretskii
  2021-11-19  9:26                     ` martin rudalics
  1 sibling, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2021-11-19  7:54 UTC (permalink / raw)
  To: mark.t.kennedy; +Cc: 51794

> Date: Fri, 19 Nov 2021 09:01:16 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 51794@debbugs.gnu.org
> 
> Specifically, why does this happen to you only under those
> customizations and not in "emacs -Q"?

Could it be that some package you load enables mouse-tracking?  if so,
which one, and for what purpose?





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  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
  1 sibling, 2 replies; 21+ messages in thread
From: martin rudalics @ 2021-11-19  9:26 UTC (permalink / raw)
  To: Eli Zaretskii, Mark Kennedy; +Cc: 51794

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

 >> bug fix #50993 is the bug.  it made make_lispy_position skip setting
 >> posn to the tab_bar if track_mouse is non-nil.  why track_mouse is nil
 >> for some frames and not for others i didn't look into.
 >> thoughts/comments?
 >
 > Please do look into that last part, because we need to understand the
 > situations in which this happens well enough to devise a solution.  We
 > don't want to revert that fix because it will re-introduce a larger
 > problem.  Specifically, why does this happen to you only under those
 > customizations and not in "emacs -Q"?
 >
 > Martin, any suggestions?

Maybe the attached patch helps.

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: 1482 bytes --]

diff --git a/lisp/mouse-drag.el b/lisp/mouse-drag.el
index ecfb359b36..98e18a5c86 100644
--- a/lisp/mouse-drag.el
+++ b/lisp/mouse-drag.el
@@ -282,6 +282,7 @@ mouse-drag-drag
     (setq window-last-row (- (window-height) 2)
 	  window-last-col (- (window-width) 2))
     (track-mouse
+      (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..c94862d01b 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1615,7 +1615,7 @@ mouse-drag-track
       (goto-char (nth 1 range)))

     (setf (terminal-parameter nil 'mouse-drag-start) start-event)
-    (setq track-mouse t)
+    (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..abd9635a92 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5136,7 +5136,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,

 	 This issue should be properly handled by 'mouse-drag-track' and
 	 friends, so the below is only a temporary workaround.  */
-      if (NILP (track_mouse))
+      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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  2021-11-19  9:26                     ` martin rudalics
@ 2021-11-19 13:18                       ` Mark Kennedy
  2021-11-20  8:03                       ` Eli Zaretskii
  1 sibling, 0 replies; 21+ messages in thread
From: Mark Kennedy @ 2021-11-19 13:18 UTC (permalink / raw)
  To: martin rudalics; +Cc: 51794

that patch fixed the problem i observed.  thanks to both of you!
/mark

On Fri, Nov 19, 2021 at 4:26 AM martin rudalics <rudalics@gmx.at> wrote:
>
>  >> bug fix #50993 is the bug.  it made make_lispy_position skip setting
>  >> posn to the tab_bar if track_mouse is non-nil.  why track_mouse is nil
>  >> for some frames and not for others i didn't look into.
>  >> thoughts/comments?
>  >
>  > Please do look into that last part, because we need to understand the
>  > situations in which this happens well enough to devise a solution.  We
>  > don't want to revert that fix because it will re-introduce a larger
>  > problem.  Specifically, why does this happen to you only under those
>  > customizations and not in "emacs -Q"?
>  >
>  > Martin, any suggestions?
>
> Maybe the attached patch helps.
>
> martin





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  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
  1 sibling, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2021-11-20  8:03 UTC (permalink / raw)
  To: martin rudalics; +Cc: 51794, mark.t.kennedy

> Cc: 51794@debbugs.gnu.org
> From: martin rudalics <rudalics@gmx.at>
> Date: Fri, 19 Nov 2021 10:26:52 +0100
> 
>  >> bug fix #50993 is the bug.  it made make_lispy_position skip setting
>  >> posn to the tab_bar if track_mouse is non-nil.  why track_mouse is nil
>  >> for some frames and not for others i didn't look into.
>  >> thoughts/comments?
>  >
>  > Please do look into that last part, because we need to understand the
>  > situations in which this happens well enough to devise a solution.  We
>  > don't want to revert that fix because it will re-introduce a larger
>  > problem.  Specifically, why does this happen to you only under those
>  > customizations and not in "emacs -Q"?
>  >
>  > Martin, any suggestions?
> 
> Maybe the attached patch helps.

Thanks.  Please install this on the emacs-28 branch, but please add
comments explaining why we need this special symbol.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  2021-11-20  8:03                       ` Eli Zaretskii
@ 2021-11-20  8:48                         ` martin rudalics
  2021-11-20  9:07                           ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: martin rudalics @ 2021-11-20  8:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 51794, mark.t.kennedy

 > Thanks.  Please install this on the emacs-28 branch,

I'll try to do that.

 > but please add
 > comments explaining why we need this special symbol.

We don't need a "special" symbol, anything non-nil but 't' will do.
I'll add a comment in that sense.

martin





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  2021-11-20  8:48                         ` martin rudalics
@ 2021-11-20  9:07                           ` Eli Zaretskii
  2021-11-20  9:56                             ` martin rudalics
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2021-11-20  9:07 UTC (permalink / raw)
  To: martin rudalics; +Cc: 51794, mark.t.kennedy

> Cc: mark.t.kennedy@gmail.com, 51794@debbugs.gnu.org
> From: martin rudalics <rudalics@gmx.at>
> Date: Sat, 20 Nov 2021 09:48:55 +0100
> 
>  > Thanks.  Please install this on the emacs-28 branch,
> 
> I'll try to do that.

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

Thanks.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  2021-11-20  9:07                           ` Eli Zaretskii
@ 2021-11-20  9:56                             ` martin rudalics
  2021-11-20 10:08                               ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: martin rudalics @ 2021-11-20  9:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 51794, mark.t.kennedy

[-- 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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  2021-11-20  9:56                             ` martin rudalics
@ 2021-11-20 10:08                               ` Eli Zaretskii
  2021-11-21  9:12                                 ` martin rudalics
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2021-11-20 10:08 UTC (permalink / raw)
  To: martin rudalics; +Cc: 51794-done, mark.t.kennedy

> Cc: mark.t.kennedy@gmail.com, 51794@debbugs.gnu.org
> From: martin rudalics <rudalics@gmx.at>
> Date: Sat, 20 Nov 2021 10:56:13 +0100
> 
> > 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

Thanks, installed, and closing the bug.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  2021-11-20 10:08                               ` Eli Zaretskii
@ 2021-11-21  9:12                                 ` martin rudalics
  2021-11-21 14:56                                   ` Mark Kennedy
  0 siblings, 1 reply; 21+ messages in thread
From: martin rudalics @ 2021-11-21  9:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 51794-done, mark.t.kennedy

> Thanks, installed, and closing the bug.

Thanks for helping.

martin







^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  2021-11-21  9:12                                 ` martin rudalics
@ 2021-11-21 14:56                                   ` Mark Kennedy
  2021-11-21 15:00                                     ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Mark Kennedy @ 2021-11-21 14:56 UTC (permalink / raw)
  To: martin rudalics; +Cc: 51794-done

quick question only indirectly related to the fix.  why would it go
into the emacs-28 branch and not the HEAD branch?  if you're busy,
don't worry about answering.  or both branches?

/mark

On Sun, Nov 21, 2021 at 4:12 AM martin rudalics <rudalics@gmx.at> wrote:
>
> > Thanks, installed, and closing the bug.
>
> Thanks for helping.
>
> martin
>
>





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  2021-11-21 14:56                                   ` Mark Kennedy
@ 2021-11-21 15:00                                     ` Eli Zaretskii
  2021-11-21 15:20                                       ` Mark Kennedy
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2021-11-21 15:00 UTC (permalink / raw)
  To: Mark Kennedy; +Cc: 51794-done

> From: Mark Kennedy <mark.t.kennedy@gmail.com>
> Date: Sun, 21 Nov 2021 09:56:47 -0500
> Cc: Eli Zaretskii <eliz@gnu.org>, 51794-done@debbugs.gnu.org
> 
> quick question only indirectly related to the fix.  why would it go
> into the emacs-28 branch and not the HEAD branch?  if you're busy,
> don't worry about answering.  or both branches?

The release branch gets merged to master quite regularly, so this is
not a problem, and the bonus is that the same commit exists on master
as well.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#51794: 29.0.50; invalid input events generated from a mouse click for the tab bar
  2021-11-21 15:00                                     ` Eli Zaretskii
@ 2021-11-21 15:20                                       ` Mark Kennedy
  0 siblings, 0 replies; 21+ messages in thread
From: Mark Kennedy @ 2021-11-21 15:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 51794-done

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

Got it. Thanks!

On Sun, Nov 21, 2021, 10:00 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Mark Kennedy <mark.t.kennedy@gmail.com>
> > Date: Sun, 21 Nov 2021 09:56:47 -0500
> > Cc: Eli Zaretskii <eliz@gnu.org>, 51794-done@debbugs.gnu.org
> >
> > quick question only indirectly related to the fix.  why would it go
> > into the emacs-28 branch and not the HEAD branch?  if you're busy,
> > don't worry about answering.  or both branches?
>
> The release branch gets merged to master quite regularly, so this is
> not a problem, and the bonus is that the same commit exists on master
> as well.
>

[-- Attachment #2: Type: text/html, Size: 1157 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2021-11-21 15:20 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).