From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#66655: 29.1; Clicking buttons sometimes doesn't work Date: Wed, 25 Oct 2023 12:36:00 -0400 Message-ID: References: <1d9187b71e7288eaf08ac9a2f0559bdf@gmail.com> <8334y4s0oe.fsf@gnu.org> <83v8axmbsh.fsf@gnu.org> <83y1fskyjj.fsf@gnu.org> <83il6wktxt.fsf@gnu.org> <83h6mgkst3.fsf@gnu.org> <83edhkkrzd.fsf@gnu.org> <83bkcokoxu.fsf@gnu.org> <83pm12kj44.fsf@gnu.org> <83msw6it17.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22159"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: tomasralph2000@gmail.com, 66655@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 25 18:38:56 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qvguF-0005WX-8J for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Oct 2023 18:38:55 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvgtt-0006E8-Vu; Wed, 25 Oct 2023 12:38:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvgts-0006Cv-8R for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2023 12:38:32 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvgtr-0002qG-W7 for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2023 12:38:32 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qvguL-0004jc-PO for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2023 12:39:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Oct 2023 16:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66655 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 66655-submit@debbugs.gnu.org id=B66655.169825192818178 (code B ref 66655); Wed, 25 Oct 2023 16:39:01 +0000 Original-Received: (at 66655) by debbugs.gnu.org; 25 Oct 2023 16:38:48 +0000 Original-Received: from localhost ([127.0.0.1]:59906 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qvgu7-0004j8-UF for submit@debbugs.gnu.org; Wed, 25 Oct 2023 12:38:48 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:41390) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qvgu6-0004iu-08 for 66655@debbugs.gnu.org; Wed, 25 Oct 2023 12:38:46 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 4FCA8807D7; Wed, 25 Oct 2023 12:38:10 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1698251888; bh=mDpGrFteBwsewLS6EQukliWrzYyX+Zfyf5eTjQfVba0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=mofJI0e0RXk2HlQw8e9NpJthwblqndO7SJ1N9MA9YbLBSS+KROCWEz7v4XLBGMeoC bqydgGzEMZjJFlRfsAdzH/fRzdDNxfJ76+me4JIvhqJm+NtsPRrzePYNBfm9m9Ge1w wNozSjXLHSqiVNZC7LYv0oAkQHJriGOJr8mzeAOT+HdE9mWDcF3gHGP0WxdRL0RhGu 4suTlL2CZkdKMwJzp//XgmMiBO0Z+ATtyQhurVWGpSP1arqb7DfWpsrmh8VCqLLzSu A4mu3Yn0sCzpJqkGL024KeMuMX2372AHRNQG75EOGOIdzXCs4kOS4PqsMidkFAcnF8 mjl0DHF1ZliMw== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 946CF80361; Wed, 25 Oct 2023 12:38:08 -0400 (EDT) Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8099F1201F9; Wed, 25 Oct 2023 12:38:08 -0400 (EDT) In-Reply-To: <83msw6it17.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 25 Oct 2023 19:08:36 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:273201 Archived-At: >> 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