VirtualBox

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

Last change on this file since 95395 was 95395, checked in by vboxsync, 2 years ago

Main/Mouse+SystemProperties+Settings: Forgotten important pieces of TouchPad support. bugref:9891

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