bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66655: 29.1; Clicking buttons sometimes doesn't work


From: Stefan Monnier
Subject: bug#66655: 29.1; Clicking buttons sometimes doesn't work
Date: Wed, 25 Oct 2023 12:36:00 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

>> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]