VirtualBox

Changeset 30416 in vbox for trunk/src/VBox/Devices/Input


Ignore:
Timestamp:
Jun 24, 2010 10:35:13 AM (15 years ago)
Author:
vboxsync
Message:

Devices/Input/DevPS2: fix tilt wheel reporting regression which affects OpenSolaris guests

File:
1 edited

Legend:

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

    r30013 r30416  
    681681
    682682/**
    683  * Send a single relative packet in 3-byte PS/2 format, optionally with our
    684  * packed button protocol extension, to the PS/2 controller.
     683 * Send a single relative packet in 3-byte PS/2 format to the PS/2 controller.
    685684 * @param  s               keyboard state object
    686685 * @param  dx              relative X value, must be between -256 and +255
     
    727726{
    728727    int aux = fToCmdQueue ? 1 : 2;
    729 
    730     if (s->mouse_dw)
    731     {
    732         int dw1 = s->mouse_dw < 0 ? RT_MAX(s->mouse_dw, -31)
    733                                   : RT_MIN(s->mouse_dw, 32);
     728    int dz1 = 0, dw1 = 0;
     729    unsigned fButtonsHigh = s->mouse_buttons & 0x18;
     730
     731    if (s->mouse_dw > 0)
     732        dw1 = 1;
     733    else if (s->mouse_dw < 0)
     734        dw1 = -1;
     735    else if (s->mouse_dz > 0)
     736        dz1 = 1;
     737    else if (s->mouse_dz < 0)
     738        dz1 = -1;
     739    if (s->mouse_dw && s->mouse_flags & MOUSE_REPORT_HORIZONTAL)
     740    {
    734741        LogRel3(("%s: dw1=%d\n", __PRETTY_FUNCTION__, dw1));
    735         s->mouse_dw -= dw1;
    736742        kbd_queue(s, 0x40 | (dw1 & 0x3f), aux);
    737743    }
    738     else if (s->mouse_flags & MOUSE_REPORT_HORIZONTAL && s->mouse_dz)
    739     {
    740         int dz1 = s->mouse_dz < 0 ? RT_MAX(s->mouse_dz, -31)
    741                                   : RT_MIN(s->mouse_dz, 32);
    742         LogRel3(("%s: dz1=%d\n", __PRETTY_FUNCTION__, dz1));
    743         s->mouse_dz -= dz1;
    744         kbd_queue(s, 0x80 | (dz1 & 0x3f), aux);
    745     }
    746744    else
    747745    {
    748         int dz1 = s->mouse_dz < 0 ? RT_MAX(s->mouse_dz, -7)
    749                                   : RT_MIN(s->mouse_dz, 8);
    750         unsigned fButtonsHigh = s->mouse_buttons & 0x18;
    751         LogRel3(("%s: dz1=%d fButtonsHigh=0x%x\n",
    752                  __PRETTY_FUNCTION__, dz1, fButtonsHigh));
    753         s->mouse_dz -= dz1;
     746        LogRel3(("%s: dz1=%d, dw1=%d, fButtonsHigh=0x%x\n",
     747                 __PRETTY_FUNCTION__, dz1, dw1, fButtonsHigh));
     748        unsigned u4Low =   dw1 > 0 ? 9 /* -7 & 0xf */
     749                         : dw1 < 0 ? 7
     750                         : dz1 > 0 ? 1
     751                         : dz1 < 0 ? 0xf /* -1 & 0xf */
     752                         : 0;
    754753        kbd_mouse_set_reported_buttons(s, fButtonsHigh, 0x18);
    755         kbd_queue(s, (dz1 & 0x0f) | (fButtonsHigh << 1), aux);
    756     }
     754        kbd_queue(s, (fButtonsHigh << 1) | u4Low, aux);
     755    }
     756    s->mouse_dz -= dz1;
     757    s->mouse_dw -= dw1;
    757758}
    758759
     
    806807        || (s->mouse_type == MOUSE_PROT_IMEX))
    807808        s->mouse_dz += dz;
    808     if (   (   (s->mouse_type == MOUSE_PROT_IMEX)
    809             && s->mouse_flags & MOUSE_REPORT_HORIZONTAL))
     809    if (s->mouse_type == MOUSE_PROT_IMEX)
    810810        s->mouse_dw += dw;
    811811    s->mouse_buttons = buttons_state;
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