Ticket #15863: r111428-r111430-r111508-r111561.patch
| File r111428-r111430-r111508-r111561.patch, 13.5 KB (added by , 8 years ago) |
|---|
-
src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.cpp
unchanged:
101 101 { 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): */ 107 107 if (gEDataManager->machineWindowShouldBeMaximized(machineLogic()->visualStateType(), … … 120 120 /* Move newly created window to the screen-center: */ 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 126 126 /* Normalize to the optimal size: */ … … 201 201 frGeo = VBoxGlobal::normalizeGeometry(frGeo, gpDesktop->overallAvailableRegion()); 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 208 208 * machine-window resize/move on machine-view resize: */ -
src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
unchanged:
371 371 { 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: */ 377 377 else … … 378 378 { 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 */); 384 384 } … … 400 400 /* Move newly created window to the screen-center: */ 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 406 406 /* Normalize to the optimal size: */ … … 574 574 frGeo = VBoxGlobal::normalizeGeometry(frGeo, gpDesktop->overallAvailableRegion()); 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 581 581 * machine-window resize/move on machine-view resize: */ -
src/VBox/Frontends/VirtualBox/src/runtime/UISlidingToolBar.cpp
unchanged:
139 139 { 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; 146 146 } 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; 153 153 } … … 196 196 { 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 } 209 209 } -
src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
unchanged:
350 350 geo = QRect(QPoint(0, 0), QSize(800, 600).boundedTo(workingArea.size())); 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 356 356 #elif defined(VBOX_WS_WIN) -
src/VBox/Frontends/VirtualBox/src/extensions/QIMainWindow.cpp
unchanged:
21 21 22 22 /* GUI includes: */ 23 23 # include "QIMainWindow.h" 24 # include "VBoxGlobal.h" 24 25 25 26 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 26 27 … … 38 39 resize(m_geometry.size()); 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 44 45 /* Maximize (if necessary): */ -
src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
diff -u src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
49 49 # endif /* VBOX_GUI_WITH_PIDFILE */ 50 50 # if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 51 51 # include <QScreen> 52 # include <xcb/xcb.h> 52 53 # endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */ 53 54 54 55 /* GUI includes: */ … … 3702 3703 pSpinBox->setMinimumWidth(iTextWidth + iSpinBoxDelta); 3703 3704 } 3704 3705 3706 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 3707 typedef struct { 3708 /** User specified flags */ 3709 uint32_t flags; 3710 /** User-specified position */ 3711 int32_t x, y; 3712 /** User-specified size */ 3713 int32_t width, height; 3714 /** Program-specified minimum size */ 3715 int32_t min_width, min_height; 3716 /** Program-specified maximum size */ 3717 int32_t max_width, max_height; 3718 /** Program-specified resize increments */ 3719 int32_t width_inc, height_inc; 3720 /** Program-specified minimum aspect ratios */ 3721 int32_t min_aspect_num, min_aspect_den; 3722 /** Program-specified maximum aspect ratios */ 3723 int32_t max_aspect_num, max_aspect_den; 3724 /** Program-specified base size */ 3725 int32_t base_width, base_height; 3726 /** Program-specified window gravity */ 3727 uint32_t win_gravity; 3728 } xcb_size_hints_t; 3729 #endif /* defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 */ 3730 3731 /* static */ 3732 void VBoxGlobal::setTopLevelGeometry(QWidget *pWidget, int x, int y, int w, int h) 3733 { 3734 AssertPtrReturnVoid(pWidget); 3735 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 3736 # define QWINDOWSIZE_MAX ((1<<24)-1) 3737 if (pWidget->isWindow() && pWidget->isVisible()) 3738 { 3739 /* X11 window managers are not required to accept geometry changes on 3740 * the top-level window. Unfortunately, current at Qt 5.6 and 5.7, Qt 3741 * assumes that the change will succeed, and resizes all sub-windows 3742 * unconditionally. By calling ConfigureWindow directly, Qt will see 3743 * our change request as an externally triggered one on success and not 3744 * at all if it is rejected. */ 3745 uint16_t fMask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y 3746 | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; 3747 uint32_t values[] = { (uint32_t)x, (uint32_t)y, (uint32_t)w, (uint32_t)h }; 3748 xcb_configure_window(QX11Info::connection(), (xcb_window_t)pWidget->winId(), 3749 fMask, values); 3750 xcb_size_hints_t hints; 3751 hints.flags = 1 /* XCB_ICCCM_SIZE_HINT_US_POSITION */ 3752 | 2 /* XCB_ICCCM_SIZE_HINT_US_SIZE */ 3753 | 512 /* XCB_ICCCM_SIZE_P_WIN_GRAVITY */; 3754 hints.x = x; 3755 hints.y = y; 3756 hints.width = w; 3757 hints.height = h; 3758 hints.min_width = pWidget->minimumSize().width(); 3759 hints.min_height = pWidget->minimumSize().height(); 3760 hints.max_width = pWidget->maximumSize().width(); 3761 hints.max_height = pWidget->maximumSize().height(); 3762 hints.width_inc = pWidget->sizeIncrement().width(); 3763 hints.height_inc = pWidget->sizeIncrement().height(); 3764 hints.base_width = pWidget->baseSize().width(); 3765 hints.base_height = pWidget->baseSize().height(); 3766 hints.win_gravity = XCB_GRAVITY_STATIC; 3767 if (hints.min_width > 0 || hints.min_height > 0) 3768 hints.flags |= 16 /* XCB_ICCCM_SIZE_HINT_P_MIN_SIZE */; 3769 if (hints.max_width < QWINDOWSIZE_MAX || hints.max_height < QWINDOWSIZE_MAX) 3770 hints.flags |= 32 /* XCB_ICCCM_SIZE_HINT_P_MAX_SIZE */; 3771 if (hints.width_inc > 0 || hints.height_inc) 3772 hints.flags |= 64 /* XCB_ICCCM_SIZE_HINT_P_MIN_SIZE */ 3773 | 256 /* XCB_ICCCM_SIZE_HINT_BASE_SIZE */; 3774 xcb_change_property(QX11Info::connection(), XCB_PROP_MODE_REPLACE, 3775 (xcb_window_t)pWidget->winId(), XCB_ATOM_WM_NORMAL_HINTS, 3776 XCB_ATOM_WM_SIZE_HINTS, 32, sizeof(hints) >> 2, &hints); 3777 xcb_flush(QX11Info::connection()); 3778 } 3779 else 3780 /* Call the Qt method if the window is not visible as otherwise no 3781 * Configure event will arrive to tell Qt what geometry we want. */ 3782 pWidget->setGeometry(x, y, w, h); 3783 # else /* !defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 */ 3784 pWidget->setGeometry(x, y, w, h); 3785 # endif /* !defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 */ 3786 } 3787 3788 /* static */ 3789 void VBoxGlobal::setTopLevelGeometry(QWidget *pWidget, const QRect &rect) 3790 { 3791 VBoxGlobal::setTopLevelGeometry(pWidget, rect.x(), rect.y(), rect.width(), rect.height()); 3792 } 3793 3705 3794 // Public slots 3706 3795 //////////////////////////////////////////////////////////////////////////////// 3707 3796 -
src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
unchanged:
442 442 * to strict the minimum width to reflect at least [n] symbols. */ 443 443 static void setMinimumWidthAccordingSymbolCount(QSpinBox *pSpinBox, int cCount); 444 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); 451 445 452 signals: 446 453 447 454 /** Notifies listeners about the VBoxSVC availability change. */ -
src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.cpp
unchanged:
27 27 # include <QStatusBar> 28 28 29 29 /* GUI includes: */ 30 # include "VBoxGlobal.h" 30 31 # include "UIPopupStack.h" 31 32 # include "UIPopupStackViewport.h" 32 33 … … 166 167 } 167 168 168 169 /* Adjust geometry: */ 169 setGeometry(iX, iY, iWidth, iHeight);170 VBoxGlobal::setTopLevelGeometry(this, iX, iY, iWidth, iHeight); 170 171 } 171 172 172 173 void UIPopupStack::sltPopupPaneRemoved(QString) -
src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.cpp
unchanged:
193 193 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(); 199 199 }

