Module: wine Branch: master Commit: 85fed5b1949473df5ec9f14648bf134e30b2af94 URL: http://source.winehq.org/git/wine.git/?a=commit;h=85fed5b1949473df5ec9f14648...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Aug 29 18:13:57 2012 +0200
user32: Invalidate the DCEs while still holding the window lock in SetWindowPos.
---
dlls/user32/painting.c | 19 ++++++++----------- dlls/user32/user_private.h | 3 ++- dlls/user32/winpos.c | 16 +++++++--------- 3 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/dlls/user32/painting.c b/dlls/user32/painting.c index 98dfc54..64f4318 100644 --- a/dlls/user32/painting.c +++ b/dlls/user32/painting.c @@ -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(); }
/*********************************************************************** diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 1a63bad..2bd8ad8 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -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; diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c index 0ff4762..23b0b7f 100644 --- a/dlls/user32/winpos.c +++ b/dlls/user32/winpos.c @@ -1997,17 +1997,15 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, } } SERVER_END_REQ; - 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 ); + 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 );
- USER_Driver->pWindowPosChanged( hwnd, insert_after, swp_flags, window_rect, - client_rect, &visible_rect, valid_rects ); - } + WIN_ReleasePtr( win ); + + if (ret) USER_Driver->pWindowPosChanged( hwnd, insert_after, swp_flags, window_rect, + client_rect, &visible_rect, valid_rects ); return ret; }