VirtualBox

Ignore:
Timestamp:
Feb 18, 2010 9:18:04 PM (15 years ago)
Author:
vboxsync
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Input/DevPS2.cpp

    r26624 r26638  
    230230    int32_t mouse_dw;
    231231    int32_t mouse_flags;
    232     int32_t mouse_cx;
    233     int32_t mouse_cy;
     232    uint32_t mouse_cx;
     233    uint32_t mouse_cy;
    234234    uint8_t mouse_buttons;
    235235    uint8_t mouse_buttons_reported;
     
    847847{
    848848    int aux = fToCmdQueue ? 1 : 2;
    849     int cx1 = s->mouse_cx * 4096 / 0xffff;
    850     int cy1 = 4096 - (s->mouse_cy * 4096 / 0xffff);
     849    unsigned cx1 = s->mouse_cx * 4095 / 0xffff;
     850    unsigned cy1 = 4095 - (s->mouse_cy * 4095 / 0xffff);
    851851    unsigned fButtons = s->mouse_buttons & 0x03;
    852     unsigned int b;
     852    unsigned int b[6];
    853853
    854854    LogRel3(("%s: cx1=%d, cy1=%d, fButtons=0x%x\n", __PRETTY_FUNCTION__,
    855855             cx1, cy1, fButtons));
    856     b = 4 /* Screen is being touched */ | fButtons;
    857     kbd_queue(s, b, aux);
    858     b = ((cy1 << 2) & 0xc0) | (cx1 >> 6);
    859     kbd_queue(s, b, aux);
    860     b = ((cx1 << 2) & 0xc0) | (cx1 & 0x3f);
    861     kbd_queue(s, b, aux);
    862     kbd_queue(s, 0xc0, aux);  /* This byte is really wasted in the protocol */
    863     b = ((cx1 << 2) & 0xc0) | (cy1 >> 6);
    864     kbd_queue(s, b, aux);
    865     b = ((cy1 << 2) & 0xc0) | (cy1 & 0x3f);
    866     kbd_queue(s, b, aux);
     856    b[0] = 4 /* Screen is being touched */ | fButtons;
     857    Assert((b[0] & 0xf8) == 0);
     858    kbd_queue(s, b[0], aux);
     859    b[1] = ((cy1 << 2) & 0xc0) | (cx1 >> 6);
     860    kbd_queue(s, b[1], aux);
     861    b[2] = ((cx1 << 2) & 0xc0) | (cx1 & 0x3f);
     862    Assert(((b[2] & 0x30) << 2) == (b[2] & 0xc0));
     863    kbd_queue(s, b[2], aux);
     864    b[3] = 0xc0;
     865    kbd_queue(s, b[3], aux);  /* This byte is really wasted in the protocol */
     866    b[4] = ((cx1 << 2) & 0xc0) | (cy1 >> 6);
     867    Assert((b[4] & 0xc0) == (b[2] & 0xc0));
     868    kbd_queue(s, b[4], aux);
     869    b[5] = ((cy1 << 2) & 0xc0) | (cy1 & 0x3f);
     870    Assert(   (((b[5] & 0x30) << 2) == (b[1] & 0xc0))
     871           && ((b[5] & 0xc0) == (b[1] & 0xc0)));
     872    kbd_queue(s, b[5], aux);
    867873}
    868874
     
    13391345    if (version_id > 3)
    13401346    {
    1341         SSMR3GetS32(f, &s->mouse_cx);
    1342         SSMR3GetS32(f, &s->mouse_cy);
     1347        SSMR3GetU32(f, &s->mouse_cx);
     1348        SSMR3GetU32(f, &s->mouse_cy);
    13431349        SSMR3GetU8(f, &s->mouse_buttons_reported);
    13441350        SSMR3GetU8(f, &s->mouse_last_button);
     
    16811687 * @param   i32cY           The Y value.
    16821688 */
    1683 static DECLCALLBACK(int) kbdMousePutEventAbs(PPDMIMOUSEPORT pInterface, int32_t i32cX, int32_t i32cY)
     1689static DECLCALLBACK(int) kbdMousePutEventAbs(PPDMIMOUSEPORT pInterface, uint32_t u32cX, uint32_t u32cY, int32_t dz, int32_t dw, uint32_t fButtons)
    16841690{
    16851691    KBDState *pThis = RT_FROM_MEMBER(pInterface, KBDState, Mouse.IPort);
     
    16871693    AssertReleaseRC(rc);
    16881694
    1689     pc_kbd_mouse_event_abs(pThis, i32cX, i32cY);
     1695    if (u32cX != pThis->mouse_cx || u32cY != pThis->mouse_cy)
     1696        pc_kbd_mouse_event_abs(pThis, u32cX, u32cY);
     1697    if (dz || dw || fButtons != pThis->mouse_buttons)
     1698        pc_kbd_mouse_event(pThis, 0, 0, dz, dw, fButtons);
    16901699
    16911700    PDMCritSectLeave(&pThis->CritSect);
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