VirtualBox

Changeset 21034 in vbox


Ignore:
Timestamp:
Jun 29, 2009 3:36:04 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4-OSX: Fix initial window position for the selector & sub windows.

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

Legend:

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

    r20470 r21034  
    34283428    /* ensure the widget is within the available desktop area */
    34293429    QRect newGeo = normalizeGeometry (geo, deskGeo, aCanResize);
     3430#ifdef Q_WS_MAC
     3431    /* No idea why, but Qt doesn't respect if there is a unified toolbar on the
     3432     * ::move call. So manually add the height of the toolbar before setting
     3433     * the position. */
     3434    if (w)
     3435        newGeo.translate (0, ::darwinWindowToolBarHeight (aWidget));
     3436#endif /* Q_WS_MAC */
    34303437
    34313438    aWidget->move (newGeo.topLeft());
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp

    r20928 r21034  
    717717    /* Save the position of the window */
    718718    {
     719        int y = mNormalGeo.y();
     720#if defined (Q_WS_MAC) && !defined (QT_MAC_USE_COCOA)
     721        /* The toolbar counts to the content not to the frame. Unfortunaly the
     722         * toolbar isn't fully initialized when this window will be moved to
     723         * the last position after VBox starting. As a workaround just do
     724         * remove the toolbar height part when save the last position. */
     725        y -= ::darwinWindowToolBarHeight (this);
     726#endif /* Q_WS_MAC && !QT_MAC_USE_COCOA */
    719727        QString winPos = QString ("%1,%2,%3,%4")
    720             .arg (mNormalGeo.x()).arg (mNormalGeo.y())
     728            .arg (mNormalGeo.x()).arg (y)
    721729            .arg (mNormalGeo.width()).arg (mNormalGeo.height());
    722730        if (isMaximized())
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin-carbon.cpp

    r18829 r21034  
    137137//    HIWindowInvalidateShadow (::darwinToWindowRef (console->viewport()));
    138138//    ReshapeCustomWindow (::darwinToWindowRef (this));
     139}
     140
     141int darwinWindowToolBarHeight (NativeWindowRef aWindow)
     142{
     143    int h = 0;
     144    if (::IsWindowToolbarVisible (aWindow))
     145    {
     146        /* Seems there is no method for getting the height of a toolbar in
     147         * Carbon directly. Calculate it by getting the full window size,
     148         * without the titlebar height & the content height. */
     149        HIRect win, win1, win2;
     150        if (OSStatus result = ::HIWindowGetBounds (aWindow, kWindowStructureRgn, kHICoordSpaceWindow, &win) == noErr)
     151            if((result = ::HIWindowGetBounds (aWindow, kWindowTitleBarRgn, kHICoordSpaceWindow, &win1)) == noErr)
     152                if ((result = ::HIWindowGetBounds (aWindow, kWindowContentRgn, kHICoordSpaceWindow, &win2)) == noErr)
     153                    h = win.size.height - win1.size.height - win2.size.height;
     154    }
     155    return h;
    139156}
    140157
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.cpp

    r17340 r21034  
    138138    QApplication::instance()->setAttribute (Qt::AA_DontShowIconsInMenus, true);
    139139#endif /* QT_VERSION >= 0x040400 */
     140}
     141
     142int darwinWindowToolBarHeight (QWidget *aWidget)
     143{
     144#ifndef QT_MAC_USE_COCOA
     145    return ::darwinWindowToolBarHeight (::darwinToNativeWindow (aWidget));
     146#else /* QT_MAC_USE_COCOA */
     147    NOREF (aWidget);
     148    return 0;
     149#endif /* QT_MAC_USE_COCOA */
    140150}
    141151
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