aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-03-22 16:55:48 +0000
committerPeter Maydell <peter.maydell@linaro.org>2021-03-22 16:55:48 +0000
commite5cf4588f469c0d20d781875b0cc0ce7b8904271 (patch)
tree29aa1cc7cfb7da64986e52298259d647c809d6aa
parentfea581180214fb9ddee48fee1762a0cef965be92 (diff)
downloadqemu-arm-e5cf4588f469c0d20d781875b0cc0ce7b8904271.tar.gz
javafx style workaroundcocoa-menu
-rw-r--r--ui/cocoa.m13
1 files changed, 13 insertions, 0 deletions
diff --git a/ui/cocoa.m b/ui/cocoa.m
index d2b9efd2ad..a8101afbd3 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1140,9 +1140,16 @@ QemuCocoaView *cocoaView;
static void create_menus(void);
+static bool first_activation;
+static bool should_reactivate;
+
- (void)applicationDidResignActive: (NSNotification *) note
{
COCOA_DEBUG("DidResignActive\n");
+ if (should_reactivate) {
+ should_reactivate = false;
+ [NSApp activateIgnoringOtherApps: YES];
+ }
}
- (void)applicationWillBecomeActive: (NSNotification *) note
@@ -1153,6 +1160,11 @@ static void create_menus(void);
- (void)applicationDidBecomeActive: (NSNotification *) note
{
COCOA_DEBUG("DidBecomeActive\n");
+ if (first_activation) {
+ first_activation = false;
+ should_reactivate = true;
+ [NSApp hide:NSApp];
+ }
}
- (void)applicationWillFinishLaunching: (NSNotification *) note
@@ -1160,6 +1172,7 @@ static void create_menus(void);
COCOA_DEBUG("WillFinishLaunching\n");
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
create_menus();
+ first_activation = true;
}
- (void)applicationDidFinishLaunching: (NSNotification *) note