mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
[DESK.CPL]: Fix resolution slider issues.
Patch by "reactosfanboy" and Mark Jansen (nick "learn_more") CORE-10792 #resolve svn path=/trunk/; revision=70729
This commit is contained in:
parent
340d1b6e9f
commit
3ef979d4d3
1 changed files with 47 additions and 26 deletions
|
@ -56,6 +56,28 @@ UpdateDisplay(IN HWND hwndDlg, PDATA pData, IN BOOL bUpdateThumb)
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
CompareSettings(PSETTINGS_ENTRY Entry, DWORD dmPelsWidth, DWORD dmPelsHeight,
|
||||
DWORD dmBitsPerPel, DWORD dmDisplayFrequency)
|
||||
{
|
||||
if (Entry->dmPelsWidth == dmPelsWidth &&
|
||||
Entry->dmPelsHeight == dmPelsHeight &&
|
||||
Entry->dmBitsPerPel == dmBitsPerPel &&
|
||||
Entry->dmDisplayFrequency == dmDisplayFrequency)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
if ((Entry->dmPelsWidth < dmPelsWidth) ||
|
||||
(Entry->dmPelsWidth == dmPelsWidth && Entry->dmPelsHeight < dmPelsHeight) ||
|
||||
(Entry->dmPelsWidth == dmPelsWidth && Entry->dmPelsHeight == dmPelsHeight &&
|
||||
Entry->dmBitsPerPel < dmBitsPerPel))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static PSETTINGS_ENTRY
|
||||
GetPossibleSettings(IN LPCTSTR DeviceName, OUT DWORD* pSettingsCount, OUT PSETTINGS_ENTRY* CurrentSettings)
|
||||
{
|
||||
|
@ -66,7 +88,7 @@ GetPossibleSettings(IN LPCTSTR DeviceName, OUT DWORD* pSettingsCount, OUT PSETTI
|
|||
PSETTINGS_ENTRY Settings = NULL;
|
||||
HDC hDC;
|
||||
PSETTINGS_ENTRY Current;
|
||||
DWORD bpp, xres, yres, checkbpp;
|
||||
DWORD bpp, xres, yres;
|
||||
DWORD curDispFreq;
|
||||
|
||||
/* Get current settings */
|
||||
|
@ -89,22 +111,17 @@ GetPossibleSettings(IN LPCTSTR DeviceName, OUT DWORD* pSettingsCount, OUT PSETTI
|
|||
|
||||
while (EnumDisplaySettingsEx(DeviceName, iMode, &devmode, dwFlags))
|
||||
{
|
||||
if ((devmode.dmBitsPerPel == 4 ||
|
||||
devmode.dmBitsPerPel == 8 ||
|
||||
devmode.dmBitsPerPel == 16 ||
|
||||
devmode.dmBitsPerPel == 24 ||
|
||||
devmode.dmBitsPerPel == 32) &&
|
||||
devmode.dmDisplayFrequency == curDispFreq)
|
||||
{
|
||||
checkbpp=1;
|
||||
}
|
||||
else
|
||||
checkbpp=0;
|
||||
iMode++;
|
||||
|
||||
if (devmode.dmPelsWidth < 640 ||
|
||||
devmode.dmPelsHeight < 480 || checkbpp == 0)
|
||||
devmode.dmPelsHeight < 480 ||
|
||||
devmode.dmDisplayFrequency != curDispFreq ||
|
||||
(devmode.dmBitsPerPel != 4 &&
|
||||
devmode.dmBitsPerPel != 8 &&
|
||||
devmode.dmBitsPerPel != 16 &&
|
||||
devmode.dmBitsPerPel != 24 &&
|
||||
devmode.dmBitsPerPel != 32))
|
||||
{
|
||||
iMode++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -118,12 +135,10 @@ GetPossibleSettings(IN LPCTSTR DeviceName, OUT DWORD* pSettingsCount, OUT PSETTI
|
|||
Current->dmPelsHeight = devmode.dmPelsHeight;
|
||||
Current->dmBitsPerPel = devmode.dmBitsPerPel;
|
||||
Current->dmDisplayFrequency = devmode.dmDisplayFrequency;
|
||||
while (Next != NULL && (
|
||||
Next->dmPelsWidth < Current->dmPelsWidth ||
|
||||
(Next->dmPelsWidth == Current->dmPelsWidth && Next->dmPelsHeight < Current->dmPelsHeight) ||
|
||||
(Next->dmPelsHeight == Current->dmPelsHeight &&
|
||||
Next->dmPelsWidth == Current->dmPelsWidth &&
|
||||
Next->dmBitsPerPel < Current->dmBitsPerPel )))
|
||||
while (Next != NULL &&
|
||||
CompareSettings(Next, devmode.dmPelsWidth,
|
||||
devmode.dmPelsHeight, devmode.dmBitsPerPel,
|
||||
devmode.dmDisplayFrequency) > 0)
|
||||
{
|
||||
Previous = Next;
|
||||
Next = Next->Flink;
|
||||
|
@ -142,7 +157,6 @@ GetPossibleSettings(IN LPCTSTR DeviceName, OUT DWORD* pSettingsCount, OUT PSETTI
|
|||
}
|
||||
NbSettings++;
|
||||
}
|
||||
iMode++;
|
||||
}
|
||||
|
||||
*pSettingsCount = NbSettings;
|
||||
|
@ -538,6 +552,8 @@ OnResolutionChanged(IN HWND hwndDlg, IN PDATA pData, IN DWORD NewPosition,
|
|||
PSETTINGS_ENTRY Current;
|
||||
DWORD dmNewPelsHeight = pData->CurrentDisplayDevice->Resolutions[NewPosition].dmPelsHeight;
|
||||
DWORD dmNewPelsWidth = pData->CurrentDisplayDevice->Resolutions[NewPosition].dmPelsWidth;
|
||||
DWORD dmBitsPerPel;
|
||||
DWORD dmDisplayFrequency;
|
||||
|
||||
/* Find if new parameters are valid */
|
||||
Current = pData->CurrentDisplayDevice->CurrentSettings;
|
||||
|
@ -549,14 +565,19 @@ OnResolutionChanged(IN HWND hwndDlg, IN PDATA pData, IN DWORD NewPosition,
|
|||
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
|
||||
if (dmNewPelsHeight < Current->dmPelsHeight)
|
||||
dmBitsPerPel = Current->dmBitsPerPel;
|
||||
dmDisplayFrequency = Current->dmDisplayFrequency;
|
||||
|
||||
if (CompareSettings(Current, dmNewPelsWidth,
|
||||
dmNewPelsHeight, dmBitsPerPel,
|
||||
dmDisplayFrequency) < 0)
|
||||
{
|
||||
Current = Current->Blink;
|
||||
while (Current != NULL)
|
||||
{
|
||||
if (Current->dmPelsHeight == dmNewPelsHeight
|
||||
&& Current->dmPelsWidth == dmNewPelsWidth
|
||||
&& Current->dmBitsPerPel == pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel)
|
||||
&& Current->dmPelsWidth == dmNewPelsWidth
|
||||
&& Current->dmBitsPerPel == dmBitsPerPel)
|
||||
{
|
||||
pData->CurrentDisplayDevice->CurrentSettings = Current;
|
||||
UpdateDisplay(hwndDlg, pData, bUpdateThumb);
|
||||
|
@ -571,8 +592,8 @@ OnResolutionChanged(IN HWND hwndDlg, IN PDATA pData, IN DWORD NewPosition,
|
|||
while (Current != NULL)
|
||||
{
|
||||
if (Current->dmPelsHeight == dmNewPelsHeight
|
||||
&& Current->dmPelsWidth == dmNewPelsWidth
|
||||
&& Current->dmBitsPerPel == pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel)
|
||||
&& Current->dmPelsWidth == dmNewPelsWidth
|
||||
&& Current->dmBitsPerPel == dmBitsPerPel)
|
||||
{
|
||||
pData->CurrentDisplayDevice->CurrentSettings = Current;
|
||||
UpdateDisplay(hwndDlg, pData, bUpdateThumb);
|
||||
|
|
Loading…
Reference in a new issue