MouseImpl.cpp revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
/** @file
*
* VBox frontends: Basic Frontend (BFE):
* Implementation of Mouse class
*/
/*
* Copyright (C) 2006 InnoTek Systemberatung GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
#ifdef VBOXBFE_WITHOUT_COM
# include "COMDefs.h"
#else
#endif
#include "MouseImpl.h"
#include "DisplayImpl.h"
#include "VMMDevInterface.h"
/**
* Mouse driver instance data.
*/
typedef struct DRVMAINMOUSE
{
/** Pointer to the associated mouse driver. */
/** Pointer to the driver instance structure. */
/** Our mouse connector interface. */
/** Converts PDMIMOUSECONNECTOR pointer to a DRVMAINMOUSE pointer. */
#define PDMIMOUSECONNECTOR_2_MAINMOUSE(pInterface) ( (PDRVMAINMOUSE) ((uintptr_t)pInterface - RT_OFFSETOF(DRVMAINMOUSE, Connector)) )
// IMouse methods
/////////////////////////////////////////////////////////////////////////////
{
return S_OK;
}
{
this->fNeedsHostCursor = fNeedsHostCursor;
return S_OK;
}
{
return S_OK;
}
/**
* Send a mouse event.
*
* @returns COM status code
* @param dx X movement
* @param dy Y movement
* @param dz Z movement
* @param buttonState The mouse button state
*/
{
/*
* This method being called implies that the host no
* longer wants to use absolute coordinates. If the VMM
* device isn't aware of that yet, tell it.
*/
{
}
if (VBOX_FAILURE (vrc))
return E_FAIL;
return S_OK;
}
/**
* Send an absolute mouse event to the VM. This only works
* when the required guest support has been installed.
*
* @returns COM status code
* @param x X position (pixel)
* @param y Y position (pixel)
* @param dz Z movement
* @param buttonState The mouse button state
*/
{
/*
* This method being called implies that the host no
* longer wants to use absolute coordinates. If the VMM
* device isn't aware of that yet, tell it.
*/
if (!(mouseCaps & VMMDEV_MOUSEHOSTWANTSABS))
{
}
/*
* Send the absolute mouse position to the VMM device
*/
// check if the guest actually wants absolute mouse positions
{
if (VBOX_FAILURE (vrc))
return E_FAIL;
}
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
/**
* Queries an interface to the driver.
*
* @returns Pointer to interface.
* @returns NULL if the interface was not supported by the driver.
* @param pInterface Pointer to this interface structure.
* @param enmInterface The requested interface identification.
*/
{
switch (enmInterface)
{
case PDMINTERFACE_BASE:
default:
return NULL;
}
}
/**
* Destruct a mouse driver instance.
*
* @returns VBox status.
* @param pDrvIns The driver instance data.
*/
{
//PDRVMAINMOUSE pData = PDMINS2DATA(pDrvIns, PDRVMAINMOUSE);
}
/**
* Construct a mouse driver instance.
*
* @returns VBox status.
* @param pDrvIns The driver instance data.
* If the registration structure is needed, pDrvIns->pDrvReg points to it.
* @param pCfgHandle Configuration node handle for the driver. Use this to obtain the configuration
* of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
* iInstance it's expected to be used a bit in this function.
*/
{
/*
* Validate configuration.
*/
if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
{
AssertMsgFailed(("Configuration error: Not possible to attach anything to this driver!\n"));
return VERR_PDM_DRVINS_NO_ATTACH;
}
/*
* IBase.
*/
/*
*/
pData->pUpPort = (PPDMIMOUSEPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_MOUSE_PORT);
{
AssertMsgFailed(("Configuration error: No mouse port interface above!\n"));
return VERR_PDM_MISSING_INTERFACE_ABOVE;
}
/*
* Get the Mouse object pointer and update the mpDrv member.
*/
void *pv;
if (VBOX_FAILURE(rc))
{
return rc;
}
return VINF_SUCCESS;
}
/**
* Main mouse driver registration record.
*/
{
/* u32Version */
/* szDriverName */
"MainMouse",
/* pszDescription */
"Main mouse driver (Main as in the API).",
/* fFlags */
/* fClass. */
/* cMaxInstances */
~0,
/* cbInstance */
sizeof(DRVMAINMOUSE),
/* pfnConstruct */
/* pfnDestruct */
/* pfnIOCtl */
NULL,
/* pfnPowerOn */
NULL,
/* pfnReset */
NULL,
/* pfnSuspend */
NULL,
/* pfnResume */
NULL,
/* pfnDetach */
};