VirtualBox

Changeset 29076 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 5, 2010 1:03:29 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: new core: Make sure the seamless/fullscreen windows are opened on the
host screen the user expect until he manual overwrite this decision.

File:
1 edited

Legend:

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

    r29069 r29076  
    8181     * they are valid, which means there have to be unique combinations and all
    8282     * guests screens need there own host screen. */
     83    QDesktopWidget *pDW = QApplication::desktop();
    8384    for (int i = 0; i < m_cGuestScreens; ++i)
    8485    {
     86        /* If the user ever selected a combination in the view menu, we have
     87         * the following entry: */
    8588        QString strTest = machine.GetExtraData(QString("%1%2").arg(VBoxDefs::GUI_VirtualScreenToHostScreen).arg(i));
    8689        bool fOk;
     
    9093              && cScreen >= 0 && cScreen < m_cHostScreens /* In the host screen bounds? */
    9194              && m_pScreenMap->key(cScreen, -1) == -1)) /* Not taken already? */
    92             /* If not, use one from the available screens */
    93             cScreen = availableScreens.first();
     95        {
     96            /* If not, check the position of the guest window in normal mode.
     97             * This makes sure that on first use the window opens on the same
     98             * screen as the normal window was before. This even works with
     99             * multi-screen. The user just have to move all the normal windows
     100             * to the target screens and they will magically open there in
     101             * seamless/fullscreen also. */
     102            QString strTest1 = machine.GetExtraData(VBoxDefs::GUI_LastWindowPosition + (i > 0 ? QString::number(i): ""));
     103            QRegExp posParser("(-?\\d+),(-?\\d+),(-?\\d+),(-?\\d+)");
     104            if (   posParser.exactMatch(strTest1)
     105                && posParser.captureCount() == 4)
     106            {
     107                /* If parsing was successfully, convert it to a position. */
     108                bool fOk1, fOk2;
     109                QPoint p(posParser.cap(1).toInt(&fOk1), posParser.cap(2).toInt(&fOk2));
     110                /* Check to which screen the position belongs. */
     111                cScreen = pDW->screenNumber(p);
     112                if (!(   fOk1 /* Valid data */
     113                      && fOk2 /* Valid data */
     114                      && cScreen >= 0 && cScreen < m_cHostScreens /* In the host screen bounds? */
     115                      && m_pScreenMap->key(cScreen, -1) == -1)) /* Not taken already? */
     116                    /* If not, simply pick the next one of the still available
     117                     * host screens. */
     118                    cScreen = availableScreens.first();
     119            }
     120            else
     121                /* If not, simply pick the next one of the still available host
     122                 * screens. */
     123                cScreen = availableScreens.first();
     124        }
    94125        m_pScreenMap->insert(i, cScreen);
    95         /* Remove the current set screen from the list of available screens. */
     126        /* Remove the just selected screen from the list of available screens. */
    96127        availableScreens.removeOne(cScreen);
    97128    }
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