MacOS: Only activate after the application has finished launching (#1903)
* MacOS: Only activate after the application has finished launching This fixes the main menu not responding until you refocus, at least from what I can tell - though we might have to do something similar to https://github.com/linebender/druid/pull/994 to fix it fully? * MacOS: Remove activation hack * Stop unnecessarily calling `makeKeyWindow` on initially hidden windows You can't make hidden windows the key window * Add new, simpler activation hack For activating multiple windows created before the application finished launching
This commit is contained in:
parent
45aacd8407
commit
277515636d
8 changed files with 50 additions and 289 deletions
|
|
@ -359,7 +359,7 @@ impl UnownedWindow {
|
|||
|
||||
let pool = unsafe { NSAutoreleasePool::new(nil) };
|
||||
|
||||
let ns_app = create_app(pl_attribs.activation_policy).ok_or_else(|| {
|
||||
create_app(pl_attribs.activation_policy).ok_or_else(|| {
|
||||
unsafe { pool.drain() };
|
||||
os_error!(OsError::CreationError("Couldn't create `NSApplication`"))
|
||||
})?;
|
||||
|
|
@ -391,7 +391,6 @@ impl UnownedWindow {
|
|||
ns_window.setBackgroundColor_(NSColor::clearColor(nil));
|
||||
}
|
||||
|
||||
ns_app.activateIgnoringOtherApps_(YES);
|
||||
win_attribs.min_inner_size.map(|dim| {
|
||||
let logical_dim = dim.to_logical(scale_factor);
|
||||
set_min_inner_size(*ns_window, logical_dim)
|
||||
|
|
@ -441,12 +440,9 @@ impl UnownedWindow {
|
|||
// Setting the window as key has to happen *after* we set the fullscreen
|
||||
// state, since otherwise we'll briefly see the window at normal size
|
||||
// before it transitions.
|
||||
unsafe {
|
||||
if visible {
|
||||
window.ns_window.makeKeyAndOrderFront_(nil);
|
||||
} else {
|
||||
window.ns_window.makeKeyWindow();
|
||||
}
|
||||
if visible {
|
||||
// Tightly linked with `app_state::window_activation_hack`
|
||||
unsafe { window.ns_window.makeKeyAndOrderFront_(nil) };
|
||||
}
|
||||
|
||||
if maximized {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue