forge
Explore
Log in

Don't you dare go Hollow

input: Suppress release from Pick grab clicks

Browse files at this commit

500dcca9b70c9b8968f3dbcfe06c4177ca7fd66aIvan MolodetskikhParent: 7210045
Otherwise, it would trigger something inside the window.
src/input/pick_color_grab.rsmodified+3 -0
@@ -120,6 +120,9 @@ impl PointerGrab<State> for PickColorGrab {
120 return;120 return;
121 }121 }
122 122
123+ // We're handling this press, don't send the release to the window.
124+ data.niri.suppressed_buttons.insert(event.button);
125+
123 if let Some(tx) = data.niri.pick_color.take() {126 if let Some(tx) = data.niri.pick_color.take() {
124 let color = Self::pick_color_at_point(handle.current_location(), data);127 let color = Self::pick_color_at_point(handle.current_location(), data);
125 let _ = tx.send_blocking(color);128 let _ = tx.send_blocking(color);
src/input/pick_window_grab.rsmodified+15 -9
@@ -60,16 +60,22 @@ impl PointerGrab<State> for PickWindowGrab {
60 handle: &mut PointerInnerHandle<'_, State>,60 handle: &mut PointerInnerHandle<'_, State>,
61 event: &ButtonEvent,61 event: &ButtonEvent,
62 ) {62 ) {
63- if event.state == ButtonState::Pressed {63+ if event.state != ButtonState::Pressed {
64- if let Some(tx) = data.niri.pick_window.take() {64+ return;
65- let _ = tx.send_blocking(
66- data.niri
67- .window_under(handle.current_location())
68- .map(Mapped::id),
69- );
70- }
71- handle.unset_grab(self, data, event.serial, event.time, true);
72 }65 }
66+
67+ // We're handling this press, don't send the release to the window.
68+ data.niri.suppressed_buttons.insert(event.button);
69+
70+ if let Some(tx) = data.niri.pick_window.take() {
71+ let _ = tx.send_blocking(
72+ data.niri
73+ .window_under(handle.current_location())
74+ .map(Mapped::id),
75+ );
76+ }
77+
78+ handle.unset_grab(self, data, event.serial, event.time, true);
73 }79 }
74 80
75 fn axis(81 fn axis(