From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alex Newsgroups: gmane.emacs.bugs 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 Message-ID: <87d15yd3kf.fsf@gmail.com> References: <87r2unyh79.fsf@gmail.com> <83zi95x4of.fsf@gnu.org> <87376xxhcg.fsf@gmail.com> <8360bswxx6.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1507413495 11851 195.159.176.226 (7 Oct 2017 21:58:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 7 Oct 2017 21:58:15 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 28658@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 07 23:58:10 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e0x6l-0001fL-8A for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Oct 2017 23:58:07 +0200 Original-Received: from localhost ([::1]:51310 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0x6q-0004sJ-HJ for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Oct 2017 17:58:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0x6j-0004sA-Pe for bug-gnu-emacs@gnu.org; Sat, 07 Oct 2017 17:58:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e0x6g-0005Al-LH for bug-gnu-emacs@gnu.org; Sat, 07 Oct 2017 17:58:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46492) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e0x6g-0005AC-GC for bug-gnu-emacs@gnu.org; Sat, 07 Oct 2017 17:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e0x6g-0000AM-6H for bug-gnu-emacs@gnu.org; Sat, 07 Oct 2017 17:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alex Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Oct 2017 21:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28658 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 28658-submit@debbugs.gnu.org id=B28658.1507413437583 (code B ref 28658); Sat, 07 Oct 2017 21:58:02 +0000 Original-Received: (at 28658) by debbugs.gnu.org; 7 Oct 2017 21:57:17 +0000 Original-Received: from localhost ([127.0.0.1]:55173 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e0x5x-00009L-Ay for submit@debbugs.gnu.org; Sat, 07 Oct 2017 17:57:17 -0400 Original-Received: from mail-io0-f178.google.com ([209.85.223.178]:45875) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e0x5u-000096-2P for 28658@debbugs.gnu.org; Sat, 07 Oct 2017 17:57:15 -0400 Original-Received: by mail-io0-f178.google.com with SMTP id i38so6262965iod.2 for <28658@debbugs.gnu.org>; Sat, 07 Oct 2017 14:57:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=pVD3AuY1oW7v4naRyXTMO+wvTHVPAFQbotBAwoO56V0=; b=RR6F/F+bGjNYgvU4A6ah0FZfraubk7vb9Hf3eNFnbawXPrAsRvf8vPeUxvtmGUPhCx T0YeAZcDjYKxaNFJtNiaGE/hxOwtGhW/DCntItbutJrN9MntM8yLYdkI6KhuYdH2dtSi lqZ2X6kTEIgh6SUcGcCMw9AFTelvDy3imeCRW9R96QdujRY0Y1TvLAxzn2TmKxi0y/1k 3KBw1U7SQhivHhE1cUn124fYgv5kMgMCQg+4macfAua8GejlnNaEN5BYsCKv3AkBttD5 12DqDDVrcfcqrrPvBMEEoAvIp3x6XiW7kPHxpQ9+y1khTwrW5rHQT/Zumz3BawxdeusI DIbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=pVD3AuY1oW7v4naRyXTMO+wvTHVPAFQbotBAwoO56V0=; b=OVemui4un893xX0/1zE9U6zWeABLakdaR4lfXFw47f1GJZ4s6ew2THechb12B0YAeg anlgG5z34Msdn1kOX/cuFvWNV/s8QyLTZYh/U5p0/i3/LcSsPxhlHmLVltwgRlsk0vFM e9UbVHpAHkw3/WoK4/KdbeyDA2GdCiSl8/tKk5g3SgwLt4a+D13z2iRpBWMi5c5E1+M6 iJRXs860VXUNvOv0nK9fvGDy7ozQoGaP2/PzmGARssO6yFjgZ3i9xXFazvoG3ZsDvm8Q +5TA0w71z/3cLvN2os7ZAAJX82D/ulj2gfpEoYolNWsFzhA9YQ+9juruXUerEHDKOCjs MK0g== X-Gm-Message-State: AMCzsaVC9QQrCoFtvw8YZOA9xi/6tWu66SkHrmbIG0+tehmCm3RdPeTd aP9K55BMI11WZDuGZ7oNpHFc+g== X-Google-Smtp-Source: AOwi7QAB646I/Shq26XBhEohO/2HrruiyUaKMcYajuvYbdZww2mg0wgS5dM6MiLiMHeZCyBnewHtuQ== X-Received: by 10.107.153.81 with SMTP id b78mr7884448ioe.231.1507413427852; Sat, 07 Oct 2017 14:57:07 -0700 (PDT) Original-Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59]) by smtp.gmail.com with ESMTPSA id 199sm2433094itv.37.2017.10.07.14.57.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 07 Oct 2017 14:57:06 -0700 (PDT) In-Reply-To: <8360bswxx6.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 06 Oct 2017 10:14:13 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:138058 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Alex >> Cc: 28658@debbugs.gnu.org >> Date: Thu, 05 Oct 2017 18:14:39 -0600 >> >> Eli Zaretskii 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: --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Increase-xterm-click-count-only-within-double-click-.patch Content-Description: xterm >From e9c7aca2ade951e03f67db66bb8d2608d740936d Mon Sep 17 00:00:00 2001 From: Alexander Gramiak 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 --=-=-=--