Author: jimtabor
Date: Thu May 29 13:51:17 2008
New Revision: 33760
URL:
http://svn.reactos.org/svn/reactos?rev=33760&view=rev
Log:
Use server information structure for system colors.
Modified:
trunk/reactos/dll/win32/user32/windows/defwnd.c
trunk/reactos/include/reactos/win32k/ntuser.h
trunk/reactos/subsystems/win32/win32k/objects/stockobj.c
Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] Thu May 29 13:51:17 2008
@@ -1,4 +1,4 @@
-/* $Id$
+/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@@ -33,10 +33,6 @@
/* GLOBALS *******************************************************************/
-COLORREF SysColors[NUM_SYSCOLORS] = {0};
-HPEN SysPens[NUM_SYSCOLORS] = {0};
-HBRUSH SysBrushes[NUM_SYSCOLORS] = {0};
-
/* Bits in the dwKeyData */
#define KEYDATA_ALT 0x2000
#define KEYDATA_PREVSTATE 0x4000
@@ -55,13 +51,8 @@
we should rather map the table into usermode. But it only affects the
SysColors table - the pens, brushes and stock objects are not affected
as their handles never change. But it'd be faster to map them, too. */
- if(SysBrushes[0] == NULL)
- {
- /* only initialize once */
- (void)NtUserGetSysColors(SysColors, NUM_SYSCOLORS);
- (void)NtUserGetSysColorPens(SysPens, NUM_SYSCOLORS);
- (void)NtUserGetSysColorBrushes(SysBrushes, NUM_SYSCOLORS);
- }
+
+ // Done! g_psi!
}
/*
@@ -72,7 +63,7 @@
{
if(nIndex >= 0 && nIndex <= NUM_SYSCOLORS)
{
- return SysColors[nIndex];
+ return g_psi->SysColors[nIndex];
}
SetLastError(ERROR_INVALID_PARAMETER);
@@ -87,7 +78,7 @@
{
if(nIndex >= 0 && nIndex <= NUM_SYSCOLORS)
{
- return SysPens[nIndex];
+ return g_psi->SysColorPens[nIndex];
}
SetLastError(ERROR_INVALID_PARAMETER);
@@ -102,7 +93,7 @@
{
if(nIndex >= 0 && nIndex <= NUM_SYSCOLORS)
{
- return SysBrushes[nIndex];
+ return g_psi->SysColorBrushes[nIndex];
}
SetLastError(ERROR_INVALID_PARAMETER);
@@ -132,11 +123,6 @@
if(cElements > 0)
{
Ret = NtUserSetSysColors(&ChangeSysColors, cElements);
- if(Ret)
- {
- /* FIXME - just change it in the usermode structure, too, instead of asking win32k
again */
- (void)NtUserGetSysColors(SysColors, NUM_SYSCOLORS);
- }
}
else
{
Modified: trunk/reactos/include/reactos/win32k/ntuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Thu May 29 13:51:17 2008
@@ -171,8 +171,12 @@
typedef struct _SERVERINFO
{
- DWORD SrvEventActivity;
-
+// DWORD SystemMetrics[SM_CMETRICS]; // System Metrics
+// COLORREF SystemColorCopy[COLOR_MENUBAR+1]; // Backup Copy of system colors.
+ COLORREF SysColors[COLOR_MENUBAR+1]; // GetSysColor
+ HBRUSH SysColorBrushes[COLOR_MENUBAR+1]; // GetSysColorBrush
+ HPEN SysColorPens[COLOR_MENUBAR+1]; // ReactOS exclusive
+ DWORD SrvEventActivity;
} SERVERINFO, *PSERVERINFO;
typedef struct _W32PROCESSINFO
Modified: trunk/reactos/subsystems/win32/win32k/objects/stockobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] Thu May 29
13:51:17 2008
@@ -27,6 +27,8 @@
#define NDEBUG
#include <debug.h>
+
+extern PSERVERINFO gpsi;
static COLORREF SysColors[] =
{
@@ -64,8 +66,11 @@
};
#define NUM_SYSCOLORS (sizeof(SysColors) / sizeof(SysColors[0]))
-static HPEN SysColorPens[NUM_SYSCOLORS];
-static HBRUSH SysColorBrushes[NUM_SYSCOLORS];
+//static HPEN SysColorPens[NUM_SYSCOLORS];
+//static HBRUSH SysColorBrushes[NUM_SYSCOLORS];
+
+// System Bitmap DC and System Display DC...
+HDC hSystemBM, hSystemDisplayDC;
/* GDI stock objects */
@@ -182,9 +187,9 @@
{
if((UINT)(*Elements) < NUM_SYSCOLORS)
{
- SysColors[*Elements] = *Colors;
- IntGdiSetSolidBrushColor(SysColorBrushes[*Elements], *Colors);
- IntGdiSetSolidPenColor(SysColorPens[*Elements], *Colors);
+ gpsi->SysColors[*Elements] = *Colors;
+ IntGdiSetSolidBrushColor(gpsi->SysColorBrushes[*Elements], *Colors);
+ IntGdiSetSolidPenColor(gpsi->SysColorPens[*Elements], *Colors);
}
Elements++;
Colors++;
@@ -209,7 +214,7 @@
for(i = 0; i < nBrushes; i++)
{
- *(Brushes++) = SysColorBrushes[i];
+ *(Brushes++) = gpsi->SysColorBrushes[i];
}
return nBrushes > 0;
@@ -218,7 +223,7 @@
HGDIOBJ FASTCALL
IntGetSysColorBrush(INT Object)
{
- return ((Object < 0) || (NUM_SYSCOLORS <= Object)) ? NULL :
SysColorBrushes[Object];
+ return ((Object < 0) || (NUM_SYSCOLORS <= Object)) ? NULL :
gpsi->SysColorBrushes[Object];
}
BOOL FASTCALL
@@ -236,7 +241,7 @@
for(i = 0; i < nPens; i++)
{
- *(Pens++) = SysColorPens[i];
+ *(Pens++) = gpsi->SysColorPens[i];
}
return nPens > 0;
@@ -256,7 +261,7 @@
return FALSE;
}
- col = &SysColors[0];
+ col = &gpsi->SysColors[0];
for(i = 0; i < nColors; i++)
{
*(Colors++) = *(col++);
@@ -268,7 +273,7 @@
DWORD FASTCALL
IntGetSysColor(INT nIndex)
{
- return (NUM_SYSCOLORS <= (UINT)nIndex) ? 0 : SysColors[nIndex];
+ return (NUM_SYSCOLORS <= (UINT)nIndex) ? 0 : gpsi->SysColors[nIndex];
}
VOID FASTCALL
@@ -277,15 +282,20 @@
UINT i;
LOGPEN Pen;
+ for(i = 0; i < NUM_SYSCOLORS; i++)
+ {
+ gpsi->SysColors[i] = SysColors[i];
+ }
+
/* Create the syscolor brushes */
for(i = 0; i < NUM_SYSCOLORS; i++)
{
- if(SysColorBrushes[i] == NULL)
+ if(gpsi->SysColorBrushes[i] == NULL)
{
- SysColorBrushes[i] = IntGdiCreateSolidBrush(SysColors[i]);
- if(SysColorBrushes[i] != NULL)
+ gpsi->SysColorBrushes[i] = IntGdiCreateSolidBrush(SysColors[i]);
+ if(gpsi->SysColorBrushes[i] != NULL)
{
- GDIOBJ_ConvertToStockObj((HGDIOBJ*)&SysColorBrushes[i]);
+ GDIOBJ_ConvertToStockObj((HGDIOBJ*)&gpsi->SysColorBrushes[i]);
}
}
}
@@ -296,13 +306,13 @@
Pen.lopnWidth.y = 0;
for(i = 0; i < NUM_SYSCOLORS; i++)
{
- if(SysColorPens[i] == NULL)
+ if(gpsi->SysColorPens[i] == NULL)
{
Pen.lopnColor = SysColors[i];
- SysColorPens[i] = IntGdiExtCreatePen(Pen.lopnStyle, Pen.lopnWidth.x, BS_SOLID,
Pen.lopnColor, 0, 0, 0, NULL, 0, TRUE, NULL);
- if(SysColorPens[i] != NULL)
+ gpsi->SysColorPens[i] = IntGdiExtCreatePen(Pen.lopnStyle, Pen.lopnWidth.x,
BS_SOLID, Pen.lopnColor, 0, 0, 0, NULL, 0, TRUE, NULL);
+ if(gpsi->SysColorPens[i] != NULL)
{
- GDIOBJ_ConvertToStockObj((HGDIOBJ*)&SysColorPens[i]);
+ GDIOBJ_ConvertToStockObj((HGDIOBJ*)&gpsi->SysColorPens[i]);
}
}
}