Changeset 44729 in vbox
- Timestamp:
- Feb 18, 2013 12:13:52 PM (12 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/VBoxTray
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDispIf.cpp
r44576 r44729 1315 1315 { 1316 1316 Log(("VBoxTray: Invalidating VidPn Worked!\n")); 1317 winEr = vboxDispIfWddmValidateFixResize(pIf, paDisplayDevices, paDeviceModes, cDevModes); 1317 OSVERSIONINFO OSinfo; 1318 OSinfo.dwOSVersionInfoSize = sizeof (OSinfo); 1319 GetVersionEx (&OSinfo); 1320 /* for win 7 and above calling ChangeDisplaySettingsEx to resize a specific display, is having 1321 * a side affect for enabling all the monitors including the disabled ones. So using 1322 * WDDM win 7 APIs to resize the display for OSes Win7 and above. 1323 */ 1324 if (OSinfo.dwMajorVersion >= 6 && OSinfo.dwMinorVersion >= 1) 1325 winEr = vboxDispIfWddmResizeDisplay(pIf,iChangedMode, paDisplayDevices, paDeviceModes, cDevModes); 1326 else 1327 winEr = vboxDispIfWddmValidateFixResize(pIf, paDisplayDevices, paDeviceModes, cDevModes); 1328 1318 1329 } 1319 1330 else … … 1345 1356 DWORD vboxDispIfWddmEnableDisplay(PCVBOXDISPIF const pIf, UINT Id, bool fEnabled) 1346 1357 { 1347 DISPLAYCONFIG_PATH_INFO PathInfoArray[10];1348 DISPLAYCONFIG_MODE_INFO ModeInfoArray[10];1358 DISPLAYCONFIG_PATH_INFO *pPathInfoArray; 1359 DISPLAYCONFIG_MODE_INFO *pModeInfoArray; 1349 1360 UINT NumPathArrayElements = 0; 1350 1361 UINT NumModeInfoArrayElements = 0; 1351 1362 ULONG dwStatus; 1352 UINT uFlag; 1353 1363 1364 pPathInfoArray = (DISPLAYCONFIG_PATH_INFO *)malloc(NumPathArrayElements); 1365 pModeInfoArray = (DISPLAYCONFIG_MODE_INFO *)malloc(NumModeInfoArrayElements); 1366 if (!pPathInfoArray || !pModeInfoArray ) { 1367 return ERROR_OUTOFMEMORY; 1368 } 1354 1369 dwStatus = gCtx.pfnGetDisplayConfigBufferSizes(fEnabled ? QDC_ALL_PATHS : QDC_ONLY_ACTIVE_PATHS,&NumPathArrayElements,&NumModeInfoArrayElements); 1355 1370 if (dwStatus != ERROR_SUCCESS) 1356 1371 { 1357 1372 LogFlow(("VBoxTray: (WDDM) Failed GetDisplayConfigBufferSizes \n")); 1373 if (pPathInfoArray) 1374 free(pPathInfoArray); 1375 if (pModeInfoArray) 1376 free(pModeInfoArray); 1358 1377 return dwStatus; 1359 1378 } 1360 dwStatus = gCtx.pfnQueryDisplayConfig(fEnabled ? QDC_ALL_PATHS : QDC_ONLY_ACTIVE_PATHS,&NumPathArrayElements, & PathInfoArray[0],&NumModeInfoArrayElements, &ModeInfoArray[0],NULL);1379 dwStatus = gCtx.pfnQueryDisplayConfig(fEnabled ? QDC_ALL_PATHS : QDC_ONLY_ACTIVE_PATHS,&NumPathArrayElements, &pPathInfoArray[0],&NumModeInfoArrayElements, &pModeInfoArray[0],NULL); 1361 1380 if (dwStatus != ERROR_SUCCESS) 1362 1381 { 1363 1382 LogFlow(("VBoxTray: (WDDM) Failed QueryDisplayConfig \n")); 1383 if (pPathInfoArray) 1384 free(pPathInfoArray); 1385 if (pModeInfoArray) 1386 free(pModeInfoArray); 1364 1387 return dwStatus; 1365 1388 } 1366 1389 for (unsigned int i=0; i < NumPathArrayElements; ++i) 1367 1390 { 1368 if (PathInfoArray[i].sourceInfo.id == Id) 1391 LogRel(("Sourceid= %d and targetid = %d\n", pPathInfoArray[i].sourceInfo.id, pPathInfoArray[i].targetInfo.id)); 1392 if (pPathInfoArray[i].sourceInfo.id == Id) 1369 1393 { 1370 1394 if (fEnabled) 1371 1395 { 1372 1396 LogRel(("VBoxTray: (WDDM) Enable the Display Device i =%d \n", i)); 1373 PathInfoArray[i].flags=DISPLAYCONFIG_PATH_ACTIVE;1397 pPathInfoArray[i].flags=DISPLAYCONFIG_PATH_ACTIVE; 1374 1398 break; 1375 1399 } 1376 1400 else 1377 1401 { 1378 LogRel(("VBoxTray: (WDDM) Disable the Display Device ID=%d and Sourceid=%d\n", i,PathInfoArray[i].sourceInfo.id));1379 PathInfoArray[i].flags=0;1402 LogRel(("VBoxTray: (WDDM) Disable the Display Device Path ID=%d and Sourceid=%d\n", i, pPathInfoArray[i].sourceInfo.id)); 1403 pPathInfoArray[i].flags=0; 1380 1404 break; 1381 1405 } 1382 1406 } 1383 1407 } 1384 dwStatus = gCtx.pfnSetDisplayConfig(NumPathArrayElements, &PathInfoArray[0],NumModeInfoArrayElements, &ModeInfoArray[0],(SDC_APPLY | SDC_SAVE_TO_DATABASE| SDC_ALLOW_CHANGES | SDC_USE_SUPPLIED_DISPLAY_CONFIG)); 1408 dwStatus = gCtx.pfnSetDisplayConfig(NumPathArrayElements, &pPathInfoArray[0],NumModeInfoArrayElements, &pModeInfoArray[0],(SDC_APPLY | SDC_SAVE_TO_DATABASE| SDC_ALLOW_CHANGES | SDC_USE_SUPPLIED_DISPLAY_CONFIG)); 1409 if (dwStatus != ERROR_SUCCESS) 1410 { 1411 if (pPathInfoArray) 1412 free(pPathInfoArray); 1413 if (pModeInfoArray) 1414 free(pModeInfoArray); 1415 LogRel(("VBoxTray:(WDDM) Failed to Enable/ disable the monitor.")); 1416 return dwStatus; 1417 } 1418 return ERROR_SUCCESS; 1419 } 1420 1421 DWORD vboxDispIfWddmResizeDisplay(PCVBOXDISPIF const pIf, UINT Id, DISPLAY_DEVICE * paDisplayDevices, DEVMODE *paDeviceMode, UINT devModes) 1422 { 1423 DISPLAYCONFIG_PATH_INFO *pPathInfoArray; 1424 DISPLAYCONFIG_MODE_INFO *pModeInfoArray; 1425 UINT NumPathArrayElements = 0; 1426 UINT NumModeInfoArrayElements = 0; 1427 ULONG dwStatus; 1428 1429 pPathInfoArray = (DISPLAYCONFIG_PATH_INFO *)malloc(NumPathArrayElements); 1430 pModeInfoArray = (DISPLAYCONFIG_MODE_INFO *)malloc(NumModeInfoArrayElements); 1431 if (!pPathInfoArray || !pModeInfoArray ) { 1432 return ERROR_OUTOFMEMORY; 1433 } 1434 dwStatus = gCtx.pfnGetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS,&NumPathArrayElements,&NumModeInfoArrayElements); 1435 if (dwStatus != ERROR_SUCCESS) 1436 { 1437 LogFlow(("VBoxTray: (WDDM) Failed GetDisplayConfigBufferSizes \n")); 1438 if (pPathInfoArray) 1439 free(pPathInfoArray); 1440 if (pModeInfoArray) 1441 free(pModeInfoArray); 1442 return dwStatus; 1443 } 1444 dwStatus = gCtx.pfnQueryDisplayConfig( QDC_ONLY_ACTIVE_PATHS,&NumPathArrayElements, &pPathInfoArray[0],&NumModeInfoArrayElements, &pModeInfoArray[0],NULL); 1445 if (dwStatus != ERROR_SUCCESS) 1446 { 1447 LogFlow(("VBoxTray: (WDDM) Failed QueryDisplayConfig \n")); 1448 if (pPathInfoArray) 1449 free(pPathInfoArray); 1450 if (pModeInfoArray) 1451 free(pModeInfoArray); 1452 return dwStatus; 1453 } 1454 for (unsigned int i=0; i < NumPathArrayElements; ++i) 1455 { 1456 LogRel(("Sourceid= %d and targetid = %d\n", pPathInfoArray[i].sourceInfo.id, pPathInfoArray[i].targetInfo.id)); 1457 if (pPathInfoArray[i].sourceInfo.id == Id) 1458 { 1459 LogRel(("VBoxTray: (Resize) Enable the Display Device i =%d \n", i)); 1460 int test = pPathInfoArray[i].sourceInfo.modeInfoIdx; 1461 pModeInfoArray[test].sourceMode.width = paDeviceMode[Id].dmPelsWidth; 1462 pModeInfoArray[test].sourceMode.height = paDeviceMode[Id].dmPelsHeight; 1463 pModeInfoArray[test].sourceMode.position.x = paDeviceMode[Id].dmPosition.x; 1464 pModeInfoArray[test].sourceMode.position.y = paDeviceMode[Id].dmPosition.y; 1465 break; 1466 } 1467 } 1468 dwStatus = gCtx.pfnSetDisplayConfig(NumPathArrayElements, &pPathInfoArray[0],NumModeInfoArrayElements, &pModeInfoArray[0],(SDC_APPLY | SDC_SAVE_TO_DATABASE| SDC_ALLOW_CHANGES | SDC_USE_SUPPLIED_DISPLAY_CONFIG)); 1385 1469 if (dwStatus != ERROR_SUCCESS) { 1386 LogRel(("VBoxTray:(WDDM) Failed to disable the monitor.")); 1470 if (pPathInfoArray) 1471 free(pPathInfoArray); 1472 if (pModeInfoArray) 1473 free(pModeInfoArray); 1474 LogRel(("VBoxTray:(WDDM) Failed to Enable/ disable the monitor.")); 1387 1475 return dwStatus; 1388 1476 } 1477 if (pPathInfoArray) 1478 free(pPathInfoArray); 1479 if (pModeInfoArray) 1480 free(pModeInfoArray); 1389 1481 return ERROR_SUCCESS; 1390 1482 } -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDispIf.h
r44557 r44729 88 88 DWORD VBoxDispIfCancelPendingResize(PCVBOXDISPIF const pIf); 89 89 DWORD vboxDispIfWddmEnableDisplay(PCVBOXDISPIF const pIf, UINT Id, bool fEnabled); 90 DWORD vboxDispIfWddmResizeDisplay(PCVBOXDISPIF const pIf, UINT Id, DISPLAY_DEVICE * paDisplayDevices, DEVMODE *paDeviceMode, UINT devModes); 90 91 //DWORD VBoxDispIfReninitModes(PCVBOXDISPIF const pIf, uint8_t *pScreenIdMask, BOOL fReconnectDisplaysOnChange);
Note:
See TracChangeset
for help on using the changeset viewer.