Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore double press / release events #71

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@ impl Server {
}
}
State::Receiving => {
let mut ignore_event = false;
if let Event::Keyboard(KeyboardEvent::Key {
time: _,
key,
Expand All @@ -736,15 +737,21 @@ impl Server {
return;
};
if state == 0 {
client_state.pressed_keys.remove(&key);
// ignore release event if key not pressed
ignore_event = !client_state.pressed_keys.remove(&key);
} else {
client_state.pressed_keys.insert(key);
// ignore press event if key not released
ignore_event = !client_state.pressed_keys.insert(key);
let _ = timer_tx.try_send(());
}
}
// consume event
consumer.consume(event, handle).await;
log::trace!("{event:?} => consumer");
// ignore double press / release events to
// workaround buggy rdp backend.
if !ignore_event {
// consume event
consumer.consume(event, handle).await;
log::trace!("{event:?} => consumer");
}
}
State::AwaitingLeave => {
// we just entered the deadzone of a client, so
Expand Down