Skip to content

Commit

Permalink
Merge pull request rust-windowing#4 from rye/windows-send-empty-modif…
Browse files Browse the repository at this point in the history
…iers-when-lose-focus

windows: Send ModifiersChanged(ModifiersState::empty) on KILLFOCUS
  • Loading branch information
murarth authored Jan 22, 2020
2 parents eb1c08d + 88aab18 commit b28fd6b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/platform_impl/windows/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,11 @@ unsafe extern "system" fn public_window_callback<T: 'static>(
}

winuser::WM_KILLFOCUS => {
use crate::event::{ElementState::Released, WindowEvent::Focused};
use crate::event::{
ElementState::Released,
ModifiersState,
WindowEvent::{Focused, ModifiersChanged},
};
for windows_keycode in event::get_pressed_keys() {
let scancode =
winuser::MapVirtualKeyA(windows_keycode as _, winuser::MAPVK_VK_TO_VSC);
Expand All @@ -1379,6 +1383,11 @@ unsafe extern "system" fn public_window_callback<T: 'static>(
})
}

subclass_input.send_event(Event::WindowEvent {
window_id: RootWindowId(WindowId(window)),
event: ModifiersChanged(ModifiersState::empty()),
});

subclass_input.send_event(Event::WindowEvent {
window_id: RootWindowId(WindowId(window)),
event: Focused(false),
Expand Down

0 comments on commit b28fd6b

Please sign in to comment.