aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-03-22 15:10:53 +0000
committerPeter Maydell <peter.maydell@linaro.org>2021-03-22 16:45:38 +0000
commitfea581180214fb9ddee48fee1762a0cef965be92 (patch)
treeedc20f892860780b74f6649b6e9c5d1dd985c3b3
parente0003bc032ce5cf6a886675f288e6cd8b9da9849 (diff)
downloadqemu-arm-fea581180214fb9ddee48fee1762a0cef965be92.tar.gz
move menus to applicationDidFinishLaunching
-rw-r--r--ui/cocoa.m33
1 files changed, 20 insertions, 13 deletions
diff --git a/ui/cocoa.m b/ui/cocoa.m
index c0fdbcccf8..d2b9efd2ad 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1138,6 +1138,8 @@ QemuCocoaView *cocoaView;
[super dealloc];
}
+static void create_menus(void);
+
- (void)applicationDidResignActive: (NSNotification *) note
{
COCOA_DEBUG("DidResignActive\n");
@@ -1156,11 +1158,15 @@ QemuCocoaView *cocoaView;
- (void)applicationWillFinishLaunching: (NSNotification *) note
{
COCOA_DEBUG("WillFinishLaunching\n");
+ [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
+ create_menus();
}
- (void)applicationDidFinishLaunching: (NSNotification *) note
{
COCOA_DEBUG("QemuCocoaAppController: applicationDidFinishLaunching\n");
+ [NSApp activateIgnoringOtherApps: YES];
+
allow_events = true;
/* Tell cocoa_display_init to proceed */
qemu_sem_post(&app_started_sem);
@@ -1731,6 +1737,20 @@ static void addRemovableDevicesMenuItems(void)
qapi_free_BlockInfoList(pointerToFree);
}
+static void create_menus(void)
+{
+ create_initial_menus();
+ /*
+ * Create the menu entries which depend on QEMU state (for consoles
+ * and removeable devices). These make calls back into QEMU functions,
+ * which is OK because at this point we know that the second thread
+ * holds the iothread lock and is synchronously waiting for us to
+ * finish.
+ */
+ add_console_menu_entries();
+ addRemovableDevicesMenuItems();
+}
+
/*
* The startup process for the OSX/Cocoa UI is complicated, because
* OSX insists that the UI runs on the initial main thread, and so we
@@ -1794,18 +1814,6 @@ int main (int argc, const char * argv[]) {
[QemuApplication sharedApplication];
- create_initial_menus();
-
- /*
- * Create the menu entries which depend on QEMU state (for consoles
- * and removeable devices). These make calls back into QEMU functions,
- * which is OK because at this point we know that the second thread
- * holds the iothread lock and is synchronously waiting for us to
- * finish.
- */
- add_console_menu_entries();
- addRemovableDevicesMenuItems();
-
// Create an Application controller
QemuCocoaAppController *appController = [[QemuCocoaAppController alloc] init];
[NSApp setDelegate:appController];
@@ -1900,7 +1908,6 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
/* if fullscreen mode is to be used */
if (opts->has_full_screen && opts->full_screen) {
dispatch_async(dispatch_get_main_queue(), ^{
- [NSApp activateIgnoringOtherApps: YES];
[(QemuCocoaAppController *)[[NSApplication sharedApplication] delegate] toggleFullScreen: nil];
});
}