Skip to content
Snippets Groups Projects
Commit a277a230 authored by John Hodge's avatar John Hodge
Browse files

GUI - Fix ordering of key events (better debugging)

parent 58d630f2
No related merge requests found
...@@ -130,12 +130,18 @@ impl InputChannel ...@@ -130,12 +130,18 @@ impl InputChannel
_ => {}, _ => {},
} }
let last_key = self.last_key_pressed.load(Ordering::Relaxed);
if !release {
self.last_key_pressed.store(key as u8, Ordering::Relaxed);
super::windows::handle_input(/*self, */Event::KeyDown(key));
}
// Handle fire and text events // Handle fire and text events
if key.is_modifier() if key.is_modifier()
{ {
// Only fire a modifier on key-up IF they were the last one pressed // Only fire a modifier on key-up IF they were the last one pressed
// - This allows "Gui" (windows) to fire on key-up while still being used as a modifier // - This allows "Gui" (windows) to fire on key-up while still being used as a modifier
if release && self.last_key_pressed.load(Ordering::Relaxed) == key as u8 if release && last_key == key as u8
{ {
super::windows::handle_input( Event::KeyFire(key) ); super::windows::handle_input( Event::KeyFire(key) );
} }
...@@ -164,10 +170,6 @@ impl InputChannel ...@@ -164,10 +170,6 @@ impl InputChannel
self.last_key_pressed.store(KeyCode::None as u8, Ordering::Relaxed); self.last_key_pressed.store(KeyCode::None as u8, Ordering::Relaxed);
super::windows::handle_input(/*self, */Event::KeyUp(key)); super::windows::handle_input(/*self, */Event::KeyUp(key));
} }
else {
self.last_key_pressed.store(key as u8, Ordering::Relaxed);
super::windows::handle_input(/*self, */Event::KeyDown(key));
}
} }
pub fn handle_mouse_move(&self, dx: i16, dy: i16) pub fn handle_mouse_move(&self, dx: i16, dy: i16)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment