Changeset 106349 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Oct 16, 2024 10:03:28 AM (6 months ago)
- svn:sync-xref-src-repo-rev:
- 165162
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r105548 r106349 153 153 , m_enmWindowManagerType(X11WMType_Unknown) 154 154 , m_fCompositingManagerRunning(false) 155 , m_enmDisplayServerType(VBGHDISPLAYSERVERTYPE_NONE)156 155 #endif 157 156 , m_fDarkMode(false) … … 208 207 #endif 209 208 210 #ifdef VBOX_WS_NIX211 /* Detect display server type: */212 m_enmDisplayServerType = VBGHDisplayServerTypeDetect();213 #endif214 215 209 /* Create converter: */ 216 210 UIConverter::create(); … … 278 272 #ifdef VBOX_WS_NIX 279 273 /* Check whether we have compositing manager running: */ 280 m_fCompositingManagerRunning = NativeWindowSubsystem::isCompositingManagerRunning( X11ServerAvailable());274 m_fCompositingManagerRunning = NativeWindowSubsystem::isCompositingManagerRunning(); 281 275 282 276 /* Acquire current Window Manager type: */ 283 m_enmWindowManagerType = NativeWindowSubsystem::windowManagerType( X11ServerAvailable());277 m_enmWindowManagerType = NativeWindowSubsystem::windowManagerType(); 284 278 #endif /* VBOX_WS_NIX */ 285 279 … … 810 804 #endif /* VBOX_WS_MAC */ 811 805 812 #ifdef VBOX_WS_NIX813 bool UICommon::X11ServerAvailable() const814 {815 return VBGHDisplayServerTypeIsXAvailable(m_enmDisplayServerType);816 }817 818 VBGHDISPLAYSERVERTYPE UICommon::displayServerType() const819 {820 return m_enmDisplayServerType;821 }822 #endif823 824 806 QString UICommon::hostOperatingSystem() const 825 807 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r105548 r106349 122 122 bool isCompositingManagerRunning() const { return m_fCompositingManagerRunning; } 123 123 /** Returns true if the detected display server type is either xorg or xwayland. */ 124 bool X11ServerAvailable() const;125 /** Returns display server type. */126 VBGHDISPLAYSERVERTYPE displayServerType() const;127 124 #endif 128 125 /** Returns the name of the host OS by using IHost::getOperatingSystem. */ … … 382 379 /** X11: Holds whether the Window Manager we are running at is composition one. */ 383 380 bool m_fCompositingManagerRunning; 384 /** Unixes: Holds the display server type. */385 VBGHDISPLAYSERVERTYPE m_enmDisplayServerType;386 381 #endif 387 382 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.cpp
r106061 r106349 771 771 #ifdef VBOX_WS_NIX 772 772 # define QWINDOWSIZE_MAX ((1<<24)-1) 773 if (pWidget->isWindow() && pWidget->isVisible() && uiCommon().X11ServerAvailable())773 if (pWidget->isWindow() && pWidget->isVisible() && NativeWindowSubsystem::displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 774 774 { 775 775 // WORKAROUND: … … 843 843 #elif defined(VBOX_WS_NIX) 844 844 845 fResult &= NativeWindowSubsystem::activateWindow( uiCommon().X11ServerAvailable(),wId, fSwitchDesktop);845 fResult &= NativeWindowSubsystem::activateWindow(wId, fSwitchDesktop); 846 846 847 847 #else -
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r106061 r106349 418 418 break; 419 419 } 420 if (VBGHDisplayServerTypeIsXAvailable(enmDisplayServerType)) 421 /* Force using Qt platform plugin 'xcb', we have X11 specific code: */ 420 /* Default to wayland QPA in Wayland even if XWayland is available: */ 421 if (enmDisplayServerType == VBGHDISPLAYSERVERTYPE_XWAYLAND) 422 RTEnvSet("QT_QPA_PLATFORM", "wayland"); 423 else 422 424 RTEnvSet("QT_QPA_PLATFORM", "xcb"); 423 else424 /* Assume pure Wayland (without a X server):*/425 RTEnvSet("QT_QPA_PLATFORM", "wayland");426 425 #endif /* VBOX_WS_NIX */ 427 426 … … 519 518 * Yes, we aware of note that alien widgets faster to draw but the only widget we need to be fast 520 519 * is viewport of VM which was always native since we are using his id for 3D service needs. */ 520 /* We have realized that making all windows native messes up widget updates in several cases like 521 ssh forwarding, wayland qpa etc. Thus we experiment with not doing it any longer. */ 522 #if 0 521 523 a.setAttribute(Qt::AA_NativeWindows); 524 #endif 522 525 523 526 # ifdef Q_OS_SOLARIS -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r106061 r106349 2373 2373 { 2374 2374 #ifdef VBOX_WS_NIX 2375 NativeWindowSubsystem::setWMClass( uiCommon().X11ServerAvailable(),this, "VirtualBox Manager", "VirtualBox Manager");2375 NativeWindowSubsystem::setWMClass(this, "VirtualBox Manager", "VirtualBox Manager"); 2376 2376 #endif 2377 2377 -
trunk/src/VBox/Frontends/VirtualBox/src/platform/nix/VBoxUtils-nix.cpp
r106061 r106349 58 58 #include <dlfcn.h> 59 59 60 bool NativeWindowSubsystem::isCompositingManagerRunning(bool fIsXServerAvailable) 61 { 62 if (fIsXServerAvailable) 60 VBGHDISPLAYSERVERTYPE NativeWindowSubsystem::displayServerType() 61 { 62 if (!qApp) 63 return VBGHDISPLAYSERVERTYPE_NONE; 64 QNativeInterface::QX11Application *pX11App = qApp->nativeInterface<QNativeInterface::QX11Application>(); 65 if (pX11App) 66 return VBGHDISPLAYSERVERTYPE_X11; 67 QNativeInterface::QWaylandApplication *pWaylandApp = qApp->nativeInterface<QNativeInterface::QWaylandApplication>(); 68 if (pWaylandApp) 69 return VBGHDISPLAYSERVERTYPE_PURE_WAYLAND; 70 return VBGHDISPLAYSERVERTYPE_NONE; 71 } 72 73 bool NativeWindowSubsystem::isCompositingManagerRunning() 74 { 75 if (displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 63 76 return X11IsCompositingManagerRunning(); 64 return WaylandIsCompositingManagerRunning(); 65 } 77 else if (displayServerType() == VBGHDISPLAYSERVERTYPE_PURE_WAYLAND) 78 return WaylandIsCompositingManagerRunning(); 79 return false; 80 } 81 66 82 bool NativeWindowSubsystem::X11IsCompositingManagerRunning() 67 83 { … … 75 91 bool NativeWindowSubsystem::WaylandIsCompositingManagerRunning() 76 92 { 77 /// @todo implement 78 return true; 79 } 80 81 X11WMType NativeWindowSubsystem::windowManagerType(bool fIsXServerAvailable) 82 { 83 if (fIsXServerAvailable) 93 QNativeInterface::QWaylandApplication *pWaylandApp = qApp->nativeInterface<QNativeInterface::QWaylandApplication>(); 94 if (pWaylandApp) 95 { 96 if (pWaylandApp->compositor()) 97 return true; 98 } 99 return false; 100 } 101 102 X11WMType NativeWindowSubsystem::windowManagerType() 103 { 104 if (displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 84 105 return X11WindowManagerType(); 85 return WaylandWindowManagerType(); 106 else if (displayServerType() == VBGHDISPLAYSERVERTYPE_PURE_WAYLAND) 107 return WaylandWindowManagerType(); 108 return X11WMType_Unknown; 86 109 } 87 110 … … 410 433 } 411 434 412 bool NativeWindowSubsystem::activateWindow( bool fIsXServerAvailable,WId wId, bool fSwitchDesktop)413 { 414 if ( fIsXServerAvailable)435 bool NativeWindowSubsystem::activateWindow(WId wId, bool fSwitchDesktop) 436 { 437 if (displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 415 438 return X11ActivateWindow(wId, fSwitchDesktop); 416 return WaylandActivateWindow(wId, fSwitchDesktop); 439 else if (displayServerType() == VBGHDISPLAYSERVERTYPE_PURE_WAYLAND) 440 return WaylandActivateWindow(wId, fSwitchDesktop); 441 return false; 417 442 } 418 443 … … 655 680 } 656 681 657 void NativeWindowSubsystem::setWMClass( bool fIsXServerAvailable,QWidget *pWidget, const QString &strNameString, const QString &strClassString)658 { 659 if ( fIsXServerAvailable)682 void NativeWindowSubsystem::setWMClass(QWidget *pWidget, const QString &strNameString, const QString &strClassString) 683 { 684 if (displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 660 685 X11SetWMClass(pWidget, strNameString, strClassString); 661 else 686 else if (displayServerType() == VBGHDISPLAYSERVERTYPE_PURE_WAYLAND) 662 687 WaylandSetWMClass(pWidget, strNameString, strClassString); 663 688 } … … 695 720 } 696 721 697 void NativeWindowSubsystem::setXwaylandMayGrabKeyboardFlag( bool fIsXServerAvailable,QWidget *pWidget)698 { 699 if ( fIsXServerAvailable)722 void NativeWindowSubsystem::setXwaylandMayGrabKeyboardFlag(QWidget *pWidget) 723 { 724 if (displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 700 725 XXSendClientMessage(NativeWindowSubsystem::X11GetDisplay(), pWidget->window()->winId(), 701 726 "_XWAYLAND_MAY_GRAB_KEYBOARD", 1); -
trunk/src/VBox/Frontends/VirtualBox/src/platform/nix/VBoxUtils-nix.h
r106061 r106349 95 95 namespace NativeWindowSubsystem 96 96 { 97 /** Determines display sever type by looking at QGuiApplication::nativeInterface() return type: */ 98 SHARED_LIBRARY_STUFF VBGHDISPLAYSERVERTYPE displayServerType(); 97 99 /** Wrapper function for X11IsCompositingManagerRunning and WaylandIsCompositingManagerRunning. */ 98 bool isCompositingManagerRunning( bool fIsXServerAvailable);100 bool isCompositingManagerRunning(); 99 101 /** X11: Determines and returns whether the compositing manager is running. */ 100 102 bool X11IsCompositingManagerRunning(); … … 103 105 104 106 /** Wrapper for window manager type functions. */ 105 X11WMType windowManagerType( bool fIsXServerAvailable);107 X11WMType windowManagerType(); 106 108 /** X11: Determines and returns current Window Manager type. */ 107 109 X11WMType X11WindowManagerType(); … … 124 126 125 127 /** Wrapper function for X11ActivateWindow or WaylandActivateWindow. */ 126 bool activateWindow( bool fIsXServerAvailable,WId wId, bool fSwitchDesktop);128 bool activateWindow(WId wId, bool fSwitchDesktop); 127 129 /** Activates window with certain @a wId, @a fSwitchDesktop if requested. */ 128 130 bool X11ActivateWindow(WId wId, bool fSwitchDesktop); … … 141 143 142 144 /** Wrapper function for WMClass setters. */ 143 SHARED_LIBRARY_STUFF void setWMClass( bool fIsXServerAvailable,QWidget *pWidget, const QString &strNameString, const QString &strClassString);145 SHARED_LIBRARY_STUFF void setWMClass(QWidget *pWidget, const QString &strNameString, const QString &strClassString); 144 146 /** X11: Assigns WM_CLASS property for passed @a pWidget. */ 145 147 SHARED_LIBRARY_STUFF void X11SetWMClass(QWidget *pWidget, const QString &strNameString, const QString &strClassString); … … 151 153 * so that e.g. alt+tab will get send to the VM instead of moving the 152 154 * focus away from the VM. */ 153 SHARED_LIBRARY_STUFF void setXwaylandMayGrabKeyboardFlag( bool fIsXServerAvailable,QWidget *pWidget);155 SHARED_LIBRARY_STUFF void setXwaylandMayGrabKeyboardFlag(QWidget *pWidget); 154 156 155 157 /** X11: Gets the X11 display pointer. */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r106061 r106349 456 456 457 457 #ifdef VBOX_WS_NIX 458 if ( uiCommon().X11ServerAvailable())458 if (NativeWindowSubsystem::displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 459 459 /* Resync Qt and X11 Server (see xTracker #7547). */ 460 460 XSync(NativeWindowSubsystem::X11GetDisplay(), false); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
r106061 r106349 267 267 268 268 #elif defined(VBOX_WS_NIX) 269 if ( uiCommon().X11ServerAvailable())269 if (NativeWindowSubsystem::displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 270 270 { 271 271 /* On X11, we are using XCB stuff to grab the keyboard. … … 370 370 371 371 #elif defined(VBOX_WS_NIX) 372 if ( uiCommon().X11ServerAvailable())372 if (NativeWindowSubsystem::displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 373 373 { 374 374 /* On X11, we are using XCB stuff to grab the keyboard. … … 819 819 820 820 # elif defined(VBOX_WS_NIX) 821 if ( uiCommon().X11ServerAvailable())821 if (NativeWindowSubsystem::displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 822 822 { 823 823 /* Cast to XCB event: */ … … 1038 1038 /* Global settings: */ 1039 1039 #ifdef VBOX_WS_NIX 1040 if ( uiCommon().X11ServerAvailable())1040 if (NativeWindowSubsystem::displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 1041 1041 { 1042 1042 /* Initialize the X keyboard subsystem: */ … … 1786 1786 1787 1787 #elif defined(VBOX_WS_NIX) 1788 if ( uiCommon().X11ServerAvailable())1788 if (NativeWindowSubsystem::displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 1789 1789 { 1790 1790 Q_UNUSED(pHotKey); … … 1863 1863 1864 1864 #elif defined(VBOX_WS_NIX) 1865 if ( uiCommon().X11ServerAvailable())1865 if (NativeWindowSubsystem::displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 1866 1866 { 1867 1867 Window wDummy1, wDummy2; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r106061 r106349 511 511 case KMachineState_TeleportingIn: 512 512 { 513 if ( uiCommon().X11ServerAvailable())513 if (NativeWindowSubsystem::displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 514 514 { 515 515 /* The keyboard handler may wish to do some release logging on startup. -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r106061 r106349 615 615 616 616 # elif defined(VBOX_WS_NIX) 617 618 if (uiCommon().X11ServerAvailable()) 617 if (NativeWindowSubsystem::displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 619 618 { 620 619 /* Make sure it's generic XCB event: */ … … 2022 2021 void UIMachineView::keyPressEvent(QKeyEvent *pEvent) 2023 2022 { 2024 if ( uiCommon().displayServerType() == VBGHDISPLAYSERVERTYPE_PURE_WAYLAND)2023 if (NativeWindowSubsystem::displayServerType() == VBGHDISPLAYSERVERTYPE_PURE_WAYLAND) 2025 2024 uimachine()->putScancode(pEvent->nativeScanCode() - 8); 2026 2025 QAbstractScrollArea::keyPressEvent(pEvent); … … 2029 2028 void UIMachineView::keyReleaseEvent(QKeyEvent *pEvent) 2030 2029 { 2031 if ( uiCommon().displayServerType() == VBGHDISPLAYSERVERTYPE_PURE_WAYLAND)2030 if (NativeWindowSubsystem::displayServerType() == VBGHDISPLAYSERVERTYPE_PURE_WAYLAND) 2032 2031 uimachine()->putScancode((pEvent->nativeScanCode() - 8) | 0x80); 2033 2032 QAbstractScrollArea::keyReleaseEvent(pEvent); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r106061 r106349 154 154 strWindowName = QString("VirtualBox Machine UUID: %1").arg(uiCommon().managedVMUuid().toString()); 155 155 /* Assign WM_CLASS property: */ 156 NativeWindowSubsystem::setWMClass( uiCommon().X11ServerAvailable(),this, strWindowName, strWindowClass);156 NativeWindowSubsystem::setWMClass(this, strWindowName, strWindowClass); 157 157 /* Tell the WM we are well behaved wrt Xwayland keyboard-grabs: */ 158 NativeWindowSubsystem::setXwaylandMayGrabKeyboardFlag( uiCommon().X11ServerAvailable(),this);158 NativeWindowSubsystem::setXwaylandMayGrabKeyboardFlag(this); 159 159 #endif 160 160 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
r106061 r106349 323 323 324 324 # elif defined(VBOX_WS_NIX) 325 326 if (uiCommon().X11ServerAvailable()) 325 if (NativeWindowSubsystem::displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 327 326 { 328 327 /* Cast to XCB event: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIHostComboEditor.cpp
r106061 r106349 570 570 #elif defined(VBOX_WS_NIX) 571 571 /* Initialize the X keyboard subsystem: */ 572 if ( uiCommon().X11ServerAvailable())572 if (NativeWindowSubsystem::displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 573 573 initMappedX11Keyboard(NativeWindowSubsystem::X11GetDisplay(), gEDataManager->remappedScanCodes()); 574 574 #endif /* VBOX_WS_NIX */ … … 740 740 741 741 # elif defined(VBOX_WS_NIX) 742 if ( uiCommon().X11ServerAvailable())742 if (NativeWindowSubsystem::displayServerType() == VBGHDISPLAYSERVERTYPE_X11) 743 743 { 744 744 /* Make sure it's generic XCB event: */
Note:
See TracChangeset
for help on using the changeset viewer.