Touch: fingers reach apps as wl_touch, so a thumb scrolls
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:
1 parent
98a99aaa36
commit
e30d9cc71f
17 files changed
+786
-126
No files matched your search
@@ -345,6 +345,8 @@ pub(all) struct ChandraCompositor {
|
||||
mut vol_osd : VolOsd?
|
||||
mut vol_pct : Int
|
||||
mut vol_muted : Bool
|
||||
/// Fingers on the screen (touch.mbt).
|
||||
touch : TouchState
|
||||
mut vol_repeat_key : UInt
|
||||
mut vol_repeat_action : @shell.ShortcutAction?
|
||||
mut vol_repeat_next_ms : UInt64
|
||||
@@ -513,6 +515,7 @@ pub fn ChandraCompositor::new(
|
||||
vol_osd: None,
|
||||
vol_pct: 0,
|
||||
vol_muted: false,
|
||||
touch: TouchState::new(),
|
||||
vol_repeat_key: 0U,
|
||||
vol_repeat_action: None,
|
||||
vol_repeat_next_ms: 0UL,
|
||||
@@ -786,6 +789,7 @@ pub fn ChandraCompositor::step(self : ChandraCompositor) -> Unit {
|
||||
self.face_window_tick()
|
||||
self.control_tick()
|
||||
self.volume_tick()
|
||||
self.touch_tick()
|
||||
self.shell.launch_tick()
|
||||
let events = self.server.poll_events()
|
||||
for ev in events {
|
||||
@@ -930,7 +934,7 @@ pub fn ChandraCompositor::step(self : ChandraCompositor) -> Unit {
|
||||
}
|
||||
None => release_snapshot(snap)
|
||||
}
|
||||
@wayland.CompositorEvent::DragStarted(win) => self.dnd_start(win, self.input_time)
|
||||
@wayland.CompositorEvent::DragStarted(win) => self.touch_handover(win, () => self.dnd_start(win, self.input_time))
|
||||
@wayland.CompositorEvent::DragIcon(snap, dx, dy) =>
|
||||
if self.dnd {
|
||||
release_snapshot(self.dnd_icon)
|
||||
@@ -965,7 +969,7 @@ pub fn ChandraCompositor::step(self : ChandraCompositor) -> Unit {
|
||||
}
|
||||
None => ()
|
||||
}
|
||||
@wayland.CompositorEvent::ToplevelResizeRequest(wid, edges) => self.client_resize(wid, edges)
|
||||
@wayland.CompositorEvent::ToplevelResizeRequest(wid, edges) => self.touch_handover(wid, () => self.client_resize(wid, edges))
|
||||
@wayland.CompositorEvent::PopupOpened(wid, parent, rx, ry, w, h) => {
|
||||
// Keyboard focus stays on the parent until the popup grabs and maps: moving it away
|
||||
// early makes clients (Chrome, Qt) take the keyboard leave as "dismiss the menu".
|
||||
@@ -1066,7 +1070,7 @@ pub fn ChandraCompositor::step(self : ChandraCompositor) -> Unit {
|
||||
)
|
||||
self.apply_actions(actions)
|
||||
}
|
||||
@wayland.CompositorEvent::ToplevelMoveRequest(wid) => self.client_move(wid)
|
||||
@wayland.CompositorEvent::ToplevelMoveRequest(wid) => self.touch_handover(wid, () => self.client_move(wid))
|
||||
}
|
||||
}
|
||||
self.session_tick()
|
||||
@@ -1102,6 +1106,8 @@ pub fn ChandraCompositor::wake_timeout(self : ChandraCompositor, idle_ms : Int)
|
||||
let d = if g >= 0 && (d < 0 || g < d) { g } else { d }
|
||||
let l = self.shell.launch_wake_ms(now)
|
||||
let d = if l >= 0 && (d < 0 || l < d) { l } else { d }
|
||||
let t = self.touch_wake_ms(now)
|
||||
let d = if t >= 0 && (d < 0 || t < d) { t } else { d }
|
||||
let v = self.volume_wake_ms(now)
|
||||
let d = if v >= 0 && (d < 0 || v < d) { v } else { d }
|
||||
if d >= 0 && d < idle_ms {
|
||||
@@ -2126,7 +2132,10 @@ pub fn ChandraCompositor::handle_input(
|
||||
ev : @nested.InputEvent,
|
||||
time_ms : UInt,
|
||||
) -> Unit {
|
||||
self.handle_input_inner(ev, time_ms)
|
||||
match ev {
|
||||
Touch(t) => self.touch_input(t, time_ms)
|
||||
_ => self.handle_input_inner(ev, time_ms)
|
||||
}
|
||||
self.osk_sync()
|
||||
}
|
||||
|
||||
@@ -2801,6 +2810,8 @@ fn ChandraCompositor::dispatch_input_inner(
|
||||
None => ()
|
||||
}
|
||||
}
|
||||
// touch_input (touch.mbt) took these.
|
||||
Touch(_) => ()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user