GNU bug report logs - #49803
27.2; Mouse wheel on MacOS is reported as mouse-4 and mouse-5, but Emacs mwheel seems to use wheel-up/wheel-down instead

Previous Next

Package: emacs;

Reported by: Didier <didibus <at> gmail.com>

Date: Sun, 1 Aug 2021 02:29:02 UTC

Severity: normal

Tags: moreinfo

Found in version 27.2

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Didier <didibus <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 49803 <at> debbugs.gnu.org
Subject: bug#49803: 27.2; Mouse wheel on MacOS is reported as mouse-4 and mouse-5, but Emacs mwheel seems to use wheel-up/wheel-down instead
Date: Sun, 1 Aug 2021 23:44:05 -0700
[Message part 1 (text/plain, inline)]
In macOS, when running Emacs in GUI, the wheel is received as <wheel-up>
and <wheel-down> and it all works.

But in macOS, when running inside a terminal such as Terminal.app or
iTerm2, the wheel is received as <mouse-4> and <mouse-5> and it no longer
works, because the defcustom is not smart enough to check if we are running
in GUI or not.

So I think it should be modified to something like:

(if (or (featurep 'w32-win) (and (display-graphic-p) (featurep 'ns-win)))
        'wheel-down
      'mouse-5)

Does that make sense?

On Sat, 31 Jul 2021 at 23:18, Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: Didier <didibus <at> gmail.com>
> > Date: Sat, 31 Jul 2021 19:27:58 -0700
> >
> > I'm on a MacBook Pro with macOS Big Sur, and on both the laptop trackpad
> > and with my plugged in USB mouse, the wheel or 2-finger up/down on
> > trackpad, is reported to Emacs when in terminal as mouse-4 and mouse-5.
> > That means that scroll doesn't work in Terminal.app or in iTerm2 on MAC,
> > since mouse-4 and mouse-5 are not bound.
> >
> > In the GUI Mac it works, because it gets reported as wheel-up and
> > wheel-down.
> >
> > My thought is maybe here
> > https://github.com/emacs-mirror/emacs/blob/master/lisp/mwheel.el#L54
> > there should be an additional check for if its running with a
> > window-system or not?
>
> I don't think I follow.  The defcustoms there say:
>
>   (defcustom mouse-wheel-down-event
>     (if (or (featurep 'w32-win) (featurep 'ns-win))
>         'wheel-up
>       'mouse-4)
>     "Event used for scrolling down."
>     :group 'mouse
>     :type 'symbol
>     :set 'mouse-wheel-change-button)
>
>   (defcustom mouse-wheel-up-event
>     (if (or (featurep 'w32-win) (featurep 'ns-win))
>         'wheel-down
>       'mouse-5)
>     "Event used for scrolling up."
>     :group 'mouse
>     :type 'symbol
>     :set 'mouse-wheel-change-button)
>
> This seems already to cater to macOS, so why isn't it working for you?
>
[Message part 2 (text/html, inline)]

This bug report was last modified 3 years ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.