VirtualBox

Changeset 65419 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 24, 2017 10:58:56 AM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8636: X11: Runtime UI: After r113027 we need a mechanism for restoring from minimized state similar to that full-screen mode has (s.a. r108421).

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

Legend:

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

    r65417 r65419  
    5252#endif /* VBOX_WS_WIN || VBOX_WS_X11 */
    5353    , m_fWasMinimized(false)
     54#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
     55    , m_fIsMinimized(false)
     56#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
    5457{
    5558}
     
    298301#endif /* VBOX_WS_WIN || VBOX_WS_X11 */
    299302
     303#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
     304void UIMachineWindowSeamless::changeEvent(QEvent *pEvent)
     305{
     306    switch (pEvent->type())
     307    {
     308        case QEvent::WindowStateChange:
     309        {
     310            /* Watch for window state changes: */
     311            QWindowStateChangeEvent *pChangeEvent = static_cast<QWindowStateChangeEvent*>(pEvent);
     312            LogRel2(("GUI: UIMachineWindowSeamless::changeEvent: Window state changed from %d to %d\n",
     313                     (int)pChangeEvent->oldState(), (int)windowState()));
     314            if (   windowState() == Qt::WindowMinimized
     315                && pChangeEvent->oldState() == Qt::WindowNoState
     316                && !m_fIsMinimized)
     317            {
     318                /* Mark window minimized, isMinimized() is not enough due to Qt5vsX11 fight: */
     319                LogRel2(("GUI: UIMachineWindowSeamless::changeEvent: Window minimized\n"));
     320                m_fIsMinimized = true;
     321            }
     322            else
     323            if (   windowState() == Qt::WindowNoState
     324                && pChangeEvent->oldState() == Qt::WindowMinimized
     325                && m_fIsMinimized)
     326            {
     327                /* Mark window restored, and do manual restoring with showInNecessaryMode(): */
     328                LogRel2(("GUI: UIMachineWindowSeamless::changeEvent: Window restored\n"));
     329                m_fIsMinimized = false;
     330                showInNecessaryMode();
     331            }
     332            break;
     333        }
     334        default:
     335            break;
     336    }
     337
     338    /* Call to base-class: */
     339    UIMachineWindow::changeEvent(pEvent);
     340}
     341#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
     342
    300343#ifdef VBOX_WS_WIN
    301344# if QT_VERSION >= 0x050000
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h

    r62493 r65419  
    7474#endif /* VBOX_WS_WIN || VBOX_WS_X11 */
    7575
     76#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
     77    /** Handles @a pEvent about state change. */
     78    void changeEvent(QEvent *pEvent);
     79#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
     80
    7681#ifdef VBOX_WS_WIN
    7782# if QT_VERSION >= 0x050000
     
    101106      * Used to restore minimized state when the window shown again. */
    102107    bool m_fWasMinimized;
     108#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
     109    /** Holds whether the window is currently minimized.
     110      * Used to restore maximized state when the window restored again. */
     111    bool m_fIsMinimized;
     112#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
    103113
    104114    /** 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