diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 22:55:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 22:55:46 +0000 |
commit | 96647a898d62d699808316238dfb933d960413f2 (patch) | |
tree | 0138491ada40b7b3fcb80d4b219fa7922ae8f512 /src/VBox/Frontends | |
parent | Adding debian version 7.0.14-dfsg-4. (diff) | |
download | virtualbox-96647a898d62d699808316238dfb933d960413f2.tar.xz virtualbox-96647a898d62d699808316238dfb933d960413f2.zip |
Merging upstream version 7.0.16-dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/Frontends')
4 files changed, 70 insertions, 13 deletions
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp index 524c1be2..05bed8bf 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp @@ -1169,14 +1169,14 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> pVirtualBox, Bstr strCipher; Bstr strPasswordId; HRESULT hrc2 = machine->GetEncryptionSettings(strCipher.asOutParam(), strPasswordId.asOutParam()); + + SHOW_UTF8_STRING( "encryption", Info::tr("Encryption:"), + SUCCEEDED(hrc2) ? "enabled" : "disabled"); if (SUCCEEDED(hrc2)) { - RTPrintf("Encryption: enabled\n"); - RTPrintf("Cipher: %ls\n", strCipher.raw()); - RTPrintf("Password ID: %ls\n", strPasswordId.raw()); + SHOW_BSTR_STRING( "enc_cipher", Info::tr("Cipher:"), strCipher); + SHOW_BSTR_STRING( "enc_password_id", Info::tr("Password ID:"), strPasswordId); } - else - RTPrintf("Encryption: disabled\n"); } SHOW_STRINGARRAY_PROP( machine, Groups, "groups", Info::tr("Groups:")); Bstr osTypeId; @@ -1372,7 +1372,7 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> pVirtualBox, Bstr bstrNVRAMFile; CHECK_ERROR2I_RET(nvramStore, COMGETTER(NonVolatileStorageFile)(bstrNVRAMFile.asOutParam()), hrcCheck); if (bstrNVRAMFile.isNotEmpty()) - SHOW_BSTR_STRING("BIOS NVRAM File", Info::tr("BIOS NVRAM File:"), bstrNVRAMFile); + SHOW_BSTR_STRING("NvramFile", Info::tr("BIOS NVRAM File:"), bstrNVRAMFile); SHOW_BOOLEAN_PROP_EX(machine, RTCUseUTC, "rtcuseutc", Info::tr("RTC:"), "UTC", Info::tr("local time")); SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_Enabled, &f), "hwvirtex", Info::tr("Hardware Virtualization:")); SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, &f),"nestedpaging", Info::tr("Nested Paging:")); diff --git a/src/VBox/Frontends/VirtualBox/src/main.cpp b/src/VBox/Frontends/VirtualBox/src/main.cpp index 02b1de55..dd6c6b64 100644 --- a/src/VBox/Frontends/VirtualBox/src/main.cpp +++ b/src/VBox/Frontends/VirtualBox/src/main.cpp @@ -423,8 +423,13 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char ** /*envp*/) #endif /* VBOX_WITH_HARDENING */ #ifdef VBOX_WS_MAC + /* Prevent AppNap for Runtime UI only: */ + bool fPreventAppNap = false; +# ifdef VBOX_RUNTIME_UI + fPreventAppNap = true; +# endif /* Instantiate own NSApplication before QApplication do it for us: */ - UICocoaApplication::instance(); + UICocoaApplication::create(fPreventAppNap); # ifdef VBOX_RUNTIME_UI /* If we're a helper app inside Resources in the main application bundle, diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.h b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.h index 5d17cb0d..5df6a407 100644 --- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.h +++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.h @@ -67,12 +67,18 @@ class SHARED_LIBRARY_STUFF UICocoaApplication { public: + /** Creates singleton instance. + * @param fPreventAppNap Brings whether we should prevent AppNap. */ + static void create(bool fPreventAppNap); /** Returns singleton instance. */ static UICocoaApplication *instance(); /** Destructs cocoa application. */ virtual ~UICocoaApplication(); + /** Returns whether we should prevent AppNap. */ + bool isPreventAppNap() const { return m_fPreventAppNap; } + /** Returns whether application is currently active. */ bool isActive() const; @@ -111,12 +117,16 @@ public: private: - /** Constructs cocoa application. */ - UICocoaApplication(); + /** Constructs cocoa application. + * @param fPreventAppNap Brings whether we should prevent AppNap. */ + UICocoaApplication(bool fPreventAppNap); /** Holds the singleton access instance. */ static UICocoaApplication *s_pInstance; + /** Holds whether we should prevent AppNap. */ + const bool m_fPreventAppNap; + /** Holds the private NSApplication instance. */ NativeUICocoaApplicationPrivateRef m_pNative; /** Holds the private NSAutoreleasePool instance. */ diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm index 42196b26..c73f5c1e 100644 --- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm +++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm @@ -76,12 +76,17 @@ uint32_t m_fMask; /** Array of callbacks. */ NSMutableArray *m_pCallbacks; + /** AppNap preventing activity. */ + id <NSObject> m_activity; } - (id)init; - (void)sendEvent :(NSEvent *)theEvent; - (void)setCallback :(uint32_t)fMask :(PFNVBOXCACALLBACK)pfnCallback :(void *)pvUser; - (void)unsetCallback :(uint32_t)fMask :(PFNVBOXCACALLBACK)pfnCallback :(void *)pvUser; +- (void)finishLaunching; +- (void)terminate :(nullable id)sender; + - (void)registerToNotificationOfWorkspace :(NSString *)pstrNotificationName; - (void)unregisterFromNotificationOfWorkspace :(NSString *)pstrNotificationName; @@ -180,6 +185,38 @@ m_fMask = fNewMask; } +/** Standard handler called right after NSApp finished launching. */ +- (void)finishLaunching +{ + /* Call to base-class: */ + [super finishLaunching]; + + if (UICocoaApplication::instance()->isPreventAppNap()) + { + //printf("Start activity preventing AppNap!\n"); + NSActivityOptions options = NSActivityUserInitiatedAllowingIdleSystemSleep; + NSString *pstrReason = @"VirtualBox napping is prohibited!"; + m_activity = [[NSProcessInfo processInfo] beginActivityWithOptions:options + reason:pstrReason]; + [m_activity retain]; + } +} + +/** Standard handler called right before NSApp starting termination. */ +- (void)terminate :(nullable id)sender +{ + if (UICocoaApplication::instance()->isPreventAppNap()) + { + //printf("Finish activity preventing AppNap!\n"); + [[NSProcessInfo processInfo] endActivity:m_activity]; + [m_activity release]; + m_activity = Nil; + } + + /* Call to base-class: */ + [super terminate: sender]; +} + /** Registers to cocoa notification @a pstrNotificationName. */ - (void) registerToNotificationOfWorkspace :(NSString *)pstrNotificationName { @@ -294,18 +331,23 @@ *********************************************************************************************************************************/ /* static */ -UICocoaApplication* UICocoaApplication::s_pInstance = 0; +UICocoaApplication *UICocoaApplication::s_pInstance = 0; /* static */ -UICocoaApplication* UICocoaApplication::instance() +void UICocoaApplication::create(bool fPreventAppNap) { if (!s_pInstance) - s_pInstance = new UICocoaApplication; + s_pInstance = new UICocoaApplication(fPreventAppNap); +} +/* static */ +UICocoaApplication *UICocoaApplication::instance() +{ return s_pInstance; } -UICocoaApplication::UICocoaApplication() +UICocoaApplication::UICocoaApplication(bool fPreventAppNap) + : m_fPreventAppNap(fPreventAppNap) { /* Make sure our private NSApplication object is created: */ m_pNative = (UICocoaApplicationPrivate*)[UICocoaApplicationPrivate sharedApplication]; |