Author: fireball
Date: Sun Sep 19 11:54:33 2010
New Revision: 48812
URL:
http://svn.reactos.org/svn/reactos?rev=48812&view=rev
Log:
[DESK.CPL]
Katayama Hirofumi <katayama.hirofumi.mz(a)gmail.com>
- Renamed GLOBAL_DATA structures to DATA.
- Added real GLOBAL_DATA in background.c, that manages the background color.
- Resolved conflict of background colors in background.c and appearance.c.
- Fixed drawing the menu in draw.c.
See issue #5620 for more details.
Modified:
trunk/reactos/dll/cpl/desk/appearance.c
trunk/reactos/dll/cpl/desk/background.c
trunk/reactos/dll/cpl/desk/desk.c
trunk/reactos/dll/cpl/desk/desk.h
trunk/reactos/dll/cpl/desk/draw.c
trunk/reactos/dll/cpl/desk/preview.c
trunk/reactos/dll/cpl/desk/screensaver.c
trunk/reactos/dll/cpl/desk/settings.c
Modified: trunk/reactos/dll/cpl/desk/appearance.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/appearance.c?…
==============================================================================
--- trunk/reactos/dll/cpl/desk/appearance.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/desk/appearance.c [iso-8859-1] Sun Sep 19 11:54:33 2010
@@ -5,7 +5,7 @@
* PURPOSE: Appearance property page
*
* PROGRAMMERS: Trevor McCort (lycan359(a)gmail.com)
- * Timo Kreuzer (timo[dot]kreuzer[at]web[dot]de
+ * Timo Kreuzer (timo[dot]kreuzer[at]web[dot]de)
*/
#include "desk.h"
@@ -115,6 +115,7 @@
{
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
g->Theme = g->ThemeAdv;
+ g_GlobalData.desktop_color = g->Theme.crColor[COLOR_DESKTOP];
g->bHasChanged = TRUE;
g->ThemeId = -1; /* Customized */
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_COLORSCHEME, CB_SETCURSEL, (WPARAM)-1,
0);
@@ -160,6 +161,14 @@
case PSN_KILLACTIVE:
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)FALSE);
return TRUE;
+
+ case PSN_SETACTIVE:
+ if (g->Theme.crColor[COLOR_DESKTOP] != g_GlobalData.desktop_color)
+ {
+ g->Theme.crColor[COLOR_DESKTOP] = g_GlobalData.desktop_color;
+ SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0,
(LPARAM)&g->Theme);
+ }
+ break;
}
break;
}
Modified: trunk/reactos/dll/cpl/desk/background.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/background.c?…
==============================================================================
--- trunk/reactos/dll/cpl/desk/background.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/desk/background.c [iso-8859-1] Sun Sep 19 11:54:33 2010
@@ -26,7 +26,7 @@
} BackgroundItem;
-typedef struct _GLOBAL_DATA
+typedef struct _DATA
{
BackgroundItem backgroundItems[MAX_BACKGROUNDS];
@@ -35,7 +35,6 @@
int placementSelection;
int backgroundSelection;
- COLORREF backgroundDesktopColor;
COLORREF custom_colors[16];
int listViewItemCount;
@@ -43,13 +42,14 @@
HBITMAP hBitmap;
int cxSource;
int cySource;
-} GLOBAL_DATA, *PGLOBAL_DATA;
-
+} DATA, *PDATA;
+
+GLOBAL_DATA g_GlobalData;
/* Add the images in the C:\ReactOS directory and the current wallpaper if any */
static VOID
-AddListViewItems(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
+AddListViewItems(HWND hwndDlg, PDATA pData)
{
WIN32_FIND_DATA fd;
HANDLE hFind;
@@ -85,7 +85,7 @@
(void)ListView_InsertColumn(hwndBackgroundList, 0, &dummy);
/* Add the "None" item */
- backgroundItem =
&pGlobalData->backgroundItems[pGlobalData->listViewItemCount];
+ backgroundItem = &pData->backgroundItems[pData->listViewItemCount];
backgroundItem->bWallpaper = FALSE;
LoadString(hApplet,
IDS_NONE,
@@ -97,16 +97,16 @@
listItem.state = 0;
listItem.pszText = backgroundItem->szDisplayName;
listItem.iImage = -1;
- listItem.iItem = pGlobalData->listViewItemCount;
- listItem.lParam = pGlobalData->listViewItemCount;
+ listItem.iItem = pData->listViewItemCount;
+ listItem.lParam = pData->listViewItemCount;
(void)ListView_InsertItem(hwndBackgroundList, &listItem);
ListView_SetItemState(hwndBackgroundList,
- pGlobalData->listViewItemCount,
+ pData->listViewItemCount,
LVIS_SELECTED,
LVIS_SELECTED);
- pGlobalData->listViewItemCount++;
+ pData->listViewItemCount++;
/* Add current wallpaper if any */
RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0,
KEY_ALL_ACCESS, ®Key);
@@ -134,7 +134,7 @@
(void)ListView_SetImageList(hwndBackgroundList, himl, LVSIL_SMALL);
}
- backgroundItem =
&pGlobalData->backgroundItems[pGlobalData->listViewItemCount];
+ backgroundItem =
&pData->backgroundItems[pData->listViewItemCount];
backgroundItem->bWallpaper = TRUE;
@@ -149,16 +149,16 @@
listItem.state = 0;
listItem.pszText = backgroundItem->szDisplayName;
listItem.iImage = sfi.iIcon;
- listItem.iItem = pGlobalData->listViewItemCount;
- listItem.lParam = pGlobalData->listViewItemCount;
+ listItem.iItem = pData->listViewItemCount;
+ listItem.lParam = pData->listViewItemCount;
(void)ListView_InsertItem(hwndBackgroundList, &listItem);
ListView_SetItemState(hwndBackgroundList,
- pGlobalData->listViewItemCount,
+ pData->listViewItemCount,
LVIS_SELECTED,
LVIS_SELECTED);
- pGlobalData->listViewItemCount++;
+ pData->listViewItemCount++;
}
}
@@ -203,7 +203,7 @@
(void)ListView_SetImageList(hwndBackgroundList, himl, LVSIL_SMALL);
}
- backgroundItem =
&pGlobalData->backgroundItems[pGlobalData->listViewItemCount];
+ backgroundItem =
&pData->backgroundItems[pData->listViewItemCount];
backgroundItem->bWallpaper = TRUE;
@@ -218,12 +218,12 @@
listItem.pszText = backgroundItem->szDisplayName;
listItem.state = 0;
listItem.iImage = sfi.iIcon;
- listItem.iItem = pGlobalData->listViewItemCount;
- listItem.lParam = pGlobalData->listViewItemCount;
+ listItem.iItem = pData->listViewItemCount;
+ listItem.lParam = pData->listViewItemCount;
(void)ListView_InsertItem(hwndBackgroundList, &listItem);
- pGlobalData->listViewItemCount++;
+ pData->listViewItemCount++;
}
if(!FindNextFile(hFind, &fd))
@@ -236,7 +236,7 @@
static VOID
-InitBackgroundDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
+InitBackgroundDialog(HWND hwndDlg, PDATA pData)
{
TCHAR szString[256];
HKEY regKey;
@@ -246,9 +246,7 @@
LONG result;
BITMAP bitmap;
- pGlobalData->backgroundDesktopColor = GetSysColor(COLOR_BACKGROUND);
-
- AddListViewItems(hwndDlg, pGlobalData);
+ AddListViewItems(hwndDlg, pData);
LoadString(hApplet, IDS_CENTER, szString, sizeof(szString) / sizeof(TCHAR));
SendDlgItemMessage(hwndDlg, IDC_PLACEMENT_COMBO, CB_INSERTSTRING, PLACEMENT_CENTER,
(LPARAM)szString);
@@ -278,19 +276,19 @@
if (_ttoi(szBuffer) == 0)
{
SendDlgItemMessage(hwndDlg, IDC_PLACEMENT_COMBO, CB_SETCURSEL,
PLACEMENT_CENTER, 0);
- pGlobalData->placementSelection = PLACEMENT_CENTER;
+ pData->placementSelection = PLACEMENT_CENTER;
}
if (_ttoi(szBuffer) == 2)
{
SendDlgItemMessage(hwndDlg, IDC_PLACEMENT_COMBO, CB_SETCURSEL,
PLACEMENT_STRETCH, 0);
- pGlobalData->placementSelection = PLACEMENT_STRETCH;
+ pData->placementSelection = PLACEMENT_STRETCH;
}
}
else
{
SendDlgItemMessage(hwndDlg, IDC_PLACEMENT_COMBO, CB_SETCURSEL, PLACEMENT_CENTER,
0);
- pGlobalData->placementSelection = PLACEMENT_CENTER;
+ pData->placementSelection = PLACEMENT_CENTER;
}
result = RegQueryValueEx(regKey, TEXT("TileWallpaper"), 0, &varType,
(LPBYTE)szBuffer, &bufferSize);
@@ -299,25 +297,25 @@
if (_ttoi(szBuffer) == 1)
{
SendDlgItemMessage(hwndDlg, IDC_PLACEMENT_COMBO, CB_SETCURSEL,
PLACEMENT_TILE, 0);
- pGlobalData->placementSelection = PLACEMENT_TILE;
+ pData->placementSelection = PLACEMENT_TILE;
}
}
RegCloseKey(regKey);
- pGlobalData->hBitmap = (HBITMAP) LoadImage(hApplet, MAKEINTRESOURCE(IDC_MONITOR),
IMAGE_BITMAP, 0, 0, LR_LOADTRANSPARENT);
- if (pGlobalData->hBitmap != NULL)
- {
- GetObject(pGlobalData->hBitmap, sizeof(BITMAP), &bitmap);
-
- pGlobalData->cxSource = bitmap.bmWidth;
- pGlobalData->cySource = bitmap.bmHeight;
+ pData->hBitmap = (HBITMAP) LoadImage(hApplet, MAKEINTRESOURCE(IDC_MONITOR),
IMAGE_BITMAP, 0, 0, LR_LOADTRANSPARENT);
+ if (pData->hBitmap != NULL)
+ {
+ GetObject(pData->hBitmap, sizeof(BITMAP), &bitmap);
+
+ pData->cxSource = bitmap.bmWidth;
+ pData->cySource = bitmap.bmHeight;
}
}
static VOID
-OnColorButton(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
+OnColorButton(HWND hwndDlg, PDATA pData)
{
/* Load custom colors from Registry */
HKEY hKey = NULL;
@@ -331,9 +329,9 @@
{
/* Key opened */
DWORD dwType = REG_BINARY;
- DWORD cbData = sizeof(pGlobalData->custom_colors);
+ DWORD cbData = sizeof(pData->custom_colors);
res = RegQueryValueEx(hKey, TEXT("CustomColors"), NULL, &dwType,
- (LPBYTE)pGlobalData->custom_colors, &cbData);
+ (LPBYTE)pData->custom_colors, &cbData);
RegCloseKey(hKey);
hKey = NULL;
}
@@ -343,8 +341,8 @@
cc.lStructSize = sizeof(CHOOSECOLOR);
cc.hwndOwner = hwndDlg;
cc.hInstance = NULL;
- cc.rgbResult = pGlobalData->backgroundDesktopColor;
- cc.lpCustColors = pGlobalData->custom_colors;
+ cc.rgbResult = g_GlobalData.desktop_color;
+ cc.lpCustColors = pData->custom_colors;
cc.Flags = CC_ANYCOLOR | /* Causes the dialog box to display all available colors in
the set of basic colors. */
CC_FULLOPEN | /* opens dialog in full size */
CC_RGBINIT ; /* init chosen color by rgbResult value */
@@ -354,7 +352,7 @@
if (ChooseColor(&cc))
{
/* Save selected color to var */
- pGlobalData->backgroundDesktopColor = cc.rgbResult;
+ g_GlobalData.desktop_color = cc.rgbResult;
/* Apply button will be activated */
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
@@ -369,7 +367,7 @@
{
/* Key opened */
RegSetValueEx(hKey, TEXT("CustomColors"), 0, REG_BINARY,
- (const BYTE *)pGlobalData->custom_colors,
sizeof(pGlobalData->custom_colors));
+ (const BYTE *)pData->custom_colors, sizeof(pData->custom_colors));
RegCloseKey(hKey);
hKey = NULL;
}
@@ -400,7 +398,7 @@
static VOID
-OnBrowseButton(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
+OnBrowseButton(HWND hwndDlg, PDATA pData)
{
OPENFILENAME ofn;
TCHAR filename[MAX_PATH];
@@ -439,7 +437,7 @@
if (CheckListViewFilenameExists(hwndBackgroundList, ofn.lpstrFileTitle) == TRUE)
return;
- if (pGlobalData->listViewItemCount > (MAX_BACKGROUNDS - 1))
+ if (pData->listViewItemCount > (MAX_BACKGROUNDS - 1))
return;
SHGetFileInfo(filename,
@@ -448,7 +446,7 @@
sizeof(sfi),
SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_DISPLAYNAME);
- backgroundItem =
&pGlobalData->backgroundItems[pGlobalData->listViewItemCount];
+ backgroundItem = &pData->backgroundItems[pData->listViewItemCount];
backgroundItem->bWallpaper = TRUE;
@@ -463,40 +461,40 @@
listItem.state = 0;
listItem.pszText = backgroundItem->szDisplayName;
listItem.iImage = sfi.iIcon;
- listItem.iItem = pGlobalData->listViewItemCount;
- listItem.lParam = pGlobalData->listViewItemCount;
+ listItem.iItem = pData->listViewItemCount;
+ listItem.lParam = pData->listViewItemCount;
(void)ListView_InsertItem(hwndBackgroundList, &listItem);
ListView_SetItemState(hwndBackgroundList,
- pGlobalData->listViewItemCount,
+ pData->listViewItemCount,
LVIS_SELECTED,
LVIS_SELECTED);
SendMessage(hwndBackgroundList, WM_VSCROLL, SB_BOTTOM, 0);
- pGlobalData->listViewItemCount++;
+ pData->listViewItemCount++;
}
}
static VOID
-ListViewItemChanged(HWND hwndDlg, PGLOBAL_DATA pGlobalData, int itemIndex)
+ListViewItemChanged(HWND hwndDlg, PDATA pData, int itemIndex)
{
BackgroundItem *backgroundItem = NULL;
- pGlobalData->backgroundSelection = itemIndex;
- backgroundItem =
&pGlobalData->backgroundItems[pGlobalData->backgroundSelection];
-
- if (pGlobalData->pWallpaperBitmap != NULL)
- {
- DibFreeImage(pGlobalData->pWallpaperBitmap);
- pGlobalData->pWallpaperBitmap = NULL;
+ pData->backgroundSelection = itemIndex;
+ backgroundItem = &pData->backgroundItems[pData->backgroundSelection];
+
+ if (pData->pWallpaperBitmap != NULL)
+ {
+ DibFreeImage(pData->pWallpaperBitmap);
+ pData->pWallpaperBitmap = NULL;
}
if (backgroundItem->bWallpaper == TRUE)
{
- pGlobalData->pWallpaperBitmap = DibLoadImage(backgroundItem->szFilename);
-
- if (pGlobalData->pWallpaperBitmap == NULL)
+ pData->pWallpaperBitmap = DibLoadImage(backgroundItem->szFilename);
+
+ if (pData->pWallpaperBitmap == NULL)
return;
}
@@ -511,7 +509,7 @@
static VOID
-DrawBackgroundPreview(LPDRAWITEMSTRUCT draw, PGLOBAL_DATA pGlobalData)
+DrawBackgroundPreview(LPDRAWITEMSTRUCT draw, PDATA pData)
{
float scaleX;
float scaleY;
@@ -523,23 +521,23 @@
int x;
int y;
- if (pGlobalData->backgroundItems[pGlobalData->backgroundSelection].bWallpaper
== FALSE)
+ if (pData->backgroundItems[pData->backgroundSelection].bWallpaper == FALSE)
{
/* update desktop background color image */
- hBrush = CreateSolidBrush(pGlobalData->backgroundDesktopColor);
+ hBrush = CreateSolidBrush(g_GlobalData.desktop_color);
FillRect(draw->hDC, &draw->rcItem, hBrush);
DeleteObject(hBrush);
return;
}
- if (pGlobalData->pWallpaperBitmap == NULL)
+ if (pData->pWallpaperBitmap == NULL)
return;
scaleX = ((float)GetSystemMetrics(SM_CXSCREEN) - 1) / (float)draw->rcItem.right;
scaleY = ((float)GetSystemMetrics(SM_CYSCREEN) - 1) / (float)draw->rcItem.bottom;
- scaledWidth = pGlobalData->pWallpaperBitmap->width / scaleX;
- scaledHeight = pGlobalData->pWallpaperBitmap->height / scaleY;
+ scaledWidth = pData->pWallpaperBitmap->width / scaleX;
+ scaledHeight = pData->pWallpaperBitmap->height / scaleY;
posX = (draw->rcItem.right / 2) - (scaledWidth / 2);
posY = (draw->rcItem.bottom / 2) - (scaledHeight / 2);
@@ -548,7 +546,7 @@
SetStretchBltMode(draw->hDC, COLORONCOLOR);
- switch (pGlobalData->placementSelection)
+ switch (pData->placementSelection)
{
case PLACEMENT_CENTER:
StretchDIBits(draw->hDC,
@@ -558,10 +556,10 @@
scaledHeight,
0,
0,
- pGlobalData->pWallpaperBitmap->width,
- pGlobalData->pWallpaperBitmap->height,
- pGlobalData->pWallpaperBitmap->bits,
- pGlobalData->pWallpaperBitmap->info,
+ pData->pWallpaperBitmap->width,
+ pData->pWallpaperBitmap->height,
+ pData->pWallpaperBitmap->bits,
+ pData->pWallpaperBitmap->info,
DIB_RGB_COLORS,
SRCCOPY);
break;
@@ -574,10 +572,10 @@
draw->rcItem.bottom,
0,
0,
- pGlobalData->pWallpaperBitmap->width,
- pGlobalData->pWallpaperBitmap->height,
- pGlobalData->pWallpaperBitmap->bits,
- pGlobalData->pWallpaperBitmap->info,
+ pData->pWallpaperBitmap->width,
+ pData->pWallpaperBitmap->height,
+ pData->pWallpaperBitmap->bits,
+ pData->pWallpaperBitmap->info,
DIB_RGB_COLORS,
SRCCOPY);
break;
@@ -594,10 +592,10 @@
scaledHeight,
0,
0,
- pGlobalData->pWallpaperBitmap->width,
- pGlobalData->pWallpaperBitmap->height,
- pGlobalData->pWallpaperBitmap->bits,
- pGlobalData->pWallpaperBitmap->info,
+ pData->pWallpaperBitmap->width,
+ pData->pWallpaperBitmap->height,
+ pData->pWallpaperBitmap->bits,
+ pData->pWallpaperBitmap->info,
DIB_RGB_COLORS,
SRCCOPY);
}
@@ -608,25 +606,25 @@
static VOID
-SetWallpaper(PGLOBAL_DATA pGlobalData)
+SetWallpaper(PDATA pData)
{
HKEY regKey;
RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0,
KEY_ALL_ACCESS, ®Key);
- if (pGlobalData->placementSelection == PLACEMENT_TILE)
+ if (pData->placementSelection == PLACEMENT_TILE)
{
RegSetValueEx(regKey, TEXT("TileWallpaper"), 0, REG_SZ, (BYTE
*)TEXT("1"), sizeof(TCHAR) * 2);
RegSetValueEx(regKey, TEXT("WallpaperStyle"), 0, REG_SZ, (BYTE
*)TEXT("0"), sizeof(TCHAR) * 2);
}
- if (pGlobalData->placementSelection == PLACEMENT_CENTER)
+ if (pData->placementSelection == PLACEMENT_CENTER)
{
RegSetValueEx(regKey, TEXT("TileWallpaper"), 0, REG_SZ, (BYTE
*)TEXT("0"), sizeof(TCHAR) * 2);
RegSetValueEx(regKey, TEXT("WallpaperStyle"), 0, REG_SZ, (BYTE
*)TEXT("0"), sizeof(TCHAR) * 2);
}
- if (pGlobalData->placementSelection == PLACEMENT_STRETCH)
+ if (pData->placementSelection == PLACEMENT_STRETCH)
{
RegSetValueEx(regKey, TEXT("TileWallpaper"), 0, REG_SZ, (BYTE
*)TEXT("0"), sizeof(TCHAR) * 2);
RegSetValueEx(regKey, TEXT("WallpaperStyle"), 0, REG_SZ, (BYTE
*)TEXT("2"), sizeof(TCHAR) * 2);
@@ -634,11 +632,11 @@
RegCloseKey(regKey);
- if (pGlobalData->backgroundItems[pGlobalData->backgroundSelection].bWallpaper
== TRUE)
+ if (pData->backgroundItems[pData->backgroundSelection].bWallpaper == TRUE)
{
SystemParametersInfo(SPI_SETDESKWALLPAPER,
0,
-
pGlobalData->backgroundItems[pGlobalData->backgroundSelection].szFilename,
+
pData->backgroundItems[pData->backgroundSelection].szFilename,
SPIF_UPDATEINIFILE);
}
else
@@ -650,38 +648,33 @@
/* Change system color */
static VOID
-SetDesktopBackColor(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
+SetDesktopBackColor(HWND hwndDlg, DATA *pData)
{
INT iElement = COLOR_BACKGROUND;
HKEY hKey;
LONG result;
TCHAR clText[16];
- DWORD red, green, blue;
-
- if( !SetSysColors( 1, &iElement, &pGlobalData->backgroundDesktopColor ) )
+ BYTE red, green, blue;
+ DWORD dwDispostion;
+
+ if( !SetSysColors( 1, &iElement, &g_GlobalData.desktop_color ) )
MessageBox(hwndDlg, TEXT("SetSysColor() failed!"), /* these error texts
can need internationalization? */
TEXT("Error!"), MB_ICONSTOP );
- /* Write color to registry key: HKEY_CURRENT_USER\Control Panel\Colors\Background */
- hKey = NULL;
- result = ERROR_SUCCESS;
- result = RegOpenKeyEx( HKEY_CURRENT_USER, TEXT("Control Panel\\Colors"), 0,
KEY_WRITE, &hKey );
- if( result != ERROR_SUCCESS )
- {
- /* Key open failed; maybe it does not exist? create it! */
- result = RegCreateKeyEx( HKEY_CURRENT_USER, TEXT("Control
Panel\\Colors"), 0, NULL, 0,
- KEY_ALL_ACCESS, NULL, &hKey, NULL );
- /* Now key must be created and opened and hKey must point at newly created key
*/
- /* On error result will not contain ERROR_SUCCESS. I don't know how to handle
*/
- /* this case :( */
- }
- red = GetRValue(pGlobalData->backgroundDesktopColor);
- green = GetGValue(pGlobalData->backgroundDesktopColor);
- blue = GetBValue(pGlobalData->backgroundDesktopColor);
- _stprintf(clText, TEXT("%d %d %d"), red, green, blue ); /* format string to
be set to registry */
- RegSetValueEx(hKey, TEXT("Background"), 0, REG_SZ, (BYTE *)clText, lstrlen(
clText )*sizeof(TCHAR) + sizeof(TCHAR) );
- RegCloseKey(hKey);
-}
-
+
+ result = RegCreateKeyEx( HKEY_CURRENT_USER, TEXT("Control Panel\\Colors"),
0, NULL, 0,
+ KEY_ALL_ACCESS, NULL, &hKey, &dwDispostion );
+ if (result != ERROR_SUCCESS)
+ {
+ red = GetRValue(g_GlobalData.desktop_color);
+ green = GetGValue(g_GlobalData.desktop_color);
+ blue = GetBValue(g_GlobalData.desktop_color);
+ /* format string to be set to registry */
+ wsprintf(clText, TEXT("%d %d %d"), red, green, blue);
+ RegSetValueEx(hKey, TEXT("Background"), 0, REG_SZ, (BYTE *)clText,
+ (lstrlen(clText) + 1) * sizeof(TCHAR));
+ RegCloseKey(hKey);
+ }
+}
INT_PTR CALLBACK
BackgroundPageProc(HWND hwndDlg,
@@ -689,16 +682,16 @@
WPARAM wParam,
LPARAM lParam)
{
- PGLOBAL_DATA pGlobalData;
-
- pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
+ PDATA pData;
+
+ pData = (PDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
switch (uMsg)
{
case WM_INITDIALOG:
- pGlobalData = (GLOBAL_DATA*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(GLOBAL_DATA));
- SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
- InitBackgroundDialog(hwndDlg, pGlobalData);
+ pData = (DATA*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DATA));
+ SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pData);
+ InitBackgroundDialog(hwndDlg, pData);
break;
case WM_COMMAND:
@@ -710,18 +703,18 @@
{
case IDC_COLOR_BUTTON:
if (command == BN_CLICKED)
- OnColorButton(hwndDlg, pGlobalData);
+ OnColorButton(hwndDlg, pData);
break;
case IDC_BROWSE_BUTTON:
if (command == BN_CLICKED)
- OnBrowseButton(hwndDlg, pGlobalData);
+ OnBrowseButton(hwndDlg, pData);
break;
case IDC_PLACEMENT_COMBO:
if (command == CBN_SELCHANGE)
{
- pGlobalData->placementSelection =
(int)SendDlgItemMessage(hwndDlg, IDC_PLACEMENT_COMBO, CB_GETCURSEL, 0, 0);
+ pData->placementSelection =
(int)SendDlgItemMessage(hwndDlg, IDC_PLACEMENT_COMBO, CB_GETCURSEL, 0, 0);
InvalidateRect(GetDlgItem(hwndDlg, IDC_BACKGROUND_PREVIEW),
NULL, TRUE);
@@ -739,11 +732,11 @@
hdc = BeginPaint(hwndDlg, &ps);
hdcMem = CreateCompatibleDC(hdc);
- SelectObject(hdcMem, pGlobalData->hBitmap);
+ SelectObject(hdcMem, pData->hBitmap);
/*
TransparentBlt(hdc, 98, 0,
- pGlobalData->cxSource, pGlobalData->cySource,
hdcMem, 0, 0,
- pGlobalData->cxSource, pGlobalData->cySource,
0xFF80FF);
+ pData->cxSource, pData->cySource, hdcMem, 0, 0,
+ pData->cxSource, pData->cySource, 0xFF80FF);
*/
DeleteDC(hdcMem);
EndPaint(hwndDlg, &ps);
@@ -757,7 +750,7 @@
if (drawItem->CtlID == IDC_BACKGROUND_PREVIEW)
{
- DrawBackgroundPreview(drawItem, pGlobalData);
+ DrawBackgroundPreview(drawItem, pData);
}
}
@@ -770,8 +763,8 @@
switch(lpnm->code)
{
case PSN_APPLY:
- SetWallpaper(pGlobalData);
- SetDesktopBackColor(hwndDlg, pGlobalData);
+ SetWallpaper(pData);
+ SetDesktopBackColor(hwndDlg, pData);
return TRUE;
case LVN_ITEMCHANGED:
@@ -781,23 +774,21 @@
if ((nm->uNewState & LVIS_SELECTED) == 0)
return FALSE;
- ListViewItemChanged(hwndDlg, pGlobalData, nm->iItem);
-
- } break;
+ ListViewItemChanged(hwndDlg, pData, nm->iItem);
+ }
+ break;
}
}
break;
case WM_DESTROY:
- if (pGlobalData->pWallpaperBitmap != NULL)
- DibFreeImage(pGlobalData->pWallpaperBitmap);
-
- DeleteObject(pGlobalData->hBitmap);
- HeapFree(GetProcessHeap(), 0, pGlobalData);
+ if (pData->pWallpaperBitmap != NULL)
+ DibFreeImage(pData->pWallpaperBitmap);
+
+ DeleteObject(pData->hBitmap);
+ HeapFree(GetProcessHeap(), 0, pData);
break;
}
return FALSE;
}
-
-
Modified: trunk/reactos/dll/cpl/desk/desk.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/desk.c?rev=48…
==============================================================================
--- trunk/reactos/dll/cpl/desk/desk.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/desk/desk.c [iso-8859-1] Sun Sep 19 11:54:33 2010
@@ -131,6 +131,8 @@
UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(uMsg);
UNREFERENCED_PARAMETER(hwnd);
+
+ g_GlobalData.desktop_color = GetSysColor(COLOR_DESKTOP);
LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
Modified: trunk/reactos/dll/cpl/desk/desk.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/desk.h?rev=48…
==============================================================================
--- trunk/reactos/dll/cpl/desk/desk.h [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/desk/desk.h [iso-8859-1] Sun Sep 19 11:54:33 2010
@@ -85,6 +85,13 @@
SETTINGS_ENTRY InitialSettings;
} DISPLAY_DEVICE_ENTRY, *PDISPLAY_DEVICE_ENTRY;
+typedef struct _GLOBAL_DATA
+{
+ COLORREF desktop_color;
+} GLOBAL_DATA, *PGLOBAL_DATA;
+
+extern GLOBAL_DATA g_GlobalData;
+
BOOL
DisplayAdvancedSettings(HWND hWndParent, PDISPLAY_DEVICE_ENTRY DisplayDevice);
Modified: trunk/reactos/dll/cpl/desk/draw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/draw.c?rev=48…
==============================================================================
--- trunk/reactos/dll/cpl/desk/draw.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/desk/draw.c [iso-8859-1] Sun Sep 19 11:54:33 2010
@@ -541,11 +541,11 @@
{
GetMenuStringW(Menu, i, Text, 128, MF_BYPOSITION);
- rect.left = x;
+ rect.left = rect.right = x;
rect.top = Rect->top;
+ rect.bottom = Rect->bottom;
DrawTextW(DC, Text, -1, &rect, DT_SINGLELINE | DT_CALCRECT);
-
- rect.bottom = Rect->bottom;
+ rect.bottom = Rect->bottom;
rect.right += MENU_BAR_ITEMS_SPACE;
x += rect.right - rect.left;
Modified: trunk/reactos/dll/cpl/desk/preview.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/preview.c?rev…
==============================================================================
--- trunk/reactos/dll/cpl/desk/preview.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/desk/preview.c [iso-8859-1] Sun Sep 19 11:54:33 2010
@@ -77,6 +77,7 @@
pPreviewData->hbrScrollbar =
CreateSolidBrush(theme->crColor[COLOR_SCROLLBAR]);
if (pPreviewData->hbrDesktop != NULL)
DeleteObject(pPreviewData->hbrDesktop);
+
pPreviewData->hbrDesktop = CreateSolidBrush(theme->crColor[COLOR_DESKTOP]);
if (pPreviewData->hbrWindow != NULL)
DeleteObject(pPreviewData->hbrWindow);
Modified: trunk/reactos/dll/cpl/desk/screensaver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/screensaver.c…
==============================================================================
--- trunk/reactos/dll/cpl/desk/screensaver.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/desk/screensaver.c [iso-8859-1] Sun Sep 19 11:54:33 2010
@@ -20,12 +20,12 @@
} ScreenSaverItem;
-typedef struct _GLOBAL_DATA
+typedef struct _DATA
{
ScreenSaverItem ScreenSaverItems[MAX_SCREENSAVERS];
PROCESS_INFORMATION PrevWindowPi;
int Selection;
-} GLOBAL_DATA, *PGLOBAL_DATA;
+} DATA, *PDATA;
static LPTSTR
@@ -75,7 +75,7 @@
static VOID
-SelectionChanged(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
+SelectionChanged(HWND hwndDlg, PDATA pData)
{
HWND hwndCombo;
BOOL bEnable;
@@ -86,7 +86,7 @@
i = (INT)SendMessage(hwndCombo, CB_GETCURSEL, 0, 0);
i = (INT)SendMessage(hwndCombo, CB_GETITEMDATA, i, 0);
- pGlobalData->Selection = i;
+ pData->Selection = i;
bEnable = (i != 0);
@@ -101,31 +101,31 @@
static VOID
-SetScreenSaverPreviewBox(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
+SetScreenSaverPreviewBox(HWND hwndDlg, PDATA pData)
{
HWND hPreview = GetDlgItem(hwndDlg, IDC_SCREENS_PREVIEW);
STARTUPINFO si;
TCHAR szCmdline[2048];
/* kill off the previous preview process*/
- if (pGlobalData->PrevWindowPi.hProcess)
- {
- TerminateProcess(pGlobalData->PrevWindowPi.hProcess, 0);
- CloseHandle(pGlobalData->PrevWindowPi.hProcess);
- CloseHandle(pGlobalData->PrevWindowPi.hThread);
- pGlobalData->PrevWindowPi.hThread = pGlobalData->PrevWindowPi.hProcess =
NULL;
- }
-
- if (pGlobalData->Selection > 0)
+ if (pData->PrevWindowPi.hProcess)
+ {
+ TerminateProcess(pData->PrevWindowPi.hProcess, 0);
+ CloseHandle(pData->PrevWindowPi.hProcess);
+ CloseHandle(pData->PrevWindowPi.hThread);
+ pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess = NULL;
+ }
+
+ if (pData->Selection > 0)
{
_stprintf(szCmdline,
_T("%s /p %u"),
-
pGlobalData->ScreenSaverItems[pGlobalData->Selection].szFilename,
+ pData->ScreenSaverItems[pData->Selection].szFilename,
hPreview);
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
- ZeroMemory(&pGlobalData->PrevWindowPi,
sizeof(pGlobalData->PrevWindowPi));
+ ZeroMemory(&pData->PrevWindowPi, sizeof(pData->PrevWindowPi));
if (!CreateProcess(NULL,
szCmdline,
@@ -136,9 +136,9 @@
NULL,
NULL,
&si,
- &pGlobalData->PrevWindowPi))
- {
- pGlobalData->PrevWindowPi.hThread = pGlobalData->PrevWindowPi.hProcess
= NULL;
+ &pData->PrevWindowPi))
+ {
+ pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess = NULL;
}
}
}
@@ -181,7 +181,7 @@
static VOID
-ScreensaverConfig(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
+ScreensaverConfig(HWND hwndDlg, PDATA pData)
{
/*
/c:<hwnd> Run configuration, hwnd is handle of calling window
@@ -191,12 +191,12 @@
STARTUPINFO si;
PROCESS_INFORMATION pi;
- if (pGlobalData->Selection < 1)
+ if (pData->Selection < 1)
return;
_stprintf(szCmdline,
_T("%s /c:%u"),
- pGlobalData->ScreenSaverItems[pGlobalData->Selection].szFilename,
+ pData->ScreenSaverItems[pData->Selection].szFilename,
hwndDlg);
ZeroMemory(&si, sizeof(si));
@@ -214,22 +214,22 @@
&pi))
{
/* kill off the previous preview process */
- if (pGlobalData->PrevWindowPi.hProcess)
- {
- TerminateProcess(pGlobalData->PrevWindowPi.hProcess, 0);
- CloseHandle(pGlobalData->PrevWindowPi.hProcess);
- CloseHandle(pGlobalData->PrevWindowPi.hThread);
- pGlobalData->PrevWindowPi.hThread = pGlobalData->PrevWindowPi.hProcess
= NULL;
+ if (pData->PrevWindowPi.hProcess)
+ {
+ TerminateProcess(pData->PrevWindowPi.hProcess, 0);
+ CloseHandle(pData->PrevWindowPi.hProcess);
+ CloseHandle(pData->PrevWindowPi.hThread);
+ pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess = NULL;
}
if (WaitForSettingsDialog(hwndDlg, pi.hProcess))
- SetScreenSaverPreviewBox(hwndDlg, pGlobalData);
+ SetScreenSaverPreviewBox(hwndDlg, pData);
}
}
static VOID
-ScreensaverPreview(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
+ScreensaverPreview(HWND hwndDlg, PDATA pData)
{
/*
/s Run normal
@@ -239,21 +239,21 @@
STARTUPINFO si;
PROCESS_INFORMATION pi;
- if (pGlobalData->Selection < 1)
+ if (pData->Selection < 1)
return;
/* kill off the previous preview process*/
- if (pGlobalData->PrevWindowPi.hProcess)
- {
- TerminateProcess(pGlobalData->PrevWindowPi.hProcess, 0);
- CloseHandle(pGlobalData->PrevWindowPi.hProcess);
- CloseHandle(pGlobalData->PrevWindowPi.hThread);
- pGlobalData->PrevWindowPi.hThread = pGlobalData->PrevWindowPi.hProcess =
NULL;
+ if (pData->PrevWindowPi.hProcess)
+ {
+ TerminateProcess(pData->PrevWindowPi.hProcess, 0);
+ CloseHandle(pData->PrevWindowPi.hProcess);
+ CloseHandle(pData->PrevWindowPi.hThread);
+ pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess = NULL;
}
_stprintf(szCmdline,
_T("%s /s"),
- pGlobalData->ScreenSaverItems[pGlobalData->Selection].szFilename);
+ pData->ScreenSaverItems[pData->Selection].szFilename);
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
@@ -322,7 +322,7 @@
static VOID
-AddScreenSavers(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
+AddScreenSavers(HWND hwndDlg, PDATA pData)
{
HWND hwndScreenSavers = GetDlgItem(hwndDlg, IDC_SCREENS_LIST);
WIN32_FIND_DATA fd;
@@ -334,7 +334,7 @@
HANDLE hModule = NULL;
/* Add the "None" item */
- ScreenSaverItem = &pGlobalData->ScreenSaverItems[ScreenSaverCount];
+ ScreenSaverItem = &pData->ScreenSaverItems[ScreenSaverCount];
ScreenSaverItem->bIsScreenSaver = FALSE;
@@ -374,7 +374,7 @@
_tcscat(filename, TEXT("\\"));
_tcscat(filename, fd.cFileName);
- ScreenSaverItem = &pGlobalData->ScreenSaverItems[ScreenSaverCount];
+ ScreenSaverItem = &pData->ScreenSaverItems[ScreenSaverCount];
ScreenSaverItem->bIsScreenSaver = TRUE;
@@ -416,7 +416,7 @@
static VOID
-SetScreenSaver(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
+SetScreenSaver(HWND hwndDlg, PDATA pData)
{
HKEY regKey;
@@ -432,14 +432,14 @@
UINT Ret;
/* set the screensaver */
- if (pGlobalData->ScreenSaverItems[pGlobalData->Selection].bIsScreenSaver)
+ if (pData->ScreenSaverItems[pData->Selection].bIsScreenSaver)
{
RegSetValueEx(regKey,
_T("SCRNSAVE.EXE"),
0,
REG_SZ,
-
(PBYTE)pGlobalData->ScreenSaverItems[pGlobalData->Selection].szFilename,
-
_tcslen(pGlobalData->ScreenSaverItems[pGlobalData->Selection].szFilename) *
sizeof(TCHAR));
+
(PBYTE)pData->ScreenSaverItems[pData->Selection].szFilename,
+
_tcslen(pData->ScreenSaverItems[pData->Selection].szFilename) * sizeof(TCHAR));
}
else
{
@@ -485,16 +485,16 @@
static BOOL
-OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
+OnInitDialog(HWND hwndDlg, PDATA pData)
{
LPTSTR lpCurSs;
HWND hwndSSCombo = GetDlgItem(hwndDlg, IDC_SCREENS_LIST);
INT Num;
- pGlobalData = HeapAlloc(GetProcessHeap(),
+ pData = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
- sizeof(GLOBAL_DATA));
- if (!pGlobalData)
+ sizeof(DATA));
+ if (!pData)
{
EndDialog(hwndDlg, -1);
return FALSE;
@@ -502,9 +502,9 @@
SetWindowLongPtr(hwndDlg,
DWLP_USER,
- (LONG_PTR)pGlobalData);
-
- pGlobalData->Selection = -1;
+ (LONG_PTR)pData);
+
+ pData->Selection = -1;
SendDlgItemMessage(hwndDlg,
IDC_SCREENS_TIME,
@@ -514,7 +514,7 @@
((short) 240, (short) 1));
AddScreenSavers(hwndDlg,
- pGlobalData);
+ pData);
CheckRegScreenSaverIsSecure(hwndDlg);
@@ -527,7 +527,7 @@
for (i = 0; i < MAX_SCREENSAVERS; i++)
{
- if (!_tcscmp(lpCurSs, pGlobalData->ScreenSaverItems[i].szFilename))
+ if (!_tcscmp(lpCurSs, pData->ScreenSaverItems[i].szFilename))
{
bFound = TRUE;
break;
@@ -539,7 +539,7 @@
Num = SendMessage(hwndSSCombo,
CB_FINDSTRINGEXACT,
-1,
-
(LPARAM)pGlobalData->ScreenSaverItems[i].szDisplayName);
+ (LPARAM)pData->ScreenSaverItems[i].szDisplayName);
if (Num != CB_ERR)
SendMessage(hwndSSCombo,
CB_SETCURSEL,
@@ -588,7 +588,7 @@
}
SelectionChanged(hwndDlg,
- pGlobalData);
+ pData);
return TRUE;
}
@@ -600,36 +600,36 @@
WPARAM wParam,
LPARAM lParam)
{
- PGLOBAL_DATA pGlobalData;
-
- pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
+ PDATA pData;
+
+ pData = (PDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
switch (uMsg)
{
case WM_INITDIALOG:
{
- OnInitDialog(hwndDlg, pGlobalData);
+ OnInitDialog(hwndDlg, pData);
break;
}
case WM_DESTROY:
{
- if (pGlobalData->PrevWindowPi.hProcess)
+ if (pData->PrevWindowPi.hProcess)
{
- TerminateProcess(pGlobalData->PrevWindowPi.hProcess, 0);
- CloseHandle(pGlobalData->PrevWindowPi.hProcess);
- CloseHandle(pGlobalData->PrevWindowPi.hThread);
+ TerminateProcess(pData->PrevWindowPi.hProcess, 0);
+ CloseHandle(pData->PrevWindowPi.hProcess);
+ CloseHandle(pData->PrevWindowPi.hThread);
}
HeapFree(GetProcessHeap(),
0,
- pGlobalData);
+ pData);
break;
}
case WM_ENDSESSION:
{
SetScreenSaverPreviewBox(hwndDlg,
- pGlobalData);
+ pData);
break;
}
@@ -644,8 +644,8 @@
{
if (HIWORD(wParam) == CBN_SELCHANGE)
{
- SelectionChanged(hwndDlg, pGlobalData);
- SetScreenSaverPreviewBox(hwndDlg, pGlobalData);
+ SelectionChanged(hwndDlg, pData);
+ SetScreenSaverPreviewBox(hwndDlg, pData);
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
}
break;
@@ -668,8 +668,8 @@
{
if(command == BN_CLICKED)
{
- ScreensaverPreview(hwndDlg, pGlobalData);
- SetScreenSaverPreviewBox(hwndDlg, pGlobalData);
+ ScreensaverPreview(hwndDlg, pData);
+ SetScreenSaverPreviewBox(hwndDlg, pData);
}
break;
}
@@ -677,7 +677,7 @@
case IDC_SCREENS_SETTINGS: // Screensaver Settings
{
if (command == BN_CLICKED)
- ScreensaverConfig(hwndDlg, pGlobalData);
+ ScreensaverConfig(hwndDlg, pData);
break;
}
@@ -702,7 +702,7 @@
{
case PSN_APPLY:
{
- SetScreenSaver(hwndDlg, pGlobalData);
+ SetScreenSaver(hwndDlg, pData);
return TRUE;
}
@@ -710,7 +710,7 @@
{
/* activate screen saver support */
SystemParametersInfoW(SPI_SETSCREENSAVEACTIVE, TRUE, 0,
SPIF_SENDCHANGE);
- SetScreenSaverPreviewBox(hwndDlg, pGlobalData);
+ SetScreenSaverPreviewBox(hwndDlg, pData);
break;
}
@@ -718,12 +718,12 @@
{
/* Disable screensaver support */
SystemParametersInfoW(SPI_SETSCREENSAVEACTIVE, FALSE, 0,
SPIF_SENDCHANGE);
- if (pGlobalData->PrevWindowPi.hProcess)
+ if (pData->PrevWindowPi.hProcess)
{
- TerminateProcess(pGlobalData->PrevWindowPi.hProcess, 0);
- CloseHandle(pGlobalData->PrevWindowPi.hProcess);
- CloseHandle(pGlobalData->PrevWindowPi.hThread);
- pGlobalData->PrevWindowPi.hThread =
pGlobalData->PrevWindowPi.hProcess = NULL;
+ TerminateProcess(pData->PrevWindowPi.hProcess, 0);
+ CloseHandle(pData->PrevWindowPi.hProcess);
+ CloseHandle(pData->PrevWindowPi.hThread);
+ pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess
= NULL;
}
break;
}
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] Sun Sep 19 11:54:33 2010
@@ -11,38 +11,38 @@
#include "desk.h"
#include "monslctl.h"
-typedef struct _GLOBAL_DATA
+typedef struct _DATA
{
PDISPLAY_DEVICE_ENTRY DisplayDeviceList;
PDISPLAY_DEVICE_ENTRY CurrentDisplayDevice;
HBITMAP hSpectrumBitmaps[NUM_SPECTRUM_BITMAPS];
int cxSource[NUM_SPECTRUM_BITMAPS];
int cySource[NUM_SPECTRUM_BITMAPS];
-} GLOBAL_DATA, *PGLOBAL_DATA;
+} DATA, *PDATA;
static VOID
-UpdateDisplay(IN HWND hwndDlg, PGLOBAL_DATA pGlobalData, IN BOOL bUpdateThumb)
+UpdateDisplay(IN HWND hwndDlg, PDATA pData, IN BOOL bUpdateThumb)
{
TCHAR Buffer[64];
TCHAR Pixel[64];
DWORD index;
LoadString(hApplet, IDS_PIXEL, Pixel, sizeof(Pixel) / sizeof(TCHAR));
- _stprintf(Buffer, Pixel,
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth,
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight, Pixel);
+ _stprintf(Buffer, Pixel,
pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth,
pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight, Pixel);
SendDlgItemMessage(hwndDlg, IDC_SETTINGS_RESOLUTION_TEXT, WM_SETTEXT, 0,
(LPARAM)Buffer);
- for (index = 0; index < pGlobalData->CurrentDisplayDevice->ResolutionsCount;
index++)
- {
- if (pGlobalData->CurrentDisplayDevice->Resolutions[index].dmPelsWidth ==
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth &&
- pGlobalData->CurrentDisplayDevice->Resolutions[index].dmPelsHeight ==
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight)
+ for (index = 0; index < pData->CurrentDisplayDevice->ResolutionsCount;
index++)
+ {
+ if (pData->CurrentDisplayDevice->Resolutions[index].dmPelsWidth ==
pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth &&
+ pData->CurrentDisplayDevice->Resolutions[index].dmPelsHeight ==
pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight)
{
if (bUpdateThumb)
SendDlgItemMessage(hwndDlg, IDC_SETTINGS_RESOLUTION, TBM_SETPOS, TRUE, index);
break;
}
}
- if (LoadString(hApplet, (2900 +
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel), Buffer,
sizeof(Buffer) / sizeof(TCHAR)))
+ if (LoadString(hApplet, (2900 +
pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel), Buffer,
sizeof(Buffer) / sizeof(TCHAR)))
SendDlgItemMessage(hwndDlg, IDC_SETTINGS_BPP, CB_SELECTSTRING, (WPARAM)-1,
(LPARAM)Buffer);
}
@@ -140,7 +140,7 @@
}
static BOOL
-AddDisplayDevice(IN PGLOBAL_DATA pGlobalData, IN const DISPLAY_DEVICE *DisplayDevice)
+AddDisplayDevice(IN PDATA pData, IN const DISPLAY_DEVICE *DisplayDevice)
{
PDISPLAY_DEVICE_ENTRY newEntry = NULL;
LPTSTR description = NULL;
@@ -216,8 +216,8 @@
newEntry->DeviceKey = key;
newEntry->DeviceID = devid;
newEntry->DeviceStateFlags = DisplayDevice->StateFlags;
- newEntry->Flink = pGlobalData->DisplayDeviceList;
- pGlobalData->DisplayDeviceList = newEntry;
+ newEntry->Flink = pData->DisplayDeviceList;
+ pData->DisplayDeviceList = newEntry;
return TRUE;
ByeBye:
@@ -247,12 +247,12 @@
}
static VOID
-OnDisplayDeviceChanged(IN HWND hwndDlg, IN PGLOBAL_DATA pGlobalData, IN
PDISPLAY_DEVICE_ENTRY pDeviceEntry)
+OnDisplayDeviceChanged(IN HWND hwndDlg, IN PDATA pData, IN PDISPLAY_DEVICE_ENTRY
pDeviceEntry)
{
PSETTINGS_ENTRY Current;
DWORD index;
- pGlobalData->CurrentDisplayDevice = pDeviceEntry; /* Update global variable */
+ pData->CurrentDisplayDevice = pDeviceEntry; /* Update variable */
/* Fill color depths combo box */
SendDlgItemMessage(hwndDlg, IDC_SETTINGS_BPP, CB_RESETCONTENT, 0, 0);
@@ -274,7 +274,7 @@
SendDlgItemMessage(hwndDlg, IDC_SETTINGS_RESOLUTION, TBM_CLEARTICS, TRUE, 0);
SendDlgItemMessage(hwndDlg, IDC_SETTINGS_RESOLUTION, TBM_SETRANGE, TRUE, MAKELONG(0,
pDeviceEntry->ResolutionsCount - 1));
- UpdateDisplay(hwndDlg, pGlobalData, TRUE);
+ UpdateDisplay(hwndDlg, pData, TRUE);
}
static VOID
@@ -285,22 +285,22 @@
DWORD iDevNum = 0;
DWORD i;
DISPLAY_DEVICE displayDevice;
- PGLOBAL_DATA pGlobalData;
-
- pGlobalData = HeapAlloc(GetProcessHeap(), 0, sizeof(GLOBAL_DATA));
- if (pGlobalData == NULL)
+ PDATA pData;
+
+ pData = HeapAlloc(GetProcessHeap(), 0, sizeof(DATA));
+ if (pData == NULL)
return;
- SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
+ SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pData);
/* Get video cards list */
- pGlobalData->DisplayDeviceList = NULL;
+ pData->DisplayDeviceList = NULL;
displayDevice.cb = (DWORD)sizeof(DISPLAY_DEVICE);
while (EnumDisplayDevices(NULL, iDevNum, &displayDevice, 0x1))
{
if ((displayDevice.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP) != 0)
{
- if (AddDisplayDevice(pGlobalData, &displayDevice))
+ if (AddDisplayDevice(pData, &displayDevice))
Result++;
}
iDevNum++;
@@ -316,7 +316,7 @@
ShowWindow(GetDlgItem(hwndDlg, IDC_SETTINGS_SPECTRUM), SW_HIDE);
/* Do not initialize the color spectrum bitmaps */
- memset(pGlobalData->hSpectrumBitmaps, 0, sizeof(pGlobalData->hSpectrumBitmaps));
+ memset(pData->hSpectrumBitmaps, 0, sizeof(pData->hSpectrumBitmaps));
return;
}
else if (Result == 1)
@@ -324,12 +324,12 @@
MONSL_MONINFO monitors;
/* Single video adapter */
- SendDlgItemMessage(hwndDlg, IDC_SETTINGS_DEVICE, WM_SETTEXT, 0,
(LPARAM)pGlobalData->DisplayDeviceList->DeviceDescription);
- OnDisplayDeviceChanged(hwndDlg, pGlobalData, pGlobalData->DisplayDeviceList);
+ SendDlgItemMessage(hwndDlg, IDC_SETTINGS_DEVICE, WM_SETTEXT, 0,
(LPARAM)pData->DisplayDeviceList->DeviceDescription);
+ OnDisplayDeviceChanged(hwndDlg, pData, pData->DisplayDeviceList);
monitors.Position.x = monitors.Position.y = 0;
- monitors.Size.cx =
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth;
- monitors.Size.cy =
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight;
+ monitors.Size.cx = pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth;
+ monitors.Size.cy =
pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight;
monitors.Flags = 0;
SendDlgItemMessage(hwndDlg,
IDC_SETTINGS_MONSEL,
@@ -342,8 +342,8 @@
PMONSL_MONINFO pMonitors;
DWORD i;
- SendDlgItemMessage(hwndDlg, IDC_SETTINGS_DEVICE, WM_SETTEXT, 0,
(LPARAM)pGlobalData->DisplayDeviceList->DeviceDescription);
- OnDisplayDeviceChanged(hwndDlg, pGlobalData, pGlobalData->DisplayDeviceList);
+ SendDlgItemMessage(hwndDlg, IDC_SETTINGS_DEVICE, WM_SETTEXT, 0,
(LPARAM)pData->DisplayDeviceList->DeviceDescription);
+ OnDisplayDeviceChanged(hwndDlg, pData, pData->DisplayDeviceList);
pMonitors = (PMONSL_MONINFO)HeapAlloc(GetProcessHeap(), 0, sizeof(MONSL_MONINFO) *
Result);
if (pMonitors)
@@ -353,8 +353,8 @@
{
pMonitors[i].Position.x = hack * i;
pMonitors[i].Position.y = 0;
- pMonitors[i].Size.cx =
pGlobalData->DisplayDeviceList->CurrentSettings->dmPelsWidth;
- pMonitors[i].Size.cy =
pGlobalData->DisplayDeviceList->CurrentSettings->dmPelsHeight;
+ pMonitors[i].Size.cx =
pData->DisplayDeviceList->CurrentSettings->dmPelsWidth;
+ pMonitors[i].Size.cy =
pData->DisplayDeviceList->CurrentSettings->dmPelsHeight;
pMonitors[i].Flags = 0;
}
@@ -371,27 +371,27 @@
/* Initialize the color spectrum bitmaps */
for(i = 0; i < NUM_SPECTRUM_BITMAPS; i++)
{
- pGlobalData->hSpectrumBitmaps[i] = LoadImageW(hApplet,
MAKEINTRESOURCEW(IDB_SPECTRUM_4 + i), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
-
- if (pGlobalData->hSpectrumBitmaps[i] != NULL)
- {
- if (GetObjectW(pGlobalData->hSpectrumBitmaps[i], sizeof(BITMAP), &bitmap) !=
0)
- {
- pGlobalData->cxSource[i] = bitmap.bmWidth;
- pGlobalData->cySource[i] = bitmap.bmHeight;
+ pData->hSpectrumBitmaps[i] = LoadImageW(hApplet, MAKEINTRESOURCEW(IDB_SPECTRUM_4 +
i), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
+
+ if (pData->hSpectrumBitmaps[i] != NULL)
+ {
+ if (GetObjectW(pData->hSpectrumBitmaps[i], sizeof(BITMAP), &bitmap) != 0)
+ {
+ pData->cxSource[i] = bitmap.bmWidth;
+ pData->cySource[i] = bitmap.bmHeight;
}
else
{
- pGlobalData->cxSource[i] = 0;
- pGlobalData->cySource[i] = 0;
- }
- }
- }
-}
-
-/* Get the ID for GLOBAL_DATA::hSpectrumBitmaps */
+ pData->cxSource[i] = 0;
+ pData->cySource[i] = 0;
+ }
+ }
+ }
+}
+
+/* Get the ID for DATA::hSpectrumBitmaps */
static VOID
-ShowColorSpectrum(IN HDC hDC, IN LPRECT client, IN DWORD BitsPerPel, IN PGLOBAL_DATA
pGlobalData)
+ShowColorSpectrum(IN HDC hDC, IN LPRECT client, IN DWORD BitsPerPel, IN PDATA pData)
{
HDC hdcMem;
INT iBitmap;
@@ -408,22 +408,22 @@
default: iBitmap = 2;
}
- if (SelectObject(hdcMem, pGlobalData->hSpectrumBitmaps[iBitmap]))
+ if (SelectObject(hdcMem, pData->hSpectrumBitmaps[iBitmap]))
{
StretchBlt(hDC,
client->left, client->top,
client->right - client->left,
client->bottom - client->top,
hdcMem, 0, 0,
- pGlobalData->cxSource[iBitmap],
- pGlobalData->cySource[iBitmap], SRCCOPY);
+ pData->cxSource[iBitmap],
+ pData->cySource[iBitmap], SRCCOPY);
}
DeleteDC(hdcMem);
}
static VOID
-OnBPPChanged(IN HWND hwndDlg, IN PGLOBAL_DATA pGlobalData)
+OnBPPChanged(IN HWND hwndDlg, IN PDATA pData)
{
/* if new BPP is not compatible with resolution:
* 1) try to find the nearest smaller matching resolution
@@ -443,10 +443,10 @@
hSpectrumControl = GetDlgItem(hwndDlg, IDC_SETTINGS_SPECTRUM);
hSpectrumDC = GetDC(hSpectrumControl);
GetClientRect(hSpectrumControl, &client);
- ShowColorSpectrum(hSpectrumDC, &client, dmNewBitsPerPel, pGlobalData);
+ ShowColorSpectrum(hSpectrumDC, &client, dmNewBitsPerPel, pData);
/* find if new parameters are valid */
- Current = pGlobalData->CurrentDisplayDevice->CurrentSettings;
+ Current = pData->CurrentDisplayDevice->CurrentSettings;
if (dmNewBitsPerPel == Current->dmBitsPerPel)
{
/* no change */
@@ -461,11 +461,11 @@
while (Current != NULL)
{
if (Current->dmBitsPerPel == dmNewBitsPerPel
- && Current->dmPelsHeight ==
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight
- && Current->dmPelsWidth ==
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth)
- {
- pGlobalData->CurrentDisplayDevice->CurrentSettings = Current;
- UpdateDisplay(hwndDlg, pGlobalData, TRUE);
+ && Current->dmPelsHeight ==
pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight
+ && Current->dmPelsWidth ==
pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth)
+ {
+ pData->CurrentDisplayDevice->CurrentSettings = Current;
+ UpdateDisplay(hwndDlg, pData, TRUE);
return;
}
Current = Current->Blink;
@@ -477,11 +477,11 @@
while (Current != NULL)
{
if (Current->dmBitsPerPel == dmNewBitsPerPel
- && Current->dmPelsHeight ==
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight
- && Current->dmPelsWidth ==
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth)
- {
- pGlobalData->CurrentDisplayDevice->CurrentSettings = Current;
- UpdateDisplay(hwndDlg, pGlobalData, TRUE);
+ && Current->dmPelsHeight ==
pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight
+ && Current->dmPelsWidth ==
pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth)
+ {
+ pData->CurrentDisplayDevice->CurrentSettings = Current;
+ UpdateDisplay(hwndDlg, pData, TRUE);
return;
}
Current = Current->Flink;
@@ -489,26 +489,26 @@
}
/* search smaller resolution compatible with current color depth */
- Current = pGlobalData->CurrentDisplayDevice->CurrentSettings->Blink;
+ Current = pData->CurrentDisplayDevice->CurrentSettings->Blink;
while (Current != NULL)
{
if (Current->dmBitsPerPel == dmNewBitsPerPel)
{
- pGlobalData->CurrentDisplayDevice->CurrentSettings = Current;
- UpdateDisplay(hwndDlg, pGlobalData, TRUE);
+ pData->CurrentDisplayDevice->CurrentSettings = Current;
+ UpdateDisplay(hwndDlg, pData, TRUE);
return;
}
Current = Current->Blink;
}
/* search bigger resolution compatible with current color depth */
- Current = pGlobalData->CurrentDisplayDevice->CurrentSettings->Flink;
+ Current = pData->CurrentDisplayDevice->CurrentSettings->Flink;
while (Current != NULL)
{
if (Current->dmBitsPerPel == dmNewBitsPerPel)
{
- pGlobalData->CurrentDisplayDevice->CurrentSettings = Current;
- UpdateDisplay(hwndDlg, pGlobalData, TRUE);
+ pData->CurrentDisplayDevice->CurrentSettings = Current;
+ UpdateDisplay(hwndDlg, pData, TRUE);
return;
}
Current = Current->Flink;
@@ -518,7 +518,7 @@
}
static VOID
-OnResolutionChanged(IN HWND hwndDlg, IN PGLOBAL_DATA pGlobalData, IN DWORD NewPosition,
+OnResolutionChanged(IN HWND hwndDlg, IN PDATA pData, IN DWORD NewPosition,
IN BOOL bUpdateThumb)
{
/* if new resolution is not compatible with color depth:
@@ -526,11 +526,11 @@
* 2) otherwise, get the nearest smaller color depth
*/
PSETTINGS_ENTRY Current;
- DWORD dmNewPelsHeight =
pGlobalData->CurrentDisplayDevice->Resolutions[NewPosition].dmPelsHeight;
- DWORD dmNewPelsWidth =
pGlobalData->CurrentDisplayDevice->Resolutions[NewPosition].dmPelsWidth;
+ DWORD dmNewPelsHeight =
pData->CurrentDisplayDevice->Resolutions[NewPosition].dmPelsHeight;
+ DWORD dmNewPelsWidth =
pData->CurrentDisplayDevice->Resolutions[NewPosition].dmPelsWidth;
/* find if new parameters are valid */
- Current = pGlobalData->CurrentDisplayDevice->CurrentSettings;
+ Current = pData->CurrentDisplayDevice->CurrentSettings;
if (dmNewPelsHeight == Current->dmPelsHeight && dmNewPelsWidth ==
Current->dmPelsWidth)
{
/* no change */
@@ -546,10 +546,10 @@
{
if (Current->dmPelsHeight == dmNewPelsHeight
&& Current->dmPelsWidth == dmNewPelsWidth
- && Current->dmBitsPerPel ==
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel)
- {
- pGlobalData->CurrentDisplayDevice->CurrentSettings = Current;
- UpdateDisplay(hwndDlg, pGlobalData, bUpdateThumb);
+ && Current->dmBitsPerPel ==
pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel)
+ {
+ pData->CurrentDisplayDevice->CurrentSettings = Current;
+ UpdateDisplay(hwndDlg, pData, bUpdateThumb);
return;
}
Current = Current->Blink;
@@ -562,10 +562,10 @@
{
if (Current->dmPelsHeight == dmNewPelsHeight
&& Current->dmPelsWidth == dmNewPelsWidth
- && Current->dmBitsPerPel ==
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel)
- {
- pGlobalData->CurrentDisplayDevice->CurrentSettings = Current;
- UpdateDisplay(hwndDlg, pGlobalData, bUpdateThumb);
+ && Current->dmBitsPerPel ==
pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel)
+ {
+ pData->CurrentDisplayDevice->CurrentSettings = Current;
+ UpdateDisplay(hwndDlg, pData, bUpdateThumb);
return;
}
Current = Current->Flink;
@@ -573,26 +573,26 @@
}
/* search bigger color depth compatible with current resolution */
- Current = pGlobalData->CurrentDisplayDevice->CurrentSettings->Flink;
+ Current = pData->CurrentDisplayDevice->CurrentSettings->Flink;
while (Current != NULL)
{
if (dmNewPelsHeight == Current->dmPelsHeight && dmNewPelsWidth ==
Current->dmPelsWidth)
{
- pGlobalData->CurrentDisplayDevice->CurrentSettings = Current;
- UpdateDisplay(hwndDlg, pGlobalData, bUpdateThumb);
+ pData->CurrentDisplayDevice->CurrentSettings = Current;
+ UpdateDisplay(hwndDlg, pData, bUpdateThumb);
return;
}
Current = Current->Flink;
}
/* search smaller color depth compatible with current resolution */
- Current = pGlobalData->CurrentDisplayDevice->CurrentSettings->Blink;
+ Current = pData->CurrentDisplayDevice->CurrentSettings->Blink;
while (Current != NULL)
{
if (dmNewPelsHeight == Current->dmPelsHeight && dmNewPelsWidth ==
Current->dmPelsWidth)
{
- pGlobalData->CurrentDisplayDevice->CurrentSettings = Current;
- UpdateDisplay(hwndDlg, pGlobalData, bUpdateThumb);
+ pData->CurrentDisplayDevice->CurrentSettings = Current;
+ UpdateDisplay(hwndDlg, pData, bUpdateThumb);
return;
}
Current = Current->Blink;
@@ -625,10 +625,10 @@
INT_PTR CALLBACK
SettingsPageProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
{
- PGLOBAL_DATA pGlobalData;
+ PDATA pData;
TCHAR Message[1024], Title[256];
- pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
+ pData = (PDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
switch(uMsg)
{
@@ -643,7 +643,7 @@
lpDrawItem = (LPDRAWITEMSTRUCT) lParam;
if (lpDrawItem->CtlID == IDC_SETTINGS_SPECTRUM)
- ShowColorSpectrum(lpDrawItem->hDC, &lpDrawItem->rcItem,
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel, pGlobalData);
+ ShowColorSpectrum(lpDrawItem->hDC, &lpDrawItem->rcItem,
pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel, pData);
break;
}
case WM_COMMAND:
@@ -652,9 +652,9 @@
DWORD command = HIWORD(wParam);
if (controlId == IDC_SETTINGS_ADVANCED && command == BN_CLICKED)
- DisplayAdvancedSettings(hwndDlg, pGlobalData->CurrentDisplayDevice);
+ DisplayAdvancedSettings(hwndDlg, pData->CurrentDisplayDevice);
else if (controlId == IDC_SETTINGS_BPP && command == CBN_SELCHANGE)
- OnBPPChanged(hwndDlg, pGlobalData);
+ OnBPPChanged(hwndDlg, pData);
break;
}
case WM_HSCROLL:
@@ -670,12 +670,12 @@
case TB_ENDTRACK:
{
DWORD newPosition = (DWORD) SendDlgItemMessage(hwndDlg, IDC_SETTINGS_RESOLUTION,
TBM_GETPOS, 0, 0);
- OnResolutionChanged(hwndDlg, pGlobalData, newPosition, TRUE);
+ OnResolutionChanged(hwndDlg, pData, newPosition, TRUE);
break;
}
case TB_THUMBTRACK:
- OnResolutionChanged(hwndDlg, pGlobalData, HIWORD(wParam), FALSE);
+ OnResolutionChanged(hwndDlg, pData, HIWORD(wParam), FALSE);
break;
}
break;
@@ -685,9 +685,9 @@
LPNMHDR lpnm = (LPNMHDR)lParam;
if (lpnm->code == (UINT)PSN_APPLY)
{
- if (pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth !=
pGlobalData->CurrentDisplayDevice->InitialSettings.dmPelsWidth
- || pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight !=
pGlobalData->CurrentDisplayDevice->InitialSettings.dmPelsHeight
- || pGlobalData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel !=
pGlobalData->CurrentDisplayDevice->InitialSettings.dmBitsPerPel)
+ if (pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth !=
pData->CurrentDisplayDevice->InitialSettings.dmPelsWidth
+ || pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight !=
pData->CurrentDisplayDevice->InitialSettings.dmPelsHeight
+ || pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel !=
pData->CurrentDisplayDevice->InitialSettings.dmBitsPerPel)
{
/* FIXME: Need to test changes */
/* Apply new settings */
@@ -695,13 +695,13 @@
DEVMODE devmode;
RtlZeroMemory(&devmode, sizeof(DEVMODE));
devmode.dmSize = (WORD)sizeof(DEVMODE);
- devmode.dmPelsWidth =
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth;
- devmode.dmPelsHeight =
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight;
- devmode.dmBitsPerPel =
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel;
- devmode.dmDisplayFrequency =
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmDisplayFrequency;
+ devmode.dmPelsWidth =
pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth;
+ devmode.dmPelsHeight =
pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight;
+ devmode.dmBitsPerPel =
pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel;
+ devmode.dmDisplayFrequency =
pData->CurrentDisplayDevice->CurrentSettings->dmDisplayFrequency;
devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL |
DM_DISPLAYFREQUENCY;
rc = ChangeDisplaySettingsEx(
- pGlobalData->CurrentDisplayDevice->DeviceName,
+ pData->CurrentDisplayDevice->DeviceName,
&devmode,
NULL,
CDS_UPDATEREGISTRY,
@@ -709,9 +709,9 @@
switch (rc)
{
case DISP_CHANGE_SUCCESSFUL:
- pGlobalData->CurrentDisplayDevice->InitialSettings.dmPelsWidth =
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth;
- pGlobalData->CurrentDisplayDevice->InitialSettings.dmPelsHeight =
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight;
- pGlobalData->CurrentDisplayDevice->InitialSettings.dmBitsPerPel =
pGlobalData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel;
+ pData->CurrentDisplayDevice->InitialSettings.dmPelsWidth =
pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth;
+ pData->CurrentDisplayDevice->InitialSettings.dmPelsHeight =
pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight;
+ pData->CurrentDisplayDevice->InitialSettings.dmBitsPerPel =
pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel;
break;
case DISP_CHANGE_RESTART:
LoadString(hApplet, IDS_DISPLAY_SETTINGS, Title, sizeof(Title) / sizeof(TCHAR));
@@ -833,7 +833,7 @@
case WM_DESTROY:
{
DWORD i;
- PDISPLAY_DEVICE_ENTRY Current = pGlobalData->DisplayDeviceList;
+ PDISPLAY_DEVICE_ENTRY Current = pData->DisplayDeviceList;
while (Current != NULL)
{
@@ -851,11 +851,11 @@
for (i = 0; i < NUM_SPECTRUM_BITMAPS; i++)
{
- if (pGlobalData->hSpectrumBitmaps[i])
- DeleteObject(pGlobalData->hSpectrumBitmaps[i]);
- }
-
- HeapFree(GetProcessHeap(), 0, pGlobalData);
+ if (pData->hSpectrumBitmaps[i])
+ DeleteObject(pData->hSpectrumBitmaps[i]);
+ }
+
+ HeapFree(GetProcessHeap(), 0, pData);
}
}
return FALSE;