Changeset 99491 in vbox
- Timestamp:
- Apr 20, 2023 5:32:26 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxUtils-nix.cpp
r99484 r99491 58 58 #undef BOOL /* Restore the VBox/com/defs.h variant */ 59 59 #define BOOL PRBool 60 60 #include <dlfcn.h> 61 61 62 62 bool NativeWindowSubsystem::isCompositingManagerRunning(bool fIsXServerAvailable) … … 740 740 DisplayServerType NativeWindowSubsystem::detectDisplayServerType() 741 741 { 742 /* Warning: All the following assumes: 743 - the system does not have several sessions with different display server configurations, 744 - XDG_SESSION_TYPE is set accordingly. 745 */ 746 const char *pSessionType = RTEnvGet("XDG_SESSION_TYPE"); 747 if (pSessionType != NULL) 748 { 749 if (RTStrIStr(pSessionType, "wayland")) 750 { 751 if (RTProcIsRunningByName("Xwayland")) 752 return DisplayServerType_XWayland; 753 else 754 return DisplayServerType_PureWayland; 755 } 756 else if (RTStrIStr(pSessionType, "x11")) 757 return DisplayServerType_XOrg; 758 /* On systemd systems XDG_SESSION_TYPE is set to tty for ssh sessions. Check xserver processes then:*/ 759 else if (RTStrIStr(pSessionType, "tty")) 760 { 761 if (RTProcIsRunningByName("Xorg")) 762 return DisplayServerType_XOrg; 763 else if (RTProcIsRunningByName("Xwayland")) 764 return DisplayServerType_XWayland; 765 } 766 } 767 /* Default to Xorg since Solaris set XDG_SESSION_TYPE: */ 742 void *pWaylandDisplay = NULL; 743 void *pWaylandClientHandle = dlopen("libwayland-client.so", RTLD_LAZY); 744 if (pWaylandClientHandle) 745 { 746 void * (*pWaylandDisplayConnect)(const char *) = (void * (*)(const char *))dlsym(pWaylandClientHandle, "wl_display_connect"); 747 if (pWaylandDisplayConnect) 748 pWaylandDisplay = pWaylandDisplayConnect(NULL); 749 dlclose(pWaylandClientHandle); 750 } 751 752 void *pXDisplay = NULL; 753 void *pX11Handle = dlopen("libX11.so", RTLD_LAZY); 754 if (pX11Handle) 755 { 756 void * (*pX11DisplayConnect)(const char *) = (void * (*)(const char *))dlsym(pX11Handle, "XOpenDisplay"); 757 if (pX11DisplayConnect) 758 pXDisplay = pX11DisplayConnect(NULL); 759 dlclose(pX11Handle); 760 } 761 762 if (pWaylandDisplay && pXDisplay) 763 return DisplayServerType_XWayland; 764 else if (pWaylandDisplay && !pXDisplay) 765 return DisplayServerType_PureWayland; 766 else if (!pWaylandDisplay && pXDisplay) 767 return DisplayServerType_XOrg; 768 768 769 return DisplayServerType_XOrg; 769 770 }
Note:
See TracChangeset
for help on using the changeset viewer.

