Changeset 96909 in vbox for trunk/src/VBox/Main
- Timestamp:
- Sep 27, 2022 11:24:45 PM (2 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/MouseImpl.h
r96407 r96909 127 127 HRESULT i_putEventMultiTouch(LONG aCount, const LONG64 *paContacts, BOOL isTouchScreen, ULONG aScanTime); 128 128 129 void i_getDeviceCaps(bool *pfAbs, bool *pfRel, bool *pfTS, bool *pfTP);129 uint32_t i_getDeviceCaps(void); 130 130 void i_sendMouseCapsNotifications(void); 131 131 bool i_guestNeedsHostCursor(void); 132 132 bool i_vmmdevCanAbs(void); 133 133 bool i_deviceCanAbs(void); 134 bool i_supportsAbs(uint32_t fCaps) const; 134 135 bool i_supportsAbs(void); 135 136 bool i_supportsRel(void); -
trunk/src/VBox/Main/src-client/MouseImpl.cpp
r96908 r96909 1006 1006 { 1007 1007 if (aCount >= 256) 1008 { 1009 return E_INVALIDARG; 1010 } 1008 return E_INVALIDARG; 1011 1009 1012 1010 HRESULT hrc = S_OK; … … 1095 1093 } 1096 1094 } 1097 } else { 1095 } 1096 else 1097 { 1098 1098 LONG i; 1099 1099 for (i = 0; i < aCount; i++) … … 1146 1146 1147 1147 1148 /** Check what sort of reporting can be done using the devices currently 1149 * enabled. Does not consider the VMM device. 1150 * 1151 * @param pfAbs supports absolute mouse coordinates. 1152 * @param pfRel supports relative mouse coordinates. 1153 * @param pfTS supports touchscreen. 1154 * @param pfTP supports touchpad. 1155 */ 1156 void Mouse::i_getDeviceCaps(bool *pfAbs, bool *pfRel, bool *pfTS, bool *pfTP) 1157 { 1158 bool fAbsDev = false; 1159 bool fRelDev = false; 1160 bool fTSDev = false; 1161 bool fTPDev = false; 1162 1148 /** 1149 * Gets the combined capabilities of all currently enabled devices. 1150 * 1151 * @returns Combination of MOUSE_DEVCAP_XXX 1152 */ 1153 uint32_t Mouse::i_getDeviceCaps(void) 1154 { 1155 uint32_t fCaps = 0; 1163 1156 AutoReadLock aLock(this COMMA_LOCKVAL_SRC_POS); 1164 1165 1157 for (unsigned i = 0; i < MOUSE_MAX_DEVICES; ++i) 1166 1158 if (mpDrv[i]) 1167 { 1168 if (mpDrv[i]->u32DevCaps & MOUSE_DEVCAP_ABSOLUTE) 1169 fAbsDev = true; 1170 if (mpDrv[i]->u32DevCaps & MOUSE_DEVCAP_RELATIVE) 1171 fRelDev = true; 1172 if (mpDrv[i]->u32DevCaps & MOUSE_DEVCAP_MT_ABSOLUTE) 1173 fTSDev = true; 1174 if (mpDrv[i]->u32DevCaps & MOUSE_DEVCAP_MT_RELATIVE) 1175 fTPDev = true; 1176 } 1177 if (pfAbs) 1178 *pfAbs = fAbsDev; 1179 if (pfRel) 1180 *pfRel = fRelDev; 1181 if (pfTS) 1182 *pfTS = fTSDev; 1183 if (pfTP) 1184 *pfTP = fTPDev; 1159 fCaps |= mpDrv[i]->u32DevCaps; 1160 return fCaps; 1185 1161 } 1186 1162 … … 1189 1165 bool Mouse::i_vmmdevCanAbs(void) 1190 1166 { 1191 bool fRelDev; 1192 1193 i_getDeviceCaps(NULL, &fRelDev, NULL, NULL); 1194 return (mfVMMDevGuestCaps & VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE) 1195 && fRelDev; 1196 } 1197 1198 1199 /** Does the VMM device currently support absolute reporting? */ 1167 /* This requires the VMMDev cap and a relative device, which supposedly 1168 consumes these. As seen in @bugref{10285} this isn't quite as clear cut. */ 1169 return (mfVMMDevGuestCaps & VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE) 1170 && (i_getDeviceCaps() & MOUSE_DEVCAP_RELATIVE); 1171 } 1172 1173 1174 /** Does any device currently support absolute reporting w/o help from VMMDev? */ 1200 1175 bool Mouse::i_deviceCanAbs(void) 1201 1176 { 1202 bool fAbsDev; 1203 1204 i_getDeviceCaps(&fAbsDev, NULL, NULL, NULL); 1205 return fAbsDev; 1177 return RT_BOOL(i_getDeviceCaps() & MOUSE_DEVCAP_ABSOLUTE); 1206 1178 } 1207 1179 … … 1210 1182 bool Mouse::i_supportsRel(void) 1211 1183 { 1212 bool fRelDev; 1213 1214 i_getDeviceCaps(NULL, &fRelDev, NULL, NULL); 1215 return fRelDev; 1184 return RT_BOOL(i_getDeviceCaps() & MOUSE_DEVCAP_RELATIVE); 1185 } 1186 1187 1188 /** Can we currently send absolute events to the guest (including via VMMDev)? */ 1189 bool Mouse::i_supportsAbs(uint32_t fCaps) const 1190 { 1191 return (fCaps & MOUSE_DEVCAP_ABSOLUTE) 1192 || /* inlined i_vmmdevCanAbs() to avoid unnecessary i_getDeviceCaps call: */ 1193 ( (mfVMMDevGuestCaps & VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE) 1194 && (fCaps & MOUSE_DEVCAP_RELATIVE)); 1216 1195 } 1217 1196 … … 1220 1199 bool Mouse::i_supportsAbs(void) 1221 1200 { 1222 bool fAbsDev; 1223 1224 i_getDeviceCaps(&fAbsDev, NULL, NULL, NULL); 1225 return fAbsDev || i_vmmdevCanAbs(); 1201 return Mouse::i_supportsAbs(i_getDeviceCaps()); 1226 1202 } 1227 1203 … … 1230 1206 bool Mouse::i_supportsTS(void) 1231 1207 { 1232 bool fTSDev; 1233 1234 i_getDeviceCaps(NULL, NULL, &fTSDev, NULL); 1235 return fTSDev; 1208 return RT_BOOL(i_getDeviceCaps() & MOUSE_DEVCAP_MT_ABSOLUTE); 1236 1209 } 1237 1210 … … 1240 1213 bool Mouse::i_supportsTP(void) 1241 1214 { 1242 bool fTPDev; 1243 1244 i_getDeviceCaps(NULL, NULL, NULL, &fTPDev); 1245 return fTPDev; 1215 return RT_BOOL(i_getDeviceCaps() & MOUSE_DEVCAP_MT_RELATIVE); 1246 1216 } 1247 1217 … … 1253 1223 { 1254 1224 bool fRelDev, fTSDev, fTPDev, fCanAbs, fNeedsHostCursor; 1255 1256 1225 { 1257 1226 AutoReadLock aLock(this COMMA_LOCKVAL_SRC_POS); 1258 1227 1259 i_getDeviceCaps(NULL, &fRelDev, &fTSDev, &fTPDev); 1260 fCanAbs = i_supportsAbs(); 1228 uint32_t const fCaps = i_getDeviceCaps(); 1229 fRelDev = RT_BOOL(fCaps & MOUSE_DEVCAP_RELATIVE); 1230 fTSDev = RT_BOOL(fCaps & MOUSE_DEVCAP_MT_ABSOLUTE); 1231 fTPDev = RT_BOOL(fCaps & MOUSE_DEVCAP_MT_RELATIVE); 1232 fCanAbs = i_supportsAbs(fCaps); 1261 1233 fNeedsHostCursor = i_guestNeedsHostCursor(); 1262 1234 } … … 1267 1239 /** 1268 1240 * @interface_method_impl{PDMIMOUSECONNECTOR,pfnReportModes} 1269 * A virtual device is notifying us about its current state and capabilities1270 1241 */ 1271 1242 DECLCALLBACK(void) Mouse::i_mouseReportModes(PPDMIMOUSECONNECTOR pInterface, bool fRelative,
Note:
See TracChangeset
for help on using the changeset viewer.