mirror of
https://github.com/wez/wezterm.git
synced 2024-11-30 06:03:39 +03:00
wayland: only cancel key repeat when the *held* key was released, fixes #2452
This commit is contained in:
parent
77024fa109
commit
682e83433d
@ -74,7 +74,7 @@ impl KeyRepeatState {
|
|||||||
|
|
||||||
let mut inner = handle.borrow_mut();
|
let mut inner = handle.borrow_mut();
|
||||||
|
|
||||||
if inner.key_repeat.as_ref().map(|k| Arc::as_ptr(k))
|
if inner.key_repeat.as_ref().map(|(_, k)| Arc::as_ptr(k))
|
||||||
!= Some(Arc::as_ptr(&state))
|
!= Some(Arc::as_ptr(&state))
|
||||||
{
|
{
|
||||||
// Key was released and/or some other key is doing
|
// Key was released and/or some other key is doing
|
||||||
@ -138,7 +138,7 @@ pub struct WaylandWindowInner {
|
|||||||
hscroll_remainder: f64,
|
hscroll_remainder: f64,
|
||||||
vscroll_remainder: f64,
|
vscroll_remainder: f64,
|
||||||
modifiers: Modifiers,
|
modifiers: Modifiers,
|
||||||
key_repeat: Option<Arc<Mutex<KeyRepeatState>>>,
|
key_repeat: Option<(u32, Arc<Mutex<KeyRepeatState>>)>,
|
||||||
pending_event: Arc<Mutex<PendingEvent>>,
|
pending_event: Arc<Mutex<PendingEvent>>,
|
||||||
pending_mouse: Arc<Mutex<PendingMouse>>,
|
pending_mouse: Arc<Mutex<PendingMouse>>,
|
||||||
pending_first_configure: Option<async_channel::Sender<()>>,
|
pending_first_configure: Option<async_channel::Sender<()>>,
|
||||||
@ -439,12 +439,16 @@ impl WaylandWindowInner {
|
|||||||
when: Instant::now(),
|
when: Instant::now(),
|
||||||
event,
|
event,
|
||||||
}));
|
}));
|
||||||
self.key_repeat.replace(Arc::clone(&rep));
|
self.key_repeat.replace((key, Arc::clone(&rep)));
|
||||||
KeyRepeatState::schedule(rep, self.window_id);
|
KeyRepeatState::schedule(rep, self.window_id);
|
||||||
} else {
|
} else if let Some((cur_key, _)) = self.key_repeat.as_ref() {
|
||||||
|
// important to check that it's the same key, because the release of the previously
|
||||||
|
// repeated key can come right after the press of the newly held key
|
||||||
|
if *cur_key == key {
|
||||||
self.key_repeat.take();
|
self.key_repeat.take();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
WlKeyboardEvent::Modifiers {
|
WlKeyboardEvent::Modifiers {
|
||||||
mods_depressed,
|
mods_depressed,
|
||||||
mods_latched,
|
mods_latched,
|
||||||
|
Loading…
Reference in New Issue
Block a user