diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-03-23 09:00:23 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-03-22 23:14:51 -0700 |
| commit | 500dcca9b70c9b8968f3dbcfe06c4177ca7fd66a (patch) | |
| tree | a254a4b7e6b229056a1d80c7e9165f052aeee987 | |
| parent | 7210045b2a058c4be7bef6fd2059f337bf53b1ec (diff) | |
| download | niri-500dcca9b70c9b8968f3dbcfe06c4177ca7fd66a.tar.gz niri-500dcca9b70c9b8968f3dbcfe06c4177ca7fd66a.tar.bz2 niri-500dcca9b70c9b8968f3dbcfe06c4177ca7fd66a.zip | |
input: Suppress release from Pick grab clicks
Otherwise, it would trigger something inside the window.
| -rw-r--r-- | src/input/pick_color_grab.rs | 3 | ||||
| -rw-r--r-- | src/input/pick_window_grab.rs | 24 |
2 files changed, 18 insertions, 9 deletions
diff --git a/src/input/pick_color_grab.rs b/src/input/pick_color_grab.rs index 3484b66e..1d79f68f 100644 --- a/src/input/pick_color_grab.rs +++ b/src/input/pick_color_grab.rs @@ -120,6 +120,9 @@ impl PointerGrab<State> for PickColorGrab { return; } + // We're handling this press, don't send the release to the window. + data.niri.suppressed_buttons.insert(event.button); + if let Some(tx) = data.niri.pick_color.take() { let color = Self::pick_color_at_point(handle.current_location(), data); let _ = tx.send_blocking(color); diff --git a/src/input/pick_window_grab.rs b/src/input/pick_window_grab.rs index 9a3b22ae..9c2615b4 100644 --- a/src/input/pick_window_grab.rs +++ b/src/input/pick_window_grab.rs @@ -60,16 +60,22 @@ impl PointerGrab<State> for PickWindowGrab { handle: &mut PointerInnerHandle<'_, State>, event: &ButtonEvent, ) { - if event.state == ButtonState::Pressed { - if let Some(tx) = data.niri.pick_window.take() { - let _ = tx.send_blocking( - data.niri - .window_under(handle.current_location()) - .map(Mapped::id), - ); - } - handle.unset_grab(self, data, event.serial, event.time, true); + if event.state != ButtonState::Pressed { + return; } + + // We're handling this press, don't send the release to the window. + data.niri.suppressed_buttons.insert(event.button); + + if let Some(tx) = data.niri.pick_window.take() { + let _ = tx.send_blocking( + data.niri + .window_under(handle.current_location()) + .map(Mapped::id), + ); + } + + handle.unset_grab(self, data, event.serial, event.time, true); } fn axis( |
