From: Alex <agrambot@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 28658@debbugs.gnu.org
Subject: bug#28658: 27.0.50; [PATCH] double/triple clicking in xterm-mouse-mode doesn't respect mouse position
Date: Sat, 07 Oct 2017 15:57:04 -0600 [thread overview]
Message-ID: <87d15yd3kf.fsf@gmail.com> (raw)
In-Reply-To: <8360bswxx6.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 06 Oct 2017 10:14:13 +0300")
[-- Attachment #1: Type: text/plain, Size: 1306 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Alex <agrambot@gmail.com>
>> Cc: 28658@debbugs.gnu.org
>> Date: Thu, 05 Oct 2017 18:14:39 -0600
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>>
>> >> @@ -290,12 +292,14 @@ xterm-mouse-event
>> >> (xterm-mouse--set-click-count event click-count)))
>> >> ((not last-time) nil)
>> >> ((and (> double-click-time (* 1000 (- this-time last-time)))
>> >> + (eq x last-x)
>> >> + (eq y last-y)
>> >
>> > IMO, 'eq' is not right here: this test should obey the value of
>> > double-click-fuzz, whose units on TTY frames are 1/8 of a character.
>>
>> I don't understand how to use double-click-fuzz in TTY frames. You said
>> that TTY frames can't discern screen position differences of less than a
>> character, so then why are the units 1/8th of a character?
>
> I don't know why the units are 1/8th of a character, perhaps so that a
> user could set the same value for both GUI and TTY frames. In any
> case, dividing the value of double-click-fuzz by 8 before comparing
> with coordinate differences is easy enough, no?
Yes, I was just confused about the units, but that makes sense. Though
in my GTK Emacs, (frame-char-width) returns 9 instead of 8 for me...
Anyway, here's the patch:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: xterm --]
[-- Type: text/x-diff, Size: 1866 bytes --]
From e9c7aca2ade951e03f67db66bb8d2608d740936d Mon Sep 17 00:00:00 2001
From: Alexander Gramiak <agrambot@gmail.com>
Date: Sat, 30 Sep 2017 15:47:56 -0600
Subject: [PATCH] Increase xterm click count only within double-click-fuzz
* lisp/xt-mouse.el (xterm-mouse-event): Save the last click's position
and check it against the current click's position.
---
lisp/xt-mouse.el | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index d268e1a3fe..d704cfa4e8 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -278,6 +278,8 @@ xterm-mouse-event
(last-name (symbol-name last-type))
(last-time (nth 1 last-click))
(click-count (nth 2 last-click))
+ (last-x (nth 3 last-click))
+ (last-y (nth 4 last-click))
(this-time (float-time))
(name (symbol-name type)))
(cond
@@ -292,12 +294,16 @@ xterm-mouse-event
double-click-time
(or (eq double-click-time t)
(> double-click-time (* 1000 (- this-time last-time))))
+ (<= (abs (- x last-x))
+ (/ double-click-fuzz 8))
+ (<= (abs (- y last-y))
+ (/ double-click-fuzz 8))
(equal last-name (replace-match "" t t name)))
(setq click-count (1+ click-count))
(xterm-mouse--set-click-count event click-count))
(t (setq click-count 1)))
(set-terminal-parameter nil 'xterm-mouse-last-click
- (list type this-time click-count)))
+ (list type this-time click-count x y)))
(set-terminal-parameter nil 'xterm-mouse-x x)
(set-terminal-parameter nil 'xterm-mouse-y y)
--
2.14.2
next prev parent reply other threads:[~2017-10-07 21:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-30 22:06 bug#28658: 27.0.50; [PATCH] double/triple clicking in xterm-mouse-mode doesn't respect mouse position Alex
2017-10-01 3:56 ` Alex
2017-10-01 8:23 ` martin rudalics
2017-10-01 18:30 ` Alex
2017-10-05 10:52 ` Eli Zaretskii
2017-10-05 10:52 ` Eli Zaretskii
2017-10-06 0:03 ` Alex
2017-10-06 7:44 ` Eli Zaretskii
2017-10-09 2:37 ` Alex
2017-10-09 7:11 ` Eli Zaretskii
2017-10-05 10:36 ` Eli Zaretskii
2017-10-06 0:14 ` Alex
2017-10-06 7:14 ` Eli Zaretskii
2017-10-07 21:57 ` Alex [this message]
2017-10-08 7:42 ` Eli Zaretskii
2017-10-08 23:44 ` Alex
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=87d15yd3kf.fsf@gmail.com \
--to=agrambot@gmail.com \
--cc=28658@debbugs.gnu.org \
--cc=eliz@gnu.org \
/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).