VirtualBox

Changeset 35871 in vbox


Ignore:
Timestamp:
Feb 7, 2011 1:19:21 PM (14 years ago)
Author:
vboxsync
Message:

Main: generate mouse events smarter

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/MouseImpl.h

    r35638 r35871  
    130130    const ComObjPtr<EventSource> mEventSource;
    131131    VBoxEventDesc                mMouseEvent;
     132
     133    void fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw, LONG Buttons);
     134#else
     135    void fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw, LONG Buttons)
     136    {}
    132137#endif
    133138};
  • trunk/src/VBox/Main/src-client/MouseImpl.cpp

    r35638 r35871  
    405405}
    406406
     407#ifndef VBOXBFE_WITHOUT_COM
     408void Mouse::fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw, LONG Buttons)
     409{
     410    /* If mouse button is pressed, we generate new event, to avoid reusable events coalescing and thus
     411       dropping key press events */
     412    if (Buttons != 0)
     413    {
     414        VBoxEventDesc evDesc;
     415        evDesc.init(mEventSource, VBoxEventType_OnGuestMouse, fAbsolute, x, y, dz, dw, Buttons);
     416        evDesc.fire(0);
     417    }
     418    else
     419    {
     420        mMouseEvent.reinit(VBoxEventType_OnGuestMouse, fAbsolute, x, y, dz, dw, Buttons);
     421        mMouseEvent.fire(0);
     422    }
     423}
     424#endif
     425
     426
    407427/**
    408428 * Send a relative mouse event to the guest.
     
    433453    rc = reportRelEventToMouseDev(dx, dy, dz, dw, fButtons);
    434454
    435 #ifndef VBOXBFE_WITHOUT_COM
    436     mMouseEvent.reinit(VBoxEventType_OnGuestMouse, false, dx, dy, dz, dw, fButtons);
    437     mMouseEvent.fire(0);
    438 #endif
     455    fireMouseEvent(false, dx, dy, dz, dw, buttonState);
    439456
    440457    return rc;
     
    538555                                    & VMMDEV_MOUSE_NEW_PROTOCOL));
    539556
    540 #ifndef VBOXBFE_WITHOUT_COM
    541         mMouseEvent.reinit(VBoxEventType_OnGuestMouse, true, x, y, dz, dw,
    542                            fButtons);
    543         mMouseEvent.fire(0);
    544 #endif
     557        fireMouseEvent(true, x, y, dz, dw, buttonState);
    545558    }
    546559
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