Skip to content

Commit 629cd86

Browse files
authored
Stop calling NSApplication.finishLaunching on window creation (#1902)
This is called internally by NSApplication.run, and is not something we should call - I couldn't find the reasoning behind this being there in the first place, git blame reveals c38110c from 2014, so probably a piece of legacy code. Removing this fixes creating new windows when you have assigned a main menu to the application.
1 parent ba704c4 commit 629cd86

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Unreleased
22

3+
- On macOS, fix creating new windows when the application has a main menu.
34
- On Windows, fix fractional deltas for mouse wheel device events.
45
- On macOS, fix segmentation fault after dropping the main window.
56
- On Android, `InputEvent::KeyEvent` is partially implemented providing the key scancode.

src/platform_impl/macos/window.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ fn create_app(activation_policy: ActivationPolicy) -> Option<id> {
100100
if ns_app == nil {
101101
None
102102
} else {
103+
// TODO: Move ActivationPolicy from an attribute on the window to something on the EventLoop
103104
use self::NSApplicationActivationPolicy::*;
104105
ns_app.setActivationPolicy_(match activation_policy {
105106
ActivationPolicy::Regular => NSApplicationActivationPolicyRegular,
106107
ActivationPolicy::Accessory => NSApplicationActivationPolicyAccessory,
107108
ActivationPolicy::Prohibited => NSApplicationActivationPolicyProhibited,
108109
});
109-
ns_app.finishLaunching();
110110
Some(ns_app)
111111
}
112112
}
@@ -357,6 +357,7 @@ impl UnownedWindow {
357357
panic!("Windows can only be created on the main thread on macOS");
358358
}
359359
}
360+
trace!("Creating new window");
360361

361362
let pool = unsafe { NSAutoreleasePool::new(nil) };
362363

0 commit comments

Comments
 (0)