Snowcap: Add support for touch input#422
Snowcap: Add support for touch input#422Ph4ntomas wants to merge 8 commits intopinnacle-comp:mainfrom
Conversation
fc62be7 to
912c08e
Compare
|
Regarding the touch behavior, I'll note that since we do have the data, it could be fixed 'cleanly' (as in without glitches) by copying button and mouse_area implementation from iced and patching it in snowcap. The behavior would be much cleaner, but I don't want to do that unless I know it's okay, since we would not get new changes if iced behavior changes. An alternative would be to have a "touch button" and a "touch mouse_area" that would wrap their iced counterpart, and fixup the touch inputs (e.g. by spoofing the cursor position) before forwarding the
EDIT: Scratch that last part. I don't like it. I think I'll implement the patched button/mouse out of tree (unless I get the go to merge them here). This could be a "drop-in" replacement until iced gets fixed that pinnacle could add as a dependency and drop whenever, while both maintaining the same "button" and "mouse_area" API (i.e. no changes to protobuf). If we don't want to use them, I can easily patch them in in my own tree. Either way, I'm putting this back to draft until that's done, since I'll remove the workaround and touch inputs are somewhat useless/weird without that. |
912c08e to
6d5b130
Compare
Okay, so I did that but it kinda broke down when I looked at hooking the mouse-area to a grab, since touch grabs need fingers. Anyway, I'm in the process of implementing a TouchArea (which is a mouse-area-ish that works correctly for touch inputs), but since that's kinda foreign to iced, I've implemented it here. The patched button & mouse area are still out of tree tho. |
404b1ac to
49ae072
Compare
|
Touch "bind" are left out of scope on purpose. There are a bunch of stuff I need to think about before implementing them. I'd also like another type of grab that would make use of the multi-touch capabilities of touch-screen, which should also be kept for later. |
8beef06 to
25edca9
Compare
|
Okay, I'm dropping the custom widgets. I had a look at how iced handle this, they are just setting the cursor position on touch inputs using the latest touch. Let's not do anything too fancy and go with that. It might be a good idea to swap the pointer_location member in |
6b63c9b to
b411882
Compare
b411882 to
8198811
Compare
This new widget allows the config to be touched aware. While there is a primitive support in iced widget, it's currently buggy, and doesn't allow to distinguish between fingers inputs and mouse inputs, meaning it's not possible to use that data to e.g. initiate a grab.
8198811 to
c3b519c
Compare
This adds support for touch input for snowcap.
When a touch input is received on a surface, it's converted to an iced touch input event, and sent to the surface widget.
Iced currently ignores position when handling touch inputs. As a workaround, I'm updating the surfaces cursor position when processing input. This isn't ideal because the cursor position and the mouse gets temporarily disconnected, but is safe to do because the last known position is always sent in pointer events. This however prevent mouse_area from firing "Leave" events, because the position will only be updated on the next input (mouse or touch) event, but I felt it was better than missing the release event.
Hopefully, iced-rs/iced#3234 will solve this, and improve touch inputs in general at some point.
I'm opening this up for review, but there is a few thing that still need to be done:
The name also somewhat became misleading as this PR no longer only make changes in snowcap, For the full changes: