VirtualBox

Changeset 98999 in vbox


Ignore:
Timestamp:
Mar 16, 2023 10:40:45 AM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
156349
Message:

FE/Qt: bugref:10396: X11: Adding Desktop Watchdog policy controlled by corresponding environment variable allowing to partially/fully disable synthetic test for available geometry calculation.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h

    r98335 r98999  
    9292template<> SHARED_LIBRARY_STUFF bool canConvert<SizeSuffix>();
    9393template<> SHARED_LIBRARY_STUFF bool canConvert<StorageSlot>();
     94template<> SHARED_LIBRARY_STUFF bool canConvert<DesktopWatchdogPolicy_SynthTest>();
    9495template<> SHARED_LIBRARY_STUFF bool canConvert<UIExtraDataMetaDefs::DialogType>();
    9596template<> SHARED_LIBRARY_STUFF bool canConvert<UIExtraDataMetaDefs::MenuType>();
     
    183184template<> SHARED_LIBRARY_STUFF QString toString(const StorageSlot &storageSlot);
    184185template<> SHARED_LIBRARY_STUFF StorageSlot fromString<StorageSlot>(const QString &strStorageSlot);
     186template<> SHARED_LIBRARY_STUFF DesktopWatchdogPolicy_SynthTest fromInternalString<DesktopWatchdogPolicy_SynthTest>(const QString &strPolicyType);
    185187template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIExtraDataMetaDefs::DialogType &enmDialogType);
    186188template<> SHARED_LIBRARY_STUFF UIExtraDataMetaDefs::DialogType fromInternalString<UIExtraDataMetaDefs::DialogType>(const QString &strDialogType);
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp

    r98524 r98999  
    4747template<> bool canConvert<SizeSuffix>() { return true; }
    4848template<> bool canConvert<StorageSlot>() { return true; }
     49template<> bool canConvert<DesktopWatchdogPolicy_SynthTest>() { return true; }
    4950template<> bool canConvert<UIExtraDataMetaDefs::DialogType>() { return true; }
    5051template<> bool canConvert<UIExtraDataMetaDefs::MenuType>() { return true; }
     
    453454}
    454455
     456/* DesktopWatchdogPolicy_SynthTest <= QString: */
     457template<> DesktopWatchdogPolicy_SynthTest fromInternalString<DesktopWatchdogPolicy_SynthTest>(const QString &strPolicyType)
     458{
     459    if (strPolicyType.compare("Disabled", Qt::CaseInsensitive) == 0)
     460        return DesktopWatchdogPolicy_SynthTest_Disabled;
     461    if (strPolicyType.compare("ManagerOnly", Qt::CaseInsensitive) == 0)
     462        return DesktopWatchdogPolicy_SynthTest_ManagerOnly;
     463    if (strPolicyType.compare("MachineOnly", Qt::CaseInsensitive) == 0)
     464        return DesktopWatchdogPolicy_SynthTest_MachineOnly;
     465    if (strPolicyType.compare("Both", Qt::CaseInsensitive) == 0)
     466        return DesktopWatchdogPolicy_SynthTest_Both;
     467    return DesktopWatchdogPolicy_SynthTest_Both;
     468}
     469
    455470/* QString <= UIExtraDataMetaDefs::DialogType: */
    456471template<> QString toInternalString(const UIExtraDataMetaDefs::DialogType &enmDialogType)
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp

    r98103 r98999  
    3838QStringList UIDefs::VBoxExtPackFileExts = QStringList() << "vbox-extpack";
    3939QStringList UIDefs::OVFFileExts = QStringList() << "ovf" << "ova";
     40
     41/** Environment variable names: */
     42const char *UIDefs::VBox_DesktopWatchdogPolicy_SynthTest = "VBOX_DESKTOPWATCHDOGPOLICY_SYNTHTEST";
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h

    r98885 r98999  
    9494    /** Allowed OVF file extensions. */
    9595    SHARED_LIBRARY_STUFF extern QStringList OVFFileExts;
     96
     97    /** Holds environment variable name for Desktop Watchdog / Synthetic Test policy type. */
     98    SHARED_LIBRARY_STUFF extern const char *VBox_DesktopWatchdogPolicy_SynthTest;
    9699}
    97100using namespace UIDefs /* if header included */;
     
    154157
    155158
     159/** Desktop Watchdog / Synthetic Test policy type. */
     160enum DesktopWatchdogPolicy_SynthTest
     161{
     162    DesktopWatchdogPolicy_SynthTest_Disabled,
     163    DesktopWatchdogPolicy_SynthTest_ManagerOnly,
     164    DesktopWatchdogPolicy_SynthTest_MachineOnly,
     165    DesktopWatchdogPolicy_SynthTest_Both
     166};
     167Q_DECLARE_METATYPE(DesktopWatchdogPolicy_SynthTest);
     168
     169
    156170#endif /* !FEQT_INCLUDED_SRC_globals_UIDefs_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.cpp

    r98103 r98999  
    5151# include "UICommon.h"
    5252# include "VBoxUtils-x11.h"
     53# ifndef VBOX_GUI_WITH_CUSTOMIZATIONS1
     54#  include "UIConverter.h"
     55# endif
    5356#endif
    5457
     
    284287
    285288UIDesktopWidgetWatchdog::UIDesktopWidgetWatchdog()
     289#if defined(VBOX_WS_X11) && !defined(VBOX_GUI_WITH_CUSTOMIZATIONS1)
     290    : m_enmSynthTestPolicy(DesktopWatchdogPolicy_SynthTest_Both)
     291#endif
    286292{
    287293    /* Initialize instance: */
     
    9961002
    9971003#if defined(VBOX_WS_X11) && !defined(VBOX_GUI_WITH_CUSTOMIZATIONS1)
     1004    /* Load Synthetic Test policy: */
     1005    const QString strSynthTestPolicy = qEnvironmentVariable(VBox_DesktopWatchdogPolicy_SynthTest);
     1006    m_enmSynthTestPolicy = gpConverter->fromInternalString<DesktopWatchdogPolicy_SynthTest>(strSynthTestPolicy);
     1007
    9981008    /* Update host-screen configuration: */
    9991009    updateHostScreenConfiguration();
     
    10511061
    10521062#if defined(VBOX_WS_X11) && !defined(VBOX_GUI_WITH_CUSTOMIZATIONS1)
     1063bool UIDesktopWidgetWatchdog::isSynchTestRestricted() const
     1064{
     1065    return    m_enmSynthTestPolicy == DesktopWatchdogPolicy_SynthTest_Disabled
     1066           || (   m_enmSynthTestPolicy == DesktopWatchdogPolicy_SynthTest_ManagerOnly
     1067               && uiCommon().uiType() == UICommon::UIType_RuntimeUI)
     1068           || (   m_enmSynthTestPolicy == DesktopWatchdogPolicy_SynthTest_MachineOnly
     1069               && uiCommon().uiType() == UICommon::UIType_SelectorUI);
     1070}
     1071
    10531072void UIDesktopWidgetWatchdog::updateHostScreenConfiguration(int cHostScreenCount /* = -1 */)
    10541073{
     1074    /* Check the policy: */
     1075    if (isSynchTestRestricted())
     1076        return;
     1077
    10551078    /* Acquire new host-screen count: */
    10561079    if (cHostScreenCount == -1)
     
    10711094void UIDesktopWidgetWatchdog::updateHostScreenAvailableGeometry(int iHostScreenIndex)
    10721095{
     1096    /* Check the policy: */
     1097    if (isSynchTestRestricted())
     1098        return;
     1099
    10731100    /* Make sure index is valid: */
    10741101    if (iHostScreenIndex < 0 || iHostScreenIndex >= screenCount())
     
    11031130void UIDesktopWidgetWatchdog::cleanupExistingWorkers()
    11041131{
     1132    /* Check the policy: */
     1133    if (isSynchTestRestricted())
     1134        return;
     1135
    11051136    /* Destroy existing workers: */
    11061137    qDeleteAll(m_availableGeometryWorkers);
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.h

    r98103 r98999  
    4242/* GUI includes: */
    4343#include "UILibraryDefs.h"
     44#if defined(VBOX_WS_X11) && !defined(VBOX_GUI_WITH_CUSTOMIZATIONS1)
     45# include "UIDefs.h"
     46#endif
    4447
    4548/* Forward declarations: */
     
    194197
    195198#if defined(VBOX_WS_X11) && !defined(VBOX_GUI_WITH_CUSTOMIZATIONS1)
     199    /** Returns whether Synthetic Test is restricted according to cached policy. */
     200    bool isSynchTestRestricted() const;
     201
    196202    /** Updates host-screen configuration according to new @a cHostScreenCount.
    197203      * @note If cHostScreenCount is equal to -1 we have to acquire it ourselves. */
     
    203209    /** Cleanups existing workers. */
    204210    void cleanupExistingWorkers();
     211
     212    /** Holds the cached Synthetic Test policy. */
     213    DesktopWatchdogPolicy_SynthTest  m_enmSynthTestPolicy;
    205214
    206215    /** Holds current host-screen available-geometries. */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette