diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-07-06 18:20:19 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-07-06 18:20:19 +0400 |
| commit | e394a7ff2006985b27903bdf694573543f0f6268 (patch) | |
| tree | be8c2bf4e707cb8a93d4935fe58788ae77ce199c /src/input | |
| parent | 921ed632041e3f6e3e3a6be26fcafd301c845004 (diff) | |
| download | niri-e394a7ff2006985b27903bdf694573543f0f6268.tar.gz niri-e394a7ff2006985b27903bdf694573543f0f6268.tar.bz2 niri-e394a7ff2006985b27903bdf694573543f0f6268.zip | |
Implement on-demand layer-shell keyboard focus
Diffstat (limited to 'src/input')
| -rw-r--r-- | src/input/mod.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/input/mod.rs b/src/input/mod.rs index 1560d2a8..e74ff100 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -1404,6 +1404,11 @@ impl State { self.update_pointer_focus(); + if ButtonState::Pressed == button_state { + let layer_focus = self.niri.pointer_focus.layer.clone(); + self.niri.focus_layer_surface_if_on_demand(layer_focus); + } + if let Some(button) = event.button() { let pos = pointer.current_location(); if let Some((output, _)) = self.niri.output_under(pos) { @@ -1685,19 +1690,19 @@ impl State { tool.tip_down(serial, event.time_msec()); if let Some(pos) = self.niri.tablet_cursor_location { - if let Some(mapped) = self.niri.window_under(pos) { - let window = mapped.window.clone(); + let under = self.niri.surface_under_and_global_space(pos); + if let Some(window) = under.window { self.niri.layout.activate_window(&window); // FIXME: granular. self.niri.queue_redraw_all(); - } else if let Some((output, _)) = self.niri.output_under(pos) { - let output = output.clone(); + } else if let Some(output) = under.output { self.niri.layout.activate_output(&output); // FIXME: granular. self.niri.queue_redraw_all(); } + self.niri.focus_layer_surface_if_on_demand(under.layer); } } TabletToolTipState::Up => { @@ -2042,29 +2047,24 @@ impl State { return; }; + let under = self.niri.surface_under_and_global_space(touch_location); + if !handle.is_grabbed() { - let output_under_touch = self - .niri - .global_space - .output_under(touch_location) - .next() - .cloned(); - if let Some(mapped) = self.niri.window_under(touch_location) { - let window = mapped.window.clone(); + if let Some(window) = under.window { self.niri.layout.activate_window(&window); // FIXME: granular. self.niri.queue_redraw_all(); - } else if let Some(output) = output_under_touch { + } else if let Some(output) = under.output { self.niri.layout.activate_output(&output); // FIXME: granular. self.niri.queue_redraw_all(); - }; + } + self.niri.focus_layer_surface_if_on_demand(under.layer); }; let serial = SERIAL_COUNTER.next_serial(); - let under = self.niri.surface_under_and_global_space(touch_location); handle.down( self, under.surface, |
