down as press only for linux and non-modifier
This commit is contained in:
parent
ab4843b76e
commit
ccd1cab6bc
@ -150,8 +150,7 @@ pub fn resample_channels(
|
|||||||
if x.is_empty() {
|
if x.is_empty() {
|
||||||
Vec::new()
|
Vec::new()
|
||||||
} else if x.len() == 2 {
|
} else if x.len() == 2 {
|
||||||
x[0]
|
x[0].chunks(1)
|
||||||
.chunks(1)
|
|
||||||
.zip(x[1].chunks(1))
|
.zip(x[1].chunks(1))
|
||||||
.flat_map(|(a, b)| a.into_iter().chain(b))
|
.flat_map(|(a, b)| a.into_iter().chain(b))
|
||||||
.map(|x| *x as f32)
|
.map(|x| *x as f32)
|
||||||
@ -395,6 +394,10 @@ pub fn is_modifier(evt: &KeyEvent) -> bool {
|
|||||||
|| v == ControlKey::Shift.value()
|
|| v == ControlKey::Shift.value()
|
||||||
|| v == ControlKey::Control.value()
|
|| v == ControlKey::Control.value()
|
||||||
|| v == ControlKey::Meta.value()
|
|| v == ControlKey::Meta.value()
|
||||||
|
|| v == ControlKey::RAlt.value()
|
||||||
|
|| v == ControlKey::RShift.value()
|
||||||
|
|| v == ControlKey::RControl.value()
|
||||||
|
|| v == ControlKey::RWin.value()
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
@ -647,7 +647,12 @@ impl Connection {
|
|||||||
// handle all down as press
|
// handle all down as press
|
||||||
// fix unexpected repeating key on remote linux, seems also fix abnormal alt/shift, which
|
// fix unexpected repeating key on remote linux, seems also fix abnormal alt/shift, which
|
||||||
// make sure all key are released
|
// make sure all key are released
|
||||||
if me.press || me.down {
|
let is_press = if cfg!(target_os = "linux") {
|
||||||
|
(me.press || me.down) && !crate::is_modifier(&me)
|
||||||
|
} else {
|
||||||
|
me.press
|
||||||
|
};
|
||||||
|
if is_press {
|
||||||
if let Some(key_event::Union::unicode(_)) = me.union {
|
if let Some(key_event::Union::unicode(_)) = me.union {
|
||||||
handle_key(&me);
|
handle_key(&me);
|
||||||
} else if let Some(key_event::Union::seq(_)) = me.union {
|
} else if let Some(key_event::Union::seq(_)) = me.union {
|
||||||
|
@ -305,10 +305,10 @@ fn handle_mouse_(evt: &MouseEvent, conn: i32) {
|
|||||||
let mut en = ENIGO.lock().unwrap();
|
let mut en = ENIGO.lock().unwrap();
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
let mut to_release = Vec::new();
|
let mut to_release = Vec::new();
|
||||||
|
fix_modifiers(&evt.modifiers[..], &mut en, 0);
|
||||||
if evt_type == 1 {
|
if evt_type == 1 {
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
en.reset_flag();
|
en.reset_flag();
|
||||||
fix_modifiers(&evt.modifiers[..], &mut en, 0);
|
|
||||||
for ref ck in evt.modifiers.iter() {
|
for ref ck in evt.modifiers.iter() {
|
||||||
if let Some(key) = KEY_MAP.get(&ck.value()) {
|
if let Some(key) = KEY_MAP.get(&ck.value()) {
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user