Simplify filtering when not focused
This commit is contained in:
parent
e9558e42ba
commit
c1944f9c15
1 changed files with 2 additions and 8 deletions
|
|
@ -706,9 +706,7 @@ where
|
||||||
Event::Keyboard(KeyEvent::KeyPressed {
|
Event::Keyboard(KeyEvent::KeyPressed {
|
||||||
key_code,
|
key_code,
|
||||||
modifiers,
|
modifiers,
|
||||||
}) => {
|
}) if state.is_focused => {
|
||||||
// Only parse keys when focused
|
|
||||||
if state.is_focused {
|
|
||||||
match key_code {
|
match key_code {
|
||||||
KeyCode::Left => {
|
KeyCode::Left => {
|
||||||
editor.action(Action::Motion(Motion::Left));
|
editor.action(Action::Motion(Motion::Left));
|
||||||
|
|
@ -768,14 +766,11 @@ where
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => {
|
Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => {
|
||||||
state.modifiers = modifiers;
|
state.modifiers = modifiers;
|
||||||
}
|
}
|
||||||
Event::Keyboard(KeyEvent::CharacterReceived(character)) => {
|
Event::Keyboard(KeyEvent::CharacterReceived(character)) if state.is_focused => {
|
||||||
// Only parse keys when focused
|
|
||||||
if state.is_focused {
|
|
||||||
// Only parse keys when Super, Ctrl, and Alt are not pressed
|
// Only parse keys when Super, Ctrl, and Alt are not pressed
|
||||||
if !state.modifiers.logo()
|
if !state.modifiers.logo()
|
||||||
&& !state.modifiers.control()
|
&& !state.modifiers.control()
|
||||||
|
|
@ -786,7 +781,6 @@ where
|
||||||
}
|
}
|
||||||
status = Status::Captured;
|
status = Status::Captured;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Event::Mouse(MouseEvent::ButtonPressed(button)) => {
|
Event::Mouse(MouseEvent::ButtonPressed(button)) => {
|
||||||
if let Some(p) = cursor_position.position_in(layout.bounds()) {
|
if let Some(p) = cursor_position.position_in(layout.bounds()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue