From 482d43b8759ae026950c0d7b03f1b74c4dbda7ea Mon Sep 17 00:00:00 2001 From: James Tabor Date: Wed, 22 Feb 2017 17:45:19 +0000 Subject: [PATCH] [Win32SS] - Implement Fill Window, for testing. svn path=/trunk/; revision=73887 --- reactos/win32ss/user/ntuser/ntstubs.c | 17 ----- reactos/win32ss/user/ntuser/painting.c | 88 +++++++++++++++++++++++++ reactos/win32ss/user/ntuser/userfuncs.h | 3 +- 3 files changed, 90 insertions(+), 18 deletions(-) diff --git a/reactos/win32ss/user/ntuser/ntstubs.c b/reactos/win32ss/user/ntuser/ntstubs.c index 6642c8ffa21..a044232a744 100644 --- a/reactos/win32ss/user/ntuser/ntstubs.c +++ b/reactos/win32ss/user/ntuser/ntstubs.c @@ -952,23 +952,6 @@ NtUserCtxDisplayIOCtl( return 0; } -/* - * FillWindow: Called from User; Dialog, Edit and ListBox procs during a WM_ERASEBKGND. - */ -/* - * @unimplemented - */ -BOOL APIENTRY -NtUserFillWindow(HWND hWndPaint, - HWND hWndPaint1, - HDC hDC, - HBRUSH hBrush) -{ - STUB - - return 0; -} - /* * @unimplemented */ diff --git a/reactos/win32ss/user/ntuser/painting.c b/reactos/win32ss/user/ntuser/painting.c index a07b6b2fbaf..6e2f4326d45 100644 --- a/reactos/win32ss/user/ntuser/painting.c +++ b/reactos/win32ss/user/ntuser/painting.c @@ -1555,6 +1555,50 @@ IntEndPaint(PWND Wnd, PPAINTSTRUCT Ps) return TRUE; } +BOOL FASTCALL +IntFillWindow(PWND pWndParent, + PWND pWnd, + HDC hDC, + HBRUSH hBrush) +{ + RECT Rect, Rect1; + INT type; + + if (!pWndParent) + pWndParent = pWnd; + + type = GdiGetClipBox(hDC, &Rect); + + IntGetClientRect(pWnd, &Rect1); + + if ( type != NULLREGION && // Clip box is not empty, + (!(pWnd->pcls->style & CS_PARENTDC) || // not parent dc or + RECTL_bIntersectRect( &Rect, &Rect, &Rect1) ) ) // intersecting. + { + POINT ppt; + INT x = 0, y = 0; + + if ( pWndParent != UserGetDesktopWindow()) + { + x = pWndParent->rcClient.left - pWnd->rcClient.left; + y = pWndParent->rcClient.top - pWnd->rcClient.top; + } + + GreSetBrushOrg(hDC, x, y, &ppt); + + if ( hBrush < (HBRUSH)CTLCOLOR_MAX ) + hBrush = GetControlColor( pWndParent, pWnd, hDC, HandleToUlong(hBrush) + WM_CTLCOLORMSGBOX); + + FillRect(hDC, &Rect, hBrush); + + GreSetBrushOrg(hDC, ppt.x, ppt.y, NULL); + + return TRUE; + } + else + return FALSE; +} + /* PUBLIC FUNCTIONS ***********************************************************/ /* @@ -1655,6 +1699,50 @@ CLEANUP: END_CLEANUP; } +/* + * FillWindow: Called from User; Dialog, Edit and ListBox procs during a WM_ERASEBKGND. + */ +/* + * @implemented + */ +BOOL APIENTRY +NtUserFillWindow(HWND hWndParent, + HWND hWnd, + HDC hDC, + HBRUSH hBrush) +{ + BOOL ret = FALSE; + PWND pWnd, pWndParent = NULL; + USER_REFERENCE_ENTRY Ref; + + TRACE("Enter NtUserFillWindow\n"); + UserEnterExclusive(); + + if (!hDC) + { + goto Exit; + } + + if (!(pWnd = UserGetWindowObject(hWnd))) + { + goto Exit; + } + + if (hWndParent && !(pWndParent = UserGetWindowObject(hWndParent))) + { + goto Exit; + } + + UserRefObjectCo(pWnd, &Ref); + ret = IntFillWindow( pWndParent, pWnd, hDC, hBrush ); + UserDerefObjectCo(pWnd); + +Exit: + TRACE("Leave NtUserFillWindow, ret=%i\n",ret); + UserLeave(); + return ret; +} + /* * @implemented */ diff --git a/reactos/win32ss/user/ntuser/userfuncs.h b/reactos/win32ss/user/ntuser/userfuncs.h index 9d61065c9d6..33f3cd285b0 100644 --- a/reactos/win32ss/user/ntuser/userfuncs.h +++ b/reactos/win32ss/user/ntuser/userfuncs.h @@ -102,7 +102,8 @@ UserSystemParametersInfo( VOID FASTCALL IntSetWindowState(PWND, UINT); VOID FASTCALL IntClearWindowState(PWND, UINT); PTHREADINFO FASTCALL IntTID2PTI(HANDLE); -HBRUSH FASTCALL GetControlBrush(PWND pwnd,HDC hdc,UINT ctlType); +HBRUSH FASTCALL GetControlBrush(PWND,HDC,UINT); +HBRUSH FASTCALL GetControlColor(PWND,PWND,HDC,UINT); /*************** MESSAGE.C ***************/