neutrinolabs / xorgxrdp

Xorg drivers for xrdp
Other
451 stars 111 forks source link

Natural Scrolling for xrdpMouse #310

Open rowlap opened 5 months ago

rowlap commented 5 months ago
$ xinput list-props xrdpMouse
Device 'xrdpMouse':
        Device Enabled (113):   1
        Coordinate Transformation Matrix (115): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
        Device Accel Profile (231):     0
        Device Accel Constant Deceleration (232):       1.000000
        Device Accel Adaptive Deceleration (233):       1.000000
        Device Accel Velocity Scaling (234):    10.000000

Would it be possible to support Natural Scrolling or a similar option for xrdpMouse, in order to allow end-users to invert the direction of the scroll wheel?

Although this could be handled by the RDP client, Windows for example provides no standard setting to configure the direction of mouse scrolling.

In previous versions of xrdp, scroll wheel (and touchpad?) emulation converted these to button 4 and 5 events which could be overridden with xmodmap pointer settings.

Since xrdp 0.9.25, support for touch controls has replaced button 4/5 clicks, and the xmodmap method no longer works.

rowlap commented 5 months ago

This is similar to #251 in terms of code changes, I think, and might be convenient to consider together.

metalefty commented 5 months ago

It's worth considering.

metalefty commented 4 months ago

I'm working on this. I will submit an initial pull request in May.

metalefty commented 4 months ago

I raised a draft PR #315. We probably need to discuss the specifications.

  1. Where to configure the scrolling direction?
    • xrdp
    • xorgxrdp
  2. Which type of scrolling to reverse?
    • touch
    • control touch and wheel separately
    • all

In my Win11 environment, scroll directions are

  1. Moving two-finger down on touchpad scrolls upward and vice versa
  2. Rotating mouse wheel down scrolls downwards and vice versa

and there's no user-facing interface to change the scrolling direction as @rowlap mentioned. I remember it was possible a few years ago though.

We probably don't want to reverse wheel scroll directions so I implemented reversing touch scroll first. If we control the scrolling direction on xrdp side, we need to care about VNC backend that doesn't distinguish between touch scroll and wheel scroll.

@rowlap @matt335672 What do you think?

metalefty commented 4 months ago

Also, it would be nice if we could configure this kind of configuration via libinput.

rowlap commented 4 months ago

Where to configure the scrolling direction?

If the virtualized mouse / touchpad were to advertise support for what libinput calls "Natural scrolling", I think we'd be fine. The request came via a user who was previously overriding with xmodmap, for mouse wheel direction.

matt335672 commented 4 months ago

I've had a quick look at this.

The TigerVNC (at least for 1.12.0) is similar to the xrdp one:-

$ xinput list
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ TigerVNC pointer                          id=6    [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ TigerVNC keyboard                         id=7    [slave  keyboard (3)]
$ xinput list-props 'TigerVNC pointer'
Device 'TigerVNC pointer':
    Device Enabled (119):   1
    Coordinate Transformation Matrix (121): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    Device Accel Profile (240): 0
    Device Accel Constant Deceleration (241):   1.000000
    Device Accel Adaptive Deceleration (242):   1.000000
    Device Accel Velocity Scaling (243):    10.000000

Adding support for libinput won't automatically work with VNC, but if we can get this working it might(?) be possible to raise a PR on TigerVNC.

From what I can tell, we'd need to pull bits of the xf86-ibput-libinput driver into xrdpmouse.

The repo for that driver is here, but it looks like it's about to go away for 48 hours:-

https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput

Debian mirror is here:-

https://salsa.debian.org/xorg-team/driver/xserver-xorg-input-libinput

I'd be happy to look at it, but I'm a bit snowed under at the moment.