VirtualBox

Changeset 44931 in vbox


Ignore:
Timestamp:
Mar 6, 2013 12:24:58 PM (12 years ago)
Author:
vboxsync
Message:

Additions/WINNT: Code improvement. Fix for WDDM multimonitor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDispIf.cpp

    r44763 r44931  
    448448
    449449#ifdef VBOX_WITH_WDDM
    450 /**/
     450
    451451#define VBOXRR_TIMER_ID 1234
    452452
     
    876876    pMon->hThread = 0;
    877877}
    878 /**/
     878
    879879
    880880typedef struct VBOXDISPIF_WDDM_INTERNAL
     
    12751275    BOOL fAbleToInvalidateVidPn = FALSE;
    12761276
    1277     if (winEr == NO_ERROR)
     1277    if (0 && winEr == NO_ERROR)
    12781278    {
    12791279        Assert(hAdapter);
     
    13391339        vboxDispIfReninitModesWDDM(pIf, ScreenMask, TRUE);
    13401340
    1341         winEr = vboxDispIfWddmValidateFixResize(pIf, paDisplayDevices, paDeviceModes, cDevModes);
    1342 
     1341        OSVERSIONINFO OSinfo;
     1342        OSinfo.dwOSVersionInfoSize = sizeof (OSinfo);
     1343        GetVersionEx (&OSinfo);
     1344        if (OSinfo.dwMajorVersion >= 6 && OSinfo.dwMinorVersion >= 1)
     1345            winEr = vboxDispIfWddmResizeDisplay(pIf, iChangedMode, paDisplayDevices, paDeviceModes, cDevModes);
     1346        else
     1347            winEr = vboxDispIfWddmValidateFixResize(pIf, paDisplayDevices, paDeviceModes, cDevModes);
    13431348        Assert(winEr == NO_ERROR);
    13441349    }
     
    14271432    UINT numModeInfoArrayElements = 0;
    14281433    ULONG dwStatus;
     1434    bool fFoundDisplay = false;
    14291435
    14301436    dwStatus = gCtx.pfnGetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS, &numPathArrayElements, &numModeInfoArrayElements);
     
    14531459        free(pModeInfoArray);
    14541460        return dwStatus;
    1455      }
    1456     for (unsigned int i=0; i < numPathArrayElements; ++i)
    1457     {
    1458         LogRel(("Sourceid= %d and targetid = %d\n", pPathInfoArray[i].sourceInfo.id, pPathInfoArray[i].targetInfo.id));
    1459         if (pPathInfoArray[i].sourceInfo.id == Id)
    1460         {
    1461             LogRel(("VBoxTray: (Resize) Enable the Display Device i =%d \n", i));
    1462             int test = pPathInfoArray[i].sourceInfo.modeInfoIdx;
    1463             pModeInfoArray[test].sourceMode.width = paDeviceMode[Id].dmPelsWidth;
    1464             pModeInfoArray[test].sourceMode.height = paDeviceMode[Id].dmPelsHeight;
    1465             pModeInfoArray[test].sourceMode.position.x = paDeviceMode[Id].dmPosition.x;
    1466             pModeInfoArray[test].sourceMode.position.y = paDeviceMode[Id].dmPosition.y;
     1461    }
     1462    LogFlow(("VBoxTray: NumPath =%d and NumMod=%d\n", numPathArrayElements, numModeInfoArrayElements));
     1463    for (UINT iter = 0; iter < numPathArrayElements; ++iter)
     1464    {
     1465        LogFlow(("Sourceid= %d and targetid = %d iter =%d and id = %d\n", pPathInfoArray[iter].sourceInfo.id, pPathInfoArray[iter].targetInfo.id, iter, Id));
     1466        if (pPathInfoArray[iter].sourceInfo.id == Id)
     1467        {
     1468            UINT iModIdx = pPathInfoArray[iter].sourceInfo.modeInfoIdx;
     1469            LogFlow(("VBoxTray: Mode Index = %d\n", iModIdx));
     1470            pModeInfoArray[iModIdx].sourceMode.width = paDeviceMode[Id].dmPelsWidth;
     1471            pModeInfoArray[iModIdx].sourceMode.height = paDeviceMode[Id].dmPelsHeight;
     1472            if(paDeviceMode[Id].dmPosition.x != 0 || paDeviceMode[Id].dmPosition.y != 0)
     1473            {
     1474                pModeInfoArray[iModIdx].sourceMode.position.x = paDeviceMode[Id].dmPosition.x;
     1475                pModeInfoArray[iModIdx].sourceMode.position.y = paDeviceMode[Id].dmPosition.y;
     1476            }
     1477            fFoundDisplay = true;
    14671478            break;
    14681479        }
    14691480    }
    1470     dwStatus = gCtx.pfnSetDisplayConfig(numPathArrayElements, pPathInfoArray, numModeInfoArrayElements, pModeInfoArray,(SDC_APPLY | SDC_SAVE_TO_DATABASE| SDC_ALLOW_CHANGES | SDC_USE_SUPPLIED_DISPLAY_CONFIG));
    1471     if (dwStatus != ERROR_SUCCESS)
    1472     {
    1473         free(pPathInfoArray);
    1474         free(pModeInfoArray);
    1475         LogRel(("VBoxTray:(WDDM) Failed to Enable/ disable the monitor."));
    1476         return dwStatus;
     1481    if (fFoundDisplay)
     1482    {
     1483        /* Call SetDisplayConfig only if displaywith ID=Id has been found. */
     1484        LogFlow(("VBoxTray: Found Display with Id=%d\n", Id));
     1485        dwStatus = gCtx.pfnSetDisplayConfig(numPathArrayElements, pPathInfoArray, numModeInfoArrayElements, pModeInfoArray,(SDC_APPLY | SDC_SAVE_TO_DATABASE| SDC_ALLOW_CHANGES | SDC_USE_SUPPLIED_DISPLAY_CONFIG));
     1486        if (dwStatus != ERROR_SUCCESS)
     1487        {
     1488            LogRel(("VBoxTray:(WDDM) Failed to resize the monitor."));
     1489            free(pPathInfoArray);
     1490            free(pModeInfoArray);
     1491            return dwStatus;
     1492        }
    14771493    }
    14781494    free(pPathInfoArray);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette