VirtualBox

Changeset 102484 in vbox


Ignore:
Timestamp:
Dec 5, 2023 5:17:34 PM (10 months ago)
Author:
vboxsync
Message:

UsbMouse: Windows guests require that touch events with active contacts be repeated even in the absence of any changes.

File:
1 edited

Legend:

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

    r98103 r102484  
    7070/** @} */
    7171
     72#define TOUCH_TIMER_MSEC            20      /* 50 Hz touch contact repeat timer. */
     73
    7274
    7375/*********************************************************************************************************************************
     
    227229    /** Tablet coordinate shift factor for old and broken operating systems. */
    228230    uint8_t             u8CoordShift;
     231
     232    /** Contact repeat timer. */
     233    TMTIMERHANDLE       hContactTimer;
    229234
    230235    /**
     
    19921997    }
    19931998
     1999    bool fTouchActive = false;
     2000
    19942001    /* Mark still dirty existing contacts as cancelled, because a new set of contacts does not include them. */
    19952002    for (i = 0; i < RT_ELEMENTS(pThis->aCurrentContactState); i++)
     
    20012008            pCurContact->status &= ~MT_CONTACT_S_DIRTY;
    20022009        }
     2010        if (pCurContact->flags & MT_CONTACT_F_IN_CONTACT)
     2011            fTouchActive = true;
    20032012    }
    20042013
     
    20242033    /* Send a report if possible. */
    20252034    usbHidSendReport(pThis);
     2035
     2036    /* If there is an active contact, set up a timer. Windows requires that touch input
     2037     * gets repeated as long as there's contact, otherwise the guest decides that there
     2038     * is no contact anymore, even though it was never told that.
     2039     */
     2040    if (fTouchActive)
     2041        PDMUsbHlpTimerSetMillies(pThis->pUsbIns, pThis->hContactTimer, TOUCH_TIMER_MSEC);
     2042    else
     2043        PDMUsbHlpTimerStop(pThis->pUsbIns, pThis->hContactTimer);
    20262044
    20272045    RTCritSectLeave(&pThis->CritSect);
     
    27152733
    27162734/**
     2735 * @callback_method_impl{FNTMTIMERUSB}
     2736 *
     2737 * A touchscreen needs to repeatedly sent contact information as long
     2738 * as the contact is maintained.
     2739 */
     2740static DECLCALLBACK(void) usbHidContactTimer(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, void *pvUser)
     2741{
     2742    PUSBHID pThis = (PUSBHID)pvUser;
     2743
     2744    LogRel3(("usbHid: contact repeat timer\n"));
     2745    usbHidSendReport(pThis);
     2746
     2747    PDMUsbHlpTimerSetMillies(pUsbIns, hTimer, TOUCH_TIMER_MSEC);
     2748}
     2749
     2750
     2751/**
    27172752 * @interface_method_impl{PDMUSBREG,pfnDestruct}
    27182753 */
     
    27352770        pThis->hEvtDoneQueue = NIL_RTSEMEVENT;
    27362771    }
     2772
     2773    PDMUsbHlpTimerDestroy(pUsbIns, pThis->hContactTimer);
    27372774}
    27382775
     
    28092846    if (RT_FAILURE(rc))
    28102847        return PDMUsbHlpVMSetError(pUsbIns, rc, RT_SRC_POS, N_("HID failed to query shift factor"));
     2848
     2849    /*
     2850     * Create the touchscreen contact repeat timer.
     2851     */
     2852    rc = PDMUsbHlpTimerCreate(pUsbIns, TMCLOCK_VIRTUAL, usbHidContactTimer, pThis,
     2853                              TMTIMER_FLAGS_DEFAULT_CRIT_SECT,
     2854                              "Touchscreen Contact", &pThis->hContactTimer);
     2855    AssertRCReturn(rc, rc);
    28112856
    28122857    return VINF_SUCCESS;
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