1
0
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:
Emil Ernerfeldt
2025-10-07 14:21:10 +02:00
committed by GitHub
parent 78fffc7707
commit ab461f4115
3 changed files with 41 additions and 6 deletions

View File

@@ -423,10 +423,19 @@ impl State {
}
}
WindowEvent::Focused(focused) => {
self.egui_input.focused = *focused;
let focused = if cfg!(target_os = "macos") {
// 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
};
self.egui_input.focused = focused;
self.egui_input
.events
.push(egui::Event::WindowFocused(*focused));
.push(egui::Event::WindowFocused(focused));
EventResponse {
repaint: true,
consumed: false,