Skip to content

Commit 6716713

Browse files
committed
Merge branch 'feat/touchscreen-support' of github.com:devmobasa/wayscriber
2 parents 4614823 + 7b5d14b commit 6716713

6 files changed

Lines changed: 546 additions & 2 deletions

File tree

src/backend/wayland/handlers/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use smithay_client_toolkit::{
44
delegate_compositor, delegate_keyboard, delegate_layer, delegate_output, delegate_pointer,
55
delegate_pointer_constraints, delegate_registry, delegate_relative_pointer, delegate_seat,
6-
delegate_shm, delegate_xdg_shell, delegate_xdg_window,
6+
delegate_shm, delegate_touch, delegate_xdg_shell, delegate_xdg_window,
77
};
88

99
use super::state::WaylandState;
@@ -15,6 +15,7 @@ delegate_layer!(WaylandState);
1515
delegate_seat!(WaylandState);
1616
delegate_keyboard!(WaylandState);
1717
delegate_pointer!(WaylandState);
18+
delegate_touch!(WaylandState);
1819
delegate_pointer_constraints!(WaylandState);
1920
delegate_relative_pointer!(WaylandState);
2021
delegate_registry!(WaylandState);
@@ -36,4 +37,5 @@ mod seat;
3637
mod shm;
3738
#[cfg(tablet)]
3839
mod tablet;
40+
mod touch;
3941
mod xdg;

src/backend/wayland/handlers/seat.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@ impl SeatHandler for WaylandState {
5353
}
5454
}
5555

56+
if capability == Capability::Touch {
57+
info!("Touch capability available");
58+
match self.seat_state.get_touch(qh, &seat) {
59+
Ok(touch) => {
60+
debug!("Touch initialized");
61+
self.touch = Some(touch);
62+
}
63+
Err(err) => {
64+
warn!("Touch initialization failed: {}", err);
65+
}
66+
}
67+
}
68+
5669
#[cfg(tablet)]
5770
if let Some(manager) = &self.tablet_manager
5871
&& self.tablet_seats.is_empty()
@@ -79,6 +92,11 @@ impl SeatHandler for WaylandState {
7992
self.current_pointer_shape = None;
8093
self.cursor_hidden = false;
8194
}
95+
if capability == Capability::Touch {
96+
info!("Touch capability removed");
97+
self.touch = None;
98+
self.cancel_active_touch_sequence();
99+
}
82100
}
83101

84102
fn remove_seat(&mut self, _conn: &Connection, _qh: &QueueHandle<Self>, _seat: wl_seat::WlSeat) {

0 commit comments

Comments
 (0)