buffet / kiwmi

A fully programmable Wayland Compositor
Mozilla Public License 2.0
612 stars 22 forks source link

add support for touch events (WIP) #64

Open telent opened 2 years ago

telent commented 2 years ago

Opening this initial PR for feedback, not as a request for merging

There are a number of TODO items:

To discuss: unlike the Sway touch implementation, we don't emulate pointer events in the server for non-touch-enabled clients. It adds a bit of complexity and I suspect it's unnecessary for "mainstream" client toolkits which do that client side. When I test this with Gtk apps, for example, if they don't request touch events then they get button events from touches.

ghost commented 2 years ago
  • hardcoded scaling for mapping the touch co-ordinate system into layout co-ordinates (works on my Pinephone :-).

If i’ve grasped random comments that have flown around me correctly, wlr_input_device.output_name should be used to identify the output. But don’t take my word on that.

Ugh, apparently there’s wlr_cursor_absolute_to_layout_coords(), does that work?

To discuss: unlike the Sway touch implementation, we don't emulate pointer events in the server for non-touch-enabled clients. It adds a bit of complexity and I suspect it's unnecessary for "mainstream" client toolkits which do that client side. When I test this with Gtk apps, for example, if they don't request touch events then they get button events from touches.

What about programs like foot?

telent commented 2 years ago

Ugh, apparently there’s wlr_cursor_absolute_to_layout_coords(), does that work?

I'll take a look, thanks. There's a couple of different use cases here.

I think Sway has magic (aka heuristics) to deal with this, I don't know what other compositors do. It may be we should expose it to Lua so the user can set policy

To discuss: unlike the Sway touch implementation, we don't emulate pointer events in the server for non-touch-enabled clients. It adds a bit of complexity and I suspect it's unnecessary for "mainstream" client toolkits which do that client side. When I test this with Gtk apps, for example, if they don't request touch events then they get button events from touches.

What about programs like foot?

Good question. Not currently, it seems - https://codeberg.org/dnkl/foot/issues/517

ghost commented 2 years ago

What about programs like foot?

Good question. Not currently, it seems - https://codeberg.org/dnkl/foot/issues/517

Well, it was more like ‘there still are popular programs facing wayland directly, which should also work to some extent’ 😉. On the other hand, it also depends on which ‘missing implementation’ you consider missing and which is ‘not in scope’ instead.

telent commented 2 years ago

Well, it was more like ‘there still are popular programs facing wayland directly, which should also work to some extent’ wink. On the other hand, it also depends on which ‘missing implementation’ you consider missing and which is ‘not in scope’ instead.

Yes, but in the specific case of foot I use it myself - albeit not yet on a touchscreen - and thought I'd better check :-) My assumption (entirely untested) is that they won't work on touch-only devices in Gnome Shell or KDE either, so while it would be nice to have pointer emulation in the compositor, there's probably some incentive for the client authors to add touch themselves anyway.

I know that Wayland "design philosophy" changes from year to year, but this blog from 2017 to me makes a good argument https://blog.martin-graesslin.com/blog/2017/02/how-input-works-touch-input/