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: Thu, 26 Oct 2023 10:05:39 -0400 Message-ID: References: <1d9187b71e7288eaf08ac9a2f0559bdf@gmail.com> <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> <83h6meiraw.fsf@gnu.org> <83fs1yimho.fsf@gnu.org> <837cnahsyf.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="30960"; 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 Thu Oct 26 16:06:48 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 1qw10X-0007kD-8y for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Oct 2023 16:06:45 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qw10L-0006Jc-8J; Thu, 26 Oct 2023 10:06:33 -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 1qw10K-0006JU-2N for bug-gnu-emacs@gnu.org; Thu, 26 Oct 2023 10:06: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 1qw10J-0000Ic-QR for bug-gnu-emacs@gnu.org; Thu, 26 Oct 2023 10:06:31 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qw10o-0000hV-IR for bug-gnu-emacs@gnu.org; Thu, 26 Oct 2023 10:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Oct 2023 14:07:02 +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.16983291802641 (code B ref 66655); Thu, 26 Oct 2023 14:07:02 +0000 Original-Received: (at 66655) by debbugs.gnu.org; 26 Oct 2023 14:06:20 +0000 Original-Received: from localhost ([127.0.0.1]:34276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qw107-0000gW-Tt for submit@debbugs.gnu.org; Thu, 26 Oct 2023 10:06:20 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:47280) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qw106-0000gJ-2L for 66655@debbugs.gnu.org; Thu, 26 Oct 2023 10:06:18 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 9076F100126; Thu, 26 Oct 2023 10:05:41 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1698329140; bh=VCaYXZ6APVIGstYBG9/JbeCAg79D4b8s9yNfXSbfnf4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=m2Mpn+I+8/lMpPzy2iklAcAY4RF0MgB9Z0jFpbO9dYhoJjUEAwOr58il4JIv5phpd MHjZDg9gXQJ5AO+4QGRBl8CBsvA79/hzCCs1xVFgItWugOG2ZtlLV2P9VZ7lTJ7DA1 dhYGuRFqvJX9DCrL6LQRcfOS8LAxGkNPAGpYwZDmtP7JlZm57DLNQY5Ko36Dh/B0DE tPL7DF09u9M9DGszhkno3sB/3kiwKiwHsIim0pxekoCVUy1XdJ48oJ9QEOUDd0+u2h bKEw87OkZr6ZiIrQCBWy8ueOnzRmAoANsZhS9tiDdQ6akzdxRcoCrq4TCySix+2O8+ 1RdonUDeRAELg== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D30A3100061; Thu, 26 Oct 2023 10:05:40 -0400 (EDT) Original-Received: from pastel (unknown [45.72.195.71]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B1BB91201FA; Thu, 26 Oct 2023 10:05:40 -0400 (EDT) In-Reply-To: <837cnahsyf.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 26 Oct 2023 08:07:52 +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:273291 Archived-At: >> Because as soon as `note_mouse_highlight` receives information that the >> mouse is outside of the fuzz, the var is set to `false` [ And it's only >> set to true when we get the mouse-down event ]. > > I don't think I understand this explanation. (Did you mean "true" > instead of "false"?) Yes, I reversed them (and I made a similar mistake in one of the comments in the patch. I'm having some kind of "polarity issue", apparently, sorry 'bout that). > You started by saying that your code detects mouse movement, and I > asked how does it detect it. AFAIR, Emacs doesn't receive > mouse-motion events unless we turn on track-mouse, which we usually > avoid doing. It does receive them (it uses them for `mouse-face` highlighting). `track-mouse` only controls whether those C-level events get turned into ELisp-level events. >> > Yes: we can be at the same buffer position, but a different window. >> Right, but what's the problem with that? > > You could have redisplay change the windows under your feet, such that > the screen coordinates are the same, the buffer position is the same, > but the window is not the same. That test wants to emit a drag event > in such a case. That is my understanding of the test. No, the code does: if (mouse_has_moved || (!EQ (Fcar (Fcdr (start_pos)), Fcar (Fcdr (position))) && EQ (Fcar (start_pos), Fcar (position))))) so the last `EQ` *prevents* emitting a drag event when the window has changed (but only when the mouse's start and end screen position are the same). >> I think my code is immune to this problem since with it we only ever >> generate a drag event if the mouse actually moved. Which leads to >> a further simplification of the code, see patch below. > I still don't understand the implication of the mouse_has_moved part. The implication, AFAICT is that with my current code you can't easily drag over a distance less than fuzz: down-mouse-1 ...move a tiny bit to the next char-cell... up-mouse-1 will turn into a click. But indeed, that's what the fuzz is about because the above "move" could have been accidental the mere result of pushing the mouse button (what I'd call "click with noise"). Not sure how to distinguish the above drag from a "click with noise". Maybe we should take *time* into account? Stefan