VirtualBox

Changeset 61974 in vbox


Ignore:
Timestamp:
Jul 1, 2016 11:49:43 AM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8422: X11: Runtime UI: Full-screen window minimization support for Qt5.

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

Legend:

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

    r61969 r61974  
    6161#endif /* VBOX_WS_MAC */
    6262    , m_fWasMinimized(false)
     63#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
     64    , m_fIsMinimized(false)
     65#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
    6366{
    6467}
     
    537540#endif /* VBOX_WS_WIN || VBOX_WS_X11 */
    538541
     542#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
     543void UIMachineWindowFullscreen::changeEvent(QEvent *pEvent)
     544{
     545    switch (pEvent->type())
     546    {
     547        case QEvent::WindowStateChange:
     548        {
     549            /* Watch for window state changes: */
     550            QWindowStateChangeEvent *pChangeEvent = static_cast<QWindowStateChangeEvent*>(pEvent);
     551            LogRel2(("GUI: UIMachineWindowFullscreen::changeEvent: Window state changed from %d to %d\n",
     552                     (int)pChangeEvent->oldState(), (int)windowState()));
     553            if (   windowState() == Qt::WindowMinimized
     554                && pChangeEvent->oldState() == Qt::WindowNoState
     555                && !m_fIsMinimized)
     556            {
     557                /* Mark window minimized, isMinimized() is not enough due to Qt5vsX11 fight: */
     558                LogRel2(("GUI: UIMachineWindowFullscreen::changeEvent: Window minimized\n"));
     559                m_fIsMinimized = true;
     560            }
     561            else
     562            if (   windowState() == Qt::WindowNoState
     563                && pChangeEvent->oldState() == Qt::WindowMinimized
     564                && m_fIsMinimized)
     565            {
     566                /* Mark window restored, and do manual restoring with showInNecessaryMode(): */
     567                LogRel2(("GUI: UIMachineWindowFullscreen::changeEvent: Window restored\n"));
     568                m_fIsMinimized = false;
     569                showInNecessaryMode();
     570            }
     571            break;
     572        }
     573        default:
     574            break;
     575    }
     576
     577    /* Call to base-class: */
     578    UIMachineWindow::changeEvent(pEvent);
     579}
     580#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
     581
    539582#ifdef VBOX_WS_WIN
    540583# if QT_VERSION >= 0x050000
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h

    r61963 r61974  
    102102#endif /* VBOX_WS_WIN || VBOX_WS_X11 */
    103103
     104#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
     105    /** Handles @a pEvent about state change. */
     106    void changeEvent(QEvent *pEvent);
     107#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
     108
    104109#ifdef VBOX_WS_WIN
    105110# if QT_VERSION >= 0x050000
     
    124129      * Used to restore minimized state when the window shown again. */
    125130    bool m_fWasMinimized;
     131#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
     132    /** Holds whether the window is currently minimized.
     133      * Used to restore full-screen state when the window restored again. */
     134    bool m_fIsMinimized;
     135#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
    126136
    127137    /** Factory support. */
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