diff --git a/reactos/dll/win32/user32/windows/defwnd.c b/reactos/dll/win32/user32/windows/defwnd.c index f6b09bfc4b2..8f7d809e8bf 100644 --- a/reactos/dll/win32/user32/windows/defwnd.c +++ b/reactos/dll/win32/user32/windows/defwnd.c @@ -927,8 +927,8 @@ DefWndHandleWindowPosChanged(HWND hWnd, WINDOWPOS* Pos) HBRUSH DefWndControlColor(HDC hDC, UINT ctlType) { - if (CTLCOLOR_SCROLLBAR == ctlType) - { + if (ctlType == CTLCOLOR_SCROLLBAR) + { HBRUSH hb = GetSysColorBrush(COLOR_SCROLLBAR); COLORREF bk = GetSysColor(COLOR_3DHILIGHT); SetTextColor(hDC, GetSysColor(COLOR_3DFACE)); @@ -938,37 +938,24 @@ DefWndControlColor(HDC hDC, UINT ctlType) * we better use 0x55aa bitmap brush to make scrollbar's background * look different from the window background. */ - if (bk == GetSysColor(COLOR_WINDOW)) - { - static const WORD wPattern55AA[] = - { - 0x5555, 0xaaaa, 0x5555, 0xaaaa, - 0x5555, 0xaaaa, 0x5555, 0xaaaa - }; - static HBITMAP hPattern55AABitmap = NULL; - static HBRUSH hPattern55AABrush = NULL; - if (hPattern55AABrush == NULL) - { - hPattern55AABitmap = CreateBitmap(8, 8, 1, 1, wPattern55AA); - hPattern55AABrush = CreatePatternBrush(hPattern55AABitmap); - } - return hPattern55AABrush; - } - UnrealizeObject(hb); + if ( bk == GetSysColor(COLOR_WINDOW)) + return gpsi->hbrGray; + + UnrealizeObject( hb ); return hb; - } + } SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT)); - if ((CTLCOLOR_EDIT == ctlType) || (CTLCOLOR_LISTBOX == ctlType)) - { + if ((ctlType == CTLCOLOR_EDIT) || (ctlType == CTLCOLOR_LISTBOX)) + { SetBkColor(hDC, GetSysColor(COLOR_WINDOW)); - } + } else - { + { SetBkColor(hDC, GetSysColor(COLOR_3DFACE)); return GetSysColorBrush(COLOR_3DFACE); - } + } return GetSysColorBrush(COLOR_WINDOW); } diff --git a/reactos/subsystems/win32/win32k/include/brush.h b/reactos/subsystems/win32/win32k/include/brush.h index 7d3a73f9791..f4705ceb832 100644 --- a/reactos/subsystems/win32/win32k/include/brush.h +++ b/reactos/subsystems/win32/win32k/include/brush.h @@ -129,3 +129,5 @@ PVOID FASTCALL AllocateObjectAttr(VOID); VOID FASTCALL FreeObjectAttr(PVOID); BOOL FASTCALL IntGdiSetBrushOwner(PBRUSH,DWORD); +BOOL FASTCALL GreSetBrushOwner(HBRUSH,DWORD); + diff --git a/reactos/subsystems/win32/win32k/ntuser/ntuser.c b/reactos/subsystems/win32/win32k/ntuser/ntuser.c index 2e9d7eb9b47..0a4c70fc549 100644 --- a/reactos/subsystems/win32/win32k/ntuser/ntuser.c +++ b/reactos/subsystems/win32/win32k/ntuser/ntuser.c @@ -92,6 +92,8 @@ UserInitialize( HANDLE hPowerRequestEvent, HANDLE hMediaRequestEvent) { + static const WORD wPattern55AA[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa }; + HBITMAP hPattern55AABitmap = NULL; NTSTATUS Status; // Set W32PF_Flags |= (W32PF_READSCREENACCESSGRANTED | W32PF_IOWINSTA) @@ -125,6 +127,14 @@ UserInitialize( CsrInit(); + if (gpsi->hbrGray == NULL) + { + hPattern55AABitmap = GreCreateBitmap(8, 8, 1, 1, (LPBYTE)wPattern55AA); + gpsi->hbrGray = IntGdiCreatePatternBrush(hPattern55AABitmap); + GreDeleteObject(hPattern55AABitmap); + GreSetBrushOwner(gpsi->hbrGray, GDI_OBJ_HMGR_PUBLIC); + } + return STATUS_SUCCESS; } diff --git a/reactos/subsystems/win32/win32k/objects/bitmaps.c b/reactos/subsystems/win32/win32k/objects/bitmaps.c index 28dc28afb9a..b0d97d2f72c 100644 --- a/reactos/subsystems/win32/win32k/objects/bitmaps.c +++ b/reactos/subsystems/win32/win32k/objects/bitmaps.c @@ -154,15 +154,23 @@ GreCreateBitmap( IN UINT cBitsPixel, IN OPTIONAL PVOID pvBits) { + HBITMAP hbmp; /* Call the extended function */ - return GreCreateBitmapEx(nWidth, + hbmp = GreCreateBitmapEx(nWidth, nHeight, 0, /* auto width */ BitmapFormat(cBitsPixel * cPlanes, BI_RGB), 0, /* no bitmap flags */ 0, /* auto size */ - pvBits, - DDB_SURFACE /* DDB */); + NULL, + DDB_SURFACE /* DDB */); + if (pvBits && hbmp) + { + PSURFACE psurf = SURFACE_ShareLockSurface(hbmp); + UnsafeSetBitmapBits(psurf, 0, pvBits); + SURFACE_ShareUnlockSurface(psurf); + } + return hbmp; } HBITMAP diff --git a/reactos/subsystems/win32/win32k/objects/brush.c b/reactos/subsystems/win32/win32k/objects/brush.c index f72d7d1ddf7..f9658e56d05 100644 --- a/reactos/subsystems/win32/win32k/objects/brush.c +++ b/reactos/subsystems/win32/win32k/objects/brush.c @@ -61,6 +61,19 @@ IntGdiSetBrushOwner(PBRUSH pbr, ULONG ulOwner) return TRUE; } +BOOL +FASTCALL +GreSetBrushOwner(HBRUSH hBrush, ULONG ulOwner) +{ + BOOL Ret; + PBRUSH pbrush; + + pbrush = BRUSH_ShareLockBrush(hBrush); + Ret = IntGdiSetBrushOwner(pbrush, ulOwner); + BRUSH_ShareUnlockBrush(pbrush); + return Ret; +} + BOOL NTAPI BRUSH_bAllocBrushAttr(PBRUSH pbr)