mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Fix eframe window not being focused on mac on startup (#7593)
* Workaround for https://github.com/rust-windowing/winit/issues/4371 * Closes https://github.com/emilk/egui/issues/7588 Tested manually
This commit is contained in:
@@ -775,8 +775,21 @@ impl GlowWinitRunning<'_> {
|
||||
let mut repaint_asap = false;
|
||||
|
||||
match event {
|
||||
winit::event::WindowEvent::Focused(new_focused) => {
|
||||
glutin.focused_viewport = new_focused.then(|| viewport_id).flatten();
|
||||
winit::event::WindowEvent::Focused(focused) => {
|
||||
let focused = if cfg!(target_os = "macos")
|
||||
&& let Some(viewport_id) = viewport_id
|
||||
&& let Some(viewport) = glutin.viewports.get(&viewport_id)
|
||||
&& let Some(window) = &viewport.window
|
||||
{
|
||||
// TODO(emilk): remove this work-around once we update winit
|
||||
// https://github.com/rust-windowing/winit/issues/4371
|
||||
// https://github.com/emilk/egui/issues/7588
|
||||
window.has_focus()
|
||||
} else {
|
||||
*focused
|
||||
};
|
||||
|
||||
glutin.focused_viewport = focused.then_some(viewport_id).flatten();
|
||||
}
|
||||
|
||||
winit::event::WindowEvent::Resized(physical_size) => {
|
||||
|
||||
Reference in New Issue
Block a user