VirtualBox

Changeset 57043 in vbox for trunk


Ignore:
Timestamp:
Jul 21, 2015 2:01:18 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI: Visual-mode adjustment code: Separate code reordering for r101761 to keep it clear.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
2 edited

Legend:

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

    r57042 r57043  
    313313    const QRect workingArea = QApplication::desktop()->screenGeometry(iHostScreen);
    314314
    315 #ifdef Q_WS_MAC
     315#ifndef Q_WS_MAC
     316    /* Set appropriate geometry for window: */
     317    move(workingArea.topLeft());
     318    resize(workingArea.size());
     319#else /* Q_WS_MAC */
    316320    /* Make sure this window has fullscreen logic: */
    317321    UIMachineLogicFullscreen *pFullscreenLogic = qobject_cast<UIMachineLogicFullscreen*>(machineLogic());
     
    345349        setGeometry(geo);
    346350    }
    347 #else /* !Q_WS_MAC */
    348     /* Set appropriate geometry for window: */
    349     move(workingArea.topLeft());
    350     resize(workingArea.size());
    351 #endif /* !Q_WS_MAC */
     351#endif /* Q_WS_MAC */
    352352}
    353353
     
    375375        }
    376376#endif /* Q_WS_WIN || Q_WS_X11 */
     377
    377378        /* Hide window: */
    378379        hide();
    379         return;
    380     }
    381 
    382     /* Ignore if window minimized: */
    383     if (isMinimized())
    384         return;
     380    }
     381    else
     382    {
     383        /* Ignore if window minimized: */
     384        if (isMinimized())
     385            return;
    385386
    386387#ifdef Q_WS_X11
    387     /* On X11 calling placeOnScreen() is only needed for legacy window managers
    388      * which we do not test, so this is 'best effort' code. With window managers which
    389      * support the _NET_WM_FULLSCREEN_MONITORS protocol this would interfere unreliable. */
    390     const bool fSupportsNativeFullScreen = VBoxGlobal::supportsFullScreenMonitorsProtocolX11() &&
    391                                            !gEDataManager->legacyFullscreenModeRequested();
    392     if (!fSupportsNativeFullScreen)
    393         placeOnScreen();
    394 #else /* !Q_WS_X11 */
    395     /* Make sure window is maximized and placed on valid screen: */
    396     placeOnScreen();
    397 #endif /* !Q_WS_X11 */
    398 
    399 #ifdef Q_WS_MAC
    400     /* ML and next using native stuff, so we can call for simple show(),
    401      * Lion and previous using Qt stuff, so we should call for showFullScreen(): */
    402     if (fSupportsNativeFullScreen)
    403         show();
    404     else
    405         showFullScreen();
    406 #else /* !Q_WS_MAC */
    407     /* Show in fullscreen mode: */
    408     showFullScreen();
    409 #endif /* !Q_WS_MAC */
    410 
    411 #ifdef Q_WS_X11
    412     if (fSupportsNativeFullScreen)
    413     {
    414         /* Tell recent window managers which screen this window should be mapped to.
    415          * Apparently some window managers will not respond to requests for
    416          * unmapped windows, so do this *after* the call to showFullScreen(). */
    417         VBoxGlobal::setFullScreenMonitorX11(this, pFullscreenLogic->hostScreenForGuestScreen(m_uScreenId));
    418     }
    419     else
    420     {
    421388        /* On X11 calling placeOnScreen() is only needed for legacy window managers
    422389         * which we do not test, so this is 'best effort' code. With window managers which
    423390         * support the _NET_WM_FULLSCREEN_MONITORS protocol this would interfere unreliable. */
     391        const bool fSupportsNativeFullScreen = VBoxGlobal::supportsFullScreenMonitorsProtocolX11() &&
     392                                               !gEDataManager->legacyFullscreenModeRequested();
     393        if (!fSupportsNativeFullScreen)
     394            placeOnScreen();
     395#else /* !Q_WS_X11 */
     396        /* Make sure window is maximized and placed on valid screen: */
    424397        placeOnScreen();
    425     }
     398#endif /* !Q_WS_X11 */
     399
     400#ifdef Q_WS_MAC
     401        /* ML and next using native stuff, so we can call for simple show(),
     402         * Lion and previous using Qt stuff, so we should call for showFullScreen(): */
     403        if (fSupportsNativeFullScreen)
     404            show();
     405        else
     406            showFullScreen();
     407#else /* !Q_WS_MAC */
     408        /* Show in fullscreen mode: */
     409        showFullScreen();
     410#endif /* !Q_WS_MAC */
     411
     412#ifdef Q_WS_X11
     413        if (fSupportsNativeFullScreen)
     414        {
     415            /* Tell recent window managers which screen this window should be mapped to.
     416             * Apparently some window managers will not respond to requests for
     417             * unmapped windows, so do this *after* the call to showFullScreen(). */
     418            VBoxGlobal::setFullScreenMonitorX11(this, pFullscreenLogic->hostScreenForGuestScreen(m_uScreenId));
     419        }
     420        else
     421        {
     422            /* On X11 calling placeOnScreen() is only needed for legacy window managers
     423             * which we do not test, so this is 'best effort' code. With window managers which
     424             * support the _NET_WM_FULLSCREEN_MONITORS protocol this would interfere unreliable. */
     425            placeOnScreen();
     426        }
    426427#endif /* Q_WS_X11 */
    427428
     
    430431
    431432#if defined(Q_WS_WIN) || defined(Q_WS_X11)
    432     /* If there is a mini-toolbar: */
    433     if (m_pMiniToolBar)
    434     {
     433        /* If there is a mini-toolbar: */
     434        if (m_pMiniToolBar)
     435        {
    435436# if   defined(Q_WS_WIN)
    436         /* Show mini-toolbar: */
    437         m_pMiniToolBar->show();
     437            /* Show mini-toolbar: */
     438            m_pMiniToolBar->show();
    438439# elif defined(Q_WS_X11)
    439         /* Allow mini-toolbar to be located on full-screen area: */
    440         m_pMiniToolBar->showFullScreen();
    441         /* On modern window managers: */
    442         if (fSupportsNativeFullScreen)
    443         {
    444             /* We also can map mini-toolbar directly on corresponding machine-window: */
    445             VBoxGlobal::setFullScreenMonitorX11(m_pMiniToolBar, pFullscreenLogic->hostScreenForGuestScreen(m_uScreenId));
     440            /* Allow mini-toolbar to be located on full-screen area: */
     441            m_pMiniToolBar->showFullScreen();
     442            /* On modern window managers: */
     443            if (fSupportsNativeFullScreen)
     444            {
     445                /* We also can map mini-toolbar directly on corresponding machine-window: */
     446                VBoxGlobal::setFullScreenMonitorX11(m_pMiniToolBar, pFullscreenLogic->hostScreenForGuestScreen(m_uScreenId));
     447            }
     448# endif /* Q_WS_X11 */
    446449        }
    447 # endif /* Q_WS_X11 */
    448     }
    449 #endif /* Q_WS_WIN || Q_WS_X11 */
    450 
    451     /* Make sure machine-view have focus: */
    452     m_pMachineView->setFocus();
     450#endif /* Q_WS_WIN || Q_WS_X11 */
     451
     452        /* Make sure machine-view have focus: */
     453        m_pMachineView->setFocus();
     454    }
    453455}
    454456
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp

    r57042 r57043  
    205205        }
    206206#endif /* Q_WS_WIN || Q_WS_X11 */
     207
    207208        /* Hide window: */
    208209        hide();
    209         return;
    210     }
    211 
    212     /* Ignore if window minimized: */
    213     if (isMinimized())
    214         return;
    215 
    216     /* Make sure window have appropriate geometry: */
    217     placeOnScreen();
    218 
    219     /* Show in normal mode: */
    220     show();
    221 
    222     /* Adjust machine-view size if necessary: */
    223     adjustMachineViewSize();
    224 
    225 #if defined(Q_WS_WIN) || defined(Q_WS_X11)
    226     /* If there is a mini-toolbar: */
    227     if (m_pMiniToolBar)
    228     {
     210    }
     211    else
     212    {
     213        /* Ignore if window minimized: */
     214        if (isMinimized())
     215            return;
     216
     217        /* Make sure window have appropriate geometry: */
     218        placeOnScreen();
     219
     220        /* Show in normal mode: */
     221        show();
     222
     223        /* Adjust machine-view size if necessary: */
     224        adjustMachineViewSize();
     225
     226#if defined(Q_WS_WIN) || defined(Q_WS_X11)
     227        /* If there is a mini-toolbar: */
     228        if (m_pMiniToolBar)
     229        {
    229230# if   defined(Q_WS_WIN)
    230         /* Show mini-toolbar: */
    231         m_pMiniToolBar->show();
     231            /* Show mini-toolbar: */
     232            m_pMiniToolBar->show();
    232233# elif defined(Q_WS_X11)
    233         /* Allow mini-toolbar to be located on available area: */
    234         m_pMiniToolBar->showMaximized();
     234            /* Allow mini-toolbar to be located on available area: */
     235            m_pMiniToolBar->showMaximized();
    235236# endif /* Q_WS_X11 */
    236     }
    237 #endif /* Q_WS_WIN || Q_WS_X11 */
    238 
    239     /* Make sure machine-view have focus: */
    240     m_pMachineView->setFocus();
     237        }
     238#endif /* Q_WS_WIN || Q_WS_X11 */
     239
     240        /* Make sure machine-view have focus: */
     241        m_pMachineView->setFocus();
     242    }
    241243}
    242244
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