VirtualBox

Changeset 99372 in vbox for trunk


Ignore:
Timestamp:
Apr 11, 2023 12:46:56 PM (18 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10407. Loading wayland platform plugin in case no xserver is detected.

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

Legend:

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

    r98926 r99372  
    192192    , m_enmWindowManagerType(X11WMType_Unknown)
    193193    , m_fCompositingManagerRunning(false)
     194    , m_enmDisplayServerType(DisplayServerType_Unknown)
    194195#endif
    195196    , m_fSeparateProcess(false)
     
    241242            this, &UICommon::sltHandleCommitDataRequest);
    242243#endif /* VBOX_GUI_WITH_CUSTOMIZATIONS1 */
     244
     245#ifdef VBOX_WS_X11
     246    /* Detect display server type: */
     247    m_enmDisplayServerType = NativeWindowSubsystem::X11DetectDisplayServerType();
     248#endif
    243249
    244250    /* Create converter: */
     
    30163022    m_fWrappersValid = true;
    30173023}
     3024
     3025#ifdef VBOX_WS_X11
     3026bool UICommon::X11XServerAvailable() const
     3027{
     3028    return m_enmDisplayServerType == DisplayServerType_XWayland
     3029                                  || DisplayServerType_XOrg;
     3030}
     3031#endif
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h

    r98926 r99372  
    215215        /** X11: Returns whether the Window Manager we are running under is composition one. */
    216216        bool isCompositingManagerRunning() const { return m_fCompositingManagerRunning; }
     217        /** Returns true if the detected display server type is either xorg or xwayland. */
     218        bool X11XServerAvailable() const;
    217219#endif
    218220    /** @} */
     
    649651        /** X11: Holds whether the Window Manager we are running at is composition one. */
    650652        bool       m_fCompositingManagerRunning;
     653        /** Unixes: Holds the display server type. */
     654        DisplayServerType m_enmDisplayServerType;
    651655#endif
    652656    /** @} */
  • trunk/src/VBox/Frontends/VirtualBox/src/main.cpp

    r98890 r99372  
    7575# include <unistd.h>
    7676# include <X11/Xlib.h>
     77# include "VBoxUtils-x11.h"
    7778# if defined(RT_OS_LINUX) && defined(DEBUG)
    7879#  include <signal.h>
     
    395396        if (!MakeSureMultiThreadingIsSafe())
    396397            break;
    397 
    398         /* Force using Qt platform module 'xcb', we have X11 specific code: */
    399         RTEnvSet("QT_QPA_PLATFORM", "xcb");
     398        DisplayServerType enmDisplayServerType = NativeWindowSubsystem::X11DetectDisplayServerType();
     399        if (NativeWindowSubsystem::X11XServerAvailable(enmDisplayServerType))
     400            /* Force using Qt platform plugin 'xcb', we have X11 specific code: */
     401            RTEnvSet("QT_QPA_PLATFORM", "xcb");
     402        else
     403            /* Assume pure Wayland (without a X server):*/
     404            RTEnvSet("QT_QPA_PLATFORM", "wayland");
    400405#endif /* VBOX_WS_X11 */
    401406
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxUtils-x11.cpp

    r98216 r99372  
    4545/* Other VBox includes: */
    4646#include <iprt/assert.h>
     47#include <iprt/env.h>
     48#include <iprt/process.h>
     49#include <iprt/string.h>
    4750#include <VBox/log.h>
    4851
     
    663666#endif
    664667}
     668
     669DisplayServerType NativeWindowSubsystem::X11DetectDisplayServerType()
     670{
     671    const char *pSessionType = RTEnvGet("XDG_SESSION_TYPE");
     672    if (pSessionType != NULL)
     673    {
     674        if (RTStrIStr(pSessionType, "wayland"))
     675        {
     676            if (RTProcIsRunningByName("Xwayland"))
     677                return DisplayServerType_XWayland;
     678            else
     679                return DisplayServerType_PureWayland;
     680        }
     681        else if (RTStrIStr(pSessionType, "x11"))
     682            return DisplayServerType_XOrg;
     683    }
     684    return DisplayServerType_Unknown;
     685}
     686
     687bool NativeWindowSubsystem::X11XServerAvailable(DisplayServerType enmDisplayServerType)
     688{
     689    return enmDisplayServerType == DisplayServerType_XWayland
     690        || enmDisplayServerType == DisplayServerType_XOrg;
     691}
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxUtils-x11.h

    r98103 r99372  
    5050    X11WMType_Mutter,
    5151    X11WMType_Xfwm4,
     52};
     53
     54/** Display server types for Unix like systems. */
     55enum DisplayServerType
     56{
     57    DisplayServerType_Unknown = 0,
     58    DisplayServerType_XOrg,
     59    DisplayServerType_XWayland,
     60    DisplayServerType_PureWayland,
     61    DisplayServerType_None,
     62    DisplayServerType_Max
    5263};
    5364
     
    136147    /** X11: Gets the X11 root (desktop) window. */
    137148    SHARED_LIBRARY_STUFF uint32_t X11GetAppRootWindow();
     149    /** Detects and returns display server type. */
     150    SHARED_LIBRARY_STUFF DisplayServerType X11DetectDisplayServerType();
     151    /** Returns true if @a enmDisplayServerType is either xorg or xwayland. */
     152    SHARED_LIBRARY_STUFF bool X11XServerAvailable(DisplayServerType enmDisplayServerType);
    138153}
    139154
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