VirtualBox

Changeset 68089 in vbox


Ignore:
Timestamp:
Jul 23, 2017 10:07:12 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
117129
Message:

bugref:8778: Double click not working with precision touchpad (user report)
A new attempt to fix this problem by extending the throttle timer test for
unreported events to also check whether the accumulated button field is
non-zero.

Also add a test case which is executed on device construction in strict
builds to check that the use case to be fixed works and that the mouse
dragging regression introduced by the first fix attempt is not present.
Tested the test case on the two previous fix attempts which were known to
respectively fix one case and break the other. The current fix attempt
passes both tests.

File:
1 edited

Legend:

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

    r68088 r68089  
    832832#ifdef IN_RING3
    833833
     834/** Is there any state change to send as events to the guest? */
     835static uint32_t ps2mHaveEvents(PPS2M pThis)
     836{
     837    return   pThis->iAccumX | pThis->iAccumY | pThis->iAccumZ
     838           | (pThis->fCurrB != pThis->fReportedB) | (pThis->fAccumB != 0);
     839}
     840
    834841/* Event rate throttling timer to emulate the auxiliary device sampling rate.
    835842 */
     
    848855#else
    849856    /* If more movement is accumulated, report it and restart the timer. */
    850     uHaveEvents = pThis->iAccumX | pThis->iAccumY | pThis->iAccumZ | (pThis->fCurrB != pThis->fReportedB);
     857    uHaveEvents = ps2mHaveEvents(pThis);
    851858    LogFlowFunc(("Have%s events\n", uHaveEvents ? "" : " no"));
    852859
     
    991998}
    992999
     1000#ifdef RT_STRICT
     1001/** Test the event accumulation mechanism which we use to delay events going
     1002 * to the guest to one per 50ms.  This test depends on ps2mPutEventWorker() not
     1003 * touching the timer if This.fThrottleActive is true. */
     1004/** @todo if we add any more tests it might be worth using a table of test
     1005 * operations and checks. */
     1006static void ps2mTestAccumulation(void)
     1007{
     1008    PS2M This;
     1009    unsigned i;
     1010    int rc;
     1011    uint8_t b;
     1012
     1013    RT_ZERO(This);
     1014    This.evtQ.cSize = AUX_EVT_QUEUE_SIZE;
     1015    This.u8State = AUX_STATE_ENABLED;
     1016    This.fThrottleActive = true;
     1017    /* Certain Windows touch pad drivers report a double tap as a press, then
     1018     * a release-press-release all within a single 50ms interval.  Simulate
     1019     * this to check that it is handled right. */
     1020    ps2mPutEventWorker(&This, 0, 0, 0, 0, 1);
     1021    if (ps2mHaveEvents(&This))
     1022        ps2mReportAccumulatedEvents(&This, (GeneriQ *)&This.evtQ, true);
     1023    ps2mPutEventWorker(&This, 0, 0, 0, 0, 0);
     1024    if (ps2mHaveEvents(&This))
     1025        ps2mReportAccumulatedEvents(&This, (GeneriQ *)&This.evtQ, true);
     1026    ps2mPutEventWorker(&This, 0, 0, 0, 0, 1);
     1027    ps2mPutEventWorker(&This, 0, 0, 0, 0, 0);
     1028    if (ps2mHaveEvents(&This))
     1029        ps2mReportAccumulatedEvents(&This, (GeneriQ *)&This.evtQ, true);
     1030    if (ps2mHaveEvents(&This))
     1031        ps2mReportAccumulatedEvents(&This, (GeneriQ *)&This.evtQ, true);
     1032    for (i = 0; i < 12; ++i)
     1033    {
     1034        const uint8_t abExpected[] = { 9, 0, 0, 8, 0, 0, 9, 0, 0, 8, 0, 0};
     1035
     1036        rc = PS2MByteFromAux(&This, &b);
     1037        AssertRCSuccess(rc);
     1038        Assert(b == abExpected[i]);
     1039    }
     1040    rc = PS2MByteFromAux(&This, &b);
     1041    Assert(rc != VINF_SUCCESS);
     1042    /* Button hold down during mouse drags was broken at some point during
     1043     * testing fixes for the previous issue.  Test that that works. */
     1044    ps2mPutEventWorker(&This, 0, 0, 0, 0, 1);
     1045    if (ps2mHaveEvents(&This))
     1046        ps2mReportAccumulatedEvents(&This, (GeneriQ *)&This.evtQ, true);
     1047    if (ps2mHaveEvents(&This))
     1048        ps2mReportAccumulatedEvents(&This, (GeneriQ *)&This.evtQ, true);
     1049    for (i = 0; i < 3; ++i)
     1050    {
     1051        const uint8_t abExpected[] = { 9, 0, 0 };
     1052
     1053        rc = PS2MByteFromAux(&This, &b);
     1054        AssertRCSuccess(rc);
     1055        Assert(b == abExpected[i]);
     1056    }
     1057    rc = PS2MByteFromAux(&This, &b);
     1058    Assert(rc != VINF_SUCCESS);
     1059}
     1060#endif /* RT_STRICT */
     1061
    9931062/* -=-=-=-=-=- Mouse: IMousePort  -=-=-=-=-=- */
    9941063
     
    11861255    LogFlowFunc(("iInstance=%d\n", iInstance));
    11871256
     1257#ifdef RT_STRICT
     1258    ps2mTestAccumulation();
     1259#endif
     1260
    11881261    pThis->pParent = pParent;
    11891262
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