- Timestamp:
- Oct 20, 2016 2:43:06 PM (8 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.cpp
r62493 r64334 194 194 QRect geo (QPoint (0, 0), initSize); 195 195 geo.moveCenter (parentWidget()->geometry().center()); 196 setGeometry (geo);196 VBoxGlobal::setTopLevelGeometry(this, geo); 197 197 198 198 retranslateUi(); -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMainWindow.cpp
r63293 r64334 22 22 /* GUI includes: */ 23 23 # include "QIMainWindow.h" 24 # include "VBoxGlobal.h" 24 25 25 26 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ … … 39 40 #else /* VBOX_WS_MAC */ 40 41 /* Use the new approach for Windows/X11: */ 41 setGeometry(m_geometry);42 VBoxGlobal::setTopLevelGeometry(this, m_geometry); 42 43 #endif /* !VBOX_WS_MAC */ 43 44 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r64211 r64334 50 50 # if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 51 51 # include <QScreen> 52 # include <xcb/xcb.h> 53 # include <xcb/xcb_icccm.h> 52 54 # endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */ 53 55 … … 3703 3705 } 3704 3706 3707 /* static */ 3708 void VBoxGlobal::setTopLevelGeometry(QWidget *pWidget, int x, int y, int w, int h) 3709 { 3710 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 3711 # define QWINDOWSIZE_MAX ((1<<24)-1) 3712 if (pWidget->isWindow() && pWidget->isVisible()) 3713 { 3714 /* X11 window managers are not required to accept geometry changes on 3715 * the top-level window. Unfortunately, current at Qt 5.6 and 5.7, Qt 3716 * assumes that the change will succeed, and resizes all sub-windows 3717 * unconditionally. By calling ConfigureWindow directly, Qt will see 3718 * our change request as an externally triggered one on success and not 3719 * at all if it is rejected. */ 3720 uint16_t fMask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y 3721 | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; 3722 uint32_t values[] = { (uint32_t)x, (uint32_t)y, (uint32_t)w, (uint32_t)h }; 3723 xcb_configure_window(QX11Info::connection(), (xcb_window_t)pWidget->winId(), 3724 fMask, values); 3725 xcb_size_hints_t hints; 3726 hints.flags = XCB_ICCCM_SIZE_HINT_US_POSITION | XCB_ICCCM_SIZE_HINT_US_SIZE; 3727 hints.x = x; 3728 hints.y = y; 3729 hints.width = w; 3730 hints.height = h; 3731 hints.min_width = pWidget->minimumSize().width(); 3732 hints.min_height = pWidget->minimumSize().height(); 3733 hints.max_width = pWidget->maximumSize().width(); 3734 hints.max_height = pWidget->maximumSize().height(); 3735 if (hints.min_width > 0 || hints.min_height > 0) 3736 hints.flags |= XCB_ICCCM_SIZE_HINT_P_MIN_SIZE; 3737 if (hints.max_width < QWINDOWSIZE_MAX || hints.max_height < QWINDOWSIZE_MAX) 3738 hints.flags |= XCB_ICCCM_SIZE_HINT_P_MAX_SIZE; 3739 xcb_change_property(QX11Info::connection(), XCB_PROP_MODE_REPLACE, 3740 (xcb_window_t)pWidget->winId(), XCB_ATOM_WM_NORMAL_HINTS, 3741 XCB_ATOM_WM_SIZE_HINTS, 32, sizeof(hints) >> 2, &hints); 3742 xcb_flush(QX11Info::connection()); 3743 } 3744 else 3745 /* Call the Qt method if the window is not visible as otherwise no 3746 * Configure event will arrive to tell Qt what geometry we want. */ 3747 pWidget->setGeometry(x, y, w, h); 3748 # else 3749 pWidget->setGeometry(x, y, w, h); 3750 # endif 3751 } 3752 3753 /* static */ 3754 void VBoxGlobal::setTopLevelGeometry(QWidget *pWidget, const QRect &rect) 3755 { 3756 VBoxGlobal::setTopLevelGeometry(pWidget, rect.x(), rect.y(), rect.width(), rect.height()); 3757 } 3758 3705 3759 // Public slots 3706 3760 //////////////////////////////////////////////////////////////////////////////// -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r64160 r64334 442 442 * to strict the minimum width to reflect at least [n] symbols. */ 443 443 static void setMinimumWidthAccordingSymbolCount(QSpinBox *pSpinBox, int cCount); 444 445 /** Assigns top-level @a pWidget geometry passed as QRect coordinates. 446 * @note Take into account that this request may fail on X11. */ 447 static void setTopLevelGeometry(QWidget *pWidget, int x, int y, int w, int h); 448 /** Assigns top-level @a pWidget geometry passed as @a rect. 449 * @note Take into account that this request may fail on X11. */ 450 static void setTopLevelGeometry(QWidget *pWidget, const QRect &rect); 444 451 445 452 signals: -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISlidingToolBar.cpp
r62493 r64334 140 140 case Position_Top: 141 141 { 142 setGeometry(m_parentRect.x(), m_parentRect.y() + m_indentRect.height(),143 qMax(m_parentRect.width(), sh.width()), sh.height());142 VBoxGlobal::setTopLevelGeometry(this, m_parentRect.x(), m_parentRect.y() + m_indentRect.height(), 143 qMax(m_parentRect.width(), sh.width()), sh.height()); 144 144 m_pEmbeddedWidget->setGeometry(0, -sh.height(), qMax(width(), sh.width()), sh.height()); 145 145 break; … … 147 147 case Position_Bottom: 148 148 { 149 setGeometry(m_parentRect.x(), m_parentRect.y() + m_parentRect.height() - m_indentRect.height() - sh.height(),150 qMax(m_parentRect.width(), sh.width()), sh.height());149 VBoxGlobal::setTopLevelGeometry(this, m_parentRect.x(), m_parentRect.y() + m_parentRect.height() - m_indentRect.height() - sh.height(), 150 qMax(m_parentRect.width(), sh.width()), sh.height()); 151 151 m_pEmbeddedWidget->setGeometry(0, sh.height(), qMax(width(), sh.width()), sh.height()); 152 152 break; … … 197 197 case Position_Top: 198 198 { 199 setGeometry(m_parentRect.x(), m_parentRect.y() + m_indentRect.height(),200 qMax(m_parentRect.width(), sh.width()), sh.height());199 VBoxGlobal::setTopLevelGeometry(this, m_parentRect.x(), m_parentRect.y() + m_indentRect.height(), 200 qMax(m_parentRect.width(), sh.width()), sh.height()); 201 201 break; 202 202 } 203 203 case Position_Bottom: 204 204 { 205 setGeometry(m_parentRect.x(), m_parentRect.y() + m_parentRect.height() - m_indentRect.height() - sh.height(),206 qMax(m_parentRect.width(), sh.width()), sh.height());205 VBoxGlobal::setTopLevelGeometry(this, m_parentRect.x(), m_parentRect.y() + m_parentRect.height() - m_indentRect.height() - sh.height(), 206 qMax(m_parentRect.width(), sh.width()), sh.height()); 207 207 break; 208 208 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
r63054 r64334 351 351 /* Move window to the center of working-area: */ 352 352 geo.moveCenter(workingArea.center()); 353 setGeometry(geo);353 VBoxGlobal::setTopLevelGeometry(this, geo); 354 354 } 355 355 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
r63228 r64334 372 372 /* Restore window geometry: */ 373 373 m_normalGeometry = geo; 374 setGeometry(m_normalGeometry);374 VBoxGlobal::setTopLevelGeometry(this, m_normalGeometry); 375 375 } 376 376 /* If previous machine-state was NOT SAVED: */ … … 379 379 /* Restore only window position: */ 380 380 m_normalGeometry = QRect(geo.x(), geo.y(), width(), height()); 381 setGeometry(m_normalGeometry);381 VBoxGlobal::setTopLevelGeometry(this, m_normalGeometry); 382 382 /* And normalize to the optimal-size: */ 383 383 normalizeGeometry(false /* adjust position */); … … 401 401 m_normalGeometry = geometry(); 402 402 m_normalGeometry.moveCenter(availableGeo.center()); 403 setGeometry(m_normalGeometry);403 VBoxGlobal::setTopLevelGeometry(this, m_normalGeometry); 404 404 } 405 405 … … 575 575 576 576 /* Finally, set the frame geometry: */ 577 setGeometry(frGeo.left() + dl, frGeo.top() + dt,578 frGeo.width() - dl - dr, frGeo.height() - dt - db);577 VBoxGlobal::setTopLevelGeometry(this, frGeo.left() + dl, frGeo.top() + dt, 578 frGeo.width() - dl - dr, frGeo.height() - dt - db); 579 579 #else /* VBOX_GUI_WITH_CUSTOMIZATIONS1 */ 580 580 /* Customer request: There should no be -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.cpp
r63230 r64334 102 102 /* Restore window geometry: */ 103 103 m_normalGeometry = geo; 104 setGeometry(m_normalGeometry);104 VBoxGlobal::setTopLevelGeometry(this, m_normalGeometry); 105 105 106 106 /* Maximize (if necessary): */ … … 121 121 m_normalGeometry = geometry(); 122 122 m_normalGeometry.moveCenter(availableGeo.center()); 123 setGeometry(m_normalGeometry);123 VBoxGlobal::setTopLevelGeometry(this, m_normalGeometry); 124 124 } 125 125 … … 202 202 203 203 /* Finally, set the frame geometry: */ 204 setGeometry(frGeo.left() + dl, frGeo.top() + dt,205 frGeo.width() - dl - dr, frGeo.height() - dt - db);204 VBoxGlobal::setTopLevelGeometry(this, frGeo.left() + dl, frGeo.top() + dt, 205 frGeo.width() - dl - dr, frGeo.height() - dt - db); 206 206 #else /* VBOX_GUI_WITH_CUSTOMIZATIONS1 */ 207 207 /* Customer request: There should no be -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.cpp
r63315 r64334 28 28 29 29 /* GUI includes: */ 30 # include "VBoxGlobal.h" 30 31 # include "UIPopupStack.h" 31 32 # include "UIPopupStackViewport.h" … … 167 168 168 169 /* Adjust geometry: */ 169 setGeometry(iX, iY, iWidth, iHeight);170 VBoxGlobal::setTopLevelGeometry(this, iX, iY, iWidth, iHeight); 170 171 } 171 172
Note:
See TracChangeset
for help on using the changeset viewer.