From 41b502d6449bc558bc9a4ab7f86bb515d5425f6c Mon Sep 17 00:00:00 2001 From: Damian Rickard Date: Tue, 7 Jul 2026 21:01:33 -0400 Subject: [PATCH] macOS: remove deprecated Carbon foregrounding, rely on wxWidgets When started with command-line arguments, Main.cpp promoted the process to a foreground application using the Carbon Process Manager (GetCurrentProcess / TransformProcessType / SetFrontProcess). These calls have been deprecated since macOS 10.9 and produce deprecation warnings with current SDKs. wxWidgets already covers this itself: after creating its wxNSApplication instance, its applicationDidFinishLaunching handler sets NSApplicationActivationPolicyRegular and activates the app when the executable is not part of an .app bundle, and activates bundled apps whose activation policy is accessory (src/osx/cocoa/utils.mm in wxWidgets 3.2.10). Executables inside an .app bundle get the regular activation policy from LaunchServices via their Info.plist. Remove the Carbon block and the ApplicationServices include and leave foreground activation to wxWidgets. This also avoids creating an NSApplication singleton before wxWidgets installs its own wxNSApplication subclass in DoInitGui, which would break Cocoa event handling such as command-key key-up processing. --- src/Main/Unix/Main.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/Main/Unix/Main.cpp b/src/Main/Unix/Main.cpp index abed39164e..dfe820c077 100644 --- a/src/Main/Unix/Main.cpp +++ b/src/Main/Unix/Main.cpp @@ -22,10 +22,6 @@ #include "Main/Main.h" #include "Main/UserInterface.h" -#if defined (TC_MACOSX) && !defined (TC_NO_GUI) -#include -#endif - using namespace VeraCrypt; int main (int argc, char **argv) @@ -92,17 +88,6 @@ int main (int argc, char **argv) } else { -#if defined (TC_MACOSX) && !defined (TC_NO_GUI) - if (argc > 1 && !(argc == 2 && strstr (argv[1], "-psn_") == argv[1])) - { - ProcessSerialNumber p; - if (GetCurrentProcess (&p) == noErr) - { - TransformProcessType (&p, kProcessTransformToForegroundApplication); - SetFrontProcess (&p); - } - } -#endif Application::Initialize (UserInterfaceType::Graphic); }