VirtualBox

Changeset 6441 in vbox


Ignore:
Timestamp:
Jan 22, 2008 1:44:12 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
27416
Message:

Fixed wrong display in seamless mode if the toolbars (gnome-panel, windows taskbar, mac dock) of the host are not on the bottom of the screen but on the top/left/right or all together.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h

    r5999 r6441  
    182182    void onExitFullscreen();
    183183
     184    void setViewInSeamlessMode(const QRect& targetRect);
     185
    184186private:
    185187
     
    248250    bool statusBarChangedInside;
    249251
    250     QSpacerItem *mShiftingSpacer;
     252    QSpacerItem *mShiftingSpacerLeft;
     253    QSpacerItem *mShiftingSpacerTop;
     254    QSpacerItem *mShiftingSpacerRight;
     255    QSpacerItem *mShiftingSpacerBottom;
    251256
    252257#ifdef VBOX_WITH_DEBUGGER_GUI
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp

    r6184 r6441  
    10571057                mIgnoreMainwndResize = oldIgnoreMainwndResize;
    10581058
    1059                 /* emit a signal about guest was resized */
    1060                 emit resizeHintDone();
    1061 
    10621059                /* update geometry after entering fullscreen | seamless */
    10631060                if (mMainWnd->isTrueFullscreen() || mMainWnd->isTrueSeamless())
    10641061                    updateGeometry();
    10651062
     1063                /* make sure that all posted signals are processed */
     1064                qApp->processEvents();
     1065
     1066                /* emit a signal about guest was resized */
     1067                emit resizeHintDone();
     1068             
    10661069                return true;
    10671070            }
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r6284 r6441  
    631631    {
    632632        setCentralWidget (new QWidget (this, "centralWidget"));
    633         new QBoxLayout (centralWidget(), QBoxLayout::Down);
     633        QGridLayout *pMainLayout = new QGridLayout(centralWidget(), 3, 3, 0, 0);
     634        mShiftingSpacerLeft = new QSpacerItem (0, 0,
     635                                               QSizePolicy::Fixed,
     636                                               QSizePolicy::Fixed);
     637        mShiftingSpacerTop = new QSpacerItem (0, 0,
     638                                              QSizePolicy::Fixed,
     639                                              QSizePolicy::Fixed);
     640        mShiftingSpacerRight = new QSpacerItem (0, 0,
     641                                                QSizePolicy::Fixed,
     642                                                QSizePolicy::Fixed);
     643        mShiftingSpacerBottom = new QSpacerItem (0, 0,
     644                                                 QSizePolicy::Fixed,
     645                                                 QSizePolicy::Fixed);
     646        pMainLayout->addItem(mShiftingSpacerLeft, 1, 0);
     647        pMainLayout->addMultiCell(mShiftingSpacerTop, 0, 0, 0, 2);
     648        pMainLayout->addItem(mShiftingSpacerRight, 1, 2);
     649        pMainLayout->addMultiCell(mShiftingSpacerBottom, 2, 2, 0, 2);
    634650    }
    635651
     
    646662    activateUICustomizations();
    647663
    648     ((QBoxLayout*) centralWidget()->layout())->addWidget (
    649         console, 0, AlignVCenter | AlignHCenter);
    650 
    651     mShiftingSpacer = new QSpacerItem (0, 0, QSizePolicy::Expanding,
    652                                              QSizePolicy::Fixed);
    653     ((QBoxLayout*) centralWidget()->layout())->addItem (mShiftingSpacer);
    654 
     664    static_cast<QGridLayout*>(centralWidget()->layout())->addWidget(console, 1, 1, AlignVCenter | AlignHCenter);
     665   
    655666    CMachine cmachine = csession.GetMachine();
    656667
     
    9961007{
    9971008    disconnect (console, SIGNAL (resizeHintDone()), 0, 0);
     1009#ifndef Q_WS_MAC
     1010    /* It isn't guaranteed that the guest os set the video mode that
     1011     * we requested. So after all the resizing stuff set the clipping
     1012     * mask and the spacing shifter to the corresponding values. */
     1013    setViewInSeamlessMode(QRect(console->mapToGlobal(QPoint(0, 0)), console->size()));
     1014#endif
    9981015
    9991016    vmSeamlessAction->setEnabled (mIsSeamless);
     
    18951912bool VBoxConsoleWnd::toggleFullscreenMode (bool aOn, bool aSeamless)
    18961913{
     1914
    18971915    if (aSeamless)
    18981916    {
     
    19952013            dtw->availableGeometry (this) : dtw->screenGeometry (this);
    19962014
    1997         /* Calculate the difference region between current mode
    1998          * (fullscreen or seamless) and the screen geometry. */
    1999         mStrictedRegion =
    2000             QRegion (dtw->screenGeometry (this)) - scrGeo;
    2001 
    2002         /* Setup the shifting spacer to make the console to be aligned on top
    2003          * in the seamless mode. */
    2004 #ifdef Q_WS_MAC
    2005         mShiftingSpacer->changeSize (0,  dtw->screenGeometry(this).bottom() - scrGeo.bottom(),
    2006                                      QSizePolicy::Preferred, QSizePolicy::Fixed);
    2007 #else
    2008         mShiftingSpacer->changeSize (0, mStrictedRegion.boundingRect().height(),
    2009                                      QSizePolicy::Preferred, QSizePolicy::Fixed);
    2010 #endif
     2015        /* It isn't guaranteed that the guest os set the video mode that
     2016         * we requested. So after all the resizing stuff set the clipping
     2017         * mask and the spacing shifter to the corresponding values. */
     2018        setViewInSeamlessMode(dtw->availableGeometry(this));
    20112019
    20122020#ifdef Q_WS_WIN32
     
    20522060        setWindowState (windowState() ^ WindowFullScreen);
    20532061#ifdef Q_WS_MAC /* setMask seems to not include the far border pixels. */
    2054         QRect maskRect = dtw->screenGeometry (this);
    2055         maskRect.setRight (maskRect.right() + 1);
    2056         maskRect.setBottom (maskRect.bottom() + 1);
    2057         setMask (maskRect);
     2062//        QRect maskRect = dtw->screenGeometry (this);
     2063//        maskRect.setRight (maskRect.right() + 1);
     2064//        maskRect.setBottom (maskRect.bottom() + 1);
     2065//        setMask (maskRect);
     2066
    20582067#else
    2059         setMask (dtw->screenGeometry (this));
     2068//        setMask (dtw->screenGeometry (this));
    20602069#endif
    20612070
     
    20732082
    20742083        /* Reset the shifting spacer. */
    2075         mShiftingSpacer->changeSize (0, 0, QSizePolicy::Preferred,
    2076                                            QSizePolicy::Fixed);
     2084        mShiftingSpacerLeft->changeSize (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
     2085        mShiftingSpacerTop->changeSize (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
     2086        mShiftingSpacerRight->changeSize (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
     2087        mShiftingSpacerBottom->changeSize (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
    20772088
    20782089        /* Restore the previous scroll-view minimum size before the exiting
     
    21212132// Private slots
    21222133/////////////////////////////////////////////////////////////////////////////
     2134void VBoxConsoleWnd::setViewInSeamlessMode(const QRect& targetRect)
     2135{
     2136    if (mIsSeamless)
     2137    {
     2138        /* It isn't guaranteed that the guest os set the video mode that
     2139         * we requested. So after all the resizing stuff set the clipping
     2140         * mask and the spacing shifter to the corresponding values. */
     2141        QDesktopWidget *dtw = QApplication::desktop();
     2142        QRect sRect = dtw->screenGeometry (this);
     2143        QRect aRect(targetRect);
     2144        QRect a1Rect(targetRect);
     2145#ifdef Q_WS_MAC
     2146        /* On mac os x this isn't necessary cause the screen starts
     2147         * by y=0 always regardless if there is the global menubar or not. */
     2148        aRect.setRect(aRect.left(), 0, aRect.width(), aRect.height()+aRect.top());
     2149        a1Rect.setRect(a1Rect.left(), 0, a1Rect.width(), a1Rect.height());
     2150#endif // Q_WS_MAC
     2151        /* Set the clipping mask */
     2152        mStrictedRegion = QRegion(sRect) - a1Rect;
     2153        /* Set the shifting spacer */
     2154        mShiftingSpacerLeft->changeSize(RT_ABS(sRect.left() - aRect.left()), 0,
     2155                                        QSizePolicy::Fixed, QSizePolicy::Preferred);
     2156        mShiftingSpacerTop->changeSize(0, RT_ABS(sRect.top() - aRect.top()),
     2157                                       QSizePolicy::Preferred, QSizePolicy::Fixed);
     2158        mShiftingSpacerRight->changeSize(RT_ABS(sRect.right() - aRect.right()), 0,
     2159                                         QSizePolicy::Fixed, QSizePolicy::Preferred);
     2160        mShiftingSpacerBottom->changeSize(0, RT_ABS(sRect.bottom() - aRect.bottom()),
     2161                                          QSizePolicy::Preferred, QSizePolicy::Fixed);
     2162    }
     2163}
    21232164
    21242165void VBoxConsoleWnd::vmFullscreen (bool aOn)
     
    25132554void VBoxConsoleWnd::setMask (const QRegion &aRegion)
    25142555{
    2515     QRegion region = aRegion - mStrictedRegion;
     2556    QRegion region = aRegion;
     2557    region.translate(mShiftingSpacerLeft->sizeHint().width(), mShiftingSpacerTop->sizeHint().height());
     2558    region -= mStrictedRegion;
     2559
     2560#ifdef Q_WS_MAC
     2561    /* This is necessary to avoid the flicker by
     2562     * an mask update.
     2563     * See http://lists.apple.com/archives/Carbon-development/2001/Apr/msg01651.html
     2564     * for the hint.
     2565     * There *must* be a better solution. */
     2566    if(!region.isEmpty())
     2567      region |= QRect(0, 0, 1, 1);
     2568#endif
    25162569
    25172570#ifdef Q_WS_WIN
     
    25202573    /* Region offset calculation */
    25212574    int fleft = 0, ftop = 0;
    2522     if (isTopLevel())
    2523     {
    2524         ftop = topData()->ftop;
    2525         fleft = topData()->fleft;
    2526     }
     2575    /* I think this isn't necessary anymore because the 4 shifting spacer.
     2576     * Has to be verified. */
     2577//    if (isTopLevel())
     2578//    {
     2579//        ftop = topData()->ftop;
     2580//        fleft = topData()->fleft;
     2581//    }
    25272582
    25282583    /* Visible region calculation */
     
    30353090    vmAutoresizeGuestAction->setEnabled (aActive);
    30363091    vmSeamlessAction->setEnabled (aSeamlessSupported);
    3037 #ifndef Q_WS_MAC /** @todo fix seamless mode on Mac OS X. It is temporarily disabled to prevent bogus bugreports for the beta 3 / beta 2 leopard update. */
     3092//#ifndef Q_WS_MAC /** @todo fix seamless mode on Mac OS X. It is temporarily disabled to prevent bogus bugreports for the beta 3 / beta 2 leopard update. */
    30383093    mIsSeamlessSupported = aSeamlessSupported;
    3039 #endif
     3094//#endif
    30403095    /* If seamless mode should be enabled then check if it is enabled
    30413096     * currently and re-enable it if open-view procedure is finished */
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