mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-30 05:10:03 -04:00
Add WindowBuilder::with_active
Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
This commit is contained in:
@@ -114,6 +114,9 @@ extern_methods!(
|
||||
#[sel(makeKeyAndOrderFront:)]
|
||||
pub fn makeKeyAndOrderFront(&self, sender: Option<&Object>);
|
||||
|
||||
#[sel(orderFront:)]
|
||||
pub fn orderFront(&self, sender: Option<&Object>);
|
||||
|
||||
#[sel(miniaturize:)]
|
||||
pub fn miniaturize(&self, sender: Option<&Object>);
|
||||
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
|
||||
@@ -406,7 +406,7 @@ impl WinitWindowDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
fn queue_event(&self, event: WindowEvent<'static>) {
|
||||
pub(crate) fn queue_event(&self, event: WindowEvent<'static>) {
|
||||
let event = Event::WindowEvent {
|
||||
window_id: WindowId(self.window.id()),
|
||||
event,
|
||||
|
||||
Reference in New Issue
Block a user