VirtualBox

Changeset 29410 in vbox


Ignore:
Timestamp:
May 12, 2010 11:32:52 AM (15 years ago)
Author:
vboxsync
Message:

FE/Qt: 4916: Few fixes for mouse-clipping on windows host.

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

Legend:

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

    r29219 r29410  
    173173        return;
    174174
    175     /* Storing new mouse 'integrated' value: */
     175    /* Store new mouse 'integrated' state value: */
    176176    uisession()->setMouseIntegrated(fEnabled);
    177177
    178     /* We should capture/release mouse depending on mouse 'integrated' state: */
     178    /* We should capture/release mouse depending on mouse 'integrated' state value: */
    179179    captureMouse(!uisession()->isMouseIntegrated(), false /* emit signal? */);
    180180
     
    182182    updateMouseCursorShape();
    183183
    184     /* Also we switch guest mouse to the absolute mode: */
    185     if (uisession()->isMouseIntegrated() &&
    186         uisession()->isMouseSupportsAbsolute())
     184    /* If mouse is integrated and supports absolute pointing
     185     * we should switch guest mouse to the absolute mode: */
     186    if (uisession()->isMouseIntegrated() && uisession()->isMouseSupportsAbsolute())
    187187    {
    188188        CMouse mouse = session().GetConsole().GetMouse();
     
    221221    , m_fAccelerate2DVideo(bAccelerate2DVideo)
    222222#endif /* VBOX_WITH_VIDEOHWACCEL */
     223#ifdef Q_WS_WIN
     224    , m_fItsMeWhoCapturedMouse(false)
     225#endif
    223226#ifdef Q_WS_MAC
    224227    , m_darwinKeyModifiers(0)
     
    423426}
    424427
    425 #ifdef Q_WS_WIN32
    426 /* This method is actually required only because
    427  * under win-host we do not really grab the mouse
    428  * in case of capturing it. I have to check if its
    429  * really need, may be just grabMouse() will be enought: */
     428#ifdef Q_WS_WIN
     429/* This method is actually required only because under win-host
     430 * we do not really grab the mouse in case of capturing it.
     431 * I have to check if its really need, may be just grabMouse() will be enought: */
    430432void UIMachineView::updateMouseCursorClipping()
    431433{
    432     if (uisession()->isMouseCaptured())
     434    if (m_fItsMeWhoCapturedMouse)
    433435    {
    434436        QRect r = viewport()->rect();
     
    436438        RECT rect = { r.left(), r.top(), r.right() + 1, r.bottom() + 1 };
    437439        ::ClipCursor(&rect);
    438     }
    439     else
    440     {
    441         ::ClipCursor(NULL);
    442440    }
    443441}
     
    831829            /* Update mouse cursor shape: */
    832830            updateMouseCursorShape();
    833 #ifdef Q_WS_WIN32
    834             updateMouseCursorClipping();
    835 #endif
    836831
    837832            /* May be we have to restrict minimum size? */
     
    13041299void UIMachineView::sltMouseCapturedStatusChanged()
    13051300{
    1306 #ifndef Q_WS_WIN32
     1301    /* If mouse 'captured' state value changed to 'false': */
    13071302    if (!uisession()->isMouseCaptured())
    13081303    {
    13091304        /* Releasing grabbed mouse from that window: */
     1305#ifdef Q_WS_WIN
     1306        m_fItsMeWhoCapturedMouse = false;
     1307        ::ClipCursor(NULL);
     1308#else
    13101309        viewport()->releaseMouse();
    1311     }
    1312 #endif
    1313 
    1314 #ifdef Q_WS_WIN32
    1315     /* Update mouse clipping: */
    1316     updateMouseCursorClipping();
    1317 #endif
     1310#endif /* Q_WS_WIN */
     1311    }
    13181312
    13191313    /* Update mouse cursor shape: */
     
    26072601        return;
    26082602
     2603    /* Store new mouse 'captured' state value: */
     2604    uisession()->setMouseCaptured(fCapture);
     2605
    26092606    if (fCapture)
    26102607    {
     
    26122609        m_capturedMousePos = QCursor::pos();
    26132610#ifdef Q_WS_WIN32
     2611        /* Remember what this window captured mouse: */
     2612        m_fItsMeWhoCapturedMouse = true;
    26142613        /* Move the mouse to the center of the visible area: */
    26152614        m_lastMousePos = mapToGlobal(visibleRegion().boundingRect().center());
    26162615        QCursor::setPos(m_lastMousePos);
     2616        /* Update mouse clipping: */
     2617        updateMouseCursorClipping();
    26172618#elif defined (Q_WS_MAC)
    26182619        /* Move the mouse to the center of the visible area: */
     
    26362637    CMouse mouse = session().GetConsole().GetMouse();
    26372638    mouse.PutMouseEvent(0, 0, 0, 0, 0);
    2638 
    2639     /* Storing new mouse 'captured' value: */
    2640     uisession()->setMouseCaptured(fCapture);
    26412639
    26422640    /* Emit signal if required: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h

    r28800 r29410  
    243243    bool m_bIsHostkeyInCapture : 1;
    244244    bool m_bIsMachineWindowResizeIgnored : 1;
    245     bool m_fPassCAD;
     245    bool m_fPassCAD : 1;
    246246#ifdef VBOX_WITH_VIDEOHWACCEL
    247247    bool m_fAccelerate2DVideo;
    248248#endif
    249249
     250#ifdef Q_WS_WIN
     251    bool m_fItsMeWhoCapturedMouse;
     252#endif /* Q_WS_WIN */
    250253#ifdef Q_WS_MAC
    251254    /** The current modifier key mask. Used to figure out which modifier
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