VirtualBox

Changeset 99623 in vbox for trunk


Ignore:
Timestamp:
May 5, 2023 9:23:57 AM (17 months ago)
Author:
vboxsync
Message:

FE/Qt: Removed code for detecting the display server type and use the VBGHServerType API now (common code, also being used for guest stuff). bugref:10427

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r99479 r99623  
    11491149endif
    11501150
     1151# Common Guest / Host sources.
     1152VBOX_GH_SOURCES := \
     1153        $(PATH_ROOT)/src/VBox/GuestHost/Log.cpp \
     1154        $(PATH_ROOT)/src/VBox/GuestHost/DisplayServerType.cpp
    11511155
    11521156#
     
    12721276        src/wizards/importappliance/UIWizardImportAppPageExpert.cpp \
    12731277        src/wizards/importappliance/UIWizardImportAppPageSettings.cpp \
    1274         src/wizards/importappliance/UIWizardImportAppPageSource.cpp
     1278        src/wizards/importappliance/UIWizardImportAppPageSource.cpp \
     1279        $(VBOX_GH_SOURCES)
    12751280
    12761281VirtualBox_SOURCES.darwin += \
     
    13351340        src/runtime/seamless/UIMachineWindowSeamless.cpp \
    13361341        src/softkeyboard/UISoftKeyboard.cpp \
    1337         src/widgets/UIMiniToolBar.cpp
     1342        src/widgets/UIMiniToolBar.cpp \
     1343        $(VBOX_GH_SOURCES)
    13381344
    13391345ifdef VBOX_WITH_DRAG_AND_DROP
     
    16341640        src/platform/darwin/VBoxUtils-darwin.cpp
    16351641
     1642#
     1643# Include common guest / host sources.
     1644#
     1645UICommon_SOURCES += \
     1646        $(VBOX_GH_SOURCES)
    16361647
    16371648#
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp

    r99438 r99623  
    192192    , m_enmWindowManagerType(X11WMType_Unknown)
    193193    , m_fCompositingManagerRunning(false)
    194     , m_enmDisplayServerType(DisplayServerType_Unknown)
     194    , m_enmDisplayServerType(VBGHDISPLAYSERVERTYPE_NONE)
    195195#endif
    196196    , m_fSeparateProcess(false)
     
    245245#ifdef VBOX_WS_X11
    246246    /* Detect display server type: */
    247     m_enmDisplayServerType = NativeWindowSubsystem::detectDisplayServerType();
     247    m_enmDisplayServerType = VBGHDisplayServerTypeDetect();
    248248#endif
    249249
     
    30263026bool UICommon::X11ServerAvailable() const
    30273027{
    3028     return m_enmDisplayServerType == DisplayServerType_XWayland
    3029         || m_enmDisplayServerType == DisplayServerType_XOrg;
    3030 }
    3031 #endif
     3028    return VBGHDisplayServerTypeIsXAvailable(m_enmDisplayServerType);
     3029}
     3030#endif
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h

    r99479 r99623  
    648648#ifdef VBOX_WS_X11
    649649        /** X11: Holds the #X11WMType of the Window Manager we are running under. */
    650         X11WMType  m_enmWindowManagerType;
     650        X11WMType             m_enmWindowManagerType;
    651651        /** X11: Holds whether the Window Manager we are running at is composition one. */
    652         bool       m_fCompositingManagerRunning;
     652        bool                  m_fCompositingManagerRunning;
    653653        /** Unixes: Holds the display server type. */
    654         DisplayServerType m_enmDisplayServerType;
     654        VBGHDISPLAYSERVERTYPE m_enmDisplayServerType;
    655655#endif
    656656    /** @} */
  • trunk/src/VBox/Frontends/VirtualBox/src/main.cpp

    r99479 r99623  
    396396        if (!MakeSureMultiThreadingIsSafe())
    397397            break;
    398         DisplayServerType enmDisplayServerType = NativeWindowSubsystem::detectDisplayServerType();
    399         if (NativeWindowSubsystem::X11XServerAvailable(enmDisplayServerType))
     398        VBGHDISPLAYSERVERTYPE enmDisplayServerType = VBGHDisplayServerTypeDetect();
     399        /* Default to X11 if anything else was found: */
     400        if (enmDisplayServerType == VBGHDISPLAYSERVERTYPE_NONE)
     401            enmDisplayServerType = VBGHDISPLAYSERVERTYPE_X11;
     402        if (VBGHDisplayServerTypeIsXAvailable(enmDisplayServerType))
    400403            /* Force using Qt platform plugin 'xcb', we have X11 specific code: */
    401404            RTEnvSet("QT_QPA_PLATFORM", "xcb");
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxUtils-nix.cpp

    r99504 r99623  
    738738}
    739739
    740 DisplayServerType NativeWindowSubsystem::detectDisplayServerType()
    741 {
    742     /* Try to connect to the wayland display, assuming it succeeds only when a wayland compositor is active: */
    743     void *pWaylandDisplay = NULL;
    744     void *pWaylandClientHandle = dlopen("libwayland-client.so", RTLD_LAZY);
    745     if (pWaylandClientHandle)
    746     {
    747         void * (*pWaylandDisplayConnect)(const char *) = (void * (*)(const char *))dlsym(pWaylandClientHandle, "wl_display_connect");
    748         if (pWaylandDisplayConnect)
    749             pWaylandDisplay = pWaylandDisplayConnect(NULL);
    750         dlclose(pWaylandClientHandle);
    751     }
    752 
    753     /* Also try to connect to the default X11 display to determine if Xserver is running: */
    754     void *pXDisplay = NULL;
    755     void *pX11Handle = dlopen("libX11.so", RTLD_LAZY);
    756     if (pX11Handle)
    757     {
    758         void * (*pX11DisplayConnect)(const char *) = (void * (*)(const char *))dlsym(pX11Handle, "XOpenDisplay");
    759         if (pX11DisplayConnect)
    760             pXDisplay = pX11DisplayConnect(NULL);
    761         dlclose(pX11Handle);
    762     }
    763 
    764     /* If both wayland and X11 display can be connected then we should have XWayland: */
    765     if (pWaylandDisplay && pXDisplay)
    766         return DisplayServerType_XWayland;
    767     else if (pWaylandDisplay && !pXDisplay)
    768         return DisplayServerType_PureWayland;
    769     else if (!pWaylandDisplay && pXDisplay)
    770         return DisplayServerType_XOrg;
    771 
    772     /* Default to Xserver:*/
    773     return DisplayServerType_XOrg;
    774 }
    775 
    776 bool NativeWindowSubsystem::X11XServerAvailable(DisplayServerType enmDisplayServerType)
    777 {
    778     return enmDisplayServerType == DisplayServerType_XWayland
    779         || enmDisplayServerType == DisplayServerType_XOrg;
    780 }
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxUtils-nix.h

    r99482 r99623  
    3737#include <QWindow>
    3838
     39#include <VBox/GuestHost/DisplayServerType.h>
     40
    3941/* GUI includes: */
    4042#include "UILibraryDefs.h"
     
    5052    X11WMType_Mutter,
    5153    X11WMType_Xfwm4,
    52 };
    53 
    54 /** Display server types for Unix like systems. */
    55 enum DisplayServerType
    56 {
    57     DisplayServerType_Unknown = 0,
    58     DisplayServerType_XOrg,
    59     DisplayServerType_XWayland,
    60     DisplayServerType_PureWayland,
    61     DisplayServerType_None,
    62     DisplayServerType_Max
    6354};
    6455
     
    168159    /** X11: Gets the X11 root (desktop) window. */
    169160    SHARED_LIBRARY_STUFF uint32_t X11GetAppRootWindow();
    170     /** Detects and returns display server type. */
    171     SHARED_LIBRARY_STUFF DisplayServerType detectDisplayServerType();
    172     /** Returns true if @a enmDisplayServerType is either XOrg or XWayland. */
    173     SHARED_LIBRARY_STUFF bool X11XServerAvailable(DisplayServerType enmDisplayServerType);
    174161}
    175162
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