VirtualBox

Changeset 47190 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 16, 2013 1:44:46 PM (11 years ago)
Author:
vboxsync
Message:

Main/MouseImpl: restored Mouse test case, not yet building though.

Location:
trunk/src/VBox/Main
Files:
7 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r47174 r47190  
    4949class ExtPackManager;
    5050#endif
     51class VMMDevMouseInterface;
     52class DisplayMouseInterface;
    5153
    5254#include <VBox/RemoteDesktop/VRDE.h>
     
    8991///////////////////////////////////////////////////////////////////////////////
    9092
     93class ConsoleMouseInterface
     94{
     95public:
     96    virtual VMMDevMouseInterface  *getVMMDevMouseInterface()  = 0;
     97    virtual DisplayMouseInterface *getDisplayMouseInterface() = 0;
     98    virtual void onMouseCapabilityChange(BOOL supportsAbsolute,
     99                                         BOOL supportsRelative,
     100                                         BOOL supportsMT,
     101                                         BOOL needsHostCursor) = 0;
     102};
     103
    91104/** IConsole implementation class */
    92105class ATL_NO_VTABLE Console :
    93106    public VirtualBoxBase,
    94     VBOX_SCRIPTABLE_IMPL(IConsole)
     107    VBOX_SCRIPTABLE_IMPL(IConsole), public ConsoleMouseInterface
    95108{
    96109    Q_OBJECT
     
    291304    HRESULT onNATRedirectRuleChange(ULONG ulInstance, BOOL aNatRuleRemove,
    292305                                 NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort);
     306
     307    // Mouse interface
     308    VMMDevMouseInterface *getVMMDevMouseInterface();
     309    DisplayMouseInterface *getDisplayMouseInterface();
    293310
    294311private:
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r46523 r47190  
    104104} DISPLAYFBINFO;
    105105
     106class DisplayMouseInterface
     107{
     108public:
     109    virtual int getScreenResolution(uint32_t cScreen, uint32_t *pcx,
     110                                    uint32_t *pcy, uint32_t *pcBPP) = 0;
     111    virtual void getFramebufferDimensions(int32_t *px1, int32_t *py1,
     112                                          int32_t *px2, int32_t *py2) = 0;
     113};
     114
    106115class ATL_NO_VTABLE Display :
    107116    public VirtualBoxBase,
    108117    VBOX_SCRIPTABLE_IMPL(IEventListener),
    109     VBOX_SCRIPTABLE_IMPL(IDisplay)
     118    VBOX_SCRIPTABLE_IMPL(IDisplay),
     119    public DisplayMouseInterface
    110120{
    111121public:
     
    151161    }
    152162    void getFramebufferDimensions(int32_t *px1, int32_t *py1, int32_t *px2, int32_t *py2);
     163    int getScreenResolution(uint32_t cScreen, uint32_t *pcx, uint32_t *pcy,
     164                            uint32_t *pcBPP)
     165    {
     166        return GetScreenResolution(cScreen, pcx, pcy, pcBPP);
     167    }
    153168
    154169    int  handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect);
  • trunk/src/VBox/Main/include/MouseImpl.h

    r47174 r47190  
    5252
    5353    // public initializer/uninitializer for internal purposes only
    54     HRESULT init(Console *parent);
     54    HRESULT init(ConsoleMouseInterface *parent);
    5555    void uninit();
    5656
     
    7070    static const PDMDRVREG  DrvReg;
    7171
    72     Console *getParent() const
     72    ConsoleMouseInterface *getParent() const
    7373    {
    7474        return mParent;
     
    112112    bool supportsMT(void);
    113113
    114     Console * const         mParent;
     114    ConsoleMouseInterface * const         mParent;
    115115    /** Pointer to the associated mouse driver. */
    116116    struct DRVMAINMOUSE    *mpDrv[MOUSE_MAX_DEVICES];
  • trunk/src/VBox/Main/include/VMMDev.h

    r44528 r47190  
    2424class Console;
    2525
    26 class VMMDev
     26class VMMDevMouseInterface
     27{
     28public:
     29    virtual PPDMIVMMDEVPORT getVMMDevPort() = 0;
     30};
     31
     32class VMMDev : public VMMDevMouseInterface
    2733{
    2834public:
     
    4955    PPDMIVMMDEVPORT getVMMDevPort();
    5056
     57#ifdef VBOX_WITH_HGCM
    5158    int hgcmLoadService (const char *pszServiceLibrary, const char *pszServiceName);
    5259    int hgcmHostCall (const char *pszServiceName, uint32_t u32Function, uint32_t cParms, PVBOXHGCMSVCPARM paParms);
     
    5966
    6067    bool hgcmIsActive (void) { return ASMAtomicReadBool(&m_fHGCMActive); }
     68#endif /* VBOX_WITH_HGCM */
    6169
    6270private:
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r47174 r47190  
    44204420}
    44214421
     4422VMMDevMouseInterface *Console::getVMMDevMouseInterface()
     4423{
     4424    return m_pVMMDev;
     4425}
     4426
     4427DisplayMouseInterface *Console::getDisplayMouseInterface()
     4428{
     4429    return mDisplay;
     4430}
    44224431
    44234432/**
  • trunk/src/VBox/Main/src-client/MouseImpl.cpp

    r47174 r47190  
    100100 * @param parent handle of our parent object
    101101 */
    102 HRESULT Mouse::init (Console *parent)
     102HRESULT Mouse::init (ConsoleMouseInterface *parent)
    103103{
    104104    LogFlowThisFunc(("\n"));
     
    159159                                     uint32_t fCapsRemoved)
    160160{
    161     VMMDev *pVMMDev = mParent->getVMMDev();
     161    VMMDevMouseInterface *pVMMDev = mParent->getVMMDevMouseInterface();
    162162    if (!pVMMDev)
    163163        return E_FAIL;  /* No assertion, as the front-ends can send events
     
    384384HRESULT Mouse::reportAbsEventToVMMDev(int32_t mouseXAbs, int32_t mouseYAbs)
    385385{
    386     VMMDev *pVMMDev = mParent->getVMMDev();
     386    VMMDevMouseInterface *pVMMDev = mParent->getVMMDevMouseInterface();
    387387    ComAssertRet(pVMMDev, E_FAIL);
    388388    PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort();
     
    510510    AssertPtrReturn(pcY, E_POINTER);
    511511    AssertPtrNullReturn(pfValid, E_POINTER);
    512     Display *pDisplay = mParent->getDisplay();
     512    DisplayMouseInterface *pDisplay = mParent->getDisplayMouseInterface();
    513513    ComAssertRet(pDisplay, E_FAIL);
    514514    /** The amount to add to the result (multiplied by the screen width/height)
     
    523523        ULONG displayWidth, displayHeight;
    524524        /* Takes the display lock */
    525         HRESULT rc = pDisplay->GetScreenResolution(0, &displayWidth,
     525        HRESULT rc = pDisplay->getScreenResolution(0, &displayWidth,
    526526                                                   &displayHeight, NULL);
    527527        if (FAILED(rc))
  • trunk/src/VBox/Main/testcase/Makefile.kmk

    r45052 r47190  
    3131        $(if $(VBOX_WITH_RESOURCE_USAGE_API),tstCollector,) \
    3232        $(if $(VBOX_WITH_GUEST_CONTROL),tstGuestCtrlParseBuffer,) \
    33         $(if $(VBOX_WITH_GUEST_CONTROL),tstGuestCtrlContextID,)
     33        $(if $(VBOX_WITH_GUEST_CONTROL),tstGuestCtrlContextID,) \
     34        $(if ,tstMouseImpl,)
    3435  PROGRAMS.linux += \
    3536        $(if $(VBOX_WITH_USB),tstUSBProxyLinux,)
     
    208209
    209210
     211#
     212# tstMouseImpl
     213#
     214# Not yet enabled, as I still haven't managed to wrap everything into the test
     215# case.
     216#
     217tstMouseImpl_TEMPLATE = VBOXMAINCLIENTEXE
     218tstMouseImpl_INST     = $(INST_TESTCASE)
     219tstMouseImpl_SOURCES  = \
     220        tstMouseImpl.cpp \
     221        ../src-client/MouseImpl.cpp \
     222        ../src-all/EventImpl.cpp \
     223        ../src-all/VirtualBoxBase.cpp
     224tstMouseImpl_INCS     = ../include \
     225        $(dir $(VBOX_XML_SCHEMADEFS_H))
     226tstMouseImpl_LIBS     = $(PATH_STAGE_LIB)/VBoxAPIWrap$(VBOX_SUFF_LIB)
     227
     228
    210229# generate rules.
    211230include $(FILE_KBUILD_SUB_FOOTER)
  • trunk/src/VBox/Main/testcase/tstMouseImpl.cpp

    • Property svn:mergeinfo set to (toggle deleted branches)
      /branches/VBox-3.0/src/VBox/Frontends/VBoxBFE/testcase/tstMouseImpl.cpp58652,​70973
      /branches/VBox-3.2/src/VBox/Frontends/VBoxBFE/testcase/tstMouseImpl.cpp66309,​66318
      /branches/VBox-4.0/src/VBox/Frontends/VBoxBFE/testcase/tstMouseImpl.cpp70873
      /branches/VBox-4.1/src/VBox/Frontends/VBoxBFE/testcase/tstMouseImpl.cpp74233,​78414,​78691,​81841,​82127
      /branches/VBox-4.1/src/VBox/Frontends/VBoxHeadless/VBoxBFE/testcase/tstMouseImpl.cpp82454
      /branches/andy/guestctrl20/src/VBox/Frontends/VBoxBFE/testcase/tstMouseImpl.cpp78916,​78930
      /branches/dsen/gui/src/VBox/Frontends/VBoxBFE/testcase/tstMouseImpl.cpp79076-79078,​79089,​79109-79110,​79112-79113,​79127-79130,​79134,​79141,​79151,​79155,​79157-79159,​79193,​79197
      /branches/dsen/gui2/src/VBox/Frontends/VBoxBFE/testcase/tstMouseImpl.cpp79224,​79228,​79233,​79235,​79258,​79262-79263,​79273,​79341,​79345,​79354,​79357,​79387-79388,​79559-79569,​79572-79573,​79578,​79581-79582,​79590-79591,​79598-79599,​79602-79603,​79605-79606,​79632,​79635,​79637,​79644
      /branches/dsen/gui3/src/VBox/Frontends/VBoxBFE/testcase/tstMouseImpl.cpp79645-79692
    r44579 r47190  
    2929#include <iprt/test.h>
    3030
    31 /******************************************************************************
    32 *   Test infrastructure                                                       *
    33 ******************************************************************************/
    34 
    35 class TestConsole : public Console
     31NS_DECL_CLASSINFO(Mouse)
     32NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Mouse, IMouse)
     33
     34PDMIVMMDEVPORT VMMDevPort;
     35
     36class TestVMMDev : public VMMDevMouseInterface
     37{
     38    PPDMIVMMDEVPORT getVMMDevPort(void) { return &VMMDevPort; }
     39};
     40
     41class TestDisplay : public DisplayMouseInterface
     42{
     43    void getFramebufferDimensions(int32_t *px1, int32_t *py1,
     44                                  int32_t *px2, int32_t *py2);
     45    int getScreenResolution(uint32_t cScreen, uint32_t *pcx, uint32_t *pcy,
     46                            uint32_t *pcBPP);
     47};
     48
     49class TestConsole : public ConsoleMouseInterface
    3650{
    3751public:
    38     TestConsole() {}
    39     ~TestConsole() {}
    40 
    41     virtual void     updateTitlebar() {}
    42     virtual void     updateTitlebarProgress(const char *, int) {}
    43 
    44     virtual void     inputGrabStart() {}
    45     virtual void     inputGrabEnd() {}
    46 
    47     virtual void     mouseSendEvent(int) {}
    48     virtual void     onMousePointerShapeChange(bool, bool, uint32_t,
    49                                                uint32_t, uint32_t,
    50                                                uint32_t, void *) {}
    51     virtual void     progressInfo(PVM, unsigned, void *) {}
    52 
    53     virtual CONEVENT eventWait()
    54     {
    55         AssertFailedReturn(CONEVENT_QUIT);
    56     }
    57     virtual void     eventQuit() {}
    58     virtual void     resetCursor() {}
    59     virtual void     resetKeys(void) {}
    60     virtual VMMDev   *getVMMDev()
    61     {
    62         return &mVMMDev;
    63     }
    64     virtual Display  *getDisplay()
    65     {
    66         return &mDisplay;
    67     }
     52    VMMDevMouseInterface *getVMMDevMouseInterface() { return &mVMMDev; }
     53    DisplayMouseInterface *getDisplayMouseInterface() { return &mDisplay; }
     54    /** @todo why on earth is this not implemented? */
     55    void onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative,
     56                                 BOOL supportsMT, BOOL needsHostCursor) {}
    6857
    6958private:
    70     VMMDev mVMMDev;
    71     Display mDisplay;
     59    TestVMMDev mVMMDev;
     60    TestDisplay mDisplay;
    7261};
    7362
     
    147136static struct PDMDRVINS *ppdmdrvIns = NULL;
    148137
    149 PDMIVMMDEVPORT VMMDevPort;
    150138Mouse *pMouse;
    151 Console *pConsole;
     139ConsoleMouseInterface *pConsole;
    152140
    153141static struct
     
    169157}
    170158
    171 PPDMIVMMDEVPORT VMMDev::getVMMDevPort(void)
    172 {
    173     return &VMMDevPort;
    174 }
    175 
    176 VMMDev::VMMDev() {}
    177 
    178 VMMDev::~VMMDev() {}
    179 
    180 void Display::getFramebufferDimensions(int32_t *px1, int32_t *py1,
    181                                        int32_t *px2, int32_t *py2)
     159void TestDisplay::getFramebufferDimensions(int32_t *px1, int32_t *py1,
     160                                           int32_t *px2, int32_t *py2)
    182161{
    183162    if (px1)
     
    191170}
    192171
    193 STDMETHODIMP Display::GetScreenResolution(ULONG aScreenId,
    194                                           ULONG *aWidth,
    195                                           ULONG *aHeight,
    196                                           ULONG *aBitsPerPixel)
    197 {
    198     if (aWidth)
    199         *aWidth = 640;
    200     if (aHeight)
    201         *aHeight = 480;
    202     if (aBitsPerPixel)
    203         *aBitsPerPixel = 32;
     172int TestDisplay::getScreenResolution(uint32_t cScreen, uint32_t *pcx,
     173                                     uint32_t *pcy, uint32_t *pcBPP)
     174{
     175    NOREF(cScreen);
     176    if (pcx)
     177        *pcx = 640;
     178    if (pcy)
     179        *pcy = 480;
     180    if (pcBPP)
     181        *pcBPP = 32;
    204182    return S_OK;
    205183}
    206 
    207 Display::Display() {}
    208 
    209 Display::~Display() {}
    210184
    211185DECLEXPORT(bool) CFGMR3AreValuesValid(PCFGMNODE, const char *)
     
    261235    pConnector = (PPDMIMOUSECONNECTOR)pBase->pfnQueryInterface(pBase,
    262236                                                 PDMIMOUSECONNECTOR_IID);
    263     pConnector->pfnReportModes(pConnector, true, false);
     237    pConnector->pfnReportModes(pConnector, true, false, false);
    264238    pMouse->onVMMDevGuestCapsChange(  VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE
    265239                                    | VMMDEV_MOUSE_NEW_PROTOCOL);
     
    292266    pConnector = (PPDMIMOUSECONNECTOR)pBase->pfnQueryInterface(pBase,
    293267                                                 PDMIMOUSECONNECTOR_IID);
    294     pConnector->pfnReportModes(pConnector, true, false);
     268    pConnector->pfnReportModes(pConnector, true, false, false);
    295269    pMouse->onVMMDevGuestCapsChange(VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE);
    296270    pMouse->PutMouseEventAbsolute(320, 240, 0, 0, 0);
     
    322296    pConnector = (PPDMIMOUSECONNECTOR)pBase->pfnQueryInterface(pBase,
    323297                                                 PDMIMOUSECONNECTOR_IID);
    324     pConnector->pfnReportModes(pConnector, false, true);
     298    pConnector->pfnReportModes(pConnector, false, true, false);
    325299    pMouse->onVMMDevGuestCapsChange(  VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE
    326300                                    | VMMDEV_MOUSE_NEW_PROTOCOL);
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