Xpra-org / xpra

Persistent remote applications for X11; screen sharing for X11, MacOS and MSWindows.
https://xpra.org/
GNU General Public License v2.0
1.95k stars 169 forks source link

Touch screen support (Not HTML5) #3714

Open fan87 opened 1 year ago

fan87 commented 1 year ago

Is your feature request related to a problem? Please describe. Touch screens are currently unsupported and they will be emulated as mouse input, scrolling and other touch actions won't work. (Not HTML Client, X11)

Describe the solution you'd like Emulate a touch screen (Not a touchpad)

I've seen there's an open issue for Touch Device, but apparently it's not touch screen but touch pad / drawing tablet.

totaam commented 1 year ago

Please see and provide more details:

fan87 commented 1 year ago

Touch screen support on seamless mode is broken (Act as mouse but shouldn't), not sure if it has anything to do with Uinput yet Also touch screen support is broken on ssh X forwarding (Act as mouse), but is not with envioronment variable directly set to remote machine's display

totaam commented 1 year ago

Touch screen support on seamless mode is broken

You have provided no evidence for this. Please see the previous comment and provide more information.

not sure if it has anything to do with Uinput yet

Touch device emulation requires uinput.

fan87 commented 1 year ago

Kinda fixed the issue, now it's complaining unmanaged X11 context once i touch the screen

totaam commented 1 year ago

Kinda fixed the issue

So you were not using uinput and now you are?

now it's complaining unmanaged X11 context

@fan87 Please include the full message.

fan87 commented 1 year ago

uinput support is kinda broken (at least in python 3.10). server_util.py line 388

open(uevent_filename, "rb", encoding="latin1").read()
2022-12-26 13:46:19,361 Error: cannot query uinput device path:
2022-12-26 13:46:19,362  binary mode doesn't take an encoding argument

Fixed it by removing encoding, now what happens is unmanaged X11 context

2022-12-26 13:47:25,619 Error: unmanaged X11 context
2022-12-26 13:47:25,620  parse_xi_event
2022-12-26 13:47:25,621    File "/usr/bin/xpra", line 10, in <module>
2022-12-26 13:47:25,621      sys.exit(main(sys.argv[0], sys.argv))
2022-12-26 13:47:25,621    File "/usr/lib/python3.10/site-packages/xpra/scripts/main.py", line 145, in main
2022-12-26 13:47:25,621      return run_mode(script_file, cmdline, err, options, args, mode, defaults)
2022-12-26 13:47:25,621    File "/usr/lib/python3.10/site-packages/xpra/scripts/main.py", line 445, in run_mode
2022-12-26 13:47:25,621      return do_run_mode(script_file, cmdline, error_cb, options, args, mode, defaults)
2022-12-26 13:47:25,622    File "/usr/lib/python3.10/site-packages/xpra/scripts/main.py", line 489, in do_run_mode
2022-12-26 13:47:25,622      return run_client(script_file, cmdline, error_cb, options, args, mode)
2022-12-26 13:47:25,622    File "/usr/lib/python3.10/site-packages/xpra/scripts/main.py", line 1258, in run_client
2022-12-26 13:47:25,622      r = do_run_client(app)
2022-12-26 13:47:25,622    File "/usr/lib/python3.10/site-packages/xpra/scripts/main.py", line 1762, in do_run_client
2022-12-26 13:47:25,622      return app.run()
2022-12-26 13:47:25,622    File "/usr/lib/python3.10/site-packages/xpra/client/gtk_base/gtk_client_base.py", line 153, in run
2022-12-26 13:47:25,622      self.gtk_main()
2022-12-26 13:47:25,622    File "/usr/lib/python3.10/site-packages/xpra/client/gtk_base/gtk_client_base.py", line 159, in gtk_main
2022-12-26 13:47:25,622      Gtk.main()
2022-12-26 13:47:25,622    File "/usr/lib/python3.10/site-packages/gi/overrides/Gtk.py", line 1689, in main
2022-12-26 13:47:25,622      return _Gtk_main(*args, **kwargs)

It spams the stdout so it's performing really slow, I disabled the error output then it doesn't lag anymore, and touch works as mouse.

Did more digging, found out that uinput devices are created, and it's using uinput pointer device instead of xtest pointer device now, but when i click on the screen (touch screen of my linux laptop), its device ID is still -1, which resulted in UInput Pointer Device

Also touch devices are not acting the same touchpad devices, that's why I mentioned not sure if it has anything to do with uinput - because I don't know (and don't think) if touchpad devices is same as touch screen

fan87 commented 1 year ago

log.txt

totaam commented 1 year ago

uinput support is kinda broken (at least in python 3.10)

Thanks! That was recent change in the 5.0 development branch, the commit above fixes that.

Error: unmanaged X11 context parse_xi_event

The next commit should fix this one and restore parsing of XI2 events.

and it's using uinput pointer device instead of xtest pointer device now, but when i click on the screen (touch screen of my linux laptop), its device ID is still -1, which resulted in UInput Pointer Device

I can't remember all the details, but that looks correct.

because I don't know (and don't think) if touchpad devices is same as touch screen

IIRC they're close enough, and it's not easy to differentiate.

totaam commented 1 year ago

Not sure how useful that's going to be, but there are APIs we can use for simulating touch events in shadow mode: https://github.com/Xpra-org/xpra/issues/3750#issuecomment-1420793669 libei claims to have support for touch devices, but I'm not sure yet if this is going to work with X11 (how would it?).

See also #3831