mirror of
https://github.com/reactos/reactos.git
synced 2025-01-07 06:45:24 +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
|
static PSETTINGS_ENTRY
|
||||||
GetPossibleSettings(IN LPCTSTR DeviceName, OUT DWORD* pSettingsCount, OUT PSETTINGS_ENTRY* CurrentSettings)
|
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;
|
PSETTINGS_ENTRY Settings = NULL;
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
PSETTINGS_ENTRY Current;
|
PSETTINGS_ENTRY Current;
|
||||||
DWORD bpp, xres, yres, checkbpp;
|
DWORD bpp, xres, yres;
|
||||||
DWORD curDispFreq;
|
DWORD curDispFreq;
|
||||||
|
|
||||||
/* Get current settings */
|
/* Get current settings */
|
||||||
|
@ -89,22 +111,17 @@ GetPossibleSettings(IN LPCTSTR DeviceName, OUT DWORD* pSettingsCount, OUT PSETTI
|
||||||
|
|
||||||
while (EnumDisplaySettingsEx(DeviceName, iMode, &devmode, dwFlags))
|
while (EnumDisplaySettingsEx(DeviceName, iMode, &devmode, dwFlags))
|
||||||
{
|
{
|
||||||
if ((devmode.dmBitsPerPel == 4 ||
|
iMode++;
|
||||||
devmode.dmBitsPerPel == 8 ||
|
|
||||||
devmode.dmBitsPerPel == 16 ||
|
|
||||||
devmode.dmBitsPerPel == 24 ||
|
|
||||||
devmode.dmBitsPerPel == 32) &&
|
|
||||||
devmode.dmDisplayFrequency == curDispFreq)
|
|
||||||
{
|
|
||||||
checkbpp=1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
checkbpp=0;
|
|
||||||
|
|
||||||
if (devmode.dmPelsWidth < 640 ||
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,12 +135,10 @@ GetPossibleSettings(IN LPCTSTR DeviceName, OUT DWORD* pSettingsCount, OUT PSETTI
|
||||||
Current->dmPelsHeight = devmode.dmPelsHeight;
|
Current->dmPelsHeight = devmode.dmPelsHeight;
|
||||||
Current->dmBitsPerPel = devmode.dmBitsPerPel;
|
Current->dmBitsPerPel = devmode.dmBitsPerPel;
|
||||||
Current->dmDisplayFrequency = devmode.dmDisplayFrequency;
|
Current->dmDisplayFrequency = devmode.dmDisplayFrequency;
|
||||||
while (Next != NULL && (
|
while (Next != NULL &&
|
||||||
Next->dmPelsWidth < Current->dmPelsWidth ||
|
CompareSettings(Next, devmode.dmPelsWidth,
|
||||||
(Next->dmPelsWidth == Current->dmPelsWidth && Next->dmPelsHeight < Current->dmPelsHeight) ||
|
devmode.dmPelsHeight, devmode.dmBitsPerPel,
|
||||||
(Next->dmPelsHeight == Current->dmPelsHeight &&
|
devmode.dmDisplayFrequency) > 0)
|
||||||
Next->dmPelsWidth == Current->dmPelsWidth &&
|
|
||||||
Next->dmBitsPerPel < Current->dmBitsPerPel )))
|
|
||||||
{
|
{
|
||||||
Previous = Next;
|
Previous = Next;
|
||||||
Next = Next->Flink;
|
Next = Next->Flink;
|
||||||
|
@ -142,7 +157,6 @@ GetPossibleSettings(IN LPCTSTR DeviceName, OUT DWORD* pSettingsCount, OUT PSETTI
|
||||||
}
|
}
|
||||||
NbSettings++;
|
NbSettings++;
|
||||||
}
|
}
|
||||||
iMode++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*pSettingsCount = NbSettings;
|
*pSettingsCount = NbSettings;
|
||||||
|
@ -538,6 +552,8 @@ OnResolutionChanged(IN HWND hwndDlg, IN PDATA pData, IN DWORD NewPosition,
|
||||||
PSETTINGS_ENTRY Current;
|
PSETTINGS_ENTRY Current;
|
||||||
DWORD dmNewPelsHeight = pData->CurrentDisplayDevice->Resolutions[NewPosition].dmPelsHeight;
|
DWORD dmNewPelsHeight = pData->CurrentDisplayDevice->Resolutions[NewPosition].dmPelsHeight;
|
||||||
DWORD dmNewPelsWidth = pData->CurrentDisplayDevice->Resolutions[NewPosition].dmPelsWidth;
|
DWORD dmNewPelsWidth = pData->CurrentDisplayDevice->Resolutions[NewPosition].dmPelsWidth;
|
||||||
|
DWORD dmBitsPerPel;
|
||||||
|
DWORD dmDisplayFrequency;
|
||||||
|
|
||||||
/* Find if new parameters are valid */
|
/* Find if new parameters are valid */
|
||||||
Current = pData->CurrentDisplayDevice->CurrentSettings;
|
Current = pData->CurrentDisplayDevice->CurrentSettings;
|
||||||
|
@ -549,14 +565,19 @@ OnResolutionChanged(IN HWND hwndDlg, IN PDATA pData, IN DWORD NewPosition,
|
||||||
|
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
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;
|
Current = Current->Blink;
|
||||||
while (Current != NULL)
|
while (Current != NULL)
|
||||||
{
|
{
|
||||||
if (Current->dmPelsHeight == dmNewPelsHeight
|
if (Current->dmPelsHeight == dmNewPelsHeight
|
||||||
&& Current->dmPelsWidth == dmNewPelsWidth
|
&& Current->dmPelsWidth == dmNewPelsWidth
|
||||||
&& Current->dmBitsPerPel == pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel)
|
&& Current->dmBitsPerPel == dmBitsPerPel)
|
||||||
{
|
{
|
||||||
pData->CurrentDisplayDevice->CurrentSettings = Current;
|
pData->CurrentDisplayDevice->CurrentSettings = Current;
|
||||||
UpdateDisplay(hwndDlg, pData, bUpdateThumb);
|
UpdateDisplay(hwndDlg, pData, bUpdateThumb);
|
||||||
|
@ -571,8 +592,8 @@ OnResolutionChanged(IN HWND hwndDlg, IN PDATA pData, IN DWORD NewPosition,
|
||||||
while (Current != NULL)
|
while (Current != NULL)
|
||||||
{
|
{
|
||||||
if (Current->dmPelsHeight == dmNewPelsHeight
|
if (Current->dmPelsHeight == dmNewPelsHeight
|
||||||
&& Current->dmPelsWidth == dmNewPelsWidth
|
&& Current->dmPelsWidth == dmNewPelsWidth
|
||||||
&& Current->dmBitsPerPel == pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel)
|
&& Current->dmBitsPerPel == dmBitsPerPel)
|
||||||
{
|
{
|
||||||
pData->CurrentDisplayDevice->CurrentSettings = Current;
|
pData->CurrentDisplayDevice->CurrentSettings = Current;
|
||||||
UpdateDisplay(hwndDlg, pData, bUpdateThumb);
|
UpdateDisplay(hwndDlg, pData, bUpdateThumb);
|
||||||
|
|
Loading…
Reference in a new issue