unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: tomasralph2000@gmail.com, 66655@debbugs.gnu.org
Subject: bug#66655: 29.1; Clicking buttons sometimes doesn't work
Date: Wed, 25 Oct 2023 12:36:00 -0400	[thread overview]
Message-ID: <jwvo7gmk719.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83msw6it17.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 25 Oct 2023 19:08:36 +0300")

>> Where do you see that?
> In the test for the equal buffer position.

The old code did:

                if (! (0 < double_click_fuzz
                       && - double_click_fuzz < xdiff
                       && xdiff < double_click_fuzz
                       && - double_click_fuzz < ydiff
                       && ydiff < double_click_fuzz
                       /* Maybe the mouse has moved a lot, caused scrolling, and
                          eventually ended up at the same screen position (but
                          not buffer position) in which case it is a drag, not
                          a click.  */
                       /* FIXME: OTOH if the buffer position has changed
                          because of a timer or process filter rather than
                          because of mouse movement, it should be considered as
                          a click.  But mouse-drag-region completely ignores
                          this case and it hasn't caused any real problem, so
                          it's probably OK to ignore it as well.  */
                       && (EQ (Fcar (Fcdr (start_pos)),
                               Fcar (Fcdr (position))) /* Same buffer pos */
                           || !EQ (Fcar (start_pos),
                                   Fcar (position))))) /* Different window */

which in short is approximately:

                if (! (!mouse_has_moved
                       && (EQ (Fcar (Fcdr (start_pos)),
                               Fcar (Fcdr (position)))
                           || !EQ (Fcar (start_pos),
                                   Fcar (position)))))

If we apply deMorgan we get:

                if (mouse_has_moved
                    || !(EQ (Fcar (Fcdr (start_pos)),
                             Fcar (Fcdr (position)))
                         || !EQ (Fcar (start_pos),
                                 Fcar (position)))))

apply deMorgan again we get:

                if (mouse_has_moved
                    || (!EQ (Fcar (Fcdr (start_pos)),
                             Fcar (Fcdr (position)))
                         && EQ (Fcar (start_pos),
                                Fcar (position)))))

I changed it to:

		if (mouse_has_moved
		    && (!EQ (Fcar (Fcdr (start_pos)),
			     Fcar (Fcdr (position))))
		    && EQ (Fcar (start_pos), Fcar (position)))

The main purpose of the change is to address the "FIXME" in the comment:
if the mouse hasn't moved, I don't think we should generate a `drag`
even if the buffer content under the mouse has changed.

So, IIUC, what you were saying is that with the new code, a small
movement that goes from one buffer position to another both of which are
within the fuzz will be considered as a click whereas with the current
code it will be a `drag`.  Maybe that's worse than the "FIXME" issue it
tries to address?

The other part of the change is the handling of `EQ (Fcar (start_pos),
Fcar (position))` and I must admit I don't know what to do with it, so
this part of the change is largely arbitrary: I don't know why we
currently check this condition nor why we only check it when mouse has
not moved.


        Stefan






  reply	other threads:[~2023-10-25 16:36 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20 20:27 bug#66655: 29.1; Clicking buttons sometimes doesn't work tomasralph2000
2023-10-20 20:38 ` Stefan Kangas
2023-10-21 10:57 ` Eli Zaretskii
2023-10-21 11:23   ` Stefan Kangas
2023-10-21 11:34     ` Eli Zaretskii
2023-10-21 12:05   ` Stefan Kangas
2023-10-23 16:38   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-23 18:30     ` Eli Zaretskii
2023-10-23 22:36       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-24 12:14         ` Eli Zaretskii
2023-10-24 13:44           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-24 13:53             ` Eli Zaretskii
2023-10-24 13:57               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-24 14:18                 ` Eli Zaretskii
2023-10-24 14:29                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-24 14:36                     ` Eli Zaretskii
2023-10-24 14:50                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-24 15:41                         ` Eli Zaretskii
2023-10-24 22:00                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-25 11:59                             ` Eli Zaretskii
2023-10-25 15:13                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-25 16:08                                 ` Eli Zaretskii
2023-10-25 16:36                                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-10-25 16:45                                     ` Eli Zaretskii
2023-10-25 17:27                                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-25 18:29                                         ` Eli Zaretskii
2023-10-25 21:22                                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-26  5:07                                             ` Eli Zaretskii
2023-10-26 14:05                                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-24 13:59               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-23 23:00       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=jwvo7gmk719.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=66655@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=tomasralph2000@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).