win32u: Move default WM_PAINT implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-05-11 20:39:30 +02:00 committed by Alexandre Julliard
parent 1f296397ca
commit 0e0438bfaa
2 changed files with 25 additions and 26 deletions

View File

@ -266,31 +266,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
DEFWND_Print(hwnd, (HDC)wParam, lParam);
return 0;
case WM_PAINTICON:
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = NtUserBeginPaint( hwnd, &ps );
if( hdc )
{
HICON hIcon;
if (IsIconic(hwnd) && ((hIcon = (HICON)GetClassLongPtrW( hwnd, GCLP_HICON))) )
{
RECT rc;
int x, y;
GetClientRect( hwnd, &rc );
x = (rc.right - rc.left - GetSystemMetrics(SM_CXICON))/2;
y = (rc.bottom - rc.top - GetSystemMetrics(SM_CYICON))/2;
TRACE("Painting class icon: vis rect=(%s)\n",
wine_dbgstr_rect(&ps.rcPaint));
DrawIcon( hdc, x, y, hIcon );
}
NtUserEndPaint( hwnd, &ps );
}
return 0;
}
case WM_SYNCPAINT:
NtUserRedrawWindow ( hwnd, NULL, 0, RDW_ERASENOW | RDW_ERASE | RDW_ALLCHILDREN );
return 0;

View File

@ -243,7 +243,31 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
if (user_callbacks) user_callbacks->free_win_ptr( win );
win->pScroll = NULL;
release_win_ptr( win );
return 0;
break;
}
case WM_PAINTICON:
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = NtUserBeginPaint( hwnd, &ps );
if (hdc)
{
HICON icon;
if (is_iconic(hwnd) && ((icon = UlongToHandle( get_class_long( hwnd, GCLP_HICON, FALSE )))))
{
RECT rc;
int x, y;
get_client_rect( hwnd, &rc );
x = (rc.right - rc.left - get_system_metrics( SM_CXICON )) / 2;
y = (rc.bottom - rc.top - get_system_metrics( SM_CYICON )) / 2;
TRACE( "Painting class icon: vis rect=(%s)\n", wine_dbgstr_rect(&ps.rcPaint) );
NtUserDrawIconEx( hdc, x, y, icon, 0, 0, 0, 0, DI_NORMAL | DI_COMPAT | DI_DEFAULTSIZE );
}
NtUserEndPaint( hwnd, &ps );
}
break;
}
case WM_SETTEXT: