emacs升级29.x后鼠标滚轮无法识别

大家好,这件事的起因是想在虚拟机中使用最新的emacs,编译后发现鼠标滚轮无法使用,所以进行如下测试: 测试平台: Linux centos 7.9.2009,虚拟机VMware 17.0.0,鼠标罗技G502 测试步骤及结果:以下均使用emacs -Q启动

  1. 分别编译emacs29.3和29.1,滚轮无法使用
  2. 编译emacs28.1,滚轮可以使用
  3. 使用C-h k捕捉鼠标滚轮,发现28.x之前的可以捕捉到mouse-4 & mouse-5,29.x根本无法捕捉mouse-4 和mouse-5,但是可以捕捉到mouse-1 mouse-2 mouse-3

目前我已经没有什么思路去排查了,想请教一下大家还有没有其他的办法能debug的,想使用最新的emacs但奈何无能为力了,谢谢!

mouse 4 mouse 5? 是侧边功能键?

是滚轮。

If you have a mouse with a wheel, the wheel events are commonly bound to either wheel-down or wheel-up, or mouse-4 and mouse-5, but that depends on the operating system configuration.

In general, legacy X systems and terminals (see Using a Mouse in Text Terminals) will report mouse-4 and mouse-5, while all other systems will report wheel-down and wheel-up.

C-h k 就滚轮识别不出来?其他都可以?

请运行

xinput list --long

是的,目前测试滚轮识别不出来。。不过侧边功能按键也识别不出来,但是侧边功能按键这个之前旧版本就不行,怀疑鼠标驱动,就没深究

前辈您好,我从shell中执行如您所说命令,返回结果如下,可否麻烦您帮忙解读一下这个结果能说明什么呢?感激不尽!

[kyle@localhost emacs_rcfile]$ xinput list 
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ VMware VMware Virtual USB Mouse         	id=7	[slave  pointer  (2)]
⎜   ↳ VirtualPS/2 VMware VMMouse              	id=9	[slave  pointer  (2)]
⎜   ↳ VirtualPS/2 VMware VMMouse              	id=10	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=8	[slave  keyboard (3)]

[kyle@localhost emacs_rcfile]$ xinput list --long
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
	Reporting 5 classes:
		Class originated from: 10. Type: XIButtonClass
		Buttons supported: 16
		Button labels: "Button Left" "Button Unknown" "Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right" None None None None None None None None None
		Button state:
		Class originated from: 10. Type: XIValuatorClass
		Detail for Valuator 0:
		  Label: Rel X
		  Range: -1.000000 - -1.000000
		  Resolution: 1 units/m
		  Mode: relative
		Class originated from: 10. Type: XIValuatorClass
		Detail for Valuator 1:
		  Label: Rel Y
		  Range: -1.000000 - -1.000000
		  Resolution: 1 units/m
		  Mode: relative
		Class originated from: 10. Type: XIValuatorClass
		Detail for Valuator 2:
		  Label: Rel Vert Wheel
		  Range: -1.000000 - -1.000000
		  Resolution: 1 units/m
		  Mode: relative
		Class originated from: 10. Type: XIScrollClass
		Scroll info for Valuator 2
		  type: 1 (vertical)
		  increment: -1.000000
		  flags: 0x2 ( preferred )

⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
	Reporting 3 classes:
		Class originated from: 4. Type: XIButtonClass
		Buttons supported: 10
		Button labels: "Button Left" "Button Middle" "Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right" None None None
		Button state:
		Class originated from: 4. Type: XIValuatorClass
		Detail for Valuator 0:
		  Label: Rel X
		  Range: -1.000000 - -1.000000
		  Resolution: 0 units/m
		  Mode: relative
		Class originated from: 4. Type: XIValuatorClass
		Detail for Valuator 1:
		  Label: Rel Y
		  Range: -1.000000 - -1.000000
		  Resolution: 0 units/m
		  Mode: relative

⎜   ↳ VMware VMware Virtual USB Mouse         	id=7	[slave  pointer  (2)]
	Reporting 5 classes:
		Class originated from: 7. Type: XIButtonClass
		Buttons supported: 16
		Button labels: "Button Left" "Button Middle" "Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right" "Button Side" "Button Extra" "Button Forward" "Button Back" "Button Task" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown"
		Button state:
		Class originated from: 7. Type: XIValuatorClass
		Detail for Valuator 0:
		  Label: Rel X
		  Range: -1.000000 - -1.000000
		  Resolution: 1 units/m
		  Mode: relative
		Class originated from: 7. Type: XIValuatorClass
		Detail for Valuator 1:
		  Label: Rel Y
		  Range: -1.000000 - -1.000000
		  Resolution: 1 units/m
		  Mode: relative
		Class originated from: 7. Type: XIValuatorClass
		Detail for Valuator 2:
		  Label: Rel Vert Wheel
		  Range: -1.000000 - -1.000000
		  Resolution: 1 units/m
		  Mode: relative
		Class originated from: 7. Type: XIScrollClass
		Scroll info for Valuator 2
		  type: 1 (vertical)
		  increment: -1.000000
		  flags: 0x2 ( preferred )

⎜   ↳ VirtualPS/2 VMware VMMouse              	id=9	[slave  pointer  (2)]
	Reporting 3 classes:
		Class originated from: 9. Type: XIButtonClass
		Buttons supported: 5
		Button labels: "Button Left" "Button Middle" "Button Right" "Button Wheel Up" "Button Wheel Down"
		Button state:
		Class originated from: 9. Type: XIValuatorClass
		Detail for Valuator 0:
		  Label: Abs X
		  Range: 0.000000 - 65535.000000
		  Resolution: 0 units/m
		  Mode: absolute
		  Current value: 29401.000000
		Class originated from: 9. Type: XIValuatorClass
		Detail for Valuator 1:
		  Label: Abs Y
		  Range: 0.000000 - 65535.000000
		  Resolution: 0 units/m
		  Mode: absolute
		  Current value: 42012.000000

⎜   ↳ VirtualPS/2 VMware VMMouse              	id=10	[slave  pointer  (2)]
	Reporting 5 classes:
		Class originated from: 10. Type: XIButtonClass
		Buttons supported: 7
		Button labels: "Button Left" "Button Unknown" "Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right"
		Button state:
		Class originated from: 10. Type: XIValuatorClass
		Detail for Valuator 0:
		  Label: Rel X
		  Range: -1.000000 - -1.000000
		  Resolution: 1 units/m
		  Mode: relative
		Class originated from: 10. Type: XIValuatorClass
		Detail for Valuator 1:
		  Label: Rel Y
		  Range: -1.000000 - -1.000000
		  Resolution: 1 units/m
		  Mode: relative
		Class originated from: 10. Type: XIValuatorClass
		Detail for Valuator 2:
		  Label: Rel Vert Wheel
		  Range: -1.000000 - -1.000000
		  Resolution: 1 units/m
		  Mode: relative
		Class originated from: 10. Type: XIScrollClass
		Scroll info for Valuator 2
		  type: 1 (vertical)
		  increment: -1.000000
		  flags: 0x2 ( preferred )

⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
	Reporting 1 classes:
		Class originated from: 8. Type: XIKeyClass
		Keycodes supported: 248

    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
	Reporting 1 classes:
		Class originated from: 5. Type: XIKeyClass
		Keycodes supported: 248

    ↳ Power Button                            	id=6	[slave  keyboard (3)]
	Reporting 1 classes:
		Class originated from: 6. Type: XIKeyClass
		Keycodes supported: 248

    ↳ AT Translated Set 2 keyboard            	id=8	[slave  keyboard (3)]
	Reporting 1 classes:
		Class originated from: 8. Type: XIKeyClass
		Keycodes supported: 248

照理说驱动应该没问题,你虚拟机里面其他应用滚轮可以用,驱动就没有问题。 我用的也是G502,要不你虚拟机里面下载个G HUB看看,看看按键宏有没有重新被定义

g hub没有Linux的吧。。?我没找到哎,不过win下的g hub里我没对滚轮做绑定,使用的默认配置

请运行 xinput test-xi2, 然后在弹出的窗口上滚动鼠标,再将输出发过来。

您好,我贴出来看着似乎和滚轮相关的一段供您参考,详细log信息我放在了附件中,结果如下:

EVENT type 4 (ButtonPress)
    device: 10 (10)
    detail: 4
    flags: emulated
    root: 1781.47/170.49
    event: 85.47/105.49
    buttons:
    modifiers: locked 0x10 latched 0 base 0 effective: 0x10
    group: locked 0 latched 0 base 0 effective: 0
    valuators:
    windows: root 0x3ad event 0x4000001 child 0x0
EVENT type 4 (ButtonPress)
    device: 2 (10)
    detail: 4
    flags: emulated
    root: 1781.47/170.49
    event: 85.47/105.49
    buttons:
    modifiers: locked 0x10 latched 0 base 0 effective: 0x10
    group: locked 0 latched 0 base 0 effective: 0
    valuators:
    windows: root 0x3ad event 0x4000001 child 0x0
EVENT type 16 (RawButtonRelease)
    device: 2 (10)
    detail: 4
    flags: emulated
    valuators:
EVENT type 5 (ButtonRelease)
    device: 10 (10)
    detail: 4
    flags: emulated
    root: 1781.47/170.49
    event: 85.47/105.49
    buttons: 4
    modifiers: locked 0x10 latched 0 base 0 effective: 0x10
    group: locked 0 latched 0 base 0 effective: 0
    valuators:
    windows: root 0x3ad event 0x4000001 child 0x0
EVENT type 5 (ButtonRelease)
    device: 2 (10)
    detail: 4
    flags: emulated
    root: 1781.47/170.49
    event: 85.47/105.49
    buttons: 4
    modifiers: locked 0x10 latched 0 base 0 effective: 0x10
    group: locked 0 latched 0 base 0 effective: 0
    valuators:
    windows: root 0x3ad event 0x4000001 child 0x0

附件: raw.githubusercontent.com/ic-liuwei/temp/main/inputx.log

VMware 驱动有 bug,XI 2.1 环境下不应该只生成 emulated ButtonPress 和 ButtonRelease,尤其在有 aluator 的情况下。

那大佬我有一个疑问,那为啥他其他应用可以用滚轮使用呀。如果驱动有问题,不应该所有的都不能用吗?专门针对emacs29?

我这边也遇到了一个诡异的问题:在Windows上的Emacs 29可以使用USB鼠标滚轮滚动,但是用触控板双指滚动都识别成了向上滚动

那请教一下我或许可以用什么办法来改善一下呢?没有滚轮的感觉真难受emmmm

其他软件不像 Emacs 一样严格遵守 XInput 2 标准。

1 个赞

可以编译时关闭 --with-xinput2

这个 bug 已经修好了,建议升级至 emacs 29.2.

好的感谢,我试一下~

很奇怪。。我忽然发现,我在root下滚轮就是好使的,但是user下不行;

我看了一下,29以下是以<mouse-4>/<mouse-5>来接收鼠标滚轮的事件的,但是29是以<wheel-up>/<wheel-down>来接收的,是不是这块有差异导致的呢?

感谢大佬,configuration的时候加上就可以了!