Index: /trunk/src/VBox/Main/include/MouseImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/MouseImpl.h	(revision 50588)
+++ /trunk/src/VBox/Main/include/MouseImpl.h	(revision 50589)
@@ -19,5 +19,5 @@
 #define ____H_MOUSEIMPL
 
-#include "VirtualBoxBase.h"
+#include "MouseWrap.h"
 #include "ConsoleEvents.h"
 #include "ConsoleImpl.h"
@@ -31,18 +31,7 @@
 
 class ATL_NO_VTABLE Mouse :
-    public VirtualBoxBase
-    , VBOX_SCRIPTABLE_IMPL(IMouse)
+    public MouseWrap
 {
 public:
-
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Mouse, IMouse)
-
-    DECLARE_NOT_AGGREGATABLE(Mouse)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(Mouse)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IMouse)
-    END_COM_MAP()
 
     DECLARE_EMPTY_CTOR_DTOR (Mouse)
@@ -55,22 +44,7 @@
     void uninit();
 
-    // IMouse properties
-    STDMETHOD(COMGETTER(AbsoluteSupported)) (BOOL *absoluteSupported);
-    STDMETHOD(COMGETTER(RelativeSupported)) (BOOL *relativeSupported);
-    STDMETHOD(COMGETTER(MultiTouchSupported)) (BOOL *multiTouchSupported);
-    STDMETHOD(COMGETTER(NeedsHostCursor)) (BOOL *needsHostCursor);
-
-    // IMouse methods
-    STDMETHOD(PutMouseEvent)(LONG dx, LONG dy, LONG dz, LONG dw,
-                             LONG buttonState);
-    STDMETHOD(PutMouseEventAbsolute)(LONG x, LONG y, LONG dz, LONG dw,
-                                     LONG buttonState);
-    STDMETHOD(PutEventMultiTouch)(LONG aCount, ComSafeArrayIn(LONG64, aContacts), ULONG aScanTime);
-    STDMETHOD(PutEventMultiTouchString)(LONG aCount, IN_BSTR aContacts, ULONG aScanTime);
-    STDMETHOD(COMGETTER(EventSource)) (IEventSource ** aEventSource);
-
     static const PDMDRVREG  DrvReg;
 
-    ConsoleMouseInterface *getParent() const
+    ConsoleMouseInterface *i_getParent() const
     {
         return mParent;
@@ -78,40 +52,66 @@
 
     /** notify the front-end of guest capability changes */
-    void onVMMDevGuestCapsChange(uint32_t fCaps)
+    void i_onVMMDevGuestCapsChange(uint32_t fCaps)
     {
         mfVMMDevGuestCaps = fCaps;
-        sendMouseCapsNotifications();
+        i_sendMouseCapsNotifications();
     }
 
 private:
 
-    static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
-    static DECLCALLBACK(void)   mouseReportModes (PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs, bool fMT);
-    static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
-    static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
+    // Wrapped IMouse properties
+    HRESULT getAbsoluteSupported(BOOL *aAbsoluteSupported);
+    HRESULT getRelativeSupported(BOOL *aRelativeSupported);
+    HRESULT getMultiTouchSupported(BOOL *aMultiTouchSupported);
+    HRESULT getNeedsHostCursor(BOOL *aNeedsHostCursor);
+    HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
 
-    HRESULT updateVMMDevMouseCaps(uint32_t fCapsAdded, uint32_t fCapsRemoved);
-    HRESULT reportRelEventToMouseDev(int32_t dx, int32_t dy, int32_t dz,
+    // Wrapped IMouse methods
+    HRESULT putMouseEvent(LONG aDx,
+                          LONG aDy,
+                          LONG aDz,
+                          LONG aDw,
+                          LONG aButtonState);
+    HRESULT putMouseEventAbsolute(LONG aX,
+                                  LONG aY,
+                                  LONG aDz,
+                                  LONG aDw,
+                                  LONG aButtonState);
+    HRESULT putEventMultiTouch(LONG aCount,
+                               const std::vector<LONG64> &aContacts,
+                               ULONG aScanTime);
+    HRESULT putEventMultiTouchString(LONG aCount,
+                                     const com::Utf8Str &aContacts,
+                                     ULONG aScanTime);
+
+
+    static DECLCALLBACK(void *) i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
+    static DECLCALLBACK(void)   i_mouseReportModes(PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs, bool fMT);
+    static DECLCALLBACK(int)    i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
+    static DECLCALLBACK(void)   i_drvDestruct(PPDMDRVINS pDrvIns);
+
+    HRESULT i_updateVMMDevMouseCaps(uint32_t fCapsAdded, uint32_t fCapsRemoved);
+    HRESULT i_reportRelEventToMouseDev(int32_t dx, int32_t dy, int32_t dz,
                                  int32_t dw, uint32_t fButtons);
-    HRESULT reportAbsEventToMouseDev(int32_t x, int32_t y, int32_t dz,
+    HRESULT i_reportAbsEventToMouseDev(int32_t x, int32_t y, int32_t dz,
                                      int32_t dw, uint32_t fButtons);
-    HRESULT reportMTEventToMouseDev(int32_t x, int32_t z, uint32_t cContact,
+    HRESULT i_reportMTEventToMouseDev(int32_t x, int32_t z, uint32_t cContact,
                                     uint32_t fContact);
-    HRESULT reportMultiTouchEventToDevice(uint8_t cContacts, const uint64_t *pau64Contacts, uint32_t u32ScanTime);
-    HRESULT reportAbsEventToVMMDev(int32_t x, int32_t y);
-    HRESULT reportAbsEvent(int32_t x, int32_t y, int32_t dz, int32_t dw,
-                           uint32_t fButtons, bool fUsesVMMDevEvent);
-    HRESULT convertDisplayRes(LONG x, LONG y, int32_t *pxAdj, int32_t *pyAdj,
-                              bool *pfValid);
-    HRESULT putEventMultiTouch(LONG aCount, LONG64 *paContacts, ULONG aScanTime);
+    HRESULT i_reportMultiTouchEventToDevice(uint8_t cContacts, const uint64_t *pau64Contacts, uint32_t u32ScanTime);
+    HRESULT i_reportAbsEventToVMMDev(int32_t x, int32_t y);
+    HRESULT i_reportAbsEvent(int32_t x, int32_t y, int32_t dz, int32_t dw,
+                             uint32_t fButtons, bool fUsesVMMDevEvent);
+    HRESULT i_convertDisplayRes(LONG x, LONG y, int32_t *pxAdj, int32_t *pyAdj,
+                                 bool *pfValid);
+    HRESULT i_putEventMultiTouch(LONG aCount, LONG64 *paContacts, ULONG aScanTime);
 
-    void getDeviceCaps(bool *pfAbs, bool *pfRel, bool *fMT);
-    void sendMouseCapsNotifications(void);
-    bool guestNeedsHostCursor(void);
-    bool vmmdevCanAbs(void);
-    bool deviceCanAbs(void);
-    bool supportsAbs(void);
-    bool supportsRel(void);
-    bool supportsMT(void);
+    void i_getDeviceCaps(bool *pfAbs, bool *pfRel, bool *fMT);
+    void i_sendMouseCapsNotifications(void);
+    bool i_guestNeedsHostCursor(void);
+    bool i_vmmdevCanAbs(void);
+    bool i_deviceCanAbs(void);
+    bool i_supportsAbs(void);
+    bool i_supportsRel(void);
+    bool i_supportsMT(void);
 
     ConsoleMouseInterface * const         mParent;
@@ -127,10 +127,10 @@
     VBoxEventDesc                mMouseEvent;
 
-    void fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw,
-                        LONG fButtons);
+    void i_fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw,
+                          LONG fButtons);
 
-    void fireMultiTouchEvent(uint8_t cContacts,
-                             const LONG64 *paContacts,
-                             uint32_t u32ScanTime);
+    void i_fireMultiTouchEvent(uint8_t cContacts,
+                               const LONG64 *paContacts,
+                               uint32_t u32ScanTime);
 };
 
Index: /trunk/src/VBox/Main/src-client/MouseImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/MouseImpl.cpp	(revision 50588)
+++ /trunk/src/VBox/Main/src-client/MouseImpl.cpp	(revision 50589)
@@ -156,6 +156,6 @@
  * thus to the guest.
  * @note all calls out of this object are made with no locks held! */
-HRESULT Mouse::updateVMMDevMouseCaps(uint32_t fCapsAdded,
-                                     uint32_t fCapsRemoved)
+HRESULT Mouse::i_updateVMMDevMouseCaps(uint32_t fCapsAdded,
+                                       uint32_t fCapsRemoved)
 {
     VMMDevMouseInterface *pVMMDev = mParent->getVMMDevMouseInterface();
@@ -179,13 +179,7 @@
  * @param absoluteSupported address of result variable
  */
-STDMETHODIMP Mouse::COMGETTER(AbsoluteSupported) (BOOL *absoluteSupported)
-{
-    if (!absoluteSupported)
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    *absoluteSupported = supportsAbs();
+HRESULT Mouse::getAbsoluteSupported(BOOL *aAbsoluteSupported)
+{
+    *aAbsoluteSupported = i_supportsAbs();
     return S_OK;
 }
@@ -198,13 +192,8 @@
  * @param relativeSupported address of result variable
  */
-STDMETHODIMP Mouse::COMGETTER(RelativeSupported) (BOOL *relativeSupported)
-{
-    if (!relativeSupported)
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    *relativeSupported = supportsRel();
+HRESULT Mouse::getRelativeSupported(BOOL *aRelativeSupported)
+{
+
+    *aRelativeSupported = i_supportsRel();
     return S_OK;
 }
@@ -217,13 +206,8 @@
  * @param multiTouchSupported address of result variable
  */
-STDMETHODIMP Mouse::COMGETTER(MultiTouchSupported) (BOOL *multiTouchSupported)
-{
-    if (!multiTouchSupported)
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    *multiTouchSupported = supportsMT();
+HRESULT Mouse::getMultiTouchSupported(BOOL *aMultiTouchSupported)
+{
+
+    *aMultiTouchSupported = i_supportsMT();
     return S_OK;
 }
@@ -236,13 +220,8 @@
  * @param pfNeedsHostCursor address of result variable
  */
-STDMETHODIMP Mouse::COMGETTER(NeedsHostCursor) (BOOL *pfNeedsHostCursor)
-{
-    if (!pfNeedsHostCursor)
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    *pfNeedsHostCursor = guestNeedsHostCursor();
+HRESULT Mouse::getNeedsHostCursor(BOOL *aNeedsHostCursor)
+{
+
+    *aNeedsHostCursor = i_guestNeedsHostCursor();
     return S_OK;
 }
@@ -254,5 +233,5 @@
  * held down from the format used by the front-end to the format used by PDM
  * and the emulated pointing devices. */
-static uint32_t mouseButtonsToPDM(LONG buttonState)
+static uint32_t i_mouseButtonsToPDM(LONG buttonState)
 {
     uint32_t fButtons = 0;
@@ -270,14 +249,8 @@
 }
 
-STDMETHODIMP Mouse::COMGETTER(EventSource)(IEventSource ** aEventSource)
-{
-    CheckComArgOutPointerValid(aEventSource);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
+HRESULT Mouse::getEventSource(ComPtr<IEventSource> &aEventSource)
+{
     // no need to lock - lifetime constant
-    mEventSource.queryInterfaceTo(aEventSource);
-
+    mEventSource.queryInterfaceTo(aEventSource.asOutParam());
     return S_OK;
 }
@@ -289,6 +262,6 @@
  * @returns   COM status code
  */
-HRESULT Mouse::reportRelEventToMouseDev(int32_t dx, int32_t dy, int32_t dz,
-                                        int32_t dw, uint32_t fButtons)
+HRESULT Mouse::i_reportRelEventToMouseDev(int32_t dx, int32_t dy, int32_t dz,
+                                          int32_t dw, uint32_t fButtons)
 {
     if (dx || dy || dz || dw || fButtons != mfLastButtons)
@@ -325,6 +298,6 @@
  * @returns   COM status code
  */
-HRESULT Mouse::reportAbsEventToMouseDev(int32_t x, int32_t y,
-                                        int32_t dz, int32_t dw, uint32_t fButtons)
+HRESULT Mouse::i_reportAbsEventToMouseDev(int32_t x, int32_t y,
+                                          int32_t dz, int32_t dw, uint32_t fButtons)
 {
     if (   x < VMMDEV_MOUSE_RANGE_MIN
@@ -362,7 +335,7 @@
 }
 
-HRESULT Mouse::reportMultiTouchEventToDevice(uint8_t cContacts,
-                                             const uint64_t *pau64Contacts,
-                                             uint32_t u32ScanTime)
+HRESULT Mouse::i_reportMultiTouchEventToDevice(uint8_t cContacts,
+                                               const uint64_t *pau64Contacts,
+                                               uint32_t u32ScanTime)
 {
     HRESULT hrc = S_OK;
@@ -407,5 +380,5 @@
  * @returns   COM status code
  */
-HRESULT Mouse::reportAbsEventToVMMDev(int32_t x, int32_t y)
+HRESULT Mouse::i_reportAbsEventToVMMDev(int32_t x, int32_t y)
 {
     VMMDevMouseInterface *pVMMDev = mParent->getVMMDevMouseInterface();
@@ -433,7 +406,7 @@
  * @returns   COM status code
  */
-HRESULT Mouse::reportAbsEvent(int32_t x, int32_t y,
-                              int32_t dz, int32_t dw, uint32_t fButtons,
-                              bool fUsesVMMDevEvent)
+HRESULT Mouse::i_reportAbsEvent(int32_t x, int32_t y,
+                                int32_t dz, int32_t dw, uint32_t fButtons,
+                                bool fUsesVMMDevEvent)
 {
     HRESULT rc;
@@ -443,5 +416,5 @@
     LONG cJiggle = 0;
 
-    if (vmmdevCanAbs())
+    if (i_vmmdevCanAbs())
     {
         /*
@@ -450,11 +423,11 @@
         if (x != mcLastX || y != mcLastY)
         {
-            rc = reportAbsEventToVMMDev(x, y);
+            rc = i_reportAbsEventToVMMDev(x, y);
             cJiggle = !fUsesVMMDevEvent;
         }
-        rc = reportRelEventToMouseDev(cJiggle, 0, dz, dw, fButtons);
+        rc = i_reportRelEventToMouseDev(cJiggle, 0, dz, dw, fButtons);
     }
     else
-        rc = reportAbsEventToMouseDev(x, y, dz, dw, fButtons);
+        rc = i_reportAbsEventToMouseDev(x, y, dz, dw, fButtons);
 
     mcLastX = x;
@@ -463,6 +436,6 @@
 }
 
-void Mouse::fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw,
-                           LONG fButtons)
+void Mouse::i_fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw,
+                             LONG fButtons)
 {
     /* If mouse button is pressed, we generate new event, to avoid reusable events coalescing and thus
@@ -489,7 +462,7 @@
 }
 
-void Mouse::fireMultiTouchEvent(uint8_t cContacts,
-                                const LONG64 *paContacts,
-                                uint32_t u32ScanTime)
+void Mouse::i_fireMultiTouchEvent(uint8_t cContacts,
+                                  const LONG64 *paContacts,
+                                  uint32_t u32ScanTime)
 {
     com::SafeArray<SHORT> xPositions(cContacts);
@@ -528,22 +501,20 @@
  * @param fButtons    The mouse button state
  */
-STDMETHODIMP Mouse::PutMouseEvent(LONG dx, LONG dy, LONG dz, LONG dw,
-                                  LONG fButtons)
+HRESULT Mouse::putMouseEvent(LONG dx, LONG dy, LONG dz, LONG dw,
+                             LONG aButtonState)
 {
     HRESULT rc;
     uint32_t fButtonsAdj;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     LogRel3(("%s: dx=%d, dy=%d, dz=%d, dw=%d\n", __PRETTY_FUNCTION__,
                  dx, dy, dz, dw));
 
-    fButtonsAdj = mouseButtonsToPDM(fButtons);
+    fButtonsAdj = i_mouseButtonsToPDM(aButtonState);
     /* Make sure that the guest knows that we are sending real movement
      * events to the PS/2 device and not just dummy wake-up ones. */
-    updateVMMDevMouseCaps(0, VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE);
-    rc = reportRelEventToMouseDev(dx, dy, dz, dw, fButtonsAdj);
-
-    fireMouseEvent(false, dx, dy, dz, dw, fButtons);
+    i_updateVMMDevMouseCaps(0, VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE);
+    rc = i_reportRelEventToMouseDev(dx, dy, dz, dw, fButtonsAdj);
+
+    i_fireMouseEvent(false, dx, dy, dz, dw, aButtonState);
 
     return rc;
@@ -565,6 +536,6 @@
  * @returns   COM status value
  */
-HRESULT Mouse::convertDisplayRes(LONG x, LONG y, int32_t *pxAdj, int32_t *pyAdj,
-                                 bool *pfValid)
+HRESULT Mouse::i_convertDisplayRes(LONG x, LONG y, int32_t *pxAdj, int32_t *pyAdj,
+                                   bool *pfValid)
 {
     AssertPtrReturn(pxAdj, E_POINTER);
@@ -629,12 +600,9 @@
  * @param fButtons   The mouse button state
  */
-STDMETHODIMP Mouse::PutMouseEventAbsolute(LONG x, LONG y, LONG dz, LONG dw,
-                                          LONG fButtons)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
+HRESULT Mouse::putMouseEventAbsolute(LONG x, LONG y, LONG dz, LONG dw,
+                                     LONG aButtonState)
+{
     LogRel3(("%s: x=%d, y=%d, dz=%d, dw=%d, fButtons=0x%x\n",
-             __PRETTY_FUNCTION__, x, y, dz, dw, fButtons));
+             __PRETTY_FUNCTION__, x, y, dz, dw, aButtonState));
 
     int32_t xAdj, yAdj;
@@ -645,19 +613,19 @@
     /** @note Or maybe not... races are pretty inherent in everything done in
      *        this object and not really bad as far as I can see. */
-    HRESULT rc = convertDisplayRes(x, y, &xAdj, &yAdj, &fValid);
+    HRESULT rc = i_convertDisplayRes(x, y, &xAdj, &yAdj, &fValid);
     if (FAILED(rc)) return rc;
 
-    fButtonsAdj = mouseButtonsToPDM(fButtons);
+    fButtonsAdj = i_mouseButtonsToPDM(aButtonState);
     /* If we are doing old-style (IRQ-less) absolute reporting to the VMM
      * device then make sure the guest is aware of it, so that it knows to
      * ignore relative movement on the PS/2 device. */
-    updateVMMDevMouseCaps(VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE, 0);
+    i_updateVMMDevMouseCaps(VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE, 0);
     if (fValid)
     {
-        rc = reportAbsEvent(xAdj, yAdj, dz, dw, fButtonsAdj,
-                            RT_BOOL(  mfVMMDevGuestCaps
-                                    & VMMDEV_MOUSE_NEW_PROTOCOL));
-
-        fireMouseEvent(true, x, y, dz, dw, fButtons);
+        rc = i_reportAbsEvent(xAdj, yAdj, dz, dw, fButtonsAdj,
+                              RT_BOOL(  mfVMMDevGuestCaps
+                                      & VMMDEV_MOUSE_NEW_PROTOCOL));
+
+        i_fireMouseEvent(true, x, y, dz, dw, aButtonState);
     }
 
@@ -674,12 +642,9 @@
  * @param aScanTime  Timestamp.
  */
-STDMETHODIMP Mouse::PutEventMultiTouch(LONG aCount,
-                                       ComSafeArrayIn(LONG64, aContacts),
-                                       ULONG aScanTime)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    com::SafeArray <LONG64> arrayContacts(ComSafeArrayInArg(aContacts));
+HRESULT Mouse::putEventMultiTouch(LONG aCount,
+                                  const std::vector<LONG64> &aContacts,
+                                  ULONG aScanTime)
+{
+    com::SafeArray <LONG64> arrayContacts(aContacts);
 
     LogRel3(("%s: aCount %d(actual %d), aScanTime %u\n",
@@ -692,5 +657,5 @@
         LONG64* paContacts = arrayContacts.raw();
 
-        rc = putEventMultiTouch(aCount, paContacts, aScanTime);
+        rc = i_putEventMultiTouch(aCount, paContacts, aScanTime);
     }
     else
@@ -710,7 +675,7 @@
  * @param aScanTime  Timestamp.
  */
-STDMETHODIMP Mouse::PutEventMultiTouchString(LONG aCount,
-                                             IN_BSTR aContacts,
-                                             ULONG aScanTime)
+HRESULT Mouse::putEventMultiTouchString(LONG aCount,
+                                        const com::Utf8Str &aContacts,
+                                        ULONG aScanTime)
 {
     /** @todo implement: convert the string to LONG64 array and call putEventMultiTouch. */
@@ -726,7 +691,7 @@
 
 /* Used by PutEventMultiTouch and PutEventMultiTouchString. */
-HRESULT Mouse::putEventMultiTouch(LONG aCount,
-                                  LONG64 *paContacts,
-                                  ULONG aScanTime)
+HRESULT Mouse::i_putEventMultiTouch(LONG aCount,
+                                    LONG64 *paContacts,
+                                    ULONG aScanTime)
 {
     if (aCount >= 256)
@@ -819,8 +784,8 @@
     if (SUCCEEDED(rc))
     {
-        rc = reportMultiTouchEventToDevice(cContacts, cContacts? pau64Contacts: NULL, (uint32_t)aScanTime);
+        rc = i_reportMultiTouchEventToDevice(cContacts, cContacts? pau64Contacts: NULL, (uint32_t)aScanTime);
 
         /* Send the original contact information. */
-        fireMultiTouchEvent(cContacts, cContacts? paContacts: NULL, (uint32_t)aScanTime);
+        i_fireMultiTouchEvent(cContacts, cContacts? paContacts: NULL, (uint32_t)aScanTime);
     }
 
@@ -833,5 +798,5 @@
 /** Does the guest currently rely on the host to draw the mouse cursor or
  * can it switch to doing it itself in software? */
-bool Mouse::guestNeedsHostCursor(void)
+bool Mouse::i_guestNeedsHostCursor(void)
 {
     return RT_BOOL(mfVMMDevGuestCaps & VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR);
@@ -841,5 +806,5 @@
 /** Check what sort of reporting can be done using the devices currently
  * enabled.  Does not consider the VMM device. */
-void Mouse::getDeviceCaps(bool *pfAbs, bool *pfRel, bool *pfMT)
+void Mouse::i_getDeviceCaps(bool *pfAbs, bool *pfRel, bool *pfMT)
 {
     bool fAbsDev = false;
@@ -869,9 +834,9 @@
 
 /** Does the VMM device currently support absolute reporting? */
-bool Mouse::vmmdevCanAbs(void)
+bool Mouse::i_vmmdevCanAbs(void)
 {
     bool fRelDev;
 
-    getDeviceCaps(NULL, &fRelDev, NULL);
+    i_getDeviceCaps(NULL, &fRelDev, NULL);
     return    (mfVMMDevGuestCaps & VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE)
            && fRelDev;
@@ -880,9 +845,9 @@
 
 /** Does the VMM device currently support absolute reporting? */
-bool Mouse::deviceCanAbs(void)
+bool Mouse::i_deviceCanAbs(void)
 {
     bool fAbsDev;
 
-    getDeviceCaps(&fAbsDev, NULL, NULL);
+    i_getDeviceCaps(&fAbsDev, NULL, NULL);
     return fAbsDev;
 }
@@ -890,9 +855,9 @@
 
 /** Can we currently send relative events to the guest? */
-bool Mouse::supportsRel(void)
+bool Mouse::i_supportsRel(void)
 {
     bool fRelDev;
 
-    getDeviceCaps(NULL, &fRelDev, NULL);
+    i_getDeviceCaps(NULL, &fRelDev, NULL);
     return fRelDev;
 }
@@ -900,19 +865,19 @@
 
 /** Can we currently send absolute events to the guest? */
-bool Mouse::supportsAbs(void)
+bool Mouse::i_supportsAbs(void)
 {
     bool fAbsDev;
 
-    getDeviceCaps(&fAbsDev, NULL, NULL);
-    return fAbsDev || vmmdevCanAbs();
+    i_getDeviceCaps(&fAbsDev, NULL, NULL);
+    return fAbsDev || i_vmmdevCanAbs();
 }
 
 
 /** Can we currently send absolute events to the guest? */
-bool Mouse::supportsMT(void)
+bool Mouse::i_supportsMT(void)
 {
     bool fMTDev;
 
-    getDeviceCaps(NULL, NULL, &fMTDev);
+    i_getDeviceCaps(NULL, NULL, &fMTDev);
     return fMTDev;
 }
@@ -922,5 +887,5 @@
  * enabled (including the VMM device) and notify the guest and the front-end.
  */
-void Mouse::sendMouseCapsNotifications(void)
+void Mouse::i_sendMouseCapsNotifications(void)
 {
     bool fAbsDev, fRelDev, fMTDev, fCanAbs, fNeedsHostCursor;
@@ -929,12 +894,12 @@
         AutoReadLock aLock(this COMMA_LOCKVAL_SRC_POS);
 
-        getDeviceCaps(&fAbsDev, &fRelDev, &fMTDev);
-        fCanAbs = supportsAbs();
-        fNeedsHostCursor = guestNeedsHostCursor();
+        i_getDeviceCaps(&fAbsDev, &fRelDev, &fMTDev);
+        fCanAbs = i_supportsAbs();
+        fNeedsHostCursor = i_guestNeedsHostCursor();
     }
     if (fAbsDev)
-        updateVMMDevMouseCaps(VMMDEV_MOUSE_HOST_HAS_ABS_DEV, 0);
+        i_updateVMMDevMouseCaps(VMMDEV_MOUSE_HOST_HAS_ABS_DEV, 0);
     else
-        updateVMMDevMouseCaps(0, VMMDEV_MOUSE_HOST_HAS_ABS_DEV);
+        i_updateVMMDevMouseCaps(0, VMMDEV_MOUSE_HOST_HAS_ABS_DEV);
     /** @todo this call takes the Console lock in order to update the cached
      * callback data atomically.  However I can't see any sign that the cached
@@ -948,5 +913,5 @@
  * A virtual device is notifying us about its current state and capabilities
  */
-DECLCALLBACK(void) Mouse::mouseReportModes(PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs, bool fMT)
+DECLCALLBACK(void) Mouse::i_mouseReportModes(PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs, bool fMT)
 {
     PDRVMAINMOUSE pDrv = RT_FROM_MEMBER(pInterface, DRVMAINMOUSE, IConnector);
@@ -964,5 +929,5 @@
         pDrv->u32DevCaps &= ~MOUSE_DEVCAP_MULTI_TOUCH;
 
-    pDrv->pMouse->sendMouseCapsNotifications();
+    pDrv->pMouse->i_sendMouseCapsNotifications();
 }
 
@@ -971,5 +936,5 @@
  * @interface_method_impl{PDMIBASE,pfnQueryInterface}
  */
-DECLCALLBACK(void *)  Mouse::drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)
+DECLCALLBACK(void *)  Mouse::i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)
 {
     PPDMDRVINS      pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
@@ -988,5 +953,5 @@
  * @param   pDrvIns     The driver instance data.
  */
-DECLCALLBACK(void) Mouse::drvDestruct(PPDMDRVINS pDrvIns)
+DECLCALLBACK(void) Mouse::i_drvDestruct(PPDMDRVINS pDrvIns)
 {
     PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
@@ -1012,5 +977,5 @@
  * @copydoc FNPDMDRVCONSTRUCT
  */
-DECLCALLBACK(int) Mouse::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
+DECLCALLBACK(int) Mouse::i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
 {
     PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
@@ -1030,7 +995,7 @@
      * IBase.
      */
-    pDrvIns->IBase.pfnQueryInterface        = Mouse::drvQueryInterface;
-
-    pThis->IConnector.pfnReportModes        = Mouse::mouseReportModes;
+    pDrvIns->IBase.pfnQueryInterface        = Mouse::i_drvQueryInterface;
+
+    pThis->IConnector.pfnReportModes        = Mouse::i_mouseReportModes;
 
     /*
@@ -1097,7 +1062,7 @@
     sizeof(DRVMAINMOUSE),
     /* pfnConstruct */
-    Mouse::drvConstruct,
+    Mouse::i_drvConstruct,
     /* pfnDestruct */
-    Mouse::drvDestruct,
+    Mouse::i_drvDestruct,
     /* pfnRelocate */
     NULL,
Index: /trunk/src/VBox/Main/src-client/VMMDevInterface.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/VMMDevInterface.cpp	(revision 50588)
+++ /trunk/src/VBox/Main/src-client/VMMDevInterface.cpp	(revision 50589)
@@ -339,5 +339,5 @@
     Mouse *pMouse = pConsole->getMouse();
     if (pMouse)  /** @todo and if not?  Can that actually happen? */
-        pMouse->onVMMDevGuestCapsChange(fNewCaps & VMMDEV_MOUSE_GUEST_MASK);
+        pMouse->i_onVMMDevGuestCapsChange(fNewCaps & VMMDEV_MOUSE_GUEST_MASK);
 }
 
Index: /trunk/src/VBox/Main/src-client/xpcom/module.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/xpcom/module.cpp	(revision 50588)
+++ /trunk/src/VBox/Main/src-client/xpcom/module.cpp	(revision 50589)
@@ -78,6 +78,4 @@
 NS_DECL_CLASSINFO(Keyboard)
 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Keyboard, IKeyboard)
-NS_DECL_CLASSINFO(Mouse)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Mouse, IMouse)
 NS_DECL_CLASSINFO(Display)
 NS_IMPL_THREADSAFE_ISUPPORTS2_CI(Display, IDisplay, IEventListener)
Index: /trunk/src/VBox/Main/testcase/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Main/testcase/Makefile.kmk	(revision 50588)
+++ /trunk/src/VBox/Main/testcase/Makefile.kmk	(revision 50589)
@@ -250,5 +250,8 @@
 	$(VBOX_PATH_SDK)/bindings/xpcom/include/nsprpub \
 	$(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom \
-	$(dir $(VBOX_XML_SCHEMADEFS_H))
+	$(dir $(VBOX_XML_SCHEMADEFS_H)) \
+ 	$(VBOX_MAIN_APIWRAPPER_INCS)
+tstMouse_INTERMEDIATES   = $(VBOX_MAIN_APIWRAPPER_GEN_HDRS)
+
 tstMouseImpl_LIBS      = \
 	$(PATH_STAGE_LIB)/VBoxAPIWrap$(VBOX_SUFF_LIB) \
Index: /trunk/src/VBox/Main/testcase/tstMouseImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/testcase/tstMouseImpl.cpp	(revision 50588)
+++ /trunk/src/VBox/Main/testcase/tstMouseImpl.cpp	(revision 50589)
@@ -30,8 +30,4 @@
 #include <iprt/test.h>
 
-#ifndef RT_OS_WINDOWS
-NS_DECL_CLASSINFO(Mouse)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Mouse, IMouse)
-#endif
 
 PDMIVMMDEVPORT VMMDevPort;
@@ -323,6 +319,6 @@
                                                  PDMIMOUSECONNECTOR_IID);
     pConnector->pfnReportModes(pConnector, true, false, false);
-    pMouse->onVMMDevGuestCapsChange(  VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE
-                                    | VMMDEV_MOUSE_NEW_PROTOCOL);
+    pMouse->i_onVMMDevGuestCapsChange(  VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE
+                                      | VMMDEV_MOUSE_NEW_PROTOCOL);
     pMouse->PutMouseEventAbsolute(0, 0, 0, 0, 0);
     RTTESTI_CHECK_MSG(approxEq(absoluteMouse.x, 0x8000, 200),
@@ -354,5 +350,5 @@
                                                  PDMIMOUSECONNECTOR_IID);
     pConnector->pfnReportModes(pConnector, true, false, false);
-    pMouse->onVMMDevGuestCapsChange(VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE);
+    pMouse->i_onVMMDevGuestCapsChange(VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE);
     pMouse->PutMouseEventAbsolute(320, 240, 0, 0, 0);
     RTTESTI_CHECK_MSG(approxEq(absoluteMouse.x, 0x8000, 200),
@@ -384,5 +380,5 @@
                                                  PDMIMOUSECONNECTOR_IID);
     pConnector->pfnReportModes(pConnector, false, true, false);
-    pMouse->onVMMDevGuestCapsChange(VMMDEV_MOUSE_NEW_PROTOCOL);
+    pMouse->i_onVMMDevGuestCapsChange(VMMDEV_MOUSE_NEW_PROTOCOL);
     pMouse->PutMouseEventAbsolute(0, 0, 0, 0, 0);
     RTTESTI_CHECK_MSG(approxEq(mouseEventAbs.cx, 0x8000, 200),
