VirtualBox

Changeset 47174 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jul 16, 2013 3:27:24 AM (11 years ago)
Author:
vboxsync
Message:

Devices/Input: most of the Main plumbing for guest multi-touch.

Location:
trunk/src/VBox/Main
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r47124 r47174  
    1429714297    </attribute>
    1429814298
     14299    <attribute name="multiTouchSupported" type="boolean" readonly="yes">
     14300      <desc>
     14301        Whether the guest OS supports multi-touch event reporting.
     14302        <note>
     14303          You can use the <link to="IMouseCapabilityChangedEvent"/>
     14304          event to be instantly informed about changes of this attribute
     14305          during virtual machine execution.
     14306        </note>
     14307        <see><link to="#putMouseEvent"/></see>
     14308      </desc>
     14309    </attribute>
     14310
    1429914311    <attribute name="needsHostCursor" type="boolean" readonly="yes">
    1430014312      <desc>
     
    2021420226  </interface>
    2021520227
     20228  <enum
     20229    name="GuestMouseEventMode"
     20230    uuid="ef172985-7e36-4297-95be-e46396968d66"
     20231    >
     20232
     20233    <desc>
     20234      The mode (relative, absolute, multi-touch) of a pointer event.
     20235      TODO: a clear pattern seems to be emerging that we should usually have
     20236      multiple input devices active for different types of reporting, so we
     20237      should really have different event types for relative (including wheel),
     20238      absolute (not including wheel) and multi-touch events.
     20239    </desc>
     20240
     20241    <const name="Relative" value="0">
     20242      <desc>
     20243        Relative event.
     20244      </desc>
     20245    </const>
     20246
     20247    <const name="Absolute" value="1">
     20248      <desc>
     20249        Absolute event.
     20250      </desc>
     20251    </const>
     20252
     20253    <const name="MultiTouch" value="2">
     20254      <desc>
     20255        Multi-touch event.
     20256      </desc>
     20257    </const>
     20258  </enum>
     20259
    2021620260  <interface
    2021720261    name="IGuestMouseEvent" extends="IReusableEvent"
     
    2022320267    </desc>
    2022420268
    20225     <attribute name="absolute" type="boolean" readonly="yes">
    20226       <desc>
    20227         If this event is relative or absolute.
     20269    <attribute name="mode" type="GuestMouseEventMode" readonly="yes">
     20270      <desc>
     20271        If this event is relative, absolute or multi-touch.
    2022820272      </desc>
    2022920273    </attribute>
     
    2025320297    </attribute>
    2025420298
     20299    <attribute name="contact" type="long" readonly="yes">
     20300      <desc>
     20301        The multi-touch contact identifier.  This remains valid as long as a
     20302        touch is in progress and can and should be re-used after a touch has
     20303        terminated (see @a buttons).
     20304      </desc>
     20305    </attribute>
     20306
    2025520307    <attribute name="buttons" type="long" readonly="yes">
    2025620308      <desc>
    20257         Button state bitmask.
     20309        Button state bitmask.  Multi-touch events should have the first bit set
     20310        as long as the touch is in progress and terminate with an event with no
     20311        bits set.
    2025820312      </desc>
    2025920313    </attribute>
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r47106 r47174  
    269269                                   uint32_t width, uint32_t height,
    270270                                   ComSafeArrayIn(uint8_t, aShape));
    271     void onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative, BOOL needsHostCursor);
     271    void onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative,
     272                                 BOOL supportsMT, BOOL needsHostCursor);
    272273    void onStateChange(MachineState_T aMachineState);
    273274    void onAdditionsStateChange();
  • trunk/src/VBox/Main/include/MouseImpl.h

    r46937 r47174  
    5858    STDMETHOD(COMGETTER(AbsoluteSupported)) (BOOL *absoluteSupported);
    5959    STDMETHOD(COMGETTER(RelativeSupported)) (BOOL *relativeSupported);
     60    STDMETHOD(COMGETTER(MultiTouchSupported)) (BOOL *multiTouchSupported);
    6061    STDMETHOD(COMGETTER(NeedsHostCursor)) (BOOL *needsHostCursor);
    6162
     
    8485
    8586    static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
    86     static DECLCALLBACK(void)   mouseReportModes (PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs, bool);
     87    static DECLCALLBACK(void)   mouseReportModes (PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs, bool fMT);
    8788    static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
    8889    static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
     
    9394    HRESULT reportAbsEventToMouseDev(int32_t mouseXAbs, int32_t mouseYAbs,
    9495                                 int32_t dz, int32_t dw, uint32_t fButtons);
     96    HRESULT reportMTEventToMouseDev(int32_t mouseX, int32_t mouseY,
     97                                 uint32_t cContact, bool fContact);
    9598    HRESULT reportAbsEventToVMMDev(int32_t mouseXAbs, int32_t mouseYAbs);
    9699    HRESULT reportAbsEvent(int32_t mouseXAbs, int32_t mouseYAbs,
     
    100103                              bool *pfValid);
    101104
    102     void getDeviceCaps(bool *pfAbs, bool *pfRel);
     105    void getDeviceCaps(bool *pfAbs, bool *pfRel, bool *fMT);
    103106    void sendMouseCapsNotifications(void);
    104107    bool guestNeedsHostCursor(void);
     
    107110    bool supportsAbs(void);
    108111    bool supportsRel(void);
     112    bool supportsMT(void);
    109113
    110114    Console * const         mParent;
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r47117 r47174  
    60976097 */
    60986098#endif
    6099 void Console::onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative, BOOL needsHostCursor)
     6099void Console::onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative,
     6100                                      BOOL supportsMT, BOOL needsHostCursor)
    61006101{
    61016102    LogFlowThisFunc(("supportsAbsolute=%d supportsRelative=%d needsHostCursor=%d\n",
  • trunk/src/VBox/Main/src-client/MouseImpl.cpp

    r46937 r47174  
    3737    MOUSE_DEVCAP_RELATIVE = 1,
    3838    /** The mouse device can do absolute reporting */
    39     MOUSE_DEVCAP_ABSOLUTE = 2
     39    MOUSE_DEVCAP_ABSOLUTE = 2,
     40    /** The mouse device can do absolute reporting */
     41    MOUSE_DEVCAP_MULTI_TOUCH = 4
    4042};
    4143/** @} */
     
    171173
    172174/**
    173  * Returns whether the current setup can accept absolute mouse events, either
    174  * because an emulated absolute pointing device is active or because the Guest
    175  * Additions are.
     175 * Returns whether the currently active device portfolio can accept absolute
     176 * mouse events.
    176177 *
    177178 * @returns COM status code
     
    191192
    192193/**
    193  * Returns whether the current setup can accept relative mouse events, that is,
    194  * whether an emulated relative pointing device is active.
     194 * Returns whether the currently active device portfolio can accept relative
     195 * mouse events.
    195196 *
    196197 * @returns COM status code
     
    206207
    207208    *relativeSupported = supportsRel();
     209    return S_OK;
     210}
     211
     212/**
     213 * Returns whether the currently active device portfolio can accept multi-touch
     214 * mouse events.
     215 *
     216 * @returns COM status code
     217 * @param multiTouchSupported address of result variable
     218 */
     219STDMETHODIMP Mouse::COMGETTER(MultiTouchSupported) (BOOL *multiTouchSupported)
     220{
     221    if (!multiTouchSupported)
     222        return E_POINTER;
     223
     224    AutoCaller autoCaller(this);
     225    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     226
     227    *multiTouchSupported = FALSE;
    208228    return S_OK;
    209229}
     
    344364
    345365/**
     366 * Send an absolute pointer event to the emulated absolute device we deem most
     367 * appropriate.
     368 *
     369 * @returns   COM status code
     370 */
     371HRESULT Mouse::reportMTEventToMouseDev(int32_t mouseX, int32_t mouseY,
     372                                       uint32_t cContact, bool fContact)
     373{
     374    return E_NOTIMPL;
     375}
     376
     377
     378/**
    346379 * Send an absolute position event to the VMM device.
    347380 * @note all calls out of this object are made with no locks held!
     
    583616/** Check what sort of reporting can be done using the devices currently
    584617 * enabled.  Does not consider the VMM device. */
    585 void Mouse::getDeviceCaps(bool *pfAbs, bool *pfRel)
     618void Mouse::getDeviceCaps(bool *pfAbs, bool *pfRel, bool *pfMT)
    586619{
    587620    bool fAbsDev = false;
    588621    bool fRelDev = false;
     622    bool fMTDev  = false;
    589623
    590624    AutoReadLock aLock(this COMMA_LOCKVAL_SRC_POS);
     
    597631           if (mpDrv[i]->u32DevCaps & MOUSE_DEVCAP_RELATIVE)
    598632               fRelDev = true;
     633           if (mpDrv[i]->u32DevCaps & MOUSE_DEVCAP_MULTI_TOUCH)
     634               fMTDev  = true;
    599635        }
    600636    if (pfAbs)
     
    610646    bool fRelDev;
    611647
    612     getDeviceCaps(NULL, &fRelDev);
     648    getDeviceCaps(NULL, &fRelDev, NULL);
    613649    return    (mfVMMDevGuestCaps & VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE)
    614650           && fRelDev;
     
    621657    bool fAbsDev;
    622658
    623     getDeviceCaps(&fAbsDev, NULL);
     659    getDeviceCaps(&fAbsDev, NULL, NULL);
    624660    return fAbsDev;
    625661}
     
    631667    bool fRelDev;
    632668
    633     getDeviceCaps(NULL, &fRelDev);
     669    getDeviceCaps(NULL, &fRelDev, NULL);
    634670    return fRelDev;
    635671}
     
    641677    bool fAbsDev;
    642678
    643     getDeviceCaps(&fAbsDev, NULL);
     679    getDeviceCaps(&fAbsDev, NULL, NULL);
    644680    return fAbsDev || vmmdevCanAbs();
     681}
     682
     683
     684/** Can we currently send absolute events to the guest? */
     685bool Mouse::supportsMT(void)
     686{
     687    bool fMTDev;
     688
     689    getDeviceCaps(NULL, NULL, &fMTDev);
     690    return fMTDev;
    645691}
    646692
     
    651697void Mouse::sendMouseCapsNotifications(void)
    652698{
    653     bool fAbsDev, fRelDev, fCanAbs, fNeedsHostCursor;
     699    bool fAbsDev, fRelDev, fMTDev, fCanAbs, fNeedsHostCursor;
    654700
    655701    {
    656702        AutoReadLock aLock(this COMMA_LOCKVAL_SRC_POS);
    657703
    658         getDeviceCaps(&fAbsDev, &fRelDev);
     704        getDeviceCaps(&fAbsDev, &fRelDev, &fMTDev);
    659705        fCanAbs = supportsAbs();
    660706        fNeedsHostCursor = guestNeedsHostCursor();
     
    667713     * callback data atomically.  However I can't see any sign that the cached
    668714     * data is ever used again. */
    669     mParent->onMouseCapabilityChange(fCanAbs, fRelDev, fNeedsHostCursor);
     715    mParent->onMouseCapabilityChange(fCanAbs, fRelDev, fMTDev, fNeedsHostCursor);
    670716}
    671717
     
    675721 * A virtual device is notifying us about its current state and capabilities
    676722 */
    677 DECLCALLBACK(void) Mouse::mouseReportModes(PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs, bool)
     723DECLCALLBACK(void) Mouse::mouseReportModes(PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs, bool fMT)
    678724{
    679725    PDRVMAINMOUSE pDrv = RT_FROM_MEMBER(pInterface, DRVMAINMOUSE, IConnector);
     
    686732    else
    687733        pDrv->u32DevCaps &= ~MOUSE_DEVCAP_ABSOLUTE;
     734    if (fMT)
     735        pDrv->u32DevCaps |= MOUSE_DEVCAP_MULTI_TOUCH;
     736    else
     737        pDrv->u32DevCaps &= ~MOUSE_DEVCAP_MULTI_TOUCH;
    688738
    689739    pDrv->pMouse->sendMouseCapsNotifications();
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