aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-08-10 17:23:38 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-08-10 17:23:38 +0400
commit89349f2f3df431ecee1f87d6609b4ae38aa28930 (patch)
treec6866107736bd47a86458f9dbc49938142bbe631
parent64610d1e24770857edf99eb4254c0cb06abd8d08 (diff)
downloadniri-89349f2f3df431ecee1f87d6609b4ae38aa28930.tar.gz
niri-89349f2f3df431ecee1f87d6609b4ae38aa28930.tar.bz2
niri-89349f2f3df431ecee1f87d6609b4ae38aa28930.zip
input: Only do events on key press
-rw-r--r--src/input.rs23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/input.rs b/src/input.rs
index b7704221..ca08c379 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -1,6 +1,6 @@
use smithay::backend::input::{
AbsolutePositionEvent, Axis, AxisSource, ButtonState, Event, InputBackend, InputEvent,
- KeyboardKeyEvent, PointerAxisEvent, PointerButtonEvent, PointerMotionEvent,
+ KeyState, KeyboardKeyEvent, PointerAxisEvent, PointerButtonEvent, PointerMotionEvent,
};
use smithay::input::keyboard::{keysyms, FilterResult};
use smithay::input::pointer::{AxisFrame, ButtonEvent, MotionEvent, RelativeMotionEvent};
@@ -34,13 +34,22 @@ impl Niri {
event.state(),
serial,
time,
- |_, mods, keysym| match keysym.modified_sym() {
- keysyms::KEY_E if mods.logo => FilterResult::Intercept(InputAction::Quit),
- keysym @ keysyms::KEY_XF86Switch_VT_1..=keysyms::KEY_XF86Switch_VT_12 => {
- let vt = (keysym - keysyms::KEY_XF86Switch_VT_1 + 1) as i32;
- FilterResult::Intercept(InputAction::ChangeVt(vt))
+ |_, mods, keysym| {
+ if event.state() == KeyState::Pressed {
+ match keysym.modified_sym() {
+ keysyms::KEY_E if mods.logo => {
+ FilterResult::Intercept(InputAction::Quit)
+ }
+ keysym @ keysyms::KEY_XF86Switch_VT_1
+ ..=keysyms::KEY_XF86Switch_VT_12 => {
+ let vt = (keysym - keysyms::KEY_XF86Switch_VT_1 + 1) as i32;
+ FilterResult::Intercept(InputAction::ChangeVt(vt))
+ }
+ _ => FilterResult::Forward,
+ }
+ } else {
+ FilterResult::Forward
}
- _ => FilterResult::Forward,
},
);