mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 21:30:03 -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:
@@ -927,6 +927,8 @@ pub struct WindowInfo {
|
||||
pub maximized: bool,
|
||||
|
||||
/// Is the window focused and able to receive input?
|
||||
///
|
||||
/// This should be the same as [`egui::InputState::focused`].
|
||||
pub focused: bool,
|
||||
|
||||
/// Window inner size in egui points (logical pixels).
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user