diff options
| author | Christian Meissl <meissl.christian@gmail.com> | 2024-02-24 18:32:13 +0100 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-02-28 13:19:41 +0400 |
| commit | 719697179f6ddd79206e6ccf058a5e43f18ba346 (patch) | |
| tree | e316e65487350f12ef76f9741dc9abdaddfb0139 /src/niri.rs | |
| parent | 5ac350d51c0f16be3e40355bcb25cf23d34cc662 (diff) | |
| download | niri-719697179f6ddd79206e6ccf058a5e43f18ba346.tar.gz niri-719697179f6ddd79206e6ccf058a5e43f18ba346.tar.bz2 niri-719697179f6ddd79206e6ccf058a5e43f18ba346.zip | |
input: add basic touch support
Diffstat (limited to 'src/niri.rs')
| -rw-r--r-- | src/niri.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/niri.rs b/src/niri.rs index 5b2491d9..418ef6d0 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -144,6 +144,7 @@ pub struct Niri { pub devices: HashSet<input::Device>, pub tablets: HashMap<input::Device, TabletData>, + pub touch: HashSet<input::Device>, // Smithay state. pub compositor_state: CompositorState, @@ -702,6 +703,10 @@ impl State { self.niri.reposition_outputs(None); self.backend.on_output_config_changed(&mut self.niri); + + if let Some(touch) = self.niri.seat.get_touch() { + touch.cancel(self); + } } // Can't really update xdg-decoration settings since we have to hide the globals for CSD @@ -1002,6 +1007,7 @@ impl Niri { devices: HashSet::new(), tablets: HashMap::new(), + touch: HashSet::new(), compositor_state, xdg_shell_state, @@ -1602,6 +1608,14 @@ impl Niri { .or_else(|| self.global_space.outputs().next()) } + pub fn output_for_touch(&self) -> Option<&Output> { + let config = self.config.borrow(); + let map_to_output = config.input.touch.map_to_output.as_ref(); + map_to_output + .and_then(|name| self.output_by_name.get(name)) + .or_else(|| self.global_space.outputs().next()) + } + pub fn output_for_root(&self, root: &WlSurface) -> Option<&Output> { // Check the main layout. let win_out = self.layout.find_window_and_output(root); |
