VirtualBox

Changeset 27534 in vbox


Ignore:
Timestamp:
Mar 19, 2010 1:31:05 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4-OSX: fix broken Qt isMaximized method

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

Legend:

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

    r27374 r27534  
    4242#endif
    4343#ifdef Q_WS_MAC
     44# include "VBoxUtils.h"
    4445# include <ApplicationServices/ApplicationServices.h>
    4546# ifndef QT_MAC_USE_COCOA
     
    7475    virtual ~VBoxConsoleWnd();
    7576
    76     bool isWindowMaximized() const
     77    bool isWindowMaximized()
    7778    {
    7879#ifdef Q_WS_MAC
     
    8081         * maximize the window. This situation has to be considered when
    8182         * checking for maximized or fullscreen mode. */
    82         return !isTrueSeamless() && QMainWindow::isMaximized();
     83        return !isTrueSeamless() && ::darwinIsWindowMaximized(this);
    8384#else /* Q_WS_MAC */
    8485        return QMainWindow::isMaximized();
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp

    r27259 r27534  
    734734            .arg (mNormalGeo.x()).arg (y)
    735735            .arg (mNormalGeo.width()).arg (mNormalGeo.height());
     736#ifdef Q_WS_MAC
     737        if (::darwinIsWindowMaximized(this))
     738#else /* Q_WS_MAC */
    736739        if (isMaximized())
     740#endif /* !Q_WS_MAC */
    737741            winPos += QString (",%1").arg (VBoxDefs::GUI_LastWindowPosition_Max);
    738742
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin-cocoa.mm

    r26716 r27534  
    185185}
    186186
     187bool darwinIsWindowMaximized(NativeWindowRef aWindow)
     188{
     189    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     190   
     191    bool fResult = [aWindow isZoomed];
     192
     193    [pool release];
     194    return fResult;
     195}
     196
    187197float darwinSmallFontSize()
    188198{
    189     return [NSFont systemFontSizeForControlSize: NSSmallControlSize];
    190 }
    191 
     199    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     200
     201    float size = [NSFont systemFontSizeForControlSize: NSSmallControlSize];
     202
     203    [pool release];
     204    return size;
     205}
     206
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.cpp

    r26699 r27534  
    105105{
    106106    ::darwinSetShowsResizeIndicatorImpl (::darwinToNativeWindow (aWidget), aEnabled);
     107}
     108
     109bool darwinIsWindowMaximized(QWidget *aWidget)
     110{
     111#ifdef QT_MAC_USE_COCOA
     112    /* Currently only necessary in the Cocoa version */
     113    return ::darwinIsWindowMaximized(::darwinToNativeWindow(aWidget));
     114#else /* QT_MAC_USE_COCOA */
     115    NOREF (aWidget);
     116    return false;
     117#endif /* !QT_MAC_USE_COCOA */
    107118}
    108119
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.h

    r26699 r27534  
    9393void darwinWindowInvalidateShadowImpl (NativeWindowRef aWindow);
    9494int  darwinWindowToolBarHeight (NativeWindowRef aWindow);
     95bool darwinIsWindowMaximized(NativeWindowRef aWindow);
     96
    9597float darwinSmallFontSize();
    9698bool darwinSetFrontMostProcess();
     
    172174void darwinWindowInvalidateShadow (QWidget *aWidget);
    173175int  darwinWindowToolBarHeight (QWidget *aWidget);
     176bool darwinIsWindowMaximized(QWidget *aWidget);
    174177QString darwinSystemLanguage (void);
    175178QPixmap darwinCreateDragPixmap (const QPixmap& aPixmap, const QString &aText);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp

    r27436 r27534  
    3030/* Local includes */
    3131#include "VBoxGlobal.h"
     32#include "VBoxUtils.h"
    3233
    3334#include "UIActionsPool.h"
     
    260261        {
    261262            QResizeEvent *pResizeEvent = static_cast<QResizeEvent*>(pEvent);
    262             if (!isMaximized())
     263            if (!isMaximizedChecked())
    263264            {
    264265                m_normalGeometry.setSize(pResizeEvent->size());
     
    272273        case QEvent::Move:
    273274        {
    274             if (!isMaximized())
     275            if (!isMaximizedChecked())
    275276            {
    276277                m_normalGeometry.moveTo(geometry().x(), geometry().y());
     
    559560    CMachine machine = session().GetMachine();
    560561
     562    printf("bla\n");
    561563    /* Save extra-data settings: */
    562564    {
     
    564566                                    .arg(m_normalGeometry.x()).arg(m_normalGeometry.y())
    565567                                    .arg(m_normalGeometry.width()).arg(m_normalGeometry.height());
    566         if (isMaximized())
     568        if (isMaximizedChecked())
    567569            strWindowPosition += QString(",%1").arg(VBoxDefs::GUI_LastWindowPosition_Max);
    568570        QString strPositionAddress = m_uScreenId == 0 ? QString("%1").arg(VBoxDefs::GUI_LastWindowPosition) :
     
    595597}
    596598
     599bool UIMachineWindowNormal::isMaximizedChecked()
     600{
     601#ifdef Q_WS_MAC
     602    /* On the Mac the WindowStateChange signal doesn't seems to be delivered
     603     * when the user get out of the maximized state. So check this ourself. */
     604    return ::darwinIsWindowMaximized(this);
     605#endif /* !Q_WS_MAC */
     606    return isMaximized();
     607}
     608
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h

    r27375 r27534  
    106106    /* Other members: */
    107107    void showSimple();
     108    bool isMaximizedChecked();
    108109
    109110    /* Indicators pool: */
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