Add WindowBuilder::with_active
Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
This commit is contained in:
parent
930df0ec45
commit
b457329003
9 changed files with 60 additions and 5 deletions
|
|
@ -19,6 +19,7 @@ use crate::{
|
|||
LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Position, Size, Size::Logical,
|
||||
},
|
||||
error::{ExternalError, NotSupportedError, OsError as RootOsError},
|
||||
event::WindowEvent,
|
||||
icon::Icon,
|
||||
platform::macos::WindowExtMacOS,
|
||||
platform_impl::platform::{
|
||||
|
|
@ -464,14 +465,20 @@ impl WinitWindow {
|
|||
// state, since otherwise we'll briefly see the window at normal size
|
||||
// before it transitions.
|
||||
if attrs.visible {
|
||||
// Tightly linked with `app_state::window_activation_hack`
|
||||
this.makeKeyAndOrderFront(None);
|
||||
if attrs.active {
|
||||
// Tightly linked with `app_state::window_activation_hack`
|
||||
this.makeKeyAndOrderFront(None);
|
||||
} else {
|
||||
this.orderFront(None);
|
||||
}
|
||||
}
|
||||
|
||||
if attrs.maximized {
|
||||
this.set_maximized(attrs.maximized);
|
||||
}
|
||||
|
||||
delegate.queue_event(WindowEvent::Focused(false));
|
||||
|
||||
Ok((this, delegate))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue