VirtualBox

source: vbox/trunk/src/VBox/Main/include/MouseImpl.h@ 30760

Last change on this file since 30760 was 30760, checked in by vboxsync, 15 years ago

Main: separate internal machine data structs into MachineImplPrivate.h to significantly speed up compilation and for better interface separation; remove obsolete ConsoleEvents.h file

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1/* $Id: MouseImpl.h 30760 2010-07-09 13:12:04Z vboxsync $ */
2/** @file
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2008 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ____H_MOUSEIMPL
19#define ____H_MOUSEIMPL
20
21#include "VirtualBoxBase.h"
22#include <VBox/pdmdrv.h>
23
24/** Maximum number of devices supported */
25enum { MOUSE_MAX_DEVICES = 3 };
26/** Mouse driver instance data. */
27typedef struct DRVMAINMOUSE DRVMAINMOUSE, *PDRVMAINMOUSE;
28
29class Console;
30
31class ATL_NO_VTABLE Mouse :
32 public VirtualBoxBase
33#ifndef VBOXBFE_WITHOUT_COM
34 , VBOX_SCRIPTABLE_IMPL(IMouse)
35#endif
36{
37public:
38
39 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Mouse, IMouse)
40
41 DECLARE_NOT_AGGREGATABLE(Mouse)
42
43 DECLARE_PROTECT_FINAL_CONSTRUCT()
44
45 BEGIN_COM_MAP(Mouse)
46 COM_INTERFACE_ENTRY (ISupportErrorInfo)
47 COM_INTERFACE_ENTRY (IMouse)
48 COM_INTERFACE_ENTRY2 (IDispatch, IMouse)
49 END_COM_MAP()
50
51 DECLARE_EMPTY_CTOR_DTOR (Mouse)
52
53 HRESULT FinalConstruct();
54 void FinalRelease();
55
56 // public initializer/uninitializer for internal purposes only
57 HRESULT init(Console *parent);
58 void uninit();
59
60 // IMouse properties
61 STDMETHOD(COMGETTER(AbsoluteSupported)) (BOOL *absoluteSupported);
62 STDMETHOD(COMGETTER(RelativeSupported)) (BOOL *relativeSupported);
63 STDMETHOD(COMGETTER(NeedsHostCursor)) (BOOL *needsHostCursor);
64
65 // IMouse methods
66 STDMETHOD(PutMouseEvent)(LONG dx, LONG dy, LONG dz, LONG dw,
67 LONG buttonState);
68 STDMETHOD(PutMouseEventAbsolute)(LONG x, LONG y, LONG dz, LONG dw,
69 LONG buttonState);
70
71 static const PDMDRVREG DrvReg;
72
73 Console *getParent() const
74 {
75 return mParent;
76 }
77
78 // for VMMDevInterface
79 void onVMMDevCanAbsChange(bool)
80 {
81 sendMouseCapsNotifications();
82 }
83
84 void onVMMDevNeedsHostChange(bool needsHost)
85 {
86 fVMMDevNeedsHostCursor = needsHost;
87 sendMouseCapsNotifications();
88 }
89
90private:
91
92 static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
93 static DECLCALLBACK(void) mouseReportModes (PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs);
94 static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
95 static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
96
97 HRESULT getVMMDevMouseCaps(uint32_t *pfCaps);
98 HRESULT setVMMDevMouseCaps(uint32_t fCaps);
99 HRESULT reportRelEventToMouseDev(int32_t dx, int32_t dy, int32_t dz,
100 int32_t dw, uint32_t fButtons);
101 HRESULT reportAbsEventToMouseDev(uint32_t mouseXAbs, uint32_t mouseYAbs,
102 int32_t dz, int32_t dw, uint32_t fButtons);
103 HRESULT reportAbsEventToVMMDev(uint32_t mouseXAbs, uint32_t mouseYAbs);
104 HRESULT convertDisplayWidth(LONG x, uint32_t *pcX);
105 HRESULT convertDisplayHeight(LONG y, uint32_t *pcY);
106
107 void sendMouseCapsNotifications(void);
108
109#ifdef VBOXBFE_WITHOUT_COM
110 Console *mParent;
111#else
112 Console * const mParent;
113#endif
114 /** Pointer to the associated mouse driver. */
115 struct DRVMAINMOUSE *mpDrv[MOUSE_MAX_DEVICES];
116
117 LONG uHostCaps;
118 bool fVMMDevCanAbs;
119 bool fVMMDevNeedsHostCursor;
120 uint32_t mLastAbsX;
121 uint32_t mLastAbsY;
122 uint32_t mLastButtons;
123};
124
125#ifdef VBOXBFE_WITHOUT_COM
126/** @todo make this a member of Console */
127extern Mouse *gMouse;
128
129/** @todo can we get these from the API somehow? */
130enum
131{
132 MouseButtonState_LeftButton = 1,
133 MouseButtonState_RightButton = 2,
134 MouseButtonState_MiddleButton = 4,
135 MouseButtonState_XButton1 = 8,
136 MouseButtonState_XButton2 = 16,
137};
138#endif
139
140#endif // !____H_MOUSEIMPL
141/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette