VirtualBox

Changeset 26638 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Feb 18, 2010 9:18:04 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57846
Message:

Devices, Main, pdmifs.h: changed the Main-to-Device absolute event protocol to include button and wheel events; some cleanups and fixes

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MouseImpl.cpp

    r26624 r26638  
    258258 * @returns   COM status code
    259259 */
    260 int Mouse::reportAbsEventToMouseDev(uint32_t mouseXAbs, uint32_t mouseYAbs)
     260int Mouse::reportAbsEventToMouseDev(uint32_t mouseXAbs, uint32_t mouseYAbs,
     261                                    int32_t dz, int32_t dw, uint32_t fButtons)
    261262{
    262263    CHECK_CONSOLE_DRV (mpDrv);
    263264
    264     if (mouseXAbs != mLastAbsX || mouseYAbs != mLastAbsY)
     265    if (   mouseXAbs != mLastAbsX
     266        || mouseYAbs != mLastAbsY
     267        || dz
     268        || dw
     269        || fButtons != mLastButtons)
    265270    {
    266271        int vrc = mpDrv->pUpPort->pfnPutEventAbs(mpDrv->pUpPort, mouseXAbs,
    267                                                  mouseYAbs);
     272                                                 mouseYAbs, dz, dw, fButtons);
    268273        if (RT_FAILURE(vrc))
    269274            setError(VBOX_E_IPRT_ERROR,
     
    405410    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    406411
    407     LogRel3(("%s: x=%d, y=%d, dz=%d, dw=%d\n", __PRETTY_FUNCTION__,
    408              x, y, dz, dw));
     412    LogRel3(("%s: x=%d, y=%d, dz=%d, dw=%d, buttonState=0x%x\n",
     413             __PRETTY_FUNCTION__, x, y, dz, dw, buttonState));
    409414
    410415    uint32_t mouseXAbs;
    411416    rc = convertDisplayWidth(x, &mouseXAbs);
    412417    ComAssertComRCRet(rc, rc);
     418    if (mouseXAbs > 0xffff)
     419        mouseXAbs = mLastAbsX;
    413420    uint32_t mouseYAbs;
    414421    rc = convertDisplayHeight(y, &mouseYAbs);
    415422    ComAssertComRCRet(rc, rc);
     423    if (mouseYAbs > 0xffff)
     424        mouseYAbs = mLastAbsY;
    416425    uint32_t fButtons = mouseButtonsToPDM(buttonState);
    417426    /* Older guest additions rely on a small phony movement event on the
     
    420429
    421430    if (uDevCaps & MOUSE_DEVCAP_ABSOLUTE)
    422         rc = reportAbsEventToMouseDev(mouseXAbs, mouseYAbs);
     431        rc = reportAbsEventToMouseDev(mouseXAbs, mouseYAbs, dz, dw, fButtons);
    423432    else
    424433    {
     
    443452    mLastAbsX = mouseXAbs;
    444453    mLastAbsY = mouseYAbs;
    445     /* We may need to send a relative event for button information or to
    446      * wake the guest up to the changed absolute co-ordinates. */
    447     /* If the event is a pure wake up one, we make sure it contains some
    448      * (possibly phony) event data to make sure it isn't just discarded on
    449      * the way.  Note: we ignore dw as it is optional. */
    450     if (fNeedsJiggle || fButtons != mLastButtons || dz || dw)
    451         rc = reportRelEventToMouseDev(fNeedsJiggle ? 1 : 0, 0, dz, dw,
    452                                       fButtons);
    453     if (SUCCEEDED(rc))
    454         mLastButtons = fButtons;
     454    if (!(uDevCaps & MOUSE_DEVCAP_ABSOLUTE))
     455    {
     456        /* We may need to send a relative event for button information or to
     457         * wake the guest up to the changed absolute co-ordinates.
     458         * If the event is a pure wake up one, we make sure it contains some
     459         * (possibly phony) event data to make sure it isn't just discarded on
     460         * the way. */
     461        if (fNeedsJiggle || fButtons != mLastButtons || dz || dw)
     462            rc = reportRelEventToMouseDev(fNeedsJiggle ? 1 : 0, 0, dz, dw,
     463                                          fButtons);
     464        ComAssertComRCRet (rc, rc);
     465    }
     466    mLastButtons = fButtons;
    455467    return rc;
    456468}
  • trunk/src/VBox/Main/include/MouseImpl.h

    r26624 r26638  
    111111    int reportRelEventToMouseDev(int32_t dx, int32_t dy, int32_t dz,
    112112                                 int32_t dw, uint32_t fButtons);
    113     int reportAbsEventToMouseDev(uint32_t mouseXAbs, uint32_t mouseYAbs);
     113    int reportAbsEventToMouseDev(uint32_t mouseXAbs, uint32_t mouseYAbs,
     114                                 int32_t dz, int32_t dw, uint32_t fButtons);
    114115    int reportAbsEventToVMMDev(uint32_t mouseXAbs, uint32_t mouseYAbs);
    115116    int convertDisplayWidth(LONG x, uint32_t *pcX);
    116117    int convertDisplayHeight(LONG y, uint32_t *pcY);
    117     bool needsRelativeEvent(uint32_t cXAbs, uint32_t cYAbs, int32_t dz, int32_t dw, uint32_t fButtons, uint32_t fCaps);
    118118
    119119    const ComObjPtr<Console, ComWeakRef> mParent;
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