VirtualBox

Changeset 56929 in vbox for trunk


Ignore:
Timestamp:
Jul 14, 2015 2:18:11 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: X11: Helpers cleanup/rework (step 3): Reworking to detect more than one X11 WM types.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r56341 r56929  
    176176
    177177# define BOOL PRBool
    178 # include "VBoxX11Helper.h"
    179178#endif /* Q_WS_X11 */
    180179
     
    232231    , m_fSeparateProcess(false)
    233232    , m_pMediumEnumerator(0)
    234     , mIsKWinManaged (false)
     233#ifdef Q_WS_X11
     234    , m_enmWindowManagerType(X11WMType_Unknown)
     235#endif /* Q_WS_X11 */
    235236#if defined(DEBUG_bird)
    236237    , mAgressiveCaching(false)
     
    39483949
    39493950#ifdef Q_WS_X11
    3950     mIsKWinManaged = X11IsWindowManagerKWin();
    3951 #endif
     3951    /* Acquire current Window Manager type: */
     3952    m_enmWindowManagerType = X11WindowManagerType();
     3953#endif /* Q_WS_X11 */
    39523954
    39533955#ifdef VBOX_WITH_DEBUGGER_GUI
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r55678 r56929  
    3535#include "UIMediumDefs.h"
    3636#include "VBoxGlobalSettings.h"
     37#ifdef Q_WS_X11
     38# include "VBoxX11Helper.h"
     39#endif /* Q_WS_X11 */
    3740
    3841/* COM includes: */
     
    149152    QList<QUrl> &argUrlList() { return m_ArgUrlList; }
    150153
    151     bool isKWinManaged() const { return mIsKWinManaged; }
     154#ifdef Q_WS_X11
     155    /** X11: Returns the type of the Window Manager we are running under. */
     156    X11WMType typeOfWindowManager() const { return m_enmWindowManagerType; }
     157#endif /* Q_WS_X11 */
    152158
    153159    /** Returns whether we should restore current snapshot before VM started. */
     
    480486    mutable QReadWriteLock m_mediumEnumeratorDtorRwLock;
    481487
    482     bool mIsKWinManaged;
     488#ifdef Q_WS_X11
     489    /** X11: Holds the type of the Window Manager we are running under. */
     490    X11WMType m_enmWindowManagerType;
     491#endif /* Q_WS_X11 */
    483492
    484493    /** The --aggressive-caching / --no-aggressive-caching option. */
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxX11Helper.cpp

    r56928 r56929  
    1616 */
    1717
     18/* Qt includes: */
     19#include <QX11Info>
     20#include <QString>
     21
     22/* GUI includes: */
    1823#include "VBoxX11Helper.h"
    1924
     25/* Other VBox includes: */
    2026#include <iprt/cdefs.h>
    21 #include <iprt/string.h>
    22 #include <QX11Info>
    2327
    2428/* rhel3 build hack */
     
    7377}
    7478
    75 bool X11IsWindowManagerKWin()
     79X11WMType X11WindowManagerType()
    7680{
    7781    /* Get display: */
     
    8488    unsigned long ulDummy;
    8589    unsigned char *pcData = 0;
    86     bool fIsKWinManaged = false;
     90    X11WMType wmType = X11WMType_Unknown;
    8791
    8892    /* Ask if root-window supports check for WM name: */
     
    106110                                   &iReturnedFormat, &ulReturnedItemCount, &ulDummy, &pcData) == Success)
    107111            {
    108                 fIsKWinManaged = RTStrCmp((const char*)pcData, "KWin") == 0;
     112                if (QString((const char*)pcData).contains("KWin", Qt::CaseInsensitive))
     113                    wmType = X11WMType_KWin;
     114                else
     115                if (QString((const char*)pcData).contains("Mutter", Qt::CaseInsensitive))
     116                    wmType = X11WMType_Mutter;
    109117                if (pcData)
    110118                    XFree(pcData);
     
    112120        }
    113121    }
    114     return fIsKWinManaged;
     122    return wmType;
    115123}
    116124
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxX11Helper.h

    r56927 r56929  
    1919#define ___VBoxX11Helpers_h___
    2020
     21/** X11: Known Window Manager types. */
     22enum X11WMType
     23{
     24    X11WMType_Unknown,
     25    X11WMType_KWin,
     26    X11WMType_Mutter,
     27};
     28
    2129/** X11: Inits the screen saver save/restore mechanism. */
    2230void X11ScreenSaverSettingsInit();
     
    2634void X11ScreenSaverSettingsRestore();
    2735
    28 /** X11: Determines whether current Window Manager is KWin. */
    29 bool X11IsWindowManagerKWin();
     36/** X11: Determines and returns current Window Manager type. */
     37X11WMType X11WindowManagerType();
    3038
    3139#endif /* !___VBoxX11Helpers_h___ */
Note: See TracChangeset for help on using the changeset viewer.

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