Author: hbelusca
Date: Sat Feb 13 13:43:35 2016
New Revision: 70729
URL:
http://svn.reactos.org/svn/reactos?rev=70729&view=rev
Log:
[DESK.CPL]: Fix resolution slider issues.
Patch by "reactosfanboy" and Mark Jansen (nick "learn_more")
CORE-10792 #resolve
Modified:
trunk/reactos/dll/cpl/desk/settings.c
Modified: trunk/reactos/dll/cpl/desk/settings.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/settings.c?re…
==============================================================================
--- trunk/reactos/dll/cpl/desk/settings.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/desk/settings.c [iso-8859-1] Sat Feb 13 13:43:35 2016
@@ -56,6 +56,28 @@
}
}
+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 @@
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 @@
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)
- {
- iMode++;
+ devmode.dmPelsHeight < 480 ||
+ devmode.dmDisplayFrequency != curDispFreq ||
+ (devmode.dmBitsPerPel != 4 &&
+ devmode.dmBitsPerPel != 8 &&
+ devmode.dmBitsPerPel != 16 &&
+ devmode.dmBitsPerPel != 24 &&
+ devmode.dmBitsPerPel != 32))
+ {
continue;
}
@@ -118,12 +135,10 @@
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 @@
}
NbSettings++;
}
- iMode++;
}
*pSettingsCount = NbSettings;
@@ -538,6 +552,8 @@
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 @@
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 @@
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);