You are not logged in.

#1 2022-12-23 06:38:16

Jazztache
Member
Registered: 2022-10-07
Posts: 65

Mapping Tablet Stylus Across Arbitrary Co-ordinates

Hello!

I am using a Huion Kamvas 16 on Arch Linux with KDE Plasma as my desktop. On startup, there is a bug where my tablet cursor is mapped across all three of my screens. My main monitor on the top left, my second monitor on the top right, and my tablet screen on the bottom left.

This is actually kind of cool, and it allows me to access windows from other screens. In order to start drawing, I usually open a terminal and type in

xinput map-to-output 9 DP-0

, which then maps the co-ordinates of the pen to the tablet properly.

I would like to understand and learn how this works, so I can replicate the bug where my cursor is mapped across all screens when I want, and then map it to just the tablet when it's time to do some drawing.

Here's my xrandr

DP-0 connected primary 1920x1080+0+1080 (normal left inverted right x axis y axis) 345mm x 195mm
   1920x1080     59.93*+  60.00  
   1680x1050     59.95  
   1600x1200     60.00  
   1600x900      60.00  
   1400x1050     59.98  
   1366x768      59.79  
   1280x1024     60.02  
   1280x960      60.00  
   1024x768      60.00  
   800x600       60.32    56.25  
   640x480       59.94  
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 597mm x 336mm
   1920x1080    144.00*+ 119.98   119.88    60.00    59.94    50.00  
   1680x1050     59.95  
   1366x768      59.79  
   1280x1024     75.02    60.02  
   1280x800      59.81  
   1280x720      59.94    50.00  
   1152x864      75.00  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    59.94    59.93  
DP-3 disconnected (normal left inverted right x axis y axis)
HDMI-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 522mm x 272mm
   1920x1080     60.00 +  74.97*   59.94    50.00  
   1680x1050     59.95  
   1600x900      60.00  
   1440x900      59.89  
   1280x1024     75.02    60.02  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94  
DP-4 disconnected (normal left inverted right x axis y axis)
DP-5 disconnected (normal left inverted right x axis y axis)

... and xinput

⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Tablet Monitor Pen stylus                 id=9    [slave  pointer  (2)]
⎜   ↳ Tablet Monitor Pad pad                    id=10   [slave  pointer  (2)]
⎜   ↳ Tablet Monitor Touch Strip pad            id=11   [slave  pointer  (2)]
⎜   ↳ Lenovo Lenovo Legion K500 RGB Mechanical Gaming Keyboard Mouse    id=13   [slave  pointer  (2)]
⎜   ↳ Lenovo Lenovo Legion K500 RGB Mechanical Gaming Keyboard Consumer Control id=14   [slave  pointer  (2)]
⎜   ↳ Logitech MX Vertical                      id=17   [slave  pointer  (2)]
⎜   ↳ input-remapper Tablet Monitor Touch Strip forwarded pad   id=20   [slave  pointer  (2)]
⎜   ↳ input-remapper Tablet Monitor Pad forwarded pad   id=22   [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)]
    ↳ Power Button                              id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ Lenovo Lenovo Legion K500 RGB Mechanical Gaming Keyboard  id=12   [slave  keyboard (3)]
    ↳ Lenovo Lenovo Legion K500 RGB Mechanical Gaming Keyboard  id=15   [slave  keyboard (3)]
    ↳ Lenovo Lenovo Legion K500 RGB Mechanical Gaming Keyboard Consumer Control id=16   [slave  keyboard (3)]
    ↳ Logitech MX Vertical                      id=18   [slave  keyboard (3)]
    ↳ input-remapper keyboard                   id=19   [slave  keyboard (3)]
    ↳ input-remapper Lenovo Lenovo Legion K500 RGB Mechanical Gaming Keyboar forwarde   id=21   [slave  keyboard (3)]
    ↳ input-remapper Lenovo Lenovo Legion K500 RGB Mechanical Gaming Keyboar forwarde   id=23   [slave  keyboard (3)]

How do I go about mapping arbitrary co-ordinates, and how do I tell which co-ordinates are where on the screens?

Thankyou!

- Jazz

P.S. There isn't anything on https://wiki.archlinux.org/title/Graphics_tablet about this, only the above mentioned map-to-input thing, which doesn't help with any custom mappings.

Offline

#2 2023-01-26 03:24:35

thurstylark
Member
Registered: 2016-06-02
Posts: 11

Re: Mapping Tablet Stylus Across Arbitrary Co-ordinates

It looks like xinput doesn't have a very easy way to do that, but it can be done if you feed it a touchscreen calibration matrix as detailed here: https://wiki.archlinux.org/title/Calibr … ouchscreen

As a bonus, it looks like there was a feature added to the map-to-output option to reset the calibration back to default by using "__RESET__" instead of a display name, but I'm not clear on if this change is included in the most recent version of xorg-xinput found in the repos. Here's the merge request if you'd like more details: https://gitlab.freedesktop.org/xorg/app … requests/6

Offline

Board footer

Powered by FluxBB