On macOS, fix initial focused state

The synthetic focused event was queued after the real event was send
leading to focused issues on startup.

Fixes #2695.
This commit is contained in:
Kirill Chibisov committed 2023-03-02 14:35:02 +03:00
1 parent 0fbba02318
commit 2e4dafc9fe
2 files changed
+5 -2

No files matched your search

+4 -2
View File
@@ -466,6 +466,10 @@ impl WinitWindow {
let delegate = WinitWindowDelegate::new(&this, attrs.fullscreen.is_some());
// XXX Send `Focused(false)` right after creating the window delegate, so we won't
// obscure the real focused events on the startup.
delegate.queue_event(WindowEvent::Focused(false));
// Set fullscreen mode after we setup everything
this.set_fullscreen(attrs.fullscreen.map(Into::into));
@@ -485,8 +489,6 @@ impl WinitWindow {
this.set_maximized(attrs.maximized);
}
delegate.queue_event(WindowEvent::Focused(false));
Ok((this, delegate))
}