mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 05:21:31 +11:00
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:
parent
ed796dcd15
commit
2af1550bbb
|
@ -13,6 +13,7 @@ And please only add new entries to the top of this list, right below the `# Unre
|
||||||
- On Wayland, fix rare crash on DPI change
|
- On Wayland, fix rare crash on DPI change
|
||||||
- Web: Added support for `Window::theme`.
|
- Web: Added support for `Window::theme`.
|
||||||
- On Wayland, fix rounding issues when doing resize.
|
- On Wayland, fix rounding issues when doing resize.
|
||||||
|
- On macOS, fix wrong focused state on startup.
|
||||||
|
|
||||||
# 0.28.1
|
# 0.28.1
|
||||||
|
|
||||||
|
|
|
@ -466,6 +466,10 @@ impl WinitWindow {
|
||||||
|
|
||||||
let delegate = WinitWindowDelegate::new(&this, attrs.fullscreen.is_some());
|
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
|
// Set fullscreen mode after we setup everything
|
||||||
this.set_fullscreen(attrs.fullscreen.map(Into::into));
|
this.set_fullscreen(attrs.fullscreen.map(Into::into));
|
||||||
|
|
||||||
|
@ -485,8 +489,6 @@ impl WinitWindow {
|
||||||
this.set_maximized(attrs.maximized);
|
this.set_maximized(attrs.maximized);
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate.queue_event(WindowEvent::Focused(false));
|
|
||||||
|
|
||||||
Ok((this, delegate))
|
Ok((this, delegate))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue