user32: Invalidate the DCEs while still holding the window lock in SetWindowPos.

This commit is contained in:
Alexandre Julliard 2012-08-29 18:13:57 +02:00
parent d35fc4369f
commit 85fed5b194
3 changed files with 17 additions and 21 deletions

View File

@ -399,40 +399,38 @@ static void make_dc_dirty( struct dce *dce )
* rectangle. In addition, pWnd->parent DCEs may need to be updated if
* DCX_CLIPCHILDREN flag is set.
*/
void invalidate_dce( HWND hwnd, const RECT *extra_rect )
void invalidate_dce( WND *win, const RECT *extra_rect )
{
RECT window_rect;
struct dce *dce;
HWND hwndScope = GetAncestor( hwnd, GA_PARENT );
if (!hwndScope) return;
if (!win->parent) return;
GetWindowRect( hwnd, &window_rect );
GetWindowRect( win->obj.handle, &window_rect );
TRACE("%p scope hwnd = %p %s (%s)\n",
hwnd, hwndScope, wine_dbgstr_rect(&window_rect), wine_dbgstr_rect(extra_rect) );
TRACE("%p parent %p %s (%s)\n",
win->obj.handle, win->parent, wine_dbgstr_rect(&window_rect), wine_dbgstr_rect(extra_rect) );
/* walk all DCEs and fixup non-empty entries */
USER_Lock();
LIST_FOR_EACH_ENTRY( dce, &dce_list, struct dce, entry )
{
TRACE( "%p: hwnd %p dcx %08x %s %s\n", dce, dce->hwnd, dce->flags,
(dce->flags & DCX_CACHE) ? "Cache" : "Owned", dce->count ? "InUse" : "" );
if (!dce->hwnd) continue;
if ((dce->hwnd == hwndScope) && !(dce->flags & DCX_CLIPCHILDREN))
if ((dce->hwnd == win->parent) && !(dce->flags & DCX_CLIPCHILDREN))
continue; /* child window positions don't bother us */
/* if DCE window is a child of hwnd, it has to be invalidated */
if (dce->hwnd == hwnd || IsChild( hwnd, dce->hwnd ))
if (dce->hwnd == win->obj.handle || IsChild( win->obj.handle, dce->hwnd ))
{
make_dc_dirty( dce );
continue;
}
/* otherwise check if the window rectangle intersects this DCE window */
if (hwndScope == dce->hwnd || IsChild( hwndScope, dce->hwnd ))
if (win->parent == dce->hwnd || IsChild( win->parent, dce->hwnd ))
{
RECT dce_rect, tmp;
GetWindowRect( dce->hwnd, &dce_rect );
@ -441,7 +439,6 @@ void invalidate_dce( HWND hwnd, const RECT *extra_rect )
make_dc_dirty( dce );
}
}
USER_Unlock();
}
/***********************************************************************

View File

@ -205,12 +205,13 @@ extern HMODULE user32_module DECLSPEC_HIDDEN;
extern HBRUSH SYSCOLOR_55AABrush DECLSPEC_HIDDEN;
struct dce;
struct tagWND;
extern BOOL CLIPBOARD_ReleaseOwner(void) DECLSPEC_HIDDEN;
extern BOOL FOCUS_MouseActivate( HWND hwnd ) DECLSPEC_HIDDEN;
extern BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret ) DECLSPEC_HIDDEN;
extern void free_dce( struct dce *dce, HWND hwnd ) DECLSPEC_HIDDEN;
extern void invalidate_dce( HWND hwnd, const RECT *rect ) DECLSPEC_HIDDEN;
extern void invalidate_dce( struct tagWND *win, const RECT *rect ) DECLSPEC_HIDDEN;
extern void erase_now( HWND hwnd, UINT rdw_flags ) DECLSPEC_HIDDEN;
extern void *get_hook_proc( void *proc, const WCHAR *module ) DECLSPEC_HIDDEN;
extern LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;

View File

@ -1997,17 +1997,15 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
}
}
SERVER_END_REQ;
if (ret && (((swp_flags & SWP_AGG_NOPOSCHANGE) != SWP_AGG_NOPOSCHANGE) ||
(swp_flags & (SWP_HIDEWINDOW | SWP_SHOWWINDOW | SWP_STATECHANGED | SWP_FRAMECHANGED))))
invalidate_dce( win, &old_window_rect );
WIN_ReleasePtr( win );
if (ret)
{
if (((swp_flags & SWP_AGG_NOPOSCHANGE) != SWP_AGG_NOPOSCHANGE) ||
(swp_flags & (SWP_HIDEWINDOW | SWP_SHOWWINDOW | SWP_STATECHANGED | SWP_FRAMECHANGED)))
invalidate_dce( hwnd, &old_window_rect );
USER_Driver->pWindowPosChanged( hwnd, insert_after, swp_flags, window_rect,
client_rect, &visible_rect, valid_rects );
}
if (ret) USER_Driver->pWindowPosChanged( hwnd, insert_after, swp_flags, window_rect,
client_rect, &visible_rect, valid_rects );
return ret;
}