- Timestamp:
- Apr 11, 2023 12:46:56 PM (18 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
-
globals/UICommon.cpp (modified) (3 diffs)
-
globals/UICommon.h (modified) (2 diffs)
-
main.cpp (modified) (2 diffs)
-
platform/x11/VBoxUtils-x11.cpp (modified) (2 diffs)
-
platform/x11/VBoxUtils-x11.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r98926 r99372 192 192 , m_enmWindowManagerType(X11WMType_Unknown) 193 193 , m_fCompositingManagerRunning(false) 194 , m_enmDisplayServerType(DisplayServerType_Unknown) 194 195 #endif 195 196 , m_fSeparateProcess(false) … … 241 242 this, &UICommon::sltHandleCommitDataRequest); 242 243 #endif /* VBOX_GUI_WITH_CUSTOMIZATIONS1 */ 244 245 #ifdef VBOX_WS_X11 246 /* Detect display server type: */ 247 m_enmDisplayServerType = NativeWindowSubsystem::X11DetectDisplayServerType(); 248 #endif 243 249 244 250 /* Create converter: */ … … 3016 3022 m_fWrappersValid = true; 3017 3023 } 3024 3025 #ifdef VBOX_WS_X11 3026 bool 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 215 215 /** X11: Returns whether the Window Manager we are running under is composition one. */ 216 216 bool isCompositingManagerRunning() const { return m_fCompositingManagerRunning; } 217 /** Returns true if the detected display server type is either xorg or xwayland. */ 218 bool X11XServerAvailable() const; 217 219 #endif 218 220 /** @} */ … … 649 651 /** X11: Holds whether the Window Manager we are running at is composition one. */ 650 652 bool m_fCompositingManagerRunning; 653 /** Unixes: Holds the display server type. */ 654 DisplayServerType m_enmDisplayServerType; 651 655 #endif 652 656 /** @} */ -
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r98890 r99372 75 75 # include <unistd.h> 76 76 # include <X11/Xlib.h> 77 # include "VBoxUtils-x11.h" 77 78 # if defined(RT_OS_LINUX) && defined(DEBUG) 78 79 # include <signal.h> … … 395 396 if (!MakeSureMultiThreadingIsSafe()) 396 397 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"); 400 405 #endif /* VBOX_WS_X11 */ 401 406 -
trunk/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxUtils-x11.cpp
r98216 r99372 45 45 /* Other VBox includes: */ 46 46 #include <iprt/assert.h> 47 #include <iprt/env.h> 48 #include <iprt/process.h> 49 #include <iprt/string.h> 47 50 #include <VBox/log.h> 48 51 … … 663 666 #endif 664 667 } 668 669 DisplayServerType 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 687 bool 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 50 50 X11WMType_Mutter, 51 51 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 52 63 }; 53 64 … … 136 147 /** X11: Gets the X11 root (desktop) window. */ 137 148 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); 138 153 } 139 154
Note:
See TracChangeset
for help on using the changeset viewer.

