masm11 / emacs

Mirror of GNU Emacs
http://www.gnu.org/software/emacs/
GNU General Public License v3.0
198 stars 14 forks source link

Touchscreen input support? #97

Closed GorrillaRibs closed 3 years ago

GorrillaRibs commented 3 years ago

Emacs doesn't seem to register touch input at all when running the pgtk backend - is this intended? I think it worked on the old x11-only version (maybe because it treated it the same as mouse input?). Would it be possible to fix this? I'm more than happy to test/try things out (I have a couple devices with touchscreens to test on), I was mainly hoping touch input could just be treated like mouse input again but if gtk3 allows differentiating the two, maybe stuff like touch scrolling could be possible!

Also, is this the right place to report issues? Since feature/pgtk seems to be merged upstream should I report upstream instead?

Thanks for all of your work!

masm11 commented 3 years ago

Tell me about your environment. Pgtk emacs works with touch screen like mouse in my environment. wayfire 0.7.0-2acf35a6 gtk 3.24.28

Also, is this the right place to report issues?

There are some places to report issues: here, emacs-devel, and savannah. Anywhere ok.

GorrillaRibs commented 3 years ago

I'm running sway on arch, but the issue was also there on wayfire w/ gtk 3.24.28 (I alternate between the two) - after investigating a bit more though I found the issue, though am a little confused by it - normally I run emacs as a daemon (with a systemd user service) and create new gui frames with emacsclient, in this case touch doesn't work. When running emacs normally though, touch works fine! So it appears to just be an issue with my setup, I'm going to poke around further and see if I can get touch to work with daemon emacs, will update here if I find a fix so it's documented somewhre.

Thanks again!

GorrillaRibs commented 3 years ago

An update - it seems that touch input working doesn't seem to be related to running as a daemon, but rather when it's launched from a window manager shortcut (in this case a sway keybinding) or a desktop file rather than from an interactive shell - so maybe there's some env variable that get set interactively but don't otherwise, will investigate more.

I did find though that if I M-x (server-start) after starting from an interactive shell, any subsequent emacsclients do recognize touch input, so that might be good enough of a workaround.

GorrillaRibs commented 3 years ago

Something else appears to be wrong - looks like GDK_BACKEND=x11 somehow got set in my interactive shell, so touch input was only working when emacs was running with an x11 backend, so maybe something in sway is the cause? I'll do some more testing with wayfire & some other compositors

Edit: 'Hover' effects seem to still work on sway, but the cursor doesn't move, maybe related to sway separating regular mouse movement and cursor movement?

piater commented 3 years ago

I am experiencing something similar lately. Touch in Emacs stopped working for the most part, as a result of some update (gtk3? wild guess). I think (but am not sure) that it was not an Emacs update that made it stop. I am still running emacs-pgtk-native-comp-git (AUR) 28.0.50.147609-1 built fresh from git on March 18, started using bemenu. The stylus works as expected. Finger touch mostly does nothing, but occasionally does have an effect on active text areas such as filenames in dired and MIME buttons in gnus, highlighting them. Sometimes the effect becomes visible only after switching between active windows.

I'm running an up-to-date Arch Linux, latest sway-git started from the command line, GDK_BACKEND unset.

masm11 commented 3 years ago

It reproduced on sway with GDK_BACKEND=wayland, and did not with GDK_BACKEND=x11.

gdk_device_get_window_at_position doesn't work correctly on sway, so touchscreen press events were mishandled as on scrollbar. I don't know why it doesn't work correctly.

I removed the call of xg_event_is_for_scrollbar which calls it, since it is not needed.

Try latest feature/pgtk on savannah.

GorrillaRibs commented 3 years ago

The latest git on savannah works great, thanks! I'll go ahead and close this now :)