termux / termux-x11

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

[Feature request] Stylus support #315

Closed parkerlreed closed 1 year ago

parkerlreed commented 1 year ago

Right now stylus works as a mouse including hover.

Would be great to get that passed along as a pressure sensitive stylus so you can use it in applications like GIMP.

twaik commented 1 year ago

I am working on a new version of the termux-x11 that operates on different principles. It will be a full-fledged X server, so I can add support for stylus and touchscreen. Can you please help me with testing stylus support?

parkerlreed commented 1 year ago

Absolutely!

Revess commented 1 year ago

What type of stylus are you using and di you tweak any settings to make it work? I am currently using an Samsung spen and would love for this feature to work

parkerlreed commented 1 year ago

Nothing as of yet. The Samsung stylus should currently just work as a mouse.

Still awaiting some instructions to help test out the support.

twaik commented 1 year ago

Pinging me will not help, I am still working on it.

Dr4kzor commented 1 year ago

Hi I already implemented this, also added a floating button to choose the stylus input type as left,middle or right click, even when this click override is active the mouse and finger work normally :) Also the stylus hover works and updates mouse position as well (allows to see the click preview for graphic edit apps like Aseprite and Gimp)

Pull request with added stylus support:

358

Revess commented 1 year ago

Works like a charm! Thank you so much, now I can almost fully replace my laptop for code development with my tablet (I mostly do remote coding).

parkerlreed commented 1 year ago

@Dr4kzor Thanks! Is there a way I can test this without a manual compile?

twaik commented 1 year ago

https://github.com/termux/termux-x11/actions/runs/5333290836

5A52 commented 1 year ago

also added a floating button to choose the stylus input type as left,middle or right click

I appreciate your work, and floating buttons is better than nothing, but they are diffucult to real use. Why not use, stylus click as left click, stylus button as right click?

ephetic commented 1 year ago

Another option after the stylus click and button could be volume keys.

5A52 commented 1 year ago

Another option after the stylus click and button could be volume keys.

I quickly checked, all the native styluses have a button Why you need any workaround?

Dr4kzor commented 1 year ago

So the work around for this is because my stylus btn doesn't work (ArrowOs Xiaomi stylus drivers don't recognise the btn click, and stylus works with Bluetooth off) this way you can use it to draw on Aseprite or Gimp and still have the option to use the left and middle click quickly, also your finger or mouse keep their original functions, so having a stylus and making it only right click for example gives your holding hand the ability to work as a mouse with left click(finger) and right click stylus. It is not perfect, but it's better than nothing 🙂

Revess commented 1 year ago

An option would be the following, just like most stylus implementations on Ubuntu and I think Windows aswell: tap: left click tap+hold: right click double tap + hold: drag option double tap: regular double tap (maybe as secret option), stylus button click: middle mouse button

ephetic commented 1 year ago

I quickly checked, all the native styluses have a button Why you need any workaround?

Because the buttons on skinny styli are awkward to use. Even on my fatter Wacom Bamboo, the button is not fun to press. On any app that supports mapping the volume keys (or dumb tablets with mappable hardware keys), I'll always take that over a gesture or on-screen button.

I also disable non-stylus touch, FWIW, which I think is the norm for doing art.

Dr4kzor commented 1 year ago

I'm trying to learn how to fully support stylus and I found 1 app that does it and works for linux as well, Weylus, note that I have not tested this app im just assuming it works xD, and we can already detect when an event was originated by the stylus so we can also ignore normal touch and make it so that only the stylus work. Also it could be a good idea to make the stylus btns (mine has 2) cycle between left middle and right click.

parkerlreed commented 1 year ago

Weylus uses the browser as a client. So might not help a lot there but could help on backend for uinput stylus injection.

twaik commented 1 year ago

Android applications can not read /dev/input/* so uinput stylus injection is pretty much useless.

twaik commented 1 year ago

@parkerlreed @Dr4kzor do you have linux PC with stylus support? I need output of xinput list --long when stylus is connected and set up.

Dr4kzor commented 1 year ago

So at the moment I don't, but when I installed PostmarketOS natively on my Xiaomi pad 5 pro it was working and even GPU acceleration was working (glxgears at 3000 FPS). If no one else can get this I'll wipe 😭 out my data reinstall it and report it back here,

5A52 commented 1 year ago

I have send a log to @twaik with native lenovo x220t and old wacom styluses connected.

twaik commented 1 year ago

Merged from #358