diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c index 7a558444066..eb646660e11 100644 --- a/dlls/user32/defwnd.c +++ b/dlls/user32/defwnd.c @@ -167,7 +167,7 @@ HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType ) * look different from the window background. */ if (bk == GetSysColor(COLOR_WINDOW)) - return SYSCOLOR_55AABrush; + return SYSCOLOR_Get55AABrush(); UnrealizeObject( hb ); return hb; diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c index da9c6bd735c..6becd5fb8f4 100644 --- a/dlls/user32/nonclient.c +++ b/dlls/user32/nonclient.c @@ -289,7 +289,7 @@ BOOL WINAPI DrawCaptionTempW (HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, FillRect (hdc, &rc, GetSysColorBrush (COLOR_3DFACE)); if (uFlags & DC_ACTIVE) { - HBRUSH hbr = SelectObject (hdc, SYSCOLOR_55AABrush); + HBRUSH hbr = SelectObject (hdc, SYSCOLOR_Get55AABrush()); PatBlt (hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, 0xFA0089); SelectObject (hdc, hbr); diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index 7c05d004d96..bdfed3851b6 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -242,12 +242,8 @@ static BOOL notify_change = TRUE; /* System parameters storage */ static RECT work_area; -static const WORD wPattern55AA[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa }; - static HKEY volatile_base_key; -HBRUSH SYSCOLOR_55AABrush = 0; - union sysparam_all_entry; struct sysparam_entry @@ -1346,11 +1342,6 @@ void SYSPARAMS_Init(void) { HKEY key; DWORD i, dispos; - HBITMAP h55AABitmap = CreateBitmap( 8, 8, 1, 1, wPattern55AA ); - - SYSCOLOR_55AABrush = CreatePatternBrush( h55AABitmap ); - __wine_make_gdi_object_system( SYSCOLOR_55AABrush, TRUE ); - DeleteObject( h55AABitmap ); /* this one must be non-volatile */ if (RegCreateKeyW( HKEY_CURRENT_USER, WINE_CURRENT_USER_REGKEY, &key )) @@ -2715,6 +2706,29 @@ HPEN SYSCOLOR_GetPen( INT index ) } +/*********************************************************************** + * SYSCOLOR_Get55AABrush + */ +HBRUSH SYSCOLOR_Get55AABrush(void) +{ + static const WORD pattern[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa }; + static HBRUSH brush_55aa; + + if (!brush_55aa) + { + HBITMAP bitmap = CreateBitmap( 8, 8, 1, 1, pattern ); + HBRUSH brush = CreatePatternBrush( bitmap ); + DeleteObject( bitmap ); + __wine_make_gdi_object_system( brush, TRUE ); + if (InterlockedCompareExchangePointer( (void **)&brush_55aa, brush, 0 )) + { + __wine_make_gdi_object_system( brush, FALSE ); + DeleteObject( brush ); + } + } + return brush_55aa; +} + /*********************************************************************** * ChangeDisplaySettingsA (USER32.@) */ diff --git a/dlls/user32/text.c b/dlls/user32/text.c index 12432b889e5..7bef4761c0f 100644 --- a/dlls/user32/text.c +++ b/dlls/user32/text.c @@ -1240,7 +1240,7 @@ static BOOL TEXT_GrayString(HDC hdc, HBRUSH hb, GRAYSTRINGPROC fn, LPARAM lp, IN if(retval || len != -1) #endif { - hbsave = SelectObject(memdc, SYSCOLOR_55AABrush); + hbsave = SelectObject(memdc, SYSCOLOR_Get55AABrush()); PatBlt(memdc, 0, 0, cx, cy, 0x000A0329); SelectObject(memdc, hbsave); } diff --git a/dlls/user32/uitools.c b/dlls/user32/uitools.c index 386801c2b22..c11a1d30648 100644 --- a/dlls/user32/uitools.c +++ b/dlls/user32/uitools.c @@ -649,7 +649,7 @@ static void UITOOLS_DrawCheckedRect( HDC dc, LPRECT rect ) FillRect(dc, rect, GetSysColorBrush(COLOR_BTNFACE)); bg = SetBkColor(dc, RGB(255, 255, 255)); - hbsave = SelectObject(dc, SYSCOLOR_55AABrush); + hbsave = SelectObject(dc, SYSCOLOR_Get55AABrush()); PatBlt(dc, rect->left, rect->top, rect->right-rect->left, rect->bottom-rect->top, 0x00FA0089); SelectObject(dc, hbsave); SetBkColor(dc, bg); @@ -1703,7 +1703,7 @@ static BOOL UITOOLS_DrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp /* This state cause the image to be dithered */ if(flags & DSS_UNION) { - hbsave = SelectObject(memdc, SYSCOLOR_55AABrush); + hbsave = SelectObject(memdc, SYSCOLOR_Get55AABrush()); if(!hbsave) goto cleanup; tmp = PatBlt(memdc, 0, 0, cx, cy, 0x00FA0089); SelectObject(memdc, hbsave); diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 56664123533..0f86bdf91e9 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -209,7 +209,6 @@ static inline BOOL is_broadcast( HWND hwnd ) } extern HMODULE user32_module DECLSPEC_HIDDEN; -extern HBRUSH SYSCOLOR_55AABrush DECLSPEC_HIDDEN; struct dce; struct tagWND; @@ -234,6 +233,7 @@ extern LRESULT MSG_SendInternalMessageTimeout( DWORD dest_pid, DWORD dest_tid, UINT msg, WPARAM wparam, LPARAM lparam, UINT flags, UINT timeout, PDWORD_PTR res_ptr ) DECLSPEC_HIDDEN; extern HPEN SYSCOLOR_GetPen( INT index ) DECLSPEC_HIDDEN; +extern HBRUSH SYSCOLOR_Get55AABrush(void) DECLSPEC_HIDDEN; extern void SYSPARAMS_Init(void) DECLSPEC_HIDDEN; extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN; extern BOOL USER_IsExitingThread( DWORD tid ) DECLSPEC_HIDDEN;