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 2023-02-27 20:46:00 +03:00 committed by GitHub
parent ed796dcd15
commit 2af1550bbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

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))
}