Changeset 52189 in vbox
- Timestamp:
- Jul 25, 2014 2:09:02 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 95246
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxGuestLib.h
r52178 r52189 485 485 bool *pfEnabled, bool fAck); 486 486 VBGLR3DECL(bool) VbglR3HostLikesVideoMode(uint32_t cx, uint32_t cy, uint32_t cBits); 487 VBGLR3DECL(int) VbglR3VideoModeGetHighestSavedScreen(unsigned *pcScreen); 487 488 VBGLR3DECL(int) VbglR3SaveVideoMode(unsigned cScreen, unsigned cx, 488 489 unsigned cy, unsigned cBits, unsigned x, -
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestProp.cpp
r49950 r52189 778 778 VBGLR3DECL(void) VbglR3GuestPropEnumFree(PVBGLR3GUESTPROPENUM pHandle) 779 779 { 780 if (!pHandle) 781 return; 780 782 RTMemFree(pHandle->pchBuf); 781 783 RTMemFree(pHandle); -
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibVideo.cpp
r52177 r52189 278 278 279 279 /** 280 * Get the highest screen number for which there is a saved video mode or "0" 281 * if there are no saved modes. 282 * 283 * @returns iprt status value 284 * @param pcScreen where to store the virtual screen number 285 */ 286 VBGLR3DECL(int) VbglR3VideoModeGetHighestSavedScreen(unsigned *pcScreen) 287 { 288 #if defined(VBOX_WITH_GUEST_PROPS) 289 using namespace guestProp; 290 291 int rc, rc2 = VERR_UNRESOLVED_ERROR; 292 uint32_t u32ClientId = 0; 293 const char *pszPattern = VIDEO_PROP_PREFIX"*"; 294 PVBGLR3GUESTPROPENUM pHandle = NULL; 295 const char *pszName; 296 unsigned cHighestScreen = 0; 297 298 AssertPtrReturn(pcScreen, VERR_INVALID_POINTER); 299 rc = VbglR3GuestPropConnect(&u32ClientId); 300 if (RT_SUCCESS(rc)) 301 rc = VbglR3GuestPropEnum(u32ClientId, &pszPattern, 1, &pHandle, 302 &pszName, NULL, NULL, NULL); 303 if (u32ClientId != 0) 304 rc2 = VbglR3GuestPropDisconnect(u32ClientId); 305 if (RT_SUCCESS(rc)) 306 rc = rc2; 307 while (pszName != NULL && RT_SUCCESS(rc)) 308 { 309 uint32_t cScreen; 310 311 rc = RTStrToUInt32Full(pszName + sizeof(VIDEO_PROP_PREFIX) - 1, 10, 312 &cScreen); 313 if (RT_SUCCESS(rc)) /* There may be similar properties with text. */ 314 cHighestScreen = RT_MAX(cHighestScreen, cScreen); 315 rc = VbglR3GuestPropEnumNext(pHandle, &pszName, NULL, NULL, NULL); 316 } 317 VbglR3GuestPropEnumFree(pHandle); 318 if (RT_SUCCESS(rc)) 319 *pcScreen = cHighestScreen; 320 return rc; 321 #else /* !VBOX_WITH_GUEST_PROPS */ 322 return VERR_NOT_IMPLEMENTED; 323 #endif /* !VBOX_WITH_GUEST_PROPS */ 324 } 325 326 /** 280 327 * Save video mode parameters to the guest property store. 281 328 * … … 299 346 char szModeParms[MAX_VALUE_LEN]; 300 347 uint32_t u32ClientId = 0; 301 unsigned cx2, cy2, cBits2, x2, y2 ;348 unsigned cx2, cy2, cBits2, x2, y2, cHighestScreen, cHighestScreen2; 302 349 bool fEnabled2; 303 350 int rc, rc2 = VERR_UNRESOLVED_ERROR; 351 352 rc = VbglR3VideoModeGetHighestSavedScreen(&cHighestScreen); 304 353 RTStrPrintf(szModeName, sizeof(szModeName), VIDEO_PROP_PREFIX"%u", cScreen); 305 354 RTStrPrintf(szModeParms, sizeof(szModeParms), "%ux%ux%u,%ux%u,%u", cx, cy, 306 355 cBits, x, y, (unsigned) fEnabled); 307 int rc = VbglR3GuestPropConnect(&u32ClientId); 356 if (RT_SUCCESS(rc)) 357 rc = VbglR3GuestPropConnect(&u32ClientId); 308 358 if (RT_SUCCESS(rc)) 309 359 rc = VbglR3GuestPropWriteValue(u32ClientId, szModeName, szModeParms); 310 360 if (u32ClientId != 0) 311 VbglR3GuestPropDisconnect(u32ClientId); /* Return value ignored, because what can we do anyway? */ 361 rc2 = VbglR3GuestPropDisconnect(u32ClientId); 362 if (RT_SUCCESS(rc)) 363 rc = rc2; 364 /* Sanity check 1. We do not try to make allowance for someone else 365 * changing saved settings at the same time as us. */ 312 366 if (RT_SUCCESS(rc)) 313 367 { … … 319 373 rc = VERR_WRITE_ERROR; 320 374 } 375 /* Sanity check 2. Same comment. */ 376 if (RT_SUCCESS(rc)) 377 rc = VbglR3VideoModeGetHighestSavedScreen(&cHighestScreen2); 378 if (RT_SUCCESS(rc)) 379 if (cHighestScreen2 != RT_MAX(cHighestScreen, cScreen)) 380 rc = VERR_INTERNAL_ERROR; 321 381 return rc; 322 382 #else /* !VBOX_WITH_GUEST_PROPS */ … … 358 418 int cMatches; 359 419 unsigned cx, cy, cBits, x, y, fEnabled; 420 int rc, rc2 = VERR_UNRESOLVED_ERROR; 360 421 361 422 /** @todo add a VbglR3GuestPropReadValueF/FV that does the RTStrPrintf for you. */ 362 423 RTStrPrintf(szModeName, sizeof(szModeName), VIDEO_PROP_PREFIX"%u", cScreen); 363 intrc = VbglR3GuestPropConnect(&u32ClientId);424 rc = VbglR3GuestPropConnect(&u32ClientId); 364 425 if (RT_SUCCESS(rc)) 365 426 rc = VbglR3GuestPropReadValue(u32ClientId, szModeName, szModeParms, 366 427 sizeof(szModeParms), NULL); 367 428 if (u32ClientId != 0) 368 VbglR3GuestPropDisconnect(u32ClientId); /* Return value ignored, because what can we do anyway? */ 429 rc2 = VbglR3GuestPropDisconnect(u32ClientId); 430 if (RT_SUCCESS(rc)) 431 rc = rc2; 369 432 370 433 /* -
trunk/src/VBox/Additions/x11/VBoxClient/display.cpp
r52177 r52189 219 219 static void runDisplay(struct x11State *pState) 220 220 { 221 int status, rc, i; 221 int status, rc; 222 unsigned i, cScreens; 222 223 char szCommand[256]; 223 224 Cursor hClockCursor = XCreateFontCursor(pState->pDisplay, XC_watch); … … 225 226 226 227 LogRelFlowFunc(("\n")); 227 /** @todo fix this not to use a hard-coded value. */ 228 for (i = 0; i < 64; ++i) 228 rc = VbglR3VideoModeGetHighestSavedScreen(&cScreens); 229 if (RT_FAILURE(rc)) 230 FatalError(("Failed to get the number of saved screen modes, rc=%Rrc\n", 231 rc)); 232 for (i = 0; i < RT_MAX(cScreens + 1, 8); ++i) 229 233 { 230 234 unsigned cx = 0, cy = 0, cBPP = 0, x = 0, y = 0; … … 233 237 rc = VbglR3RetrieveVideoMode(i, &cx, &cy, &cBPP, &x, &y, 234 238 &fEnabled); 239 if (RT_SUCCESS(rc) && i > cScreens) /* Sanity */ 240 FatalError(("Internal error retrieving the number of saved screen modes.\n")); 235 241 if (RT_SUCCESS(rc)) 236 242 setModeX11(pState, cx, cy, cBPP, i, x, y, fEnabled, … … 298 304 rc = VbglR3SeamlessGetLastEvent(&Mode); 299 305 if (RT_FAILURE(rc)) 300 FatalError(("Failed to save size hint, rc=%Rrc\n", rc));306 FatalError(("Failed to check seamless mode, rc=%Rrc\n", rc)); 301 307 if (Mode == VMMDev_Seamless_Disabled) 302 308 {
Note:
See TracChangeset
for help on using the changeset viewer.