forge
Explore
Log in

Don't you dare go Hollow

input: Only do events on key press

Browse files at this commit

89349f2f3df431ecee1f87d6609b4ae38aa28930Ivan MolodetskikhParent: 64610d1
src/input.rsmodified+16 -7
@@ -1,6 +1,6 @@
1 use smithay::backend::input::{1 use smithay::backend::input::{
2 AbsolutePositionEvent, Axis, AxisSource, ButtonState, Event, InputBackend, InputEvent,2 AbsolutePositionEvent, Axis, AxisSource, ButtonState, Event, InputBackend, InputEvent,
3- KeyboardKeyEvent, PointerAxisEvent, PointerButtonEvent, PointerMotionEvent,3+ KeyState, KeyboardKeyEvent, PointerAxisEvent, PointerButtonEvent, PointerMotionEvent,
4 };4 };
5 use smithay::input::keyboard::{keysyms, FilterResult};5 use smithay::input::keyboard::{keysyms, FilterResult};
6 use smithay::input::pointer::{AxisFrame, ButtonEvent, MotionEvent, RelativeMotionEvent};6 use smithay::input::pointer::{AxisFrame, ButtonEvent, MotionEvent, RelativeMotionEvent};
@@ -34,13 +34,22 @@ impl Niri {
34 event.state(),34 event.state(),
35 serial,35 serial,
36 time,36 time,
37- |_, mods, keysym| match keysym.modified_sym() {37+ |_, mods, keysym| {
38- keysyms::KEY_E if mods.logo => FilterResult::Intercept(InputAction::Quit),38+ if event.state() == KeyState::Pressed {
39- keysym @ keysyms::KEY_XF86Switch_VT_1..=keysyms::KEY_XF86Switch_VT_12 => {39+ match keysym.modified_sym() {
40- let vt = (keysym - keysyms::KEY_XF86Switch_VT_1 + 1) as i32;40+ keysyms::KEY_E if mods.logo => {
41- FilterResult::Intercept(InputAction::ChangeVt(vt))41+ FilterResult::Intercept(InputAction::Quit)
42+ }
43+ keysym @ keysyms::KEY_XF86Switch_VT_1
44+ ..=keysyms::KEY_XF86Switch_VT_12 => {
45+ let vt = (keysym - keysyms::KEY_XF86Switch_VT_1 + 1) as i32;
46+ FilterResult::Intercept(InputAction::ChangeVt(vt))
47+ }
48+ _ => FilterResult::Forward,
49+ }
50+ } else {
51+ FilterResult::Forward
42 }52 }
43- _ => FilterResult::Forward,
44 },53 },
45 );54 );
46 55