VirtualBox

Changeset 72408 in vbox


Ignore:
Timestamp:
Jun 1, 2018 11:00:21 AM (7 years ago)
Author:
vboxsync
Message:

PS2K: Corrected typematic action stopping. See bbugref:4118c57

File:
1 edited

Legend:

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

    r72407 r72408  
    658658}
    659659
     660/* Clears the currently active typematic key, if any. */
     661static void ps2kStopTypematicRepeat(PPS2K pThis)
     662{
     663    if (pThis->u8TypematicKey)
     664    {
     665        LogFunc(("Typematic key %02X\n", pThis->u8TypematicKey));
     666        pThis->enmTypematicState = KBD_TMS_IDLE;
     667        pThis->u8TypematicKey = 0;
     668        TMTimerStop(pThis->CTX_SUFF(pKbdTypematicTimer));
     669    }
     670}
     671
    660672/* Convert encoded typematic value to milliseconds. Note that the values are rated
    661673 * with +/- 20% accuracy, so there's no need for high precision.
     
    686698    ps2kSetupTypematic(pThis, KBD_DFL_RATE_DELAY);
    687699    /* Clear last typematic key?? */
     700    ps2kStopTypematicRepeat(pThis);
    688701}
    689702
     
    719732            pThis->fScanning = true;
    720733            ps2kClearQueue((GeneriQ *)&pThis->keyQ);
    721             /* Clear last typematic key?? */
     734            ps2kStopTypematicRepeat(pThis);
    722735            ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK);
    723736            pThis->u8CurrCmd = 0;
     
    725738        case KCMD_DFLT_DISABLE:
    726739            pThis->fScanning = false;
    727             ps2kSetDefaults(pThis);
     740            ps2kSetDefaults(pThis); /* Also clears buffer/typematic state. */
    728741            ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK);
    729742            pThis->u8CurrCmd = 0;
     
    10601073    else
    10611074    {
    1062         pThis->u8TypematicKey    = 0;
    1063         pThis->enmTypematicState = KBD_TMS_IDLE;
    1064         /// @todo Cancel timer right away?
    1065         /// @todo Cancel timer before pushing key up code!?
     1075        /* "Typematic operation stops when the last key pressed is released, even
     1076         * if other keys are still held down." (IBM PS/2 Tech Ref). The last key pressed
     1077         * is the one that's being repeated.
     1078         */
     1079        if (pThis->u8TypematicKey == u8HidCode)
     1080        {
     1081            /* This disables the typematic repeat. */
     1082            pThis->u8TypematicKey    = 0;
     1083            pThis->enmTypematicState = KBD_TMS_IDLE;
     1084            /* For good measure, we cancel the timer, too. */
     1085            TMTimerStop(pThis->CTX_SUFF(pKbdTypematicTimer));
     1086            Log(("Typematic action cleared for key %02X\n", u8HidCode));
     1087        }
    10661088    }
    10671089
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