mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-15 07:28:28 +00:00
Handle window focus lost event
Avoids keys getting stuck when window loses focus (e.g alt+tab) Closes #602
This commit is contained in:
parent
5e2ab214d1
commit
9648b40d85
@ -941,7 +941,14 @@ 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;
|
||||
}
|
||||
},
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
@ -1052,6 +1059,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;
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
@ -1161,6 +1175,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,7 @@ 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,
|
||||
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