[DESK.CPL]

Resolution selection improvement patch by Mark Jansen:
- Fix a bug that allowed only a subset of resolutions to be visible.
- Update the preview on the fly when dragging the resolution slider.
- Fix a bug that prevented the monitor preview from properly invalidating the preview, leaving the old preview partially visible.
Needs to be included in 0.4 branch.
CORE-10786

svn path=/trunk/; revision=70577
This commit is contained in:
Hermès Bélusca-Maïto 2016-01-11 20:52:44 +00:00
parent 30862b5020
commit 658e9e13b3
2 changed files with 25 additions and 4 deletions

View file

@ -39,6 +39,7 @@ typedef struct _MONITORSELWND
PMONSL_MON Monitors;
RECT rcExtent;
RECT rcMonitors;
RECT rcOldMonitors;
POINT ScrollPos;
SIZE Margin;
SIZE SelectionFrame;
@ -261,6 +262,14 @@ MonSelRepaint(IN PMONITORSELWND infoPtr)
InvalidateRect(infoPtr->hSelf,
&rc,
TRUE);
if (!EqualRect(&infoPtr->rcMonitors, &infoPtr->rcOldMonitors) &&
infoPtr->rcOldMonitors.right != infoPtr->rcOldMonitors.left)
{
MonSelRectToScreen(infoPtr, &infoPtr->rcOldMonitors, &rc);
InvalidateRect(infoPtr->hSelf, &rc, TRUE);
infoPtr->rcOldMonitors = infoPtr->rcMonitors;
}
}
static VOID
@ -355,6 +364,7 @@ MonSelUpdateMonitorsInfo(IN OUT PMONITORSELWND infoPtr,
ScaleRectSizeFit(&rcExtSurface,
&rcExtDisplay);
infoPtr->rcOldMonitors = infoPtr->rcMonitors;
infoPtr->rcMonitors = rcExtDisplay;
/* Now that we know in which area all monitors are located,

View file

@ -26,6 +26,8 @@ UpdateDisplay(IN HWND hwndDlg, PDATA pData, IN BOOL bUpdateThumb)
TCHAR Buffer[64];
TCHAR Pixel[64];
DWORD index;
HWND hwndMonSel;
MONSL_MONINFO info;
LoadString(hApplet, IDS_PIXEL, Pixel, sizeof(Pixel) / sizeof(TCHAR));
_stprintf(Buffer, Pixel, pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth, pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight, Pixel);
@ -43,6 +45,15 @@ UpdateDisplay(IN HWND hwndDlg, PDATA pData, IN BOOL bUpdateThumb)
}
if (LoadString(hApplet, (2900 + pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel), Buffer, sizeof(Buffer) / sizeof(TCHAR)))
SendDlgItemMessage(hwndDlg, IDC_SETTINGS_BPP, CB_SELECTSTRING, (WPARAM)-1, (LPARAM)Buffer);
hwndMonSel = GetDlgItem(hwndDlg, IDC_SETTINGS_MONSEL);
index = (INT)SendMessage(hwndMonSel, MSLM_GETCURSEL, 0, 0);
if (index != (DWORD)-1 && SendMessage(hwndMonSel, MSLM_GETMONITORINFO, index, (LPARAM)&info))
{
info.Size.cx = pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth;
info.Size.cy = pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight;
SendMessage(hwndMonSel, MSLM_SETMONITORINFO, index, (LPARAM)&info);
}
}
static PSETTINGS_ENTRY
@ -165,8 +176,8 @@ AddDisplayDevice(IN PDATA pData, IN const DISPLAY_DEVICE *DisplayDevice)
for (Current = newEntry->Settings; Current != NULL; Current = Current->Flink)
{
if (Current->Flink != NULL &&
((Current->dmPelsWidth != Current->Flink->dmPelsWidth) &&
(Current->dmPelsHeight != Current->Flink->dmPelsHeight)))
((Current->dmPelsWidth != Current->Flink->dmPelsWidth) ||
(Current->dmPelsHeight != Current->Flink->dmPelsHeight)))
{
ResolutionsCount++;
}
@ -182,8 +193,8 @@ AddDisplayDevice(IN PDATA pData, IN const DISPLAY_DEVICE *DisplayDevice)
{
if (Current->Flink == NULL ||
(Current->Flink != NULL &&
((Current->dmPelsWidth != Current->Flink->dmPelsWidth) &&
(Current->dmPelsHeight != Current->Flink->dmPelsHeight))))
((Current->dmPelsWidth != Current->Flink->dmPelsWidth) ||
(Current->dmPelsHeight != Current->Flink->dmPelsHeight))))
{
newEntry->Resolutions[i].dmPelsWidth = Current->dmPelsWidth;
newEntry->Resolutions[i].dmPelsHeight = Current->dmPelsHeight;