VirtualBox

Changeset 98674 in vbox


Ignore:
Timestamp:
Feb 21, 2023 2:18:51 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
155974
Message:

FE/Qt: bugref:10322: Runtime UI: Reworking CMachine wrapper usage step-by-step; Stuff related to actual machine state (opposing to cached one).

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

Legend:

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

    r98670 r98674  
    294294{
    295295    uisession()->forgetPreviousMachineState();
     296}
     297
     298bool UIMachine::acquireLiveMachineState(KMachineState &enmState)
     299{
     300    return uisession()->acquireLiveMachineState(enmState);
    296301}
    297302
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r98670 r98674  
    214214    /** @name Machine-state stuff.
    215215     ** @{ */
    216         /** Returns machine state. */
     216        /** Returns cached machine state. */
    217217        KMachineState machineState() const;
    218218
    219219        /** Resets previous state to be the same as current one. */
    220220        void forgetPreviousMachineState();
     221
     222        /** Acquire live machine state. */
     223        bool acquireLiveMachineState(KMachineState &enmState);
    221224
    222225        /** Returns whether VM is in one of turned off states. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r98670 r98674  
    10561056                // We can't take pause pixmap if actual state is Saving, this produces
    10571057                // a lock and GUI will be frozen until SaveState call is complete...
    1058                 const KMachineState enmActualState = machine().GetState();
     1058                KMachineState enmActualState = KMachineState_Null;
     1059                uimachine()->acquireLiveMachineState(enmActualState);
    10591060                if (enmActualState != KMachineState_Saving)
    10601061                {
     
    12661267    {
    12671268#ifdef VBOX_WS_X11
    1268         /* Processing pseudo resize-event to synchronize frame-buffer with stored framebuffer size.
    1269          * On X11 this will be additional done when the machine state was 'saved'. */
    1270         if (machine().GetState() == KMachineState_Saved || machine().GetState() == KMachineState_AbortedSaved)
     1269        // WORKAROUND:
     1270        // Processing pseudo resize-event to synchronize frame-buffer with stored framebuffer size.
     1271        // On X11 this have to be additionally done when the machine state was 'saved'.
     1272        KMachineState enmActualState = KMachineState_Null;
     1273        uimachine()->acquireLiveMachineState(enmActualState);
     1274        if (enmActualState == KMachineState_Saved || enmActualState == KMachineState_AbortedSaved)
    12711275            size = storedGuestScreenSizeHint();
    12721276#endif /* VBOX_WS_X11 */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r98670 r98674  
    257257{
    258258    return mainMachineWindow() ? mainMachineWindow()->winId() : 0;
     259}
     260
     261bool UISession::acquireLiveMachineState(KMachineState &enmState)
     262{
     263    CMachine comMachine = machine();
     264    KMachineState enmMachineState = comMachine.GetState();
     265    const bool fSuccess = comMachine.isOk();
     266    if (!fSuccess)
     267        UINotificationMessage::cannotAcquireMachineParameter(comMachine);
     268    else
     269        enmState = enmMachineState;
     270    return fSuccess;
    259271}
    260272
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r98670 r98674  
    199199        /** Returns previous machine state. */
    200200        KMachineState machineStatePrevious() const { return m_enmMachineStatePrevious; }
    201         /** Returns machine state. */
     201        /** Returns cached machine state. */
    202202        KMachineState machineState() const { return m_enmMachineState; }
    203203
    204204        /** Resets previous state to be the same as current one. */
    205205        void forgetPreviousMachineState() { m_enmMachineStatePrevious = m_enmMachineState; }
     206
     207        /** Acquire live machine state. */
     208        bool acquireLiveMachineState(KMachineState &enmState);
    206209
    207210        /** Returns whether VM is in one of saved states. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp

    r98491 r98674  
    408408            UIDesktopWidgetWatchdog::setTopLevelGeometry(this, m_geometry);
    409409
    410             /* If previous machine-state was NOT SAVED => normalize window to the optimal-size: */
    411             if (machine().GetState() != KMachineState_Saved && machine().GetState() != KMachineState_AbortedSaved)
     410            /* If actual machine-state is NOT saved => normalize window to the optimal-size: */
     411            KMachineState enmActualState = KMachineState_Null;
     412            uimachine()->acquireLiveMachineState(enmActualState);
     413            if (enmActualState != KMachineState_Saved && enmActualState != KMachineState_AbortedSaved)
    412414                normalizeGeometry(false /* adjust position */, shouldResizeToGuestDisplay());
    413415
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette