1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Clear all keys and modifies on focus change (#2933)

It is very easy for keys to become stuck when we alt-tab,
or a save-dialog opens by Ctrl+S, etc.
Therefore we new clear all the modifiers and down keys to avoid that.
This commit is contained in:
Emil Ernerfeldt
2023-04-19 15:27:51 +02:00
committed by GitHub
parent ede3ded977
commit d1af798a9b
7 changed files with 50 additions and 16 deletions

View File

@@ -31,9 +31,10 @@ impl WebInput {
}
}
pub fn on_web_page_focus_change(&mut self, has_focus: bool) {
pub fn on_web_page_focus_change(&mut self, focused: bool) {
self.raw.modifiers = egui::Modifiers::default();
self.raw.has_focus = has_focus;
self.raw.focused = focused;
self.raw.events.push(egui::Event::WindowFocused(focused));
self.latest_touch_pos = None;
self.latest_touch_pos_id = None;
}