VirtualBox

Ticket #15863: r111428-r111430-r111508.patch

File r111428-r111430-r111508.patch, 13.4 KB (added by Michael Thayer, 8 years ago)

Current at this time patch against 5.1. May have slight fuzz when applying.

  • src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.cpp

    unchanged:
     
    101101        {
    102102            /* Restore window geometry: */
    103103            m_normalGeometry = geo;
    104             setGeometry(m_normalGeometry);
     104            VBoxGlobal::setTopLevelGeometry(this, m_normalGeometry);
    105105
    106106            /* Maximize (if necessary): */
    107107            if (gEDataManager->machineWindowShouldBeMaximized(machineLogic()->visualStateType(),
     
    120120            /* Move newly created window to the screen-center: */
    121121            m_normalGeometry = geometry();
    122122            m_normalGeometry.moveCenter(availableGeo.center());
    123             setGeometry(m_normalGeometry);
     123            VBoxGlobal::setTopLevelGeometry(this, m_normalGeometry);
    124124        }
    125125
    126126        /* Normalize to the optimal size: */
     
    201201        frGeo = VBoxGlobal::normalizeGeometry(frGeo, gpDesktop->overallAvailableRegion());
    202202
    203203    /* 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);
    206206#else /* VBOX_GUI_WITH_CUSTOMIZATIONS1 */
    207207    /* Customer request: There should no be
    208208     * machine-window resize/move on machine-view resize: */
  • src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp

    unchanged:
     
    371371            {
    372372                /* Restore window geometry: */
    373373                m_normalGeometry = geo;
    374                 setGeometry(m_normalGeometry);
     374                VBoxGlobal::setTopLevelGeometry(this, m_normalGeometry);
    375375            }
    376376            /* If previous machine-state was NOT SAVED: */
    377377            else
     
    378378            {
    379379                /* Restore only window position: */
    380380                m_normalGeometry = QRect(geo.x(), geo.y(), width(), height());
    381                 setGeometry(m_normalGeometry);
     381                VBoxGlobal::setTopLevelGeometry(this, m_normalGeometry);
    382382                /* And normalize to the optimal-size: */
    383383                normalizeGeometry(false /* adjust position */);
    384384            }
     
    400400            /* Move newly created window to the screen-center: */
    401401            m_normalGeometry = geometry();
    402402            m_normalGeometry.moveCenter(availableGeo.center());
    403             setGeometry(m_normalGeometry);
     403            VBoxGlobal::setTopLevelGeometry(this, m_normalGeometry);
    404404        }
    405405
    406406        /* Normalize to the optimal size: */
     
    574574        frGeo = VBoxGlobal::normalizeGeometry(frGeo, gpDesktop->overallAvailableRegion());
    575575
    576576    /* 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);
    579579#else /* VBOX_GUI_WITH_CUSTOMIZATIONS1 */
    580580    /* Customer request: There should no be
    581581     * machine-window resize/move on machine-view resize: */
  • src/VBox/Frontends/VirtualBox/src/runtime/UISlidingToolBar.cpp

    unchanged:
     
    139139    {
    140140        case Position_Top:
    141141        {
    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());
    144144            m_pEmbeddedWidget->setGeometry(0, -sh.height(), qMax(width(), sh.width()), sh.height());
    145145            break;
    146146        }
    147147        case Position_Bottom:
    148148        {
    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());
    151151            m_pEmbeddedWidget->setGeometry(0,  sh.height(), qMax(width(), sh.width()), sh.height());
    152152            break;
    153153        }
     
    196196    {
    197197        case Position_Top:
    198198        {
    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());
    201201            break;
    202202        }
    203203        case Position_Bottom:
    204204        {
    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());
    207207            break;
    208208        }
    209209    }
  • src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp

    unchanged:
     
    350350            geo = QRect(QPoint(0, 0), QSize(800, 600).boundedTo(workingArea.size()));
    351351        /* Move window to the center of working-area: */
    352352        geo.moveCenter(workingArea.center());
    353         setGeometry(geo);
     353        VBoxGlobal::setTopLevelGeometry(this, geo);
    354354    }
    355355
    356356#elif defined(VBOX_WS_WIN)
  • src/VBox/Frontends/VirtualBox/src/extensions/QIMainWindow.cpp

    unchanged:
     
    2121
    2222/* GUI includes: */
    2323# include "QIMainWindow.h"
     24# include "VBoxGlobal.h"
    2425
    2526#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    2627
     
    3839    resize(m_geometry.size());
    3940#else /* VBOX_WS_MAC */
    4041    /* Use the new approach for Windows/X11: */
    41     setGeometry(m_geometry);
     42    VBoxGlobal::setTopLevelGeometry(this, m_geometry);
    4243#endif /* !VBOX_WS_MAC */
    4344
    4445    /* 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
     
    4949# endif /* VBOX_GUI_WITH_PIDFILE */
    5050# if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
    5151#  include <QScreen>
     52#  include <xcb/xcb.h>
    5253# endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
    5354
    5455/* GUI includes: */
     
    37023703    pSpinBox->setMinimumWidth(iTextWidth + iSpinBoxDelta);
    37033704}
    37043705
     3706#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
     3707typedef struct {
     3708/** User specified flags */
     3709uint32_t flags;
     3710/** User-specified position */
     3711int32_t x, y;
     3712/** User-specified size */
     3713int32_t width, height;
     3714/** Program-specified minimum size */
     3715int32_t min_width, min_height;
     3716/** Program-specified maximum size */
     3717int32_t max_width, max_height;
     3718/** Program-specified resize increments */
     3719int32_t width_inc, height_inc;
     3720/** Program-specified minimum aspect ratios */
     3721int32_t min_aspect_num, min_aspect_den;
     3722/** Program-specified maximum aspect ratios */
     3723int32_t max_aspect_num, max_aspect_den;
     3724/** Program-specified base size */
     3725int32_t base_width, base_height;
     3726/** Program-specified window gravity */
     3727uint32_t win_gravity;
     3728} xcb_size_hints_t;
     3729#endif /* defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 */
     3730
     3731/* static */
     3732void 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        hints.x           = x;
     3754        hints.y           = y;
     3755        hints.width       = w;
     3756        hints.height      = h;
     3757        hints.min_width   = pWidget->minimumSize().width();
     3758        hints.min_height  = pWidget->minimumSize().height();
     3759        hints.max_width   = pWidget->maximumSize().width();
     3760        hints.max_height  = pWidget->maximumSize().height();
     3761        hints.width_inc   = pWidget->sizeIncrement().width();
     3762        hints.height_inc  = pWidget->sizeIncrement().height();
     3763        hints.base_width  = pWidget->baseSize().width();
     3764        hints.base_height = pWidget->baseSize().height();
     3765        if (hints.min_width > 0 || hints.min_height > 0)
     3766            hints.flags |= 16 /* XCB_ICCCM_SIZE_HINT_P_MIN_SIZE */;
     3767        if (hints.max_width < QWINDOWSIZE_MAX || hints.max_height < QWINDOWSIZE_MAX)
     3768            hints.flags |= 32 /* XCB_ICCCM_SIZE_HINT_P_MAX_SIZE */;
     3769        if (hints.width_inc > 0 || hints.height_inc)
     3770            hints.flags |=   64 /* XCB_ICCCM_SIZE_HINT_P_MIN_SIZE */
     3771                           | 256 /* XCB_ICCCM_SIZE_HINT_BASE_SIZE */;
     3772        xcb_change_property(QX11Info::connection(), XCB_PROP_MODE_REPLACE,
     3773                            (xcb_window_t)pWidget->winId(), XCB_ATOM_WM_NORMAL_HINTS,
     3774                            XCB_ATOM_WM_SIZE_HINTS, 32, sizeof(hints) >> 2, &hints);
     3775        xcb_flush(QX11Info::connection());
     3776    }
     3777    else
     3778        /* Call the Qt method if the window is not visible as otherwise no
     3779         * Configure event will arrive to tell Qt what geometry we want. */
     3780        pWidget->setGeometry(x, y, w, h);
     3781# else /* !defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 */
     3782    pWidget->setGeometry(x, y, w, h);
     3783# endif /* !defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 */
     3784}
     3785
     3786/* static */
     3787void VBoxGlobal::setTopLevelGeometry(QWidget *pWidget, const QRect &rect)
     3788{
     3789    VBoxGlobal::setTopLevelGeometry(pWidget, rect.x(), rect.y(), rect.width(), rect.height());
     3790}
     3791
    37053792// Public slots
    37063793////////////////////////////////////////////////////////////////////////////////
    37073794
  • src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    unchanged:
     
    442442     * to strict the minimum width to reflect at least [n] symbols. */
    443443    static void setMinimumWidthAccordingSymbolCount(QSpinBox *pSpinBox, int cCount);
    444444
     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
    445452signals:
    446453
    447454    /** Notifies listeners about the VBoxSVC availability change. */
  • src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.cpp

    unchanged:
     
    2727# include <QStatusBar>
    2828
    2929/* GUI includes: */
     30# include "VBoxGlobal.h"
    3031# include "UIPopupStack.h"
    3132# include "UIPopupStackViewport.h"
    3233
     
    166167    }
    167168
    168169    /* Adjust geometry: */
    169     setGeometry(iX, iY, iWidth, iHeight);
     170    VBoxGlobal::setTopLevelGeometry(this, iX, iY, iWidth, iHeight);
    170171}
    171172
    172173void UIPopupStack::sltPopupPaneRemoved(QString)
  • src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.cpp

    unchanged:
     
    193193
    194194    QRect geo (QPoint (0, 0), initSize);
    195195    geo.moveCenter (parentWidget()->geometry().center());
    196     setGeometry (geo);
     196    VBoxGlobal::setTopLevelGeometry(this, geo);
    197197
    198198    retranslateUi();
    199199}

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy