From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jared Finder via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#68698: 30.0.50; Making xt-mouse emit `wheel-up/down` Date: Thu, 25 Jan 2024 17:41:20 -0800 Message-ID: <6f61db136adaa613660edbae970840b9@finder.org> References: <86o7d9dg5e.fsf@gnu.org> Reply-To: Jared Finder Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11047"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68698@debbugs.gnu.org, Stefan Monnier To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 26 02:42:17 2024 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 1rTBEW-0002hl-O3 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 26 Jan 2024 02:42:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTBEE-0006bX-5H; Thu, 25 Jan 2024 20:41:58 -0500 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 1rTBEC-0006ay-OJ for bug-gnu-emacs@gnu.org; Thu, 25 Jan 2024 20:41:56 -0500 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 1rTBEC-0001tp-GD for bug-gnu-emacs@gnu.org; Thu, 25 Jan 2024 20:41:56 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rTBEI-0003LT-C9 for bug-gnu-emacs@gnu.org; Thu, 25 Jan 2024 20:42:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jared Finder Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 26 Jan 2024 01:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68698 X-GNU-PR-Package: emacs Original-Received: via spool by 68698-submit@debbugs.gnu.org id=B68698.170623329012809 (code B ref 68698); Fri, 26 Jan 2024 01:42:02 +0000 Original-Received: (at 68698) by debbugs.gnu.org; 26 Jan 2024 01:41:30 +0000 Original-Received: from localhost ([127.0.0.1]:49751 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTBDl-0003KX-JD for submit@debbugs.gnu.org; Thu, 25 Jan 2024 20:41:30 -0500 Original-Received: from greenhill.hpalace.com ([192.155.80.58]:44636) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTBDj-0003KO-ME for 68698@debbugs.gnu.org; Thu, 25 Jan 2024 20:41:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=finder.org; s=2018; t=1706233280; bh=QjIb5VA5WzG65UooJlVjdhQ+/j8bGqzd324g/qatx8M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gqXc9p8huEH12euQAPUFhaYHfi/WumCFpDNNO02OsTwTrUlzwgZ9Ayeko37XsYVF0 T9BnNWc1wAiRMtzsgtv64b7ANxyvQ0sMRtAcal+TkoEMTn1M6aoDSZ6XzjY2hPiu+R A9Uzdkw8TAVvBkhrFWGK1o2ci8it91S46a3qzeEfLsOJidZWUzTAiGI19VhiS983JE dT5P8cyu0B7k/d02da9tWWGRmxyHF7wgcctSdltxfRIBZov2aoAs5LeVxaTG/utidv 6iZqWbMyvfbHuXd0GlWaiKAwoKImc2uGyCUfX8HUJca5uscoNJLFaaZrnjBKPLttzL LJZe8Ux2nHHLQ== Original-Received: from mail.finder.org (unknown [192.155.80.58]) by greenhill.hpalace.com (Postfix) with ESMTPSA id 91791A68; Fri, 26 Jan 2024 01:41:20 +0000 (UTC) In-Reply-To: <86o7d9dg5e.fsf@gnu.org> X-Sender: jared@finder.org 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:278889 Archived-At: On 2024-01-24 23:30, Eli Zaretskii wrote: >> Date: Wed, 24 Jan 2024 15:31:32 -0500 >> From: Stefan Monnier via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >> >> Package: Emacs >> Version: 30.0.50 >> >> >> Currently, wheel-up/down events are generated in most setups instead >> of the old mouse-4/5. There are still two exceptions: >> - X11 builds not using XInput2. >> - text terminals. >> The attached patch intends to fix the second bullet. >> Text terminals themselves only give us info equivalent to `mouse-4/5` >> and don't actually tell us that it's a wheel movement, but we can >> still >> turn those things into `wheel-up/down`. >> >> This is related to bug#49803. > > Jared, any comments on the patch, or related issues? > > Thanks. > >> The second step would be to do something similar for the non-XInput2 >> X11 >> build: make it generate `wheel-up/down` events according to >> `mouse-wheel-down/up-event` settings. Then packages like >> `completion-preview` and `mwheel` won't need to pay attention to the >> (confusingly named) `mouse-wheel-down/up-event` vars any more. I'll be so happy if everything switches over to mouse-up / mouse-down events. This would be great. I'd love to ignore mouse-wheel-down-event and mouse-wheel-down-alternate-event. >> diff --git a/lisp/mwheel.el b/lisp/mwheel.el >> @@ -231,12 +239,24 @@ xterm-mouse--read-event-sequence >> ;; event: assume, that the last button was button 1. >> (t 1))) >> (sym (if move 'mouse-movement >> - (intern (concat (if ctrl "C-" "") >> - (if meta "M-" "") >> - (if shift "S-" "") >> - (if down "down-" "") >> - "mouse-" >> - (number-to-string btn)))))) >> + (intern >> + (concat >> + (if ctrl "C-" "") >> + (if meta "M-" "") >> + (if shift "S-" "") >> + (if down "down-" "") >> + (cond >> + ;; BEWARE: `mouse-wheel-UP-event' corresponds to >> + ;; `wheel-DOWN' events and vice versa!! >> + ((xterm-mouse--same-button-p mouse-wheel-down-event >> btn) >> + "wheel-up") >> + ((xterm-mouse--same-button-p mouse-wheel-up-event >> btn) >> + "wheel-down") >> + ((xterm-mouse--same-button-p mouse-wheel-left-event >> btn) >> + "wheel-left") >> + ((xterm-mouse--same-button-p mouse-wheel-right-event >> btn) >> + "wheel-right") I think there is a bug with mouse-wheel-up/down/left/right-event and alternate event where it doesn't take window-system into account. Without fixing that bug, this won't work because it is valid for mouse-wheel-up-event to be wheel-down in a terminal. A local run of HEAD (as of Jan 17, I'm at daec3e) with "./configure --with-pgtk" has mouse-wheel-up-event set to wheel-down because (featurep 'pgtk-win) is t, even with -nw on the command line. Testing on Windows at Emacs 29.1 shows the same behavior. Also, I do not think xt-mouse knows how to generate mouse-6 or mouse-7 events. I think to generate events beyond mouse-5, you need to test against the 128 bit as well. I don't have mouse hardware to confirm this behavior. -- MJF