Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not swap mouse button (emulate libinput input properties) #251

Open
liang16 opened this issue Jan 13, 2023 · 7 comments
Open

Can not swap mouse button (emulate libinput input properties) #251

liang16 opened this issue Jan 13, 2023 · 7 comments

Comments

@liang16
Copy link

liang16 commented Jan 13, 2023

Is there a solution for left-handed people?
thanks!
cry

@matt335672
Copy link
Member

Hi @liang16

Could you add a lot more context please. What are you trying to do, and what doesn't work exactly?

@liang16
Copy link
Author

liang16 commented Jan 14, 2023

Hi @matt335672

  1. My pc is Ubuntu 22.04 x64.
  2. Change the primary mouse button on in "setting".
  3. It's work ok on direct desktop, but not work on xrdp.

图片

thinks.

@matt335672
Copy link
Member

I've had a good look into this, and it doesn't seem to be possible at the moment.

The main problem is that the xrdp mouse driver doesn't support the libinput "Left Handed Enabled" property. If I use xinput list-props on an evdev device I get this:-

Device 'spice vdagent tablet':
	Device Enabled (124):	1
	Coordinate Transformation Matrix (126):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	libinput Natural Scrolling Enabled (264):	0
	libinput Natural Scrolling Enabled Default (265):	0
	libinput Middle Emulation Enabled (266):	0
	libinput Middle Emulation Enabled Default (267):	0
	libinput Calibration Matrix (268):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	libinput Calibration Matrix Default (269):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
        libinput Left Handed Enabled (270):	0
	libinput Left Handed Enabled Default (271):	0
	libinput Send Events Modes Available (247):	1, 0
	libinput Send Events Mode Enabled (248):	0, 0
	libinput Send Events Mode Enabled Default (249):	0, 0
	Device Node (250):	"/dev/input/event4"
	Device Product ID (251):	0, 0
	libinput Drag Lock Buttons (272):	
	libinput Horizontal Scroll Enabled (273):	1
	libinput High Resolution Wheel Scroll Enabled (274):	1

Toggling the GNOME control above changes libinput Left Handed Enabled to 1.

Using get_props on the xrdp mouse driver I get this:-

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 (232):	0
	Device Accel Constant Deceleration (233):	1.000000
	Device Accel Adaptive Deceleration (234):	1.000000
	Device Accel Velocity Scaling (235):	10.000000

I've tried messing about with xinput set-button-map, but I can only set the first two buttons for some reason. Similarly, xmodmap has similar issues.

The same happens with the VNC backend.

The RDP protocol itself has no way to communicate the user's preference from the RDP client that I can find. So I don't think a solution at the xrdp level is right here either.

I'm going to mark this as a 'feature request'. At the moment I can't see the best way to implement this. Anyone have any suggestions?

@matt335672
Copy link
Member

As it happens, I've made some progress on this.

The issues I had with xmodmap yesterday aren't explained but they don't happen just after the X server is started. The old way of swapping buttons in the xmodmap manpage seems OK.

Create etc/X11/Xsession.d/90xrdp-gnome-set-handed with the following contents to set the X server handedness at login time from the GNOME setting:-

# -*- sh -*-
# Xsession.d script to set handedness for a GNOME XRDP session mouse
#
# This file is sourced by Xsession(5), not executed.

if [ -n "$XRDP_SESSION" ]; then
    case "`/usr/bin/dconf read \
           /org/gnome/desktop/peripherals/mouse/left-handed`" in
        true)   /usr/bin/xmodmap -e "pointer = 3 2 1" ;;
        *)      /usr/bin/xmodmap -e "pointer = 1 2 3"
    esac
fi

The required utilities are installed with sudo apt install dconf-cli x11-server-utils.

@liang16 - do you want to try this and report back?

In the longer term, we could go down the route of emulating the libinput-specific device parameters for the xorgxrdp driver. These are text strings defined by the xorg-xf86-input-libinput driver in include/libinput-properties.h. This might work - I haven't tried it yet. Disadvantage of this technique is it only works for the xorgxrdp backend.

@matt335672
Copy link
Member

@liang16 - did you manage to try this?

@BruceJL
Copy link

BruceJL commented Feb 14, 2023

@matt335672 I've tested your above config and it works correctly, with the expected caveat that a full log-off/log-on is required to toggle the setting.

FWIW The x11-server-utils package was not found on my instance of debian stable.

@matt335672
Copy link
Member

Thanks for reporting back @BruceJL

The missing package looks like it's called x11-xserver-utils in Bullseye. My mistake!

I'll move this to a feature request on xorgxrdp.

@matt335672 matt335672 changed the title Can not swap mouse button Can not swap mouse button (emulate libinput input properties) Feb 20, 2023
@matt335672 matt335672 transferred this issue from neutrinolabs/xrdp Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants