Repository navigation
Touchscreen support on Wayland, X11, and Windows #67
Closed
awsl1414
started this conversation in
Feature request
Replies: 1 comment 1 reply
|
Hey, thanks for the request. Touch support for Linux has landed in the latest release. Please test it on Linux and let me know if there are any issues. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I'm using Wu 1.2.2 (41b71ce) on a Xiaomi Pad 6S Pro running Arch Linux ARM aarch64, KDE Plasma on Wayland (kwin_wayland with XWayland), kernel 7.3.0. The touchscreen is the main input device. With the keyboard detached there's no pointer or keyboard at all.
Touch doesn't reach the app on the desktop backends. On Wayland the seat handler binds only
wl_keyboardandwl_pointer, so a touchscreen-only session gets nothing: no taps in the editor, no text selection, no scrolling. gpui already covers the rest.crates/gpui/src/gestures.rshas a portable recognizer that turns raw touches into taps (synthesized mouse down/up with a tap count), pans as scroll events with axis locking and fling momentum, and long presses.Window::dispatch_touch_eventincrates/gpui/src/window.rsroutes those, andPlatformGestures/GestureKindslet a platform mark which gestures it handles natively. The web backend wires it up (crates/gpui_web/src/events.rs), so touch works in the browser build.What's missing is the per-platform glue:
crates/gpui_linux/src/linux/wayland/client.rsbindsCapability::KeyboardandCapability::Pointeronly, and there's nowl_touchbinding anywhere in the repo. Pinch comes throughzwp_pointer_gesture_pinch_v1, which compositors feed from touchpads, not touchscreens.xi_select_eventsincrates/gpui_linux/src/linux/x11/window.rsasks for motion, button press/release, enter/leave and the pinch gesture events.TouchBegin/TouchUpdate/TouchEndaren't selected, and there are no handlers for them.crates/gpui_windows/src/events.rshandles mouse and keyboard messages. I couldn't findWM_POINTERorWM_TOUCHin the repo, and direct manipulation is only used for touchpad scrolling and pinch.Binding the touch protocol per platform and forwarding it as
PlatformInput::Touchwith a stableTouchIdand theStarted/Moved/Ended/Cancelledphases would let the existing recognizer handle the rest. Roughly:wl_touchwhen the seat advertisesCapability::Touch, map seat slots toTouchIds, emit onwl_touch::Event::Frame.xi_select_eventsand handle the XInput touch events.WM_POINTER, orWM_TOUCHafterRegisterTouchWindow, and forward it the same way.Pinch-to-zoom on a touchscreen would need either multi-touch in the recognizer or a native
GestureKinds::pinch. Tap and pan alone already give caret placement, word selection by double tap, and scrolling.Typing is the other problem on a device without a keyboard. Plasma's on-screen keyboard is driven through the input-method protocol and a surface has to opt in; there's no
input_method_managerbinding in the repo either, so Wu can't bring it up. A touch build isn't usable for editing without that.I can test builds on this machine, both native Wayland and XWayland, if it helps.
All reactions