Skip to content

Commit

Permalink
Remove unused variable
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturKovacs committed Apr 12, 2021
1 parent a52f86d commit f0474f2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
4 changes: 1 addition & 3 deletions src/platform_impl/windows/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ mod runner;
use parking_lot::Mutex;
use std::{
cell::Cell,
collections::{
VecDeque,
},
collections::VecDeque,
marker::PhantomData,
mem, panic, ptr,
rc::Rc,
Expand Down
22 changes: 1 addition & 21 deletions src/platform_impl/windows/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,10 @@ pub struct MessageAsKeyEvent {
/// text input. The "sequence" only consists of one WM_KEYUP / WM_SYSKEYUP event.
pub struct KeyEventBuilder {
event_info: Option<PartialKeyEventInfo>,

/// The keyup event needs to call `ToUnicode` to determine what the text produced by the
/// key with all modifiers except CTRL (the `logical_key`) is.
///
/// But `ToUnicode` without the non-modifying flag (see `key_labels`), resets the dead key
/// state which would be incorrect during every keyup event. Therefore this variable is used
/// to determine whether the last keydown event produced a dead key.
///
/// Note that this variable is not always correct because it does
/// not track key presses outside of this window. However, the ONLY situation where this
/// doesn't work as intended is when the user presses a dead key outside of this window, and
/// switches to this window BEFORE releasing it then releases the dead key. In this case
/// the `ToUnicode` function will be called, incorrectly clearing the dead key state. Having
/// an inccorect behaviour only in this case seems acceptable.
prev_down_was_dead: bool,
}
impl Default for KeyEventBuilder {
fn default() -> Self {
KeyEventBuilder {
event_info: None,
prev_down_was_dead: false,
}
KeyEventBuilder { event_info: None }
}
}
impl KeyEventBuilder {
Expand Down Expand Up @@ -120,7 +102,6 @@ impl KeyEventBuilder {
return vec![];
}
*result = ProcResult::Value(0);
self.prev_down_was_dead = false;

let mut layouts = LAYOUT_CACHE.lock().unwrap();
let event_info = PartialKeyEventInfo::from_message(
Expand Down Expand Up @@ -176,7 +157,6 @@ impl KeyEventBuilder {
}
winuser::WM_DEADCHAR | winuser::WM_SYSDEADCHAR => {
*result = ProcResult::Value(0);
self.prev_down_was_dead = true;
// At this point, we know that there isn't going to be any more events related to
// this key press
let event_info = self.event_info.take().unwrap();
Expand Down

0 comments on commit f0474f2

Please sign in to comment.