VirtualBox

Changeset 64627 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Nov 10, 2016 11:09:22 AM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8636: UIDesktopWidgetWatchdog: Make invisible windows handle not just resize but move events as well.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.cpp

    r64624 r64627  
    6363private:
    6464
     65    /** Move @a pEvent handler. */
     66    void moveEvent(QMoveEvent *pEvent);
    6567    /** Resize @a pEvent handler. */
    6668    void resizeEvent(QResizeEvent *pEvent);
    6769
    6870    /** Holds the index of the host-screen this window created for. */
    69     int m_iHostScreenIndex;
     71    const int m_iHostScreenIndex;
     72
     73    /** Holds whether the move event came. */
     74    bool m_fMoveCame;
     75    /** Holds whether the resize event came. */
     76    bool m_fResizeCame;
    7077};
    7178
     
    7885    : QWidget(0, Qt::Window | Qt::FramelessWindowHint)
    7986    , m_iHostScreenIndex(iHostScreenIndex)
     87    , m_fMoveCame(false)
     88    , m_fResizeCame(false)
    8089{
    8190    /* Resize to minimum size of 1 pixel: */
     
    8897}
    8998
    90 void UIInvisibleWindow::resizeEvent(QResizeEvent *pEvent)
    91 {
     99void UIInvisibleWindow::moveEvent(QMoveEvent *pEvent)
     100{
     101    /* We do have both move and resize events,
     102     * with no idea who will come first, but we need
     103     * to send a final signal after last of events arrived. */
     104
    92105    /* Call to base-class: */
    93     QWidget::resizeEvent(pEvent);
     106    QWidget::moveEvent(pEvent);
    94107
    95108    /* Ignore 'not-yet-shown' case: */
     
    97110        return;
    98111
    99     /* Notify listeners about host-screen available-geometry was calulated: */
    100     emit sigHostScreenAvailableGeometryCalculated(m_iHostScreenIndex, QRect(x(), y(), width(), height()));
     112    /* Mark move event as received: */
     113    m_fMoveCame = true;
     114
     115    /* If the resize event already came: */
     116    if (m_fResizeCame)
     117    {
     118        /* Notify listeners about host-screen available-geometry was calulated: */
     119        LogRel2(("GUI: UIInvisibleWindow::moveEvent: Screen: %d, work area: %dx%d x %dx%d\n", m_iHostScreenIndex,
     120                 x(), y(), width(), height()));
     121        emit sigHostScreenAvailableGeometryCalculated(m_iHostScreenIndex, QRect(x(), y(), width(), height()));
     122    }
     123}
     124
     125void UIInvisibleWindow::resizeEvent(QResizeEvent *pEvent)
     126{
     127    /* We do have both move and resize events,
     128     * with no idea who will come first, but we need
     129     * to send a final signal after last of events arrived. */
     130
     131    /* Call to base-class: */
     132    QWidget::resizeEvent(pEvent);
     133
     134    /* Ignore 'not-yet-shown' case: */
     135    if (!isVisible())
     136        return;
     137
     138    /* Mark resize event as received: */
     139    m_fResizeCame = true;
     140
     141    /* If the move event already came: */
     142    if (m_fMoveCame)
     143    {
     144        /* Notify listeners about host-screen available-geometry was calulated: */
     145        LogRel2(("GUI: UIInvisibleWindow::resizeEvent: Screen: %d, work area: %dx%d x %dx%d\n", m_iHostScreenIndex,
     146                 x(), y(), width(), height()));
     147        emit sigHostScreenAvailableGeometryCalculated(m_iHostScreenIndex, QRect(x(), y(), width(), height()));
     148    }
    101149}
    102150
     
    530578
    531579        /* Place worker to corresponding host-screen: */
    532         pWorker->move(hostScreenGeometry.topLeft());
     580        pWorker->move(hostScreenGeometry.center());
    533581        /* And finally, maximize it: */
    534582        pWorker->showMaximized();
Note: See TracChangeset for help on using the changeset viewer.

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