VirtualBox

Changeset 98547 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Feb 13, 2023 1:46:34 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
155826
Message:

FE/Qt: bugref:10322: Runtime UI: Reworking CDisplay wrapper usage step-by-step; This one is about CDisplay::SetVideoModeHint/GetVideoModeHint stuff.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r98520 r98547  
    925925        QApplication::translate("UIMessageCenter", "Failed to change NAT network parameter.") +
    926926        UIErrorString::formatErrorInfo(comNetwork));
     927}
     928
     929/* static */
     930void UINotificationMessage::cannotChangeDisplayParameter(const CDisplay &comDisplay)
     931{
     932    createMessage(
     933        QApplication::translate("UIMessageCenter", "Display failure ..."),
     934        QApplication::translate("UIMessageCenter", "Failed to change display parameter.") +
     935        UIErrorString::formatErrorInfo(comDisplay));
    927936}
    928937
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r98520 r98547  
    320320          * @param  comNetwork  Brings the object parameter get acquired from. */
    321321        static void cannotAcquireNATNetworkParameter(const CNATNetwork &comNetwork);
    322         /** Notifies about inability to acquire INATNetwork parameter.
    323           * @param  comNetwork  Brings the object parameter get acquired from. */
     322        /** Notifies about inability to acquire IDisplay parameter.
     323          * @param  comDisplay  Brings the object parameter get acquired from. */
    324324        static void cannotAcquireDisplayParameter(const CDisplay &comDisplay);
    325325        /** Notifies about inability to acquire IUpdateAgent parameter.
     
    384384          * @param  comNetwork  Brings the object parameter being changed for. */
    385385        static void cannotChangeNATNetworkParameter(const CNATNetwork &comNetwork);
     386        /** Notifies about inability to change IDisplay parameter.
     387          * @param  comDisplay  Brings the object parameter being changed for. */
     388        static void cannotChangeDisplayParameter(const CDisplay &comDisplay);
    386389        /** Notifies about inability to change ICloudProfile parameter.
    387390          * @param  comProfile  Brings the object parameter being changed for. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r98520 r98547  
    436436                                                     uWidth, uHeight, uBitsPerPixel,
    437437                                                     xOrigin, yOrigin, enmMonitorStatus);
     438}
     439
     440bool UIMachine::setVideoModeHint(ulong uScreenId, bool fEnabled, bool fChangeOrigin,
     441                                 long xOrigin, long yOrigin, ulong uWidth, ulong uHeight,
     442                                 ulong uBitsPerPixel, bool fNotify)
     443{
     444    return uisession()->setVideoModeHint(uScreenId, fEnabled, fChangeOrigin,
     445                                         xOrigin, yOrigin, uWidth, uHeight,
     446                                         uBitsPerPixel, fNotify);
     447}
     448
     449bool UIMachine::acquireVideoModeHint(ulong uScreenId, bool &fEnabled, bool &fChangeOrigin,
     450                                     long &xOrigin, long &yOrigin, ulong &uWidth, ulong &uHeight,
     451                                     ulong &uBitsPerPixel)
     452{
     453    return uisession()->acquireVideoModeHint(uScreenId, fEnabled, fChangeOrigin,
     454                                             xOrigin, yOrigin, uWidth, uHeight,
     455                                             uBitsPerPixel);
    438456}
    439457
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r98520 r98547  
    281281                                          ulong &uWidth, ulong &uHeight, ulong &uBitsPerPixel,
    282282                                          long &xOrigin, long &yOrigin, KGuestMonitorStatus &enmMonitorStatus);
     283        /** Defines video mode hint for guest-screen with passed uScreenId. */
     284        bool setVideoModeHint(ulong uScreenId, bool fEnabled, bool fChangeOrigin,
     285                              long xOrigin, long yOrigin, ulong uWidth, ulong uHeight,
     286                              ulong uBitsPerPixel, bool fNotify);
     287        /** Acquires video mode hint for guest-screen with passed uScreenId. */
     288        bool acquireVideoModeHint(ulong uScreenId, bool &fEnabled, bool &fChangeOrigin,
     289                                  long &xOrigin, long &yOrigin, ulong &uWidth, ulong &uHeight,
     290                                  ulong &uBitsPerPixel);
    283291    /** @} */
    284292
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r98520 r98547  
    796796                LogRel(("GUI: UIMachineView::sltPerformGuestResize: Auto-pilot resizing screen %d as %dx%d\n",
    797797                        (int)screenId(), size.width(), size.height()));
    798                 display().SetVideoModeHint(screenId(),
    799                                            uimachine()->isScreenVisible(screenId()),
    800                                            false /* change origin? */,
    801                                            0 /* origin x */,
    802                                            0 /* origin y */,
    803                                            size.width(),
    804                                            size.height(),
    805                                            0 /* bits per pixel */,
    806                                            true /* notify? */);
     798                uimachine()->setVideoModeHint(screenId(),
     799                                              uimachine()->isScreenVisible(screenId()),
     800                                              false /* change origin? */,
     801                                              0 /* origin x */, 0 /* origin y */,
     802                                              size.width(), size.height(),
     803                                              0 /* bits per pixel */,
     804                                              true /* notify? */);
    807805            }
    808806        }
     
    814812                /* Send enabling size-hint to the guest: */
    815813                LogRel(("GUI: UIMachineView::sltPerformGuestResize: Auto-pilot enabling guest-screen %d\n", (int)screenId()));
    816                 display().SetVideoModeHint(screenId(),
    817                                            true /* enabled? */,
    818                                            false /* change origin? */,
    819                                            0 /* origin x */,
    820                                            0 /* origin y */,
    821                                            size.width(),
    822                                            size.height(),
    823                                            0 /* bits per pixel */,
    824                                            true /* notify? */);
     814                uimachine()->setVideoModeHint(screenId(),
     815                                              true /* enabled? */,
     816                                              false /* change origin? */,
     817                                              0 /* origin x */, 0 /* origin y */,
     818                                              size.width(), size.height(),
     819                                              0 /* bits per pixel */,
     820                                              true /* notify? */);
    825821            }
    826822            /* If host desires to have guest-screen disabled and guest-screen is enabled, retrying: */
     
    829825                /* Send disabling size-hint to the guest: */
    830826                LogRel(("GUI: UIMachineView::sltPerformGuestResize: Auto-pilot disabling guest-screen %d\n", (int)screenId()));
    831                 display().SetVideoModeHint(screenId(),
    832                                            false /* enabled? */,
    833                                            false /* change origin? */,
    834                                            0 /* origin x */,
    835                                            0 /* origin y */,
    836                                            0 /* width */,
    837                                            0 /* height */,
    838                                            0 /* bits per pixel */,
    839                                            true /* notify? */);
     827                uimachine()->setVideoModeHint(screenId(),
     828                                              false /* enabled? */,
     829                                              false /* change origin? */,
     830                                              0 /* origin x */, 0 /* origin y */,
     831                                              0 /* width */, 0 /* height */,
     832                                              0 /* bits per pixel */,
     833                                              true /* notify? */);
    840834            }
    841835        }
     
    864858            LogRel(("GUI: UIMachineView::sltPerformGuestResize: Sending guest size-hint to screen %d as %dx%d\n",
    865859                    (int)screenId(), size.width(), size.height()));
    866             display().SetVideoModeHint(screenId(),
    867                                        uimachine()->isScreenVisible(screenId()),
    868                                        false /* change origin? */,
    869                                        0 /* origin x */,
    870                                        0 /* origin y */,
    871                                        size.width(),
    872                                        size.height(),
    873                                        0 /* bits per pixel */,
    874                                        true /* notify? */);
     860            uimachine()->setVideoModeHint(screenId(),
     861                                          uimachine()->isScreenVisible(screenId()),
     862                                          false /* change origin? */,
     863                                          0 /* origin x */, 0 /* origin y */,
     864                                          size.width(), size.height(),
     865                                          0 /* bits per pixel */,
     866                                          true /* notify? */);
    875867            m_lastSizeHint = size;
    876868        }
     
    920912        /* Send enabling size-hint to the guest: */
    921913        LogRel(("GUI: UIMachineView::sltHandleActionTriggerViewScreenToggle: Enabling guest-screen %d\n", (int)screenId()));
    922         display().SetVideoModeHint(screenId(),
    923                                    true /* enabled? */,
    924                                    false /* change origin? */,
    925                                    0 /* origin x */,
    926                                    0 /* origin y */,
    927                                    uWidth,
    928                                    uHeight,
    929                                    0 /* bits per pixel */,
    930                                    true /* notify? */);
     914        uimachine()->setVideoModeHint(screenId(),
     915                                      true /* enabled? */,
     916                                      false /* change origin? */,
     917                                      0 /* origin x */, 0 /* origin y */,
     918                                      uWidth, uHeight,
     919                                      0 /* bits per pixel */,
     920                                      true /* notify? */);
    931921    }
    932922    else
     
    934924        /* Send disabling size-hint to the guest: */
    935925        LogRel(("GUI: UIMachineView::sltHandleActionTriggerViewScreenToggle: Disabling guest-screen %d\n", (int)screenId()));
    936         display().SetVideoModeHint(screenId(),
    937                                    false /* enabled? */,
    938                                    false /* change origin? */,
    939                                    0 /* origin x */,
    940                                    0 /* origin y */,
    941                                    0 /* width */,
    942                                    0 /* height */,
    943                                    0 /* bits per pixel */,
    944                                    true /* notify? */);
     926        uimachine()->setVideoModeHint(screenId(),
     927                                      false /* enabled? */,
     928                                      false /* change origin? */,
     929                                      0 /* origin x */, 0 /* origin y */,
     930                                      0 /* width */, 0 /* height */,
     931                                      0 /* bits per pixel */,
     932                                      true /* notify? */);
    945933    }
    946934}
     
    971959    /* Send enabling size-hint to the guest: */
    972960    LogRel(("GUI: UIMachineView::sltHandleActionTriggerViewScreenResize: Resizing guest-screen %d\n", (int)screenId()));
    973     display().SetVideoModeHint(screenId(),
    974                                true /* enabled? */,
    975                                false /* change origin? */,
    976                                0 /* origin x */,
    977                                0 /* origin y */,
    978                                size.width(),
    979                                size.height(),
    980                                0 /* bits per pixel */,
    981                                true /* notify? */);
     961    uimachine()->setVideoModeHint(screenId(),
     962                                  true /* enabled? */,
     963                                  false /* change origin? */,
     964                                  0 /* origin x */, 0 /* origin y */,
     965                                  size.width(), size.height(),
     966                                  0 /* bits per pixel */,
     967                                  true /* notify? */);
    982968}
    983969
     
    15171503{
    15181504    /* Acquire last guest-screen size-hint set, if any: */
    1519     BOOL fEnabled, fChangeOrigin;
    1520     LONG iOriginX, iOriginY;
    1521     ULONG uWidth, uHeight, uBitsPerPixel;
    1522     display().GetVideoModeHint(screenId(), fEnabled, fChangeOrigin,
    1523                                iOriginX, iOriginY, uWidth, uHeight, uBitsPerPixel);
     1505    bool fDummy = false;
     1506    long iDummy = 0;
     1507    ulong uWidth = 0, uHeight = 0, uDummy = 0;
     1508    uimachine()->acquireVideoModeHint(screenId(), fDummy, fDummy,
     1509                                      iDummy, iDummy, uWidth, uHeight,
     1510                                      uDummy);
    15241511
    15251512    /* Acquire effective frame-buffer size otherwise: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp

    r98520 r98547  
    3838/* COM includes: */
    3939#include "COMEnums.h"
    40 #include "CDisplay.h"
    4140#include "CMachine.h"
    4241#include "CGraphicsAdapter.h"
     
    142141            LogRel(("GUI: UIMultiScreenLayout::update: Disabling excessive guest-screen %d\n", iGuestScreen));
    143142            uimachine()->setScreenVisibleHostDesires(iGuestScreen, false);
    144             machineLogic()->display().SetVideoModeHint(iGuestScreen, false, false, 0, 0, 0, 0, 0, true);
     143            uimachine()->setVideoModeHint(iGuestScreen,
     144                                          false /* enabled? */,
     145                                          false /* change origin? */,
     146                                          0 /* origin x */, 0 /* origin y */,
     147                                          0 /* width */, 0 /* height*/,
     148                                          0 /* bits per pixel */,
     149                                          true /* notify? */);
    145150        }
    146151    }
     
    174179                    iGuestScreen, uWidth, uHeight));
    175180            uimachine()->setScreenVisibleHostDesires(iGuestScreen, true);
    176             machineLogic()->display().SetVideoModeHint(iGuestScreen, true, false, 0, 0, uWidth, uHeight, 32, true);
     181            uimachine()->setVideoModeHint(iGuestScreen,
     182                                          true/* enabled? */,
     183                                          false /* change origin? */,
     184                                          0 /* origin x */, 0 /* origin y */,
     185                                          uWidth, uHeight,
     186                                          32/* bits per pixel */,
     187                                          true /* notify? */);
    177188        }
    178189    }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r98520 r98547  
    416416    yOrigin = iGuestYOrigin;
    417417    enmMonitorStatus = enmGuestMonitorStatus;
     418    return fSuccess;
     419}
     420
     421bool UISession::setVideoModeHint(ulong uScreenId, bool fEnabled, bool fChangeOrigin, long xOrigin, long yOrigin,
     422                                 ulong uWidth, ulong uHeight, ulong uBitsPerPixel, bool fNotify)
     423{
     424    CDisplay comDisplay = display();
     425    comDisplay.SetVideoModeHint(uScreenId, fEnabled, fChangeOrigin, xOrigin, yOrigin,
     426                                uWidth, uHeight, uBitsPerPixel, fNotify);
     427    const bool fSuccess = comDisplay.isOk();
     428    if (!fSuccess)
     429        UINotificationMessage::cannotChangeDisplayParameter(comDisplay);
     430    return fSuccess;
     431}
     432
     433bool UISession::acquireVideoModeHint(ulong uScreenId, bool &fEnabled, bool &fChangeOrigin,
     434                                     long &xOrigin, long &yOrigin, ulong &uWidth, ulong &uHeight,
     435                                     ulong &uBitsPerPixel)
     436{
     437    CDisplay comDisplay = display();
     438    BOOL fGuestEnabled = false, fGuestChangeOrigin = false;
     439    LONG iGuestXOrigin = 0, iGuestYOrigin = 0;
     440    ULONG uGuestWidth = 0, uGuestHeight = 0, uGuestBitsPerPixel = 0;
     441    comDisplay.GetVideoModeHint(uScreenId, fGuestEnabled, fGuestChangeOrigin,
     442                                iGuestXOrigin, iGuestYOrigin, uGuestWidth, uGuestHeight,
     443                                uGuestBitsPerPixel);
     444    const bool fSuccess = comDisplay.isOk();
     445    if (!fSuccess)
     446        UINotificationMessage::cannotAcquireDisplayParameter(comDisplay);
     447    fEnabled = fGuestEnabled;
     448    fChangeOrigin = fGuestChangeOrigin;
     449    xOrigin = iGuestXOrigin;
     450    yOrigin = iGuestYOrigin;
     451    uWidth = uGuestWidth;
     452    uHeight = uGuestHeight;
     453    uBitsPerPixel = uGuestBitsPerPixel;
    418454    return fSuccess;
    419455}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r98520 r98547  
    299299                                          ulong &uWidth, ulong &uHeight, ulong &uBitsPerPixel,
    300300                                          long &xOrigin, long &yOrigin, KGuestMonitorStatus &enmMonitorStatus);
     301        /** Defines video mode hint for guest-screen with passed uScreenId. */
     302        bool setVideoModeHint(ulong uScreenId, bool fEnabled, bool fChangeOrigin,
     303                              long xOrigin, long yOrigin, ulong uWidth, ulong uHeight,
     304                              ulong uBitsPerPixel, bool fNotify);
     305        /** Acquires video mode hint for guest-screen with passed uScreenId. */
     306        bool acquireVideoModeHint(ulong uScreenId, bool &fEnabled, bool &fChangeOrigin,
     307                                  long &xOrigin, long &yOrigin, ulong &uWidth, ulong &uHeight,
     308                                  ulong &uBitsPerPixel);
    301309    /** @} */
    302310
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp

    r98450 r98547  
    149149void UIMachineViewNormal::resendSizeHint()
    150150{
     151    /* Skip if VM isn't running/paused yet: */
     152    if (   !uimachine()->isRunning()
     153        && !uimachine()->isPaused())
     154        return;
     155
    151156    /* Skip if another visual representation mode requested: */
    152157    if (uimachine()->requestedVisualState() == UIVisualStateType_Seamless) // Seamless only for now.
     
    174179     * guest driver which saves the video mode to the registry on shutdown. */
    175180    uimachine()->setScreenVisibleHostDesires(screenId(), guestScreenVisibilityStatus());
    176     display().SetVideoModeHint(screenId(),
    177                                guestScreenVisibilityStatus(),
    178                                false, 0, 0, effectiveSizeHint.width(), effectiveSizeHint.height(), 0, false);
     181    uimachine()->setVideoModeHint(screenId(),
     182                                  guestScreenVisibilityStatus(),
     183                                  false /* change origin? */,
     184                                  0 /* origin x */, 0 /* origin y */,
     185                                  effectiveSizeHint.width(), effectiveSizeHint.height(),
     186                                  0 /* bits per pixel */,
     187                                  false /* notify? */);
    179188}
    180189
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp

    r98419 r98547  
    4141
    4242/* COM includes: */
    43 #include "CConsole.h"
    4443#include "CDisplay.h"
    4544#include "CGraphicsAdapter.h"
     
    166165void UIMachineViewScale::resendSizeHint()
    167166{
     167    /* Skip if VM isn't running/paused yet: */
     168    if (   !uimachine()->isRunning()
     169        && !uimachine()->isPaused())
     170        return;
     171
    168172    /* Get the last guest-screen size-hint, taking the scale factor into account. */
    169173    const QSize sizeHint = scaledBackward(storedGuestScreenSizeHint());
     
    176180    /* Send saved size-hint to the guest: */
    177181    uimachine()->setScreenVisibleHostDesires(screenId(), guestScreenVisibilityStatus());
    178     display().SetVideoModeHint(screenId(),
    179                                guestScreenVisibilityStatus(),
    180                                false, 0, 0, sizeHint.width(), sizeHint.height(), 0, true);
     182    uimachine()->setVideoModeHint(screenId(),
     183                                  guestScreenVisibilityStatus(),
     184                                  false /* change origin? */,
     185                                  0 /* origin x */, 0 /* origin y */,
     186                                  sizeHint.width(), sizeHint.height(),
     187                                  0 /* bits per pixel */,
     188                                  true /* notify? */);
    181189}
    182190
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