mirror of
https://github.com/reactos/reactos.git
synced 2025-04-19 20:19:26 +00:00
Use server information structure for system colors.
svn path=/trunk/; revision=33760
This commit is contained in:
parent
616f5e97e0
commit
c03961764a
3 changed files with 40 additions and 40 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id$
|
||||
/*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS user32.dll
|
||||
|
@ -33,10 +33,6 @@ void FASTCALL MenuInitSysMenuPopup(HMENU Menu, DWORD Style, DWORD ClsStyle, LONG
|
|||
|
||||
/* 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 @@ InitStockObjects(void)
|
|||
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 @@ GetSysColor(int nIndex)
|
|||
{
|
||||
if(nIndex >= 0 && nIndex <= NUM_SYSCOLORS)
|
||||
{
|
||||
return SysColors[nIndex];
|
||||
return g_psi->SysColors[nIndex];
|
||||
}
|
||||
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
@ -87,7 +78,7 @@ GetSysColorPen(int nIndex)
|
|||
{
|
||||
if(nIndex >= 0 && nIndex <= NUM_SYSCOLORS)
|
||||
{
|
||||
return SysPens[nIndex];
|
||||
return g_psi->SysColorPens[nIndex];
|
||||
}
|
||||
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
@ -102,7 +93,7 @@ GetSysColorBrush(int nIndex)
|
|||
{
|
||||
if(nIndex >= 0 && nIndex <= NUM_SYSCOLORS)
|
||||
{
|
||||
return SysBrushes[nIndex];
|
||||
return g_psi->SysColorBrushes[nIndex];
|
||||
}
|
||||
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
@ -132,11 +123,6 @@ SetSysColors(
|
|||
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
|
||||
{
|
||||
|
|
|
@ -171,8 +171,12 @@ typedef struct _WINDOW
|
|||
|
||||
typedef struct _SERVERINFO
|
||||
{
|
||||
// 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
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
extern PSERVERINFO gpsi;
|
||||
|
||||
static COLORREF SysColors[] =
|
||||
{
|
||||
RGB(212, 208, 200), /* COLOR_SCROLLBAR */
|
||||
|
@ -64,8 +66,11 @@ static COLORREF SysColors[] =
|
|||
};
|
||||
#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 @@ IntSetSysColors(UINT nColors, INT *Elements, COLORREF *Colors)
|
|||
{
|
||||
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 @@ IntGetSysColorBrushes(HBRUSH *Brushes, UINT nBrushes)
|
|||
|
||||
for(i = 0; i < nBrushes; i++)
|
||||
{
|
||||
*(Brushes++) = SysColorBrushes[i];
|
||||
*(Brushes++) = gpsi->SysColorBrushes[i];
|
||||
}
|
||||
|
||||
return nBrushes > 0;
|
||||
|
@ -218,7 +223,7 @@ IntGetSysColorBrushes(HBRUSH *Brushes, UINT nBrushes)
|
|||
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 @@ IntGetSysColorPens(HPEN *Pens, UINT nPens)
|
|||
|
||||
for(i = 0; i < nPens; i++)
|
||||
{
|
||||
*(Pens++) = SysColorPens[i];
|
||||
*(Pens++) = gpsi->SysColorPens[i];
|
||||
}
|
||||
|
||||
return nPens > 0;
|
||||
|
@ -256,7 +261,7 @@ IntGetSysColors(COLORREF *Colors, UINT nColors)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
col = &SysColors[0];
|
||||
col = &gpsi->SysColors[0];
|
||||
for(i = 0; i < nColors; i++)
|
||||
{
|
||||
*(Colors++) = *(col++);
|
||||
|
@ -268,7 +273,7 @@ IntGetSysColors(COLORREF *Colors, UINT nColors)
|
|||
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 @@ CreateSysColorObjects(VOID)
|
|||
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 @@ CreateSysColorObjects(VOID)
|
|||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue