Commit 6f3ed5fd authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserInvalidateRect and NtUserInvalidateRgn implementation from user32.

parent dad8044f
......@@ -382,7 +382,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
if (unicode) DefWindowProcW( hWnd, WM_SETTEXT, wParam, lParam );
else DefWindowProcA( hWnd, WM_SETTEXT, wParam, lParam );
if (btn_type == BS_GROUPBOX) /* Yes, only for BS_GROUPBOX */
InvalidateRect( hWnd, NULL, TRUE );
NtUserInvalidateRect( hWnd, NULL, TRUE );
else
paint_button( hWnd, btn_type, ODA_DRAWENTIRE );
return 1; /* success. FIXME: check text length */
......@@ -390,7 +390,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
case WM_SETFONT:
set_button_font( hWnd, (HFONT)wParam );
if (lParam) InvalidateRect(hWnd, NULL, TRUE);
if (lParam) NtUserInvalidateRect(hWnd, NULL, TRUE);
break;
case WM_GETFONT:
......@@ -415,11 +415,11 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
if (style & BS_NOTIFY)
BUTTON_NOTIFY_PARENT(hWnd, BN_KILLFOCUS);
InvalidateRect( hWnd, NULL, FALSE );
NtUserInvalidateRect( hWnd, NULL, FALSE );
break;
case WM_SYSCOLORCHANGE:
InvalidateRect( hWnd, NULL, FALSE );
NtUserInvalidateRect( hWnd, NULL, FALSE );
break;
case BM_SETSTYLE:
......@@ -429,7 +429,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
/* Only redraw if lParam flag is set.*/
if (lParam)
InvalidateRect( hWnd, NULL, TRUE );
NtUserInvalidateRect( hWnd, NULL, TRUE );
break;
......@@ -452,7 +452,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
return 0;
}
oldHbitmap = (HBITMAP)SetWindowLongPtrW( hWnd, HIMAGE_GWL_OFFSET, lParam );
InvalidateRect( hWnd, NULL, FALSE );
NtUserInvalidateRect( hWnd, NULL, FALSE );
return (LRESULT)oldHbitmap;
case BM_GETIMAGE:
......
......@@ -1084,9 +1084,9 @@ BOOL COMBO_FlipListbox( LPHEADCOMBO lphc, BOOL ok, BOOL bRedrawButton )
* CBRepaintButton
*/
static void CBRepaintButton( LPHEADCOMBO lphc )
{
InvalidateRect(lphc->self, &lphc->buttonRect, TRUE);
UpdateWindow(lphc->self);
{
NtUserInvalidateRect(lphc->self, &lphc->buttonRect, TRUE);
UpdateWindow(lphc->self);
}
/***********************************************************************
......@@ -1104,7 +1104,7 @@ static void COMBO_SetFocus( LPHEADCOMBO lphc )
/* lphc->wState |= CBF_FOCUSED; */
if( !(lphc->wState & CBF_EDIT) )
InvalidateRect(lphc->self, &lphc->textRect, TRUE);
NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE);
CB_NOTIFY( lphc, CBN_SETFOCUS );
lphc->wState |= CBF_FOCUSED;
......@@ -1130,7 +1130,7 @@ static void COMBO_KillFocus( LPHEADCOMBO lphc )
/* redraw text */
if( !(lphc->wState & CBF_EDIT) )
InvalidateRect(lphc->self, &lphc->textRect, TRUE);
NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE);
CB_NOTIFY( lphc, CBN_KILLFOCUS );
}
......@@ -1561,7 +1561,7 @@ static LRESULT COMBO_SelectString( LPHEADCOMBO lphc, INT start, LPARAM pText, BO
CBUpdateEdit( lphc, index );
else
{
InvalidateRect(lphc->self, &lphc->textRect, TRUE);
NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE);
}
}
return (LRESULT)index;
......@@ -1854,7 +1854,7 @@ LRESULT ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar
EnableWindow( lphc->hWndLBox, (BOOL)wParam );
/* Force the control to repaint when the enabled state changes. */
InvalidateRect(lphc->self, NULL, TRUE);
NtUserInvalidateRect(lphc->self, NULL, TRUE);
return TRUE;
case WM_SETREDRAW:
if( wParam )
......@@ -2003,7 +2003,7 @@ LRESULT ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar
if( (lphc->wState & CBF_EDIT) && CB_HASSTRINGS(lphc) )
SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)L"");
else
InvalidateRect(lphc->self, NULL, TRUE);
NtUserInvalidateRect(lphc->self, NULL, TRUE);
return TRUE;
case CB_INITSTORAGE:
return SendMessageW(lphc->hWndLBox, LB_INITSTORAGE, wParam, lParam);
......
......@@ -1421,7 +1421,7 @@ static void EDIT_UpdateTextRegion(EDITSTATE *es, HRGN hrgn, BOOL bErase)
es->flags &= ~EF_UPDATE;
EDIT_NOTIFY_PARENT(es, EN_UPDATE);
}
InvalidateRgn(es->hwndSelf, hrgn, bErase);
NtUserInvalidateRgn(es->hwndSelf, hrgn, bErase);
}
......@@ -1436,7 +1436,7 @@ static void EDIT_UpdateText(EDITSTATE *es, const RECT *rc, BOOL bErase)
es->flags &= ~EF_UPDATE;
EDIT_NOTIFY_PARENT(es, EN_UPDATE);
}
InvalidateRect(es->hwndSelf, rc, bErase);
NtUserInvalidateRect(es->hwndSelf, rc, bErase);
}
/*********************************************************************
......@@ -4873,7 +4873,7 @@ LRESULT EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, B
}
if (old_style ^ es->style)
InvalidateRect(es->hwndSelf, NULL, TRUE);
NtUserInvalidateRect(es->hwndSelf, NULL, TRUE);
result = 1;
break;
......
......@@ -443,7 +443,7 @@ static LRESULT LISTBOX_SetTopItem( LB_DESCR *descr, INT index, BOOL scroll )
SW_INVALIDATE | SW_ERASE | SW_SCROLLCHILDREN );
}
else
InvalidateRect( descr->self, NULL, TRUE );
NtUserInvalidateRect( descr->self, NULL, TRUE );
descr->top_item = index;
LISTBOX_UpdateScroll( descr );
return LB_OKAY;
......@@ -465,7 +465,7 @@ static void LISTBOX_UpdatePage( LB_DESCR *descr )
if (page_size == descr->page_size) return;
descr->page_size = page_size;
if (descr->style & LBS_MULTICOLUMN)
InvalidateRect( descr->self, NULL, TRUE );
NtUserInvalidateRect( descr->self, NULL, TRUE );
LISTBOX_SetTopItem( descr, descr->top_item, FALSE );
}
......@@ -510,7 +510,7 @@ static void LISTBOX_UpdateSize( LB_DESCR *descr )
/* Invalidate the focused item so it will be repainted correctly */
if (LISTBOX_GetItemRect( descr, descr->focus_item, &rect ) == 1)
{
InvalidateRect( descr->self, &rect, FALSE );
NtUserInvalidateRect( descr->self, &rect, FALSE );
}
}
......@@ -741,7 +741,7 @@ static void LISTBOX_SetRedraw( LB_DESCR *descr, BOOL on )
descr->style &= ~LBS_NOREDRAW;
if (descr->style & LBS_DISPLAYCHANGED)
{ /* page was changed while setredraw false, refresh automatically */
InvalidateRect(descr->self, NULL, TRUE);
NtUserInvalidateRect(descr->self, NULL, TRUE);
if ((descr->top_item + descr->page_size) > descr->nb_items)
{ /* reset top of page if less than number of items/page */
descr->top_item = descr->nb_items - descr->page_size;
......@@ -1246,14 +1246,14 @@ static void LISTBOX_InvalidateItems( LB_DESCR *descr, INT index )
return;
}
rect.bottom = descr->height;
InvalidateRect( descr->self, &rect, TRUE );
NtUserInvalidateRect( descr->self, &rect, TRUE );
if (descr->style & LBS_MULTICOLUMN)
{
/* Repaint the other columns */
rect.left = rect.right;
rect.right = descr->width;
rect.top = 0;
InvalidateRect( descr->self, &rect, TRUE );
NtUserInvalidateRect( descr->self, &rect, TRUE );
}
}
}
......@@ -1263,7 +1263,7 @@ static void LISTBOX_InvalidateItemRect( LB_DESCR *descr, INT index )
RECT rect;
if (LISTBOX_GetItemRect( descr, index, &rect ) == 1)
InvalidateRect( descr->self, &rect, TRUE );
NtUserInvalidateRect( descr->self, &rect, TRUE );
}
/***********************************************************************
......@@ -1314,7 +1314,7 @@ static LRESULT LISTBOX_SetItemHeight( LB_DESCR *descr, INT index, INT height, BO
LISTBOX_UpdatePage( descr );
LISTBOX_UpdateScroll( descr );
if (repaint)
InvalidateRect( descr->self, 0, TRUE );
NtUserInvalidateRect( descr->self, 0, TRUE );
}
return LB_OKAY;
}
......@@ -1339,12 +1339,12 @@ static void LISTBOX_SetHorizontalPos( LB_DESCR *descr, INT pos )
RECT rect;
/* Invalidate the focused item so it will be repainted correctly */
if (LISTBOX_GetItemRect( descr, descr->focus_item, &rect ) == 1)
InvalidateRect( descr->self, &rect, TRUE );
NtUserInvalidateRect( descr->self, &rect, TRUE );
NtUserScrollWindowEx( descr->self, diff, 0, NULL, NULL, 0, NULL,
SW_INVALIDATE | SW_ERASE | SW_SCROLLCHILDREN );
}
else
InvalidateRect( descr->self, NULL, TRUE );
NtUserInvalidateRect( descr->self, NULL, TRUE );
}
......@@ -1863,7 +1863,7 @@ static LRESULT LISTBOX_SetCount( LB_DESCR *descr, UINT count )
}
else SendMessageW(descr->self, LB_RESETCONTENT, 0, 0);
InvalidateRect( descr->self, NULL, TRUE );
NtUserInvalidateRect( descr->self, NULL, TRUE );
return LB_OKAY;
}
......@@ -2696,7 +2696,7 @@ LRESULT ListBoxWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
case LB_RESETCONTENT:
LISTBOX_ResetContent( descr );
LISTBOX_UpdateScroll( descr );
InvalidateRect( descr->self, NULL, TRUE );
NtUserInvalidateRect( descr->self, NULL, TRUE );
return 0;
case LB_ADDSTRING:
......@@ -3076,7 +3076,7 @@ LRESULT ListBoxWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
return LISTBOX_Destroy( descr );
case WM_ENABLE:
InvalidateRect( descr->self, NULL, TRUE );
NtUserInvalidateRect( descr->self, NULL, TRUE );
return 0;
case WM_SETREDRAW:
......@@ -3102,7 +3102,7 @@ LRESULT ListBoxWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
return (LRESULT)descr->font;
case WM_SETFONT:
LISTBOX_SetFont( descr, (HFONT)wParam );
if (lParam) InvalidateRect( descr->self, 0, TRUE );
if (lParam) NtUserInvalidateRect( descr->self, 0, TRUE );
return 0;
case WM_SETFOCUS:
descr->in_focus = TRUE;
......
......@@ -1728,14 +1728,14 @@ MENU_EnsureMenuItemVisible(LPPOPUPMENU lppop, UINT wIndex, HDC hdc)
{
arrow_rect.top = 0;
arrow_rect.bottom = lppop->items_rect.top;
InvalidateRect(lppop->hWnd, &arrow_rect, FALSE);
NtUserInvalidateRect(lppop->hWnd, &arrow_rect, FALSE);
}
if (nOldPos + scroll_height == lppop->nTotalHeight ||
lppop->nScrollPos + scroll_height == lppop->nTotalHeight)
{
arrow_rect.top = lppop->items_rect.bottom;
arrow_rect.bottom = lppop->Height;
InvalidateRect(lppop->hWnd, &arrow_rect, FALSE);
NtUserInvalidateRect(lppop->hWnd, &arrow_rect, FALSE);
}
}
}
......
......@@ -63,41 +63,6 @@ BOOL WINAPI UpdateWindow( HWND hwnd )
/***********************************************************************
* InvalidateRgn (USER32.@)
*/
BOOL WINAPI InvalidateRgn( HWND hwnd, HRGN hrgn, BOOL erase )
{
if (!hwnd)
{
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return FALSE;
}
return NtUserRedrawWindow( hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
}
/***********************************************************************
* InvalidateRect (USER32.@)
*
* MSDN: if hwnd parameter is NULL, InvalidateRect invalidates and redraws
* all windows and sends WM_ERASEBKGND and WM_NCPAINT.
*/
BOOL WINAPI InvalidateRect( HWND hwnd, const RECT *rect, BOOL erase )
{
UINT flags = RDW_INVALIDATE | (erase ? RDW_ERASE : 0);
if (!hwnd)
{
flags = RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_ERASENOW;
rect = NULL;
}
return NtUserRedrawWindow( hwnd, rect, 0, flags );
}
/***********************************************************************
* ValidateRgn (USER32.@)
*/
BOOL WINAPI ValidateRgn( HWND hwnd, HRGN hrgn )
......
......@@ -1507,7 +1507,7 @@ LRESULT WINAPI USER_ScrollBarProc( HWND hwnd, UINT message, WPARAM wParam, LPARA
rect.bottom=rect.top+thumbSize;
}
NtUserHideCaret( hwnd );
InvalidateRect(hwnd,&rect,0);
NtUserInvalidateRect( hwnd, &rect, 0 );
DestroyCaret();
}
break;
......
......@@ -448,8 +448,8 @@
@ stdcall InternalGetWindowIcon(ptr long) NtUserInternalGetWindowIcon
@ stdcall InternalGetWindowText(long ptr long) NtUserInternalGetWindowText
@ stdcall IntersectRect(ptr ptr ptr)
@ stdcall InvalidateRect(long ptr long)
@ stdcall InvalidateRgn(long long long)
@ stdcall InvalidateRect(long ptr long) NtUserInvalidateRect
@ stdcall InvalidateRgn(long long long) NtUserInvalidateRgn
@ stdcall InvertRect(long ptr)
@ stdcall -import IsCharAlphaA(long)
@ stdcall -import IsCharAlphaNumericA(long)
......
......@@ -1576,6 +1576,36 @@ INT WINAPI NtUserExcludeUpdateRgn( HDC hdc, HWND hwnd )
}
/***********************************************************************
* NtUserInvalidateRgn (win32u.@)
*/
BOOL WINAPI NtUserInvalidateRgn( HWND hwnd, HRGN hrgn, BOOL erase )
{
if (!hwnd)
{
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return FALSE;
}
return NtUserRedrawWindow( hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
}
/***********************************************************************
* NtUserInvalidateRect (win32u.@)
*/
BOOL WINAPI NtUserInvalidateRect( HWND hwnd, const RECT *rect, BOOL erase )
{
UINT flags = RDW_INVALIDATE | (erase ? RDW_ERASE : 0);
if (!hwnd)
{
flags = RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_ERASENOW;
rect = NULL;
}
return NtUserRedrawWindow( hwnd, rect, 0, flags );
}
/***********************************************************************
* NtUserLockWindowUpdate (win32u.@)
*/
BOOL WINAPI NtUserLockWindowUpdate( HWND hwnd )
......
......@@ -1189,6 +1189,8 @@ static struct unix_funcs unix_funcs =
NtUserGetWindowPlacement,
NtUserHideCaret,
NtUserInternalGetWindowIcon,
NtUserInvalidateRect,
NtUserInvalidateRgn,
NtUserIsClipboardFormatAvailable,
NtUserMapVirtualKeyEx,
NtUserMessageCall,
......
......@@ -1047,8 +1047,8 @@
@ stdcall NtUserInternalGetWindowIcon(ptr long)
@ stdcall -syscall NtUserInternalGetWindowText(long ptr long)
@ stub NtUserInternalToUnicode
@ stub NtUserInvalidateRect
@ stub NtUserInvalidateRgn
@ stdcall NtUserInvalidateRect(long ptr long)
@ stdcall NtUserInvalidateRgn(long long long)
@ stub NtUserIsChildWindowDpiMessageEnabled
@ stdcall NtUserIsClipboardFormatAvailable(long)
@ stub NtUserIsMouseInPointerEnabled
......
......@@ -251,6 +251,8 @@ struct unix_funcs
BOOL (WINAPI *pNtUserGetWindowPlacement)( HWND hwnd, WINDOWPLACEMENT *placement );
BOOL (WINAPI *pNtUserHideCaret)( HWND hwnd );
HICON (WINAPI *pNtUserInternalGetWindowIcon)( HWND hwnd, UINT type );
BOOL (WINAPI *pNtUserInvalidateRect)( HWND hwnd, const RECT *rect, BOOL erase );
BOOL (WINAPI *pNtUserInvalidateRgn)( HWND hwnd, HRGN hrgn, BOOL erase );
BOOL (WINAPI *pNtUserIsClipboardFormatAvailable)( UINT format );
UINT (WINAPI *pNtUserMapVirtualKeyEx)( UINT code, UINT type, HKL layout );
LRESULT (WINAPI *pNtUserMessageCall)( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
......
......@@ -1048,6 +1048,18 @@ HICON WINAPI NtUserInternalGetWindowIcon( HWND hwnd, UINT type )
return unix_funcs->pNtUserInternalGetWindowIcon( hwnd, type );
}
BOOL WINAPI NtUserInvalidateRect( HWND hwnd, const RECT *rect, BOOL erase )
{
if (!unix_funcs) return FALSE;
return unix_funcs->pNtUserInvalidateRect( hwnd, rect, erase );
}
BOOL WINAPI NtUserInvalidateRgn( HWND hwnd, HRGN hrgn, BOOL erase )
{
if (!unix_funcs) return FALSE;
return unix_funcs->pNtUserInvalidateRgn( hwnd, hrgn, erase );
}
BOOL WINAPI NtUserIsClipboardFormatAvailable( UINT format )
{
if (!unix_funcs) return FALSE;
......
......@@ -617,6 +617,8 @@ NTSTATUS WINAPI NtUserInitializeClientPfnArrays( const struct user_client_procs
HICON WINAPI NtUserInternalGetWindowIcon( HWND hwnd, UINT type );
INT WINAPI NtUserInternalGetWindowText( HWND hwnd, WCHAR *text, INT count );
BOOL WINAPI NtUserIsClipboardFormatAvailable( UINT format );
BOOL WINAPI NtUserInvalidateRect( HWND hwnd, const RECT *rect, BOOL erase );
BOOL WINAPI NtUserInvalidateRgn( HWND hwnd, HRGN hrgn, BOOL erase );
BOOL WINAPI NtUserKillTimer( HWND hwnd, UINT_PTR id );
BOOL WINAPI NtUserLockWindowUpdate( HWND hwnd );
UINT WINAPI NtUserMapVirtualKeyEx( UINT code, UINT type, HKL layout );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment