termux / termux-x11

Termux X11 add-on application.
https://termux.dev
GNU General Public License v3.0
2k stars 303 forks source link

[Bug]: Stylus pressure is not usable #634

Closed TudbuT closed 3 months ago

TudbuT commented 4 months ago

Problem description

Related: #315

It seems like pressure/tilt is not working for me, despite #315 being closed as completed, which is supposed to have pressure as per issue description. GIMP sees an input device with pressure + tilt, but does not receive any events from it -> I can't use it.

My device is a Samsung Galaxy Tab S8 Ultra running [uname -a] ˋLinux localhost 5.10.168-android12-9-27940245-abX900XXS6CXB4 #1 SMP PREEMPT Mon Feb 19 06:14:03 UTC 2024 aarch64 Androidˋ.

Screenshot of the input device picker: SmartSelect_20240515_110504_TermuxX11

I am running gimp in archlinux-arm (the gimp provided by termux doesn't even see the input device).

What steps will reproduce the bug?

  1. Install a proot archlinux-arm on termux: https://github.com/TermuxArch/TermuxArch
  2. Install xf86-input-libinput, xf86-input-evdev, and gimp
  3. Open gimp
  4. No pressure detection is present
  5. Go to Edit > Input Devices
  6. Find the one with Pressure and Tilt
  7. Select screen mode on it (and no others) to make it the exclusive input device
  8. No drawing is possible

What is the expected behavior?

I should be able to use the pressure sensitive stylus for drawing in GIMP.

twaik commented 4 months ago

Currently real stylus support is not implemented. Termux:X11 can send only transform Android stylus events to X11 mouse events.

twaik commented 4 months ago

It seems like I found something that can help us.

twaik commented 4 months ago

Are you using old version? I've got rid of absolute mouse 9 commits ago.

night-nl commented 4 months ago

Are you using old version? I've got rid of absolute mouse 9 commits ago.

Is that meaning stylus is working properly responsing to pressure?

twaik commented 4 months ago

No. That means I've got rid of absolute mouse 9 commits ago.

twaik commented 4 months ago

I can not reproduce it on termux's gimp on the latest artifact. image Devices other than core pointer are not even enumerated.

TudbuT commented 4 months ago

Are you using old version? I've got rid of absolute mouse 9 commits ago.

Probably. I haven't updated in a bit - will do now.

TudbuT commented 4 months ago

New version is installed. Absolute mouse is gone as expected.

I can not reproduce it on termux's gimp on the latest artifact. As I mentioned in the issue description: I am running gimp in archlinux-arm (the gimp provided by termux doesn't even see the input device).

Your termux gimp looks exactly like mine. Only the proot distro's gimp sees the individual devices.

Here's a comparison of what i see on each now: SmartSelect_20240517_170655_TermuxX11

TudbuT commented 4 months ago

The proot distro still sees pressure and tilt present in the Lorie mouse, but as before they do nothing (except now I can actually use gimp with that mouse set to Screen mode, unlike with the old absolute mouse).

twaik commented 4 months ago

For some reason it recognizes relative horizontal and vertical high precision scrolling axes as pressure and tilt. I opened issue for termux's gimp so device enumerating should be fixed. I am planning to check what I can do with stylus recognition on Sunday.

TudbuT commented 4 months ago

Delightful, thank you!

twaik commented 4 months ago

Do you have a usb tablet which can be connected to PC, with working tilt and rotation axes?

TudbuT commented 4 months ago

Yes: I have weylus and also an old XP-Pen tablet lying around somewhere.

Edit: oh you mean tilt and rotation? not entirely sure. pressure and tilt are definitely supported, not sure about rotation on the XP-Pen tho.

twaik commented 4 months ago

AFAIK XP-pen does not support tilt and orientation. And I am not sure if Weylus reports orientation, at least I did not find this part in its code. Do you know how to check if x tilt, y tilt and orientation are configured right? Probably you know what instruments to use in Gimp? Or other ways?

twaik commented 4 months ago

@TudbuT @parkerlreed @Revess @Dr4kzor @ephetic @mistune Sorry for the ping, but it seems like all of you participated in discussions related to stylus. Do you have real wacom tablet with x tilt, y tilt and orientation working out of the box? Or maybe you know how to check if these axes are configured right? I am implementing the full stylus support but it is a bit hard to test it without knowing how it should behave and without testing on a real device (which I do not have). Thank you.

Revess commented 4 months ago

I do have a Wacom Tablet, the Wacom Intuos M Bluetooth Black. I dont know the full capabilities to test. For my tablet I have a samsung Galaxy Tab S8+ with the SPen. Feel free to let me know the pen capabilities. In the last update (last year summer I think) the pen support was working :)

twaik commented 4 months ago

Do you know how to test tilt and rotation capabilities in Gimp or other software? I need to test if I messed up with tilt formulas transforming tilt and rotation from Android to regular X11 format. So I need to know if tilt and rotation behaviour is the same in both cases.

twaik commented 4 months ago

In the last update (last year summer I think) the pen support was working :)

Currently termux-x11 supports only transforming android stylus events to X11 mouse events. Currently I am working on real stylus event forwarding, but I need someone who can test it.

parkerlreed commented 4 months ago

Still have it setup here if you need anything! Thanks.

I can do GIMP with pressure. Samsung doesn't do tilt, angle, or eraser.

twaik commented 4 months ago

I can do GIMP with pressure. Samsung doesn't do tilt, angle, or eraser.

It is pretty much weird because currently termux-x11 does not pass stylus pressure to the X server.

Do you know how we can check tilts and orientation? Maybe special Gimp instruments or similar stuff?

twaik commented 4 months ago

I do have a Wacom Tablet, the Wacom Intuos M Bluetooth Black.

Can you please post a screenshot of https://patrickhlauke.github.io/touch/tracker/multi-touch-tracker-pointer-hud-pep.html while holding stylus on a tablet? With all the properties it prints?

Revess commented 4 months ago

Do you want me to do the same thing with the spen and with the wacom pen on the tablet?

twaik commented 4 months ago

Currently only in chrome on pc with wacom tablet please.

Revess commented 4 months ago

Sure thing, later today or tomorrow (CET +1) I will try it with the link you provided on my Wacom Tablet!

TudbuT commented 4 months ago

I can do GIMP with pressure. Samsung doesn't do tilt, angle, or eraser.

It certainly does tilt. Angle I'm not so sure. Here the angle only works when its on the screen. Sketchbook always sees it. Screenshot_20240524_025508_Samsung Internet

RalfWerner commented 4 months ago

9 seconds stylus. The stylus touches the screen in second 5. The Samsung menu appears in floating mode and stylus pressure. Which I have done several times in touch mode. Helpful?

https://github.com/termux/termux-x11/assets/45426380/31c96a28-7402-4307-8b45-72b454e7caec

twaik commented 4 months ago

@parkerlreed @Revess @TudbuT Can you please test the https://github.com/termux/termux-x11/actions/runs/9365902745 ?

twaik commented 4 months ago

No, wait. We can not build it since gitlab.freedesktop.org is currently under maintenance and builder can not obtain source code.

twaik commented 4 months ago

I am not so sure when gitlab.freedesktop.org will be back so there is apk for tests. app-universal-debug.zip

twaik commented 4 months ago

@parkerlreed @Revess @TudbuT can you please test it?

twaik commented 4 months ago

Ok, https://github.com/termux/termux-x11/actions/runs/9365902745 is available too.

TudbuT commented 4 months ago

Checking it out now.

TudbuT commented 4 months ago

Screenshot_20240605_212928_TermuxX11 that seems to work perfectly!

twaik commented 4 months ago

Good. So I think I will fix the bug with device enumeration and after this it will be merged.

TudbuT commented 4 months ago

perfect! I'll show the device enumeration here:

in proot: Screenshot_20240605_213220_TermuxX11 (this is what i used, works for drawing perfectly.)

in termux directly (DOES NOT WORK FOR DRAWING): Screenshot_20240605_213257_TermuxX11

twaik commented 4 months ago

Termux's gimp should be rebuilt, I opened issue in termux-packages repo.

TudbuT commented 4 months ago

Wonderful! That's probably it for this issue then.

I'll probably be opening another soon: The captured events transform does nothing at present when using samsung's official cover.

I might take a small look at the code first tho to see if I can spot anything (in which case I'll open a PR instead of an issue).

twaik commented 3 months ago

https://github.com/termux/termux-x11/pull/650 is merged so I am closing this. Termux's Gimp problem is not related to termux-x11 plugin and it is one more reason I am closing this.