VirtualBox

Ignore:
Timestamp:
Oct 23, 2017 6:08:32 PM (7 years ago)
Author:
vboxsync
Message:

Additions/win/vboxtray: Code cleanup in VBoxDisplay service, step 1.

File:
1 edited

Legend:

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

    r68664 r69180  
    546546                       && dwNewPosX == 0 && dwNewPosY == 0 && !fChangeOrigin);
    547547    DWORD dmFields = 0;
     548    VBOXDISPLAY_DRIVER_TYPE enmDriverType = getVBoxDisplayDriverType(pCtx);
    548549
    549550    LogFlowFunc(("[%d] %dx%d at %d,%d fChangeOrigin %d fEnabled %d fExtDisSup %d\n",
     
    676677    hlpResizeRect(paRects, NumDevices, DevPrimaryNum, Id,
    677678            fEnabled ? Width : 0, fEnabled ? Height : 0, dwNewPosX, dwNewPosY);
    678 #ifdef Log
     679
    679680    for (i = 0; i < NumDevices; i++)
    680681    {
     
    684685                paRects[i].bottom - paRects[i].top));
    685686    }
    686 #endif /* Log */
    687 
    688 #ifdef VBOX_WITH_WDDM
    689     VBOXDISPLAY_DRIVER_TYPE enmDriverType = getVBoxDisplayDriverType (pCtx);
    690     if (enmDriverType == VBOXDISPLAY_DRIVER_TYPE_WDDM)
    691     {
    692         /* Assign the new rectangles to displays. */
    693         for (i = 0; i < NumDevices; i++)
    694         {
    695             paDeviceModes[i].dmPosition.x = paRects[i].left;
    696             paDeviceModes[i].dmPosition.y = paRects[i].top;
    697             paDeviceModes[i].dmPelsWidth  = paRects[i].right - paRects[i].left;
    698             paDeviceModes[i].dmPelsHeight = paRects[i].bottom - paRects[i].top;
    699 
    700             if (i == Id)
    701                 paDeviceModes[i].dmBitsPerPel = BitsPerPixel;
    702 
     687
     688    /* Assign the new rectangles to displays. */
     689    for (i = 0; i < NumDevices; i++)
     690    {
     691        paDeviceModes[i].dmPosition.x = paRects[i].left;
     692        paDeviceModes[i].dmPosition.y = paRects[i].top;
     693        paDeviceModes[i].dmPelsWidth  = paRects[i].right - paRects[i].left;
     694        paDeviceModes[i].dmPelsHeight = paRects[i].bottom - paRects[i].top;
     695
     696        if (i == Id)
     697            paDeviceModes[i].dmBitsPerPel = BitsPerPixel;
     698
     699        if (enmDriverType >= VBOXDISPLAY_DRIVER_TYPE_WDDM)
     700        {
    703701            paDeviceModes[i].dmFields |= dmFields;
    704702
    705703            /* On Vista one must specify DM_BITSPERPEL.
    706              * Note that the current mode dmBitsPerPel is already in the DEVMODE structure.
    707              */
     704            * Note that the current mode dmBitsPerPel is already in the DEVMODE structure.
     705            */
    708706            if (!(paDeviceModes[i].dmFields & DM_BITSPERPEL))
    709707            {
     
    712710                paDeviceModes[i].dmBitsPerPel = 32;
    713711            }
    714 
    715             LogFlowFunc(("ResizeDisplayDevice: pfnChangeDisplaySettingsEx %x: %dx%dx%d at %d,%d fields 0x%X\n",
    716                   pCtx->pfnChangeDisplaySettingsEx,
    717                   paDeviceModes[i].dmPelsWidth,
    718                   paDeviceModes[i].dmPelsHeight,
    719                   paDeviceModes[i].dmBitsPerPel,
    720                   paDeviceModes[i].dmPosition.x,
    721                   paDeviceModes[i].dmPosition.y,
    722                   paDeviceModes[i].dmFields));
    723         }
    724 
     712        }
     713        else
     714        {
     715            paDeviceModes[i].dmFields = DM_POSITION | DM_PELSHEIGHT | DM_PELSWIDTH | DM_BITSPERPEL;
     716        }
     717
     718        LogFlowFunc(("ResizeDisplayDevice: Going to resize display %d to %dx%dx%d at %d,%d fields 0x%X\n",
     719            i,
     720            paDeviceModes[i].dmPelsWidth,
     721            paDeviceModes[i].dmPelsHeight,
     722            paDeviceModes[i].dmBitsPerPel,
     723            paDeviceModes[i].dmPosition.x,
     724            paDeviceModes[i].dmPosition.y,
     725            paDeviceModes[i].dmFields));
     726    }
     727
     728#ifdef VBOX_WITH_WDDM
     729    if (enmDriverType == VBOXDISPLAY_DRIVER_TYPE_WDDM)
     730    {
    725731        LogFlowFunc(("Request to resize the displa\n"));
    726732        DWORD err = VBoxDispIfResizeModes(&pCtx->pEnv->dispIf, Id, fEnabled, fExtDispSup, paDisplayDevices, paDeviceModes, DevNum);
     
    753759    for (i = 0; i < NumDevices; i++)
    754760    {
    755         paDeviceModes[i].dmPosition.x = paRects[i].left;
    756         paDeviceModes[i].dmPosition.y = paRects[i].top;
    757         paDeviceModes[i].dmPelsWidth  = paRects[i].right - paRects[i].left;
    758         paDeviceModes[i].dmPelsHeight = paRects[i].bottom - paRects[i].top;
    759 
    760         /* On Vista one must specify DM_BITSPERPEL.
    761          * Note that the current mode dmBitsPerPel is already in the DEVMODE structure.
    762          */
    763         paDeviceModes[i].dmFields = DM_POSITION | DM_PELSHEIGHT | DM_PELSWIDTH | DM_BITSPERPEL;
    764 
    765         if (   i == Id
    766             && BitsPerPixel != 0)
    767         {
    768             /* Change dmBitsPerPel if requested. */
    769             paDeviceModes[i].dmBitsPerPel = BitsPerPixel;
    770         }
    771 
    772         LogFlowFunc(("ResizeDisplayDevice: pfnChangeDisplaySettingsEx Current MonitorId=%d: %dx%dx%d at %d,%d\n",
    773               i,
    774               paDeviceModes[i].dmPelsWidth,
    775               paDeviceModes[i].dmPelsHeight,
    776               paDeviceModes[i].dmBitsPerPel,
    777               paDeviceModes[i].dmPosition.x,
    778               paDeviceModes[i].dmPosition.y));
    779 
    780761        LONG status = pCtx->pfnChangeDisplaySettingsEx((LPSTR)paDisplayDevices[i].DeviceName,
    781762                                                       &paDeviceModes[i], NULL, CDS_NORESET | CDS_UPDATEREGISTRY, NULL);
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