From f36a8da95fe3d608e3bd34559499faffbf47a7f9 Mon Sep 17 00:00:00 2001 From: Phil Marell Date: Wed, 28 Jul 2021 20:14:34 +1000 Subject: [PATCH] Allow native menu to unhighlight --- AerofoilMac/AerofoilMac/AerofoilAppDelegate.mm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/AerofoilMac/AerofoilMac/AerofoilAppDelegate.mm b/AerofoilMac/AerofoilMac/AerofoilAppDelegate.mm index 153ad53..cb115d3 100644 --- a/AerofoilMac/AerofoilMac/AerofoilAppDelegate.mm +++ b/AerofoilMac/AerofoilMac/AerofoilAppDelegate.mm @@ -17,13 +17,19 @@ void DoSettingsMain(void); @implementation AerofoilAppDelegate - (IBAction)showAboutAerofoil:(id)sender { - DoAboutFramework(); + [self performAsynchronously:DoAboutFramework]; } - (IBAction)showAboutGliderPRO:(id)sender { - DoAbout(); + [self performAsynchronously:DoAbout]; } - (IBAction)showPreferences:(id)sender { - DoSettingsMain(); + [self performAsynchronously:DoSettingsMain]; +} + +- (void)performAsynchronously:(void(*)())function { + dispatch_async(dispatch_get_main_queue(), ^{ + function(); + }); } - (BOOL)validateMenuItem:(NSMenuItem *)menuItem {