VirtualBox

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

Last change on this file since 32953 was 32829, checked in by vboxsync, 14 years ago

Main/Mouse: Hungarian fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.4 KB
Line 
1/* $Id: MouseImpl.h 32829 2010-09-29 19:35:26Z 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 "ConsoleEvents.h"
23#include "ConsoleImpl.h"
24#include <VBox/pdmdrv.h>
25
26/** Maximum number of devices supported */
27enum { MOUSE_MAX_DEVICES = 3 };
28/** Mouse driver instance data. */
29typedef struct DRVMAINMOUSE DRVMAINMOUSE, *PDRVMAINMOUSE;
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 /** notify the front-end that the guest now supports absolute reporting */
79 void onVMMDevCanAbsChange(bool)
80 {
81 sendMouseCapsNotifications();
82 }
83
84 /** notify the front-end as to whether the guest can start drawing its own
85 * cursor on demand */
86 void onVMMDevNeedsHostChange(bool needsHost)
87 {
88 mfVMMDevNeedsHostCursor = needsHost;
89 sendMouseCapsNotifications();
90 }
91
92private:
93
94 static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
95 static DECLCALLBACK(void) mouseReportModes (PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs);
96 static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
97 static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
98
99 HRESULT getVMMDevMouseCaps(uint32_t *pfCaps);
100 HRESULT setVMMDevMouseCaps(uint32_t fCaps);
101 HRESULT reportRelEventToMouseDev(int32_t dx, int32_t dy, int32_t dz,
102 int32_t dw, uint32_t fButtons);
103 HRESULT reportAbsEventToMouseDev(uint32_t mouseXAbs, uint32_t mouseYAbs,
104 int32_t dz, int32_t dw, uint32_t fButtons);
105 HRESULT reportAbsEventToVMMDev(uint32_t mouseXAbs, uint32_t mouseYAbs);
106 HRESULT reportAbsEvent(uint32_t mouseXAbs, uint32_t mouseYAbs,
107 int32_t dz, int32_t dw, uint32_t fButtons,
108 bool fUsesVMMDevEvent);
109 HRESULT convertDisplayRes(LONG x, LONG y, uint32_t *pcX, uint32_t *pcY);
110
111 void sendMouseCapsNotifications(void);
112
113#ifdef VBOXBFE_WITHOUT_COM
114 Console *mParent;
115#else
116 Console * const mParent;
117#endif
118 /** Pointer to the associated mouse driver. */
119 struct DRVMAINMOUSE *mpDrv[MOUSE_MAX_DEVICES];
120
121 LONG mfHostCaps;
122 bool mfVMMDevCanAbs;
123 bool mfVMMDevNeedsHostCursor;
124 uint32_t mLastAbsX;
125 uint32_t mLastAbsY;
126 uint32_t mLastButtons;
127};
128
129#ifdef VBOXBFE_WITHOUT_COM
130/** @todo make this a member of Console */
131extern Mouse *gMouse;
132
133/** @todo can we get these from the API somehow? */
134enum
135{
136 MouseButtonState_LeftButton = 1,
137 MouseButtonState_RightButton = 2,
138 MouseButtonState_MiddleButton = 4,
139 MouseButtonState_XButton1 = 8,
140 MouseButtonState_XButton2 = 16,
141};
142#endif
143
144#endif // !____H_MOUSEIMPL
145/* 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