Sunshine icon indicating copy to clipboard operation
Sunshine copied to clipboard

Pen input active while hovering

Open cfalas opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Is your issue described in the documentation?

  • [X] I have read the documentation

Is your issue present in the latest beta/pre-release?

This issue is present in the latest pre-release

Describe the Bug

After the change from legacy input to inputtino, the pen input has changed behaviour:

  • Once I connect to the server, when I hover the screen the pointer moves (as expected)
  • Once I touch the screen with the pen, I can start drawing (as expected)
    • Note that the pressure sensitivity is ignored/not working at this stage
  • Once I am done with the stroke and the pen is lifted, the tool doesn't deactivate, and continues to draw while hovering the screen
  • If I leave and re-enter the hover area, the stroke simply jumps from the previous (hovered) position to the newest.

Video (not sure if it's very clear)

A simple fix (see commit on my fork 21484e5b6a477173245a0fcd06d2e8192c54c85e) appears to mostly solve this, but not entirely:

  • Always, once the screen is touched, the pressure is (as expected)
  • Sometimes, when the pen is lifted (but in hovering range), the pen doesn't release

e.g. trying to draw a dashed line results in something like this:

I can see some correlation between when it happens and pressure and/or tilt angle (i.e. when pressure is higher, it doesn't happen as much, and when pressure is low and tilt angle is close to the screen it happens most of the time)

Expected Behavior

When the pen is hovering, the pointer is moved without clicking anything. When the pen touches the pointer acts as a pen in apps supporting pen input (e.g. Xournal++). As soon as the pen is lifted, the pen stops writing.

Additional Context

For testing, I am using moonlight-android on a Samsung S9 Ultra with the S pen.

Host Operating System

Linux

Operating System Version

Arch Linux, kernel 6.9.5

Architecture

64 bit

Sunshine commit or version

10666c0

Package

other (self built)

GPU Type

Intel

GPU Model

UHD 770

GPU Driver/Mesa Version

24.1.2

Capture Method

wlroots (Linux)

Config

adapter_name = /dev/dri/renderD128
output_name = 0
resolutions = [
    352x240,
    480x360,
    858x480,
    1280x720,
    1920x1080,
    2560x1080,
    3440x1440,
    1920x1200,
    3840x2160,
    3840x1600,
    2960x1848
]
channels = 2

Apps

No response

Relevant log output

N/A

cfalas avatar Jun 25 '24 11:06 cfalas

Thanks for the detailed issue and PR, unfortunately I don't have the HW to test this, so I was just relying on the libinput unit tests and documentation. It might be worth to double-check what exactly Moonlight sends over the wire by enabling the debug logs in Sunshine; the client could just report the wrong values..

ABeltramo avatar Jun 26 '24 16:06 ABeltramo

I already checked both client and sunshine logs before making the issue so I'm confident the issue is within sunshine.

It looks like the combination of https://github.com/LizardByte/Sunshine/commit/21484e5b6a477173245a0fcd06d2e8192c54c85e and https://github.com/games-on-whales/inputtino/pull/10 completely fix this. I'll test some more over the next few days and make a PR here as well.

cfalas avatar Jun 26 '24 17:06 cfalas