VirtualBox

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

Last change on this file since 75488 was 69500, checked in by vboxsync, 7 years ago

*: scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.7 KB
Line 
1/* $Id: MouseImpl.h 69500 2017-10-28 15:14:05Z vboxsync $ */
2/** @file
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2017 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 "MouseWrap.h"
22#include "ConsoleImpl.h"
23#include "EventImpl.h"
24#include <VBox/vmm/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 MouseWrap
33{
34public:
35
36 DECLARE_EMPTY_CTOR_DTOR (Mouse)
37
38 HRESULT FinalConstruct();
39 void FinalRelease();
40
41 // public initializer/uninitializer for internal purposes only
42 HRESULT init(ConsoleMouseInterface *parent);
43 void uninit();
44
45 static const PDMDRVREG DrvReg;
46
47 ConsoleMouseInterface *i_getParent() const
48 {
49 return mParent;
50 }
51
52 /** notify the front-end of guest capability changes */
53 void i_onVMMDevGuestCapsChange(uint32_t fCaps)
54 {
55 mfVMMDevGuestCaps = fCaps;
56 i_sendMouseCapsNotifications();
57 }
58
59 void updateMousePointerShape(bool fVisible, bool fAlpha,
60 uint32_t hotX, uint32_t hotY,
61 uint32_t width, uint32_t height,
62 const uint8_t *pu8Shape, uint32_t cbShape);
63private:
64
65 // Wrapped IMouse properties
66 HRESULT getAbsoluteSupported(BOOL *aAbsoluteSupported);
67 HRESULT getRelativeSupported(BOOL *aRelativeSupported);
68 HRESULT getMultiTouchSupported(BOOL *aMultiTouchSupported);
69 HRESULT getNeedsHostCursor(BOOL *aNeedsHostCursor);
70 HRESULT getPointerShape(ComPtr<IMousePointerShape> &aPointerShape);
71 HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
72
73 // Wrapped IMouse methods
74 HRESULT putMouseEvent(LONG aDx,
75 LONG aDy,
76 LONG aDz,
77 LONG aDw,
78 LONG aButtonState);
79 HRESULT putMouseEventAbsolute(LONG aX,
80 LONG aY,
81 LONG aDz,
82 LONG aDw,
83 LONG aButtonState);
84 HRESULT putEventMultiTouch(LONG aCount,
85 const std::vector<LONG64> &aContacts,
86 ULONG aScanTime);
87 HRESULT putEventMultiTouchString(LONG aCount,
88 const com::Utf8Str &aContacts,
89 ULONG aScanTime);
90
91
92 static DECLCALLBACK(void *) i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
93 static DECLCALLBACK(void) i_mouseReportModes(PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs, bool fMT);
94 static DECLCALLBACK(int) i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
95 static DECLCALLBACK(void) i_drvDestruct(PPDMDRVINS pDrvIns);
96
97 HRESULT i_updateVMMDevMouseCaps(uint32_t fCapsAdded, uint32_t fCapsRemoved);
98 HRESULT i_reportRelEventToMouseDev(int32_t dx, int32_t dy, int32_t dz,
99 int32_t dw, uint32_t fButtons);
100 HRESULT i_reportAbsEventToMouseDev(int32_t x, int32_t y, int32_t dz,
101 int32_t dw, uint32_t fButtons);
102 HRESULT i_reportMTEventToMouseDev(int32_t x, int32_t z, uint32_t cContact,
103 uint32_t fContact);
104 HRESULT i_reportMultiTouchEventToDevice(uint8_t cContacts, const uint64_t *pau64Contacts, uint32_t u32ScanTime);
105 HRESULT i_reportAbsEventToVMMDev(int32_t x, int32_t y);
106 HRESULT i_reportAbsEventToInputDevices(int32_t x, int32_t y, int32_t dz, int32_t dw, uint32_t fButtons,
107 bool fUsesVMMDevEvent);
108 HRESULT i_reportAbsEventToDisplayDevice(int32_t x, int32_t y);
109 HRESULT i_convertDisplayRes(LONG x, LONG y, int32_t *pxAdj, int32_t *pyAdj,
110 bool *pfValid);
111 HRESULT i_putEventMultiTouch(LONG aCount, const LONG64 *paContacts, ULONG aScanTime);
112
113 void i_getDeviceCaps(bool *pfAbs, bool *pfRel, bool *fMT);
114 void i_sendMouseCapsNotifications(void);
115 bool i_guestNeedsHostCursor(void);
116 bool i_vmmdevCanAbs(void);
117 bool i_deviceCanAbs(void);
118 bool i_supportsAbs(void);
119 bool i_supportsRel(void);
120 bool i_supportsMT(void);
121
122 ConsoleMouseInterface * const mParent;
123 /** Pointer to the associated mouse driver. */
124 struct DRVMAINMOUSE *mpDrv[MOUSE_MAX_DEVICES];
125
126 uint32_t mfVMMDevGuestCaps; /** We cache this to avoid access races */
127 int32_t mcLastX;
128 int32_t mcLastY;
129 uint32_t mfLastButtons;
130
131 ComPtr<IMousePointerShape> mPointerShape;
132 struct
133 {
134 bool fVisible;
135 bool fAlpha;
136 uint32_t hotX;
137 uint32_t hotY;
138 uint32_t width;
139 uint32_t height;
140 uint8_t *pu8Shape;
141 uint32_t cbShape;
142 } mPointerData;
143
144 const ComObjPtr<EventSource> mEventSource;
145 VBoxEventDesc mMouseEvent;
146
147 void i_fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw,
148 LONG fButtons);
149
150 void i_fireMultiTouchEvent(uint8_t cContacts,
151 const LONG64 *paContacts,
152 uint32_t u32ScanTime);
153};
154
155#endif // !____H_MOUSEIMPL
156/* 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