mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-11 13:38:35 +00:00
Merge pull request #628 from dbr/losingfocus
Handle window focus lost event
This commit is contained in:
commit
fef6509a6e
@ -967,6 +967,13 @@ impl WinitPlatform {
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
WindowEvent::Focused(newly_focused) => {
|
||||
if !newly_focused {
|
||||
// Set focus-lost to avoid stuck keys (like 'alt'
|
||||
// when alt-tabbing)
|
||||
io.app_focus_lost = true;
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
@ -1077,6 +1084,13 @@ impl WinitPlatform {
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
WindowEvent::Focused(newly_focused) => {
|
||||
if !newly_focused {
|
||||
// Set focus-lost to avoid stuck keys (like 'alt'
|
||||
// when alt-tabbing)
|
||||
io.app_focus_lost = true;
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
@ -1186,6 +1200,13 @@ impl WinitPlatform {
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
WindowEvent::Focused(newly_focused) => {
|
||||
if !newly_focused {
|
||||
// Set focus-lost to avoid stuck keys (like 'alt'
|
||||
// when alt-tabbing)
|
||||
io.app_focus_lost = true;
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
@ -339,7 +339,11 @@ pub struct Io {
|
||||
nav_inputs_down_duration: [f32; NavInput::COUNT + NavInput::INTERNAL_COUNT],
|
||||
nav_inputs_down_duration_prev: [f32; NavInput::COUNT + NavInput::INTERNAL_COUNT],
|
||||
pen_pressure: f32,
|
||||
app_focus_lost: bool,
|
||||
|
||||
/// Clear buttons state when focus is lost (this is useful so
|
||||
/// e.g. releasing Alt after focus loss on Alt-Tab doesn't trigger
|
||||
/// the Alt menu toggle)
|
||||
pub app_focus_lost: bool,
|
||||
input_queue_surrogate: sys::ImWchar16,
|
||||
input_queue_characters: ImVector<sys::ImWchar>,
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user