VirtualBox

Ignore:
Timestamp:
Feb 27, 2014 2:46:41 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI: Mode-switching and auto-pilot logic cleanup.

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

Legend:

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

    r50514 r50631  
    597597void UIMachineLogic::sltGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)
    598598{
    599     /* Deliver event to all machine-windows: */
     599    LogRel(("UIMachineLogic: Guest-screen count changed.\n"));
     600
     601    /* Make sure all machine-window(s) have proper geometry: */
    600602    foreach (UIMachineWindow *pMachineWindow, machineWindows())
    601         pMachineWindow->handleScreenCountChange();
     603        pMachineWindow->showInNecessaryMode();
    602604}
    603605
    604606void UIMachineLogic::sltHostScreenCountChanged()
    605607{
    606     /* Deliver event to all machine-windows: */
     608    LogRel(("UIMachineLogic: Host-screen count changed.\n"));
     609
     610    /* Make sure all machine-window(s) have proper geometry: */
    607611    foreach (UIMachineWindow *pMachineWindow, machineWindows())
    608         pMachineWindow->handleScreenCountChange();
     612        pMachineWindow->showInNecessaryMode();
    609613}
    610614
    611615void UIMachineLogic::sltHostScreenGeometryChanged()
    612616{
    613     LogRelFlow(("UIMachineLogic: Host-screen geometry changed.\n"));
    614 
    615     /* Deliver event to all machine-windows: */
     617    LogRel(("UIMachineLogic: Host-screen geometry changed.\n"));
     618
     619    /* Make sure all machine-window(s) have proper geometry: */
    616620    foreach (UIMachineWindow *pMachineWindow, machineWindows())
    617         pMachineWindow->handleScreenGeometryChange();
     621        pMachineWindow->showInNecessaryMode();
    618622}
    619623
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp

    r50505 r50631  
    442442}
    443443
    444 void UIMachineWindow::handleScreenCountChange()
    445 {
    446     /* Ignore if window is minimized: */
    447     if (isMinimized())
    448         return;
    449 
    450     /* Make sure window is in necessary mode: */
    451     showInNecessaryMode();
    452 }
    453 
    454 void UIMachineWindow::handleScreenGeometryChange()
    455 {
    456     /* Ignore if window is minimized: */
    457     if (isMinimized())
    458         return;
    459 
    460     /* Make sure window is in necessary mode: */
    461     showInNecessaryMode();
    462 }
    463 
    464444void UIMachineWindow::updateAppearanceOf(int iElement)
    465445{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h

    r50522 r50631  
    121121    virtual void cleanupSessionConnections() {}
    122122
    123     /* Visibility stuff: */
    124     void handleScreenCountChange();
    125     void handleScreenGeometryChange();
    126 
    127123    /* Update stuff: */
    128124    virtual void updateAppearanceOf(int iElement);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp

    r50598 r50631  
    8585    /* We should rebuild screen-layout: */
    8686    m_pScreenLayout->rebuild();
    87     /* And update machine-windows sizes finally: */
     87    /* Make sure all machine-window(s) have proper geometry: */
    8888    foreach (UIMachineWindow *pMachineWindow, machineWindows())
    89         pMachineWindow->handleScreenGeometryChange();
     89        pMachineWindow->showInNecessaryMode();
    9090}
    9191
     
    150150            /* Reactivate 'presentation mode': */
    151151            setPresentationModeEnabled(true);
    152             /* Re-enter fullscreen mode: */
     152            /* Make sure all machine-window(s) have proper geometry: */
    153153            foreach (UIMachineWindow *pMachineWindow, machineWindows())
    154154                pMachineWindow->showInNecessaryMode();
     155            /* Re-enter fullscreen mode: */
    155156            foreach (UIMachineWindow *pMachineWindow, machineWindows())
    156157                if (   uisession()->isScreenVisible(pMachineWindow->screenId())
     
    243244        /* We should rebuild screen-layout: */
    244245        m_pScreenLayout->rebuild();
    245         /* We should update machine-windows sizes: */
    246         foreach (UIMachineWindow *pMachineWindow, machineWindows())
    247             pMachineWindow->handleScreenGeometryChange();
     246        /* Make sure all machine-window(s) have proper geometry: */
     247        foreach (UIMachineWindow *pMachineWindow, machineWindows())
     248            pMachineWindow->showInNecessaryMode();
    248249    }
    249250}
     
    262263    if (vboxGlobal().osRelease() <= MacOSXRelease_Lion)
    263264    {
    264         /* Update machine-window(s) location/size: */
     265        /* Make sure all machine-window(s) have proper geometry: */
    265266        foreach (UIMachineWindow *pMachineWindow, machineWindows())
    266267            pMachineWindow->showInNecessaryMode();
     
    271272    else invalidateFullscreenMode();
    272273#else /* !Q_WS_MAC */
    273     /* Update machine-window(s) location/size: */
     274    /* Make sure all machine-window(s) have proper geometry: */
    274275    foreach (UIMachineWindow *pMachineWindow, machineWindows())
    275276        pMachineWindow->showInNecessaryMode();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp

    r50597 r50631  
    246246void UIMachineWindowFullscreen::showInNecessaryMode()
    247247{
    248     /* Should we show window?: */
    249     if (uisession()->isScreenVisible(m_uScreenId))
    250     {
    251         /* Do we have the seamless logic? */
    252         if (UIMachineLogicFullscreen *pFullscreenLogic = qobject_cast<UIMachineLogicFullscreen*>(machineLogic()))
    253         {
    254             /* Is this guest screen has own host screen? */
    255             if (pFullscreenLogic->hasHostScreenForGuestScreen(m_uScreenId))
    256             {
    257                 /* Make sure the window is maximized and placed on valid screen: */
    258                 placeOnScreen();
     248    /* Make sure this window should be shown at all: */
     249    if (!uisession()->isScreenVisible(m_uScreenId))
     250        return hide();
     251
     252    /* Make sure this window has fullscreen logic: */
     253    UIMachineLogicFullscreen *pFullscreenLogic = qobject_cast<UIMachineLogicFullscreen*>(machineLogic());
     254    if (!pFullscreenLogic)
     255        return hide();
     256
     257    /* Make sure this window mapped to some host-screen: */
     258    if (!pFullscreenLogic->hasHostScreenForGuestScreen(m_uScreenId))
     259        return hide();
     260
     261    /* Make sure this window is not minimized: */
     262    if (isMinimized())
     263        return;
     264
     265    /* Make sure this window is maximized and placed on valid screen: */
     266    placeOnScreen();
    259267
    260268#ifdef Q_WS_WIN
    261                 /* On Windows we should activate main window first,
    262                  * because entering fullscreen there doesn't means window will be auto-activated,
    263                  * so no window-activation event will be received
    264                  * and no keyboard-hook created otherwise... */
    265                 if (m_uScreenId == 0)
    266                     setWindowState(windowState() | Qt::WindowActive);
     269    /* On Windows we should activate main window first,
     270     * because entering fullscreen there doesn't means window will be auto-activated,
     271     * so no window-activation event will be received and no keyboard-hook created otherwise... */
     272    if (m_uScreenId == 0)
     273        setWindowState(windowState() | Qt::WindowActive);
    267274#endif /* Q_WS_WIN */
    268275
    269276#ifdef Q_WS_MAC
    270                 /* ML and next using native stuff, so we can call for simple show(): */
    271                 if (vboxGlobal().osRelease() > MacOSXRelease_Lion) show();
    272                 /* Lion and previous still using Qt one, call for showFullScreen(): */
    273                 else showFullScreen();
     277    /* ML and next using native stuff, so we can call for simple show(): */
     278    if (vboxGlobal().osRelease() > MacOSXRelease_Lion) show();
     279    /* Lion and previous using Qt stuff, so we should call for showFullScreen(): */
     280    else showFullScreen();
    274281#else /* !Q_WS_MAC */
    275                 /* Show in fullscreen mode: */
    276                 showFullScreen();
     282    /* Show in fullscreen mode: */
     283    showFullScreen();
    277284#endif /* !Q_WS_MAC */
    278285
    279                 /* Make sure the window is placed on valid screen again
    280                  * after window is shown & window's decorations applied.
    281                  * That is required (still?) due to X11 Window Geometry Rules. */
    282                 placeOnScreen();
    283 
    284                 /* Return early: */
    285                 return;
    286             }
    287         }
    288     }
    289     /* Hide in other cases: */
    290     hide();
     286#ifdef Q_WS_X11
     287    /* Make sure the window is placed on valid screen again
     288     * after window is shown & window's decorations applied.
     289     * That is required (still?) due to X11 Window Geometry Rules. */
     290    placeOnScreen();
     291#endif /* Q_WS_X11 */
    291292}
    292293
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp

    r50309 r50631  
    609609void UIMachineWindowNormal::showInNecessaryMode()
    610610{
    611     /* Show window if we have to: */
    612     if (uisession()->isScreenVisible(m_uScreenId))
    613         show();
    614     /* Else hide window: */
    615     else
    616         hide();
     611    /* Make sure this window should be shown at all: */
     612    if (!uisession()->isScreenVisible(m_uScreenId))
     613        return hide();
     614
     615    /* Make sure this window is not minimized: */
     616    if (isMinimized())
     617        return;
     618
     619    /* Show in normal mode: */
     620    show();
    617621}
    618622
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.cpp

    r49462 r50631  
    197197void UIMachineWindowScale::showInNecessaryMode()
    198198{
    199     /* Show window if we have to: */
    200     if (uisession()->isScreenVisible(m_uScreenId))
    201         show();
    202     /* Else hide window: */
    203     else
    204         hide();
     199    /* Make sure this window should be shown at all: */
     200    if (!uisession()->isScreenVisible(m_uScreenId))
     201        return hide();
     202
     203    /* Make sure this window is not minimized: */
     204    if (isMinimized())
     205        return;
     206
     207    /* Show in normal mode: */
     208    show();
    205209}
    206210
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp

    r50535 r50631  
    8282    /* We should rebuild screen-layout: */
    8383    m_pScreenLayout->rebuild();
    84     /* We should update machine-windows sizes: */
     84    /* Make sure all machine-window(s) have proper geometry: */
    8585    foreach (UIMachineWindow *pMachineWindow, machineWindows())
    86         pMachineWindow->handleScreenGeometryChange();
     86        pMachineWindow->showInNecessaryMode();
    8787}
    8888
     
    140140        /* We should rebuild screen-layout: */
    141141        m_pScreenLayout->rebuild();
    142         /* We should update machine-windows sizes: */
     142        /* Make sure all machine-window(s) have proper geometry: */
    143143        foreach (UIMachineWindow *pMachineWindow, machineWindows())
    144             pMachineWindow->handleScreenGeometryChange();
     144            pMachineWindow->showInNecessaryMode();
    145145    }
    146146}
     
    148148void UIMachineLogicSeamless::sltScreenLayoutChanged()
    149149{
    150     /* Update machine-window(s) location/size: */
     150    /* Make sure all machine-window(s) have proper geometry: */
    151151    foreach (UIMachineWindow *pMachineWindow, machineWindows())
    152152        pMachineWindow->showInNecessaryMode();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp

    r49462 r50631  
    214214void UIMachineWindowSeamless::showInNecessaryMode()
    215215{
    216     /* Should we show window?: */
    217     if (uisession()->isScreenVisible(m_uScreenId))
    218     {
    219         /* Do we have the seamless logic? */
    220         if (UIMachineLogicSeamless *pSeamlessLogic = qobject_cast<UIMachineLogicSeamless*>(machineLogic()))
    221         {
    222             /* Is this guest screen has own host screen? */
    223             if (pSeamlessLogic->hasHostScreenForGuestScreen(m_uScreenId))
    224             {
    225                 /* Make sure the window is maximized and placed on valid screen: */
    226                 placeOnScreen();
    227 
    228                 /* Show in normal mode: */
    229                 show();
    230 
    231                 /* Return early: */
    232                 return;
    233             }
    234         }
    235     }
    236     /* Hide in other cases: */
    237     hide();
     216    /* Make sure this window should be shown at all: */
     217    if (!uisession()->isScreenVisible(m_uScreenId))
     218        return hide();
     219
     220    /* Make sure this window has seamless logic: */
     221    UIMachineLogicSeamless *pSeamlessLogic = qobject_cast<UIMachineLogicSeamless*>(machineLogic());
     222    if (!pSeamlessLogic)
     223        return hide();
     224
     225    /* Make sure this window mapped to some host-screen: */
     226    if (!pSeamlessLogic->hasHostScreenForGuestScreen(m_uScreenId))
     227        return hide();
     228
     229    /* Make sure this window is not minimized: */
     230    if (isMinimized())
     231        return;
     232
     233    /* Make sure this window is maximized and placed on valid screen: */
     234    placeOnScreen();
     235
     236    /* Show in normal mode: */
     237    show();
    238238}
    239239
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