[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] ui/cocoa: Fix openFile: deprecation on Big Sur
From: |
Peter Maydell |
Subject: |
Re: [PATCH v2] ui/cocoa: Fix openFile: deprecation on Big Sur |
Date: |
Mon, 22 Mar 2021 17:03:49 +0000 |
On Sun, 10 Jan 2021 at 00:14, Roman Bolshakov <r.bolshakov@yadro.com> wrote:
> Now if we apply the workaround mentioned in the article [1] that
> switches focus to Dock and then back to the app we can resolve the issue
> in QEMU:
>
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index f32adc3074..0986891ca0 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -1114,6 +1114,15 @@ QemuCocoaView *cocoaView;
> allow_events = true;
> /* Tell cocoa_display_init to proceed */
> qemu_sem_post(&app_started_sem);
> +
> + /* Workaround unresponsive menu bar in macOS prior to Big Sur */
> + NSArray *docks = [NSRunningApplication
> runningApplicationsWithBundleIdentifier: @"com.apple.dock"];
> + if ([docks.firstObject activateWithOptions:
> NSApplicationActivateAllWindows]) {
> + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 200 * NSEC_PER_MSEC),
> + dispatch_get_main_queue(), ^{
> + [NSApp activateIgnoringOtherApps:YES];
> + });
> + }
> }
>
> - (void)applicationWillTerminate:(NSNotification *)aNotification
>
> Peter, does it help you? And what version of macOS do you use?
I got round to having another look at this this afternoon.
(I'm using Catalina.) The workaround above does work for me,
though it seems like a pretty nasty one.
I tried the various reshufflings of the code suggested in various bugs,
stack-overflow questions, etc, about where we should call setActivationPolicy,
create menus, call activateIgnoringOtherApps, etc, but they didn't help.
thanks
-- PMM
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH v2] ui/cocoa: Fix openFile: deprecation on Big Sur,
Peter Maydell <=