1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 21:32:13 +03:00

wayland: clear modifiers when keyboard focus changes

refs: #222
This commit is contained in:
Wez Furlong 2020-10-11 10:02:37 -07:00
parent d33647dd97
commit dedfc4513b

View File

@ -313,8 +313,19 @@ impl WaylandWindowInner {
.key_event(&key_event, &Window::Wayland(WaylandWindow(self.window_id)));
}
KeyboardEvent::Modifiers { modifiers } => self.modifiers = modifiers,
KeyboardEvent::Enter { .. } => self.callbacks.focus_change(true),
KeyboardEvent::Leave { .. } => self.callbacks.focus_change(false),
// Clear the modifiers when we change focus, otherwise weird
// things can happen. For instance, if we lost focus because
// CTRL+SHIFT+N was pressed to spawn a new window, we'd be
// left stuck with CTRL+SHIFT held down and the window would
// be left in a broken state.
KeyboardEvent::Enter { .. } => {
self.modifiers = Modifiers::NONE;
self.callbacks.focus_change(true)
}
KeyboardEvent::Leave { .. } => {
self.modifiers = Modifiers::NONE;
self.callbacks.focus_change(false)
}
}
}