Touch: fingers reach apps as wl_touch, so a thumb scrolls
Deploy to the handset / build-and-deploy (push) Successful in 2m20s
CI / test (push) Failing after 2m56s

Every touch was turned into a mouse drag in the seat code, which selects text
instead of scrolling. The seat now reports raw touches and the compositor
routes them: to the app as wl_touch on its own content, and to the pointer
(tap, drag, hold for right click, as before) everywhere else and for apps that
don't listen to touches. The cursor is hidden while fingers are in use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
nandiandClaude Opus 5.5 committed 2026-11-29 22:22:14 -08:00
1 parent 98a99aaa36
commit e30d9cc71f
17 files changed
+786 -126

No files matched your search

+33 -1
View File
@@ -23,12 +23,22 @@ pub(all) struct ScrollDelta {
axis : UInt; value : Double; discrete : Int
}
///|
/// A finger on the touchscreen, by id (reused once it is up), in output pixels.
pub(all) struct TouchPoint {
id : Int; x : Double; y : Double
}
///|
pub(all) enum SeatEvent {
PointerMove(PointerPos)
PointerButton(KeyState)
Key(KeyState)
Modifiers(Modifiers)
Scroll(ScrollDelta)
TouchDown(TouchPoint)
TouchMotion(TouchPoint)
TouchUp(Int)
TouchCancel
TouchPresent
}
///|
/// Take over the first connected output and the seat's input. None, with the reason on the
@@ -109,7 +119,9 @@ pub fn set_power(on : Bool) -> Unit {
/// Returns `(width << 16) | height` of the new logical output size.
pub fn set_rotation(rot : UInt) -> UInt {
(wasmImportSetRotation((rot).reinterpret_as_int())).reinterpret_as_uint()
let result : Int = wasmImportSetRotation((rot).reinterpret_as_int());
let ret = (result).reinterpret_as_uint()
return ret
}
///|
@@ -144,6 +156,26 @@ pub fn take_input() -> Array[SeatEvent] {
SeatEvent::Scroll(ScrollDelta::{axis : (mbt_ffi_load32((iter_base) + 8)).reinterpret_as_uint(), value : mbt_ffi_loadf64((iter_base) + 16), discrete : mbt_ffi_load32((iter_base) + 24)})
}
5 => {
SeatEvent::TouchDown(TouchPoint::{id : mbt_ffi_load32((iter_base) + 8), x : mbt_ffi_loadf64((iter_base) + 16), y : mbt_ffi_loadf64((iter_base) + 24)})
}
6 => {
SeatEvent::TouchMotion(TouchPoint::{id : mbt_ffi_load32((iter_base) + 8), x : mbt_ffi_loadf64((iter_base) + 16), y : mbt_ffi_loadf64((iter_base) + 24)})
}
7 => {
SeatEvent::TouchUp(mbt_ffi_load32((iter_base) + 8))
}
8 => {
SeatEvent::TouchCancel
}
9 => {
SeatEvent::TouchPresent
}
_ => panic()
}