VirtualBox

Changeset 98938 in vbox


Ignore:
Timestamp:
Mar 13, 2023 3:47:28 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
156276
Message:

FE/Qt: bugref:10322: Runtime UI: Reworking some of old mouse related getters to have proper COM result checks.

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

Legend:

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

    r98811 r98938  
    841841        QApplication::translate("UIMessageCenter", "Failed to acquire update agent parameter.") +
    842842        UIErrorString::formatErrorInfo(comAgent));
     843}
     844
     845/* static */
     846void UINotificationMessage::cannotAcquireMouseParameter(const CMouse &comMouse)
     847{
     848    createMessage(
     849        QApplication::translate("UIMessageCenter", "Mouse failure ..."),
     850        QApplication::translate("UIMessageCenter", "Failed to acquire mouse parameter.") +
     851        UIErrorString::formatErrorInfo(comMouse));
    843852}
    844853
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r98811 r98938  
    358358          * @param  comAgent  Brings the object parameter get acquired from. */
    359359        static void cannotAcquireUpdateAgentParameter(const CUpdateAgent &comAgent);
     360        /** Notifies about inability to acquire IMouse parameter.
     361          * @param  comMouse  Brings the object parameter get acquired from. */
     362        static void cannotAcquireMouseParameter(const CMouse &comMouse);
    360363        /** Notifies about inability to acquire IEmulatedUSB parameter.
    361364          * @param  comDispatcher  Brings the object parameter get acquired from. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r98926 r98938  
    21802180void UIMachine::updateMouseState()
    21812181{
    2182     m_fIsMouseSupportsAbsolute = uisession()->getAbsoluteSupported();
    2183     m_fIsMouseSupportsRelative = uisession()->getRelativeSupported();
    2184     m_fIsMouseSupportsTouchScreen = uisession()->getTouchScreenSupported();
    2185     m_fIsMouseSupportsTouchPad = uisession()->getTouchPadSupported();
    2186     m_fIsMouseHostCursorNeeded = uisession()->getNeedsHostCursor();
     2182    uisession()->acquireWhetherAbsoluteSupported(m_fIsMouseSupportsAbsolute);
     2183    uisession()->acquireWhetherRelativeSupported(m_fIsMouseSupportsRelative);
     2184    uisession()->acquireWhetherTouchScreenSupported(m_fIsMouseSupportsTouchScreen);
     2185    uisession()->acquireWhetherTouchPadSupported(m_fIsMouseSupportsTouchPad);
     2186    uisession()->acquireWhetherNeedsHostCursor(m_fIsMouseHostCursorNeeded);
    21872187}
    21882188
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r98903 r98938  
    465465}
    466466
    467 bool UISession::getAbsoluteSupported()
    468 {
    469     return mouse().GetAbsoluteSupported();
    470 }
    471 
    472 bool UISession::getRelativeSupported()
    473 {
    474     return mouse().GetRelativeSupported();
    475 }
    476 
    477 bool UISession::getTouchScreenSupported()
    478 {
    479     return mouse().GetTouchScreenSupported();
    480 }
    481 
    482 bool UISession::getTouchPadSupported()
    483 {
    484     return mouse().GetTouchPadSupported();
    485 }
    486 
    487 bool UISession::getNeedsHostCursor()
    488 {
    489     return mouse().GetNeedsHostCursor();
     467bool UISession::acquireWhetherAbsoluteSupported(bool &fSupported)
     468{
     469    CMouse comMouse = mouse();
     470    const BOOL fAbsoluteSupported = comMouse.GetAbsoluteSupported();
     471    const bool fSuccess = comMouse.isOk();
     472    if (!fSuccess)
     473        UINotificationMessage::cannotAcquireMouseParameter(comMouse);
     474    else
     475        fSupported = fAbsoluteSupported == TRUE;
     476    return fSuccess;
     477}
     478
     479bool UISession::acquireWhetherRelativeSupported(bool &fSupported)
     480{
     481    CMouse comMouse = mouse();
     482    const BOOL fRelativeSupported = comMouse.GetRelativeSupported();
     483    const bool fSuccess = comMouse.isOk();
     484    if (!fSuccess)
     485        UINotificationMessage::cannotAcquireMouseParameter(comMouse);
     486    else
     487        fSupported = fRelativeSupported == TRUE;
     488    return fSuccess;
     489}
     490
     491bool UISession::acquireWhetherTouchScreenSupported(bool &fSupported)
     492{
     493    CMouse comMouse = mouse();
     494    const BOOL fTouchScreenSupported = comMouse.GetTouchScreenSupported();
     495    const bool fSuccess = comMouse.isOk();
     496    if (!fSuccess)
     497        UINotificationMessage::cannotAcquireMouseParameter(comMouse);
     498    else
     499        fSupported = fTouchScreenSupported == TRUE;
     500    return fSuccess;
     501}
     502
     503bool UISession::acquireWhetherTouchPadSupported(bool &fSupported)
     504{
     505    CMouse comMouse = mouse();
     506    const BOOL fTouchPadSupported = comMouse.GetTouchPadSupported();
     507    const bool fSuccess = comMouse.isOk();
     508    if (!fSuccess)
     509        UINotificationMessage::cannotAcquireMouseParameter(comMouse);
     510    else
     511        fSupported = fTouchPadSupported == TRUE;
     512    return fSuccess;
     513}
     514
     515bool UISession::acquireWhetherNeedsHostCursor(bool &fNeeds)
     516{
     517    CMouse comMouse = mouse();
     518    const BOOL fNeedsHostCursor = comMouse.GetNeedsHostCursor();
     519    const bool fSuccess = comMouse.isOk();
     520    if (!fSuccess)
     521        UINotificationMessage::cannotAcquireMouseParameter(comMouse);
     522    else
     523        fNeeds = fNeedsHostCursor == TRUE;
     524    return fSuccess;
    490525}
    491526
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r98903 r98938  
    288288     ** @{ */
    289289        /** Returns whether VM's mouse supports absolute coordinates. */
    290         bool getAbsoluteSupported();
     290        bool acquireWhetherAbsoluteSupported(bool &fSupported);
    291291        /** Returns whether VM's mouse supports relative coordinates. */
    292         bool getRelativeSupported();
     292        bool acquireWhetherRelativeSupported(bool &fSupported);
    293293        /** Returns whether VM's mouse supports touch screen device. */
    294         bool getTouchScreenSupported();
     294        bool acquireWhetherTouchScreenSupported(bool &fSupported);
    295295        /** Returns whether VM's mouse supports touch pad device. */
    296         bool getTouchPadSupported();
     296        bool acquireWhetherTouchPadSupported(bool &fSupported);
    297297        /** Returns whether VM's mouse requires host cursor. */
    298         bool getNeedsHostCursor();
     298        bool acquireWhetherNeedsHostCursor(bool &fNeeds);
    299299
    300300        /** Sends relative mouse move event to VM's mouse. */
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