From e13a64de891775f8c6c0937baad1621d1c58805d Mon Sep 17 00:00:00 2001 From: "msw@chromium.org" Date: Wed, 13 Mar 2013 07:02:01 +0000 Subject: Limit the WM_SETCURSOR DefWindowProc artifacts workaround. This is a refinement of http://crrev.com/186306 Only use a ScopedRedrawLock and DefWindowProc as needed. Otherwise, mark the message as unhandled for default handling. ( some WM_SETCURSOR calls don't trigger DefWindowProc artifacts ) This is also a speculative fix for http://crbug.com/181282 ( http://crrev.com/186306 may have regressed performance ) BUG=89820,97808,113127,178600,181282 TEST=No Win7/Vista/XP opaque-frame (classic theme) painting glitches. Potential fix for MPArch.RWHH_WhiteoutDuration UMA perf regression. R=sky@chromium.org,ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/12567010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187803 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/views/win/hwnd_message_handler.cc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'ui/views') diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc index 6c0d854..520980d 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -1817,11 +1817,20 @@ LRESULT HWNDMessageHandler::OnReflectedMessage(UINT message, LRESULT HWNDMessageHandler::OnSetCursor(UINT message, WPARAM w_param, LPARAM l_param) { - const LRESULT result = DefWindowProcWithRedrawLock(message, w_param, l_param); - // Invalidate the window to paint over any outdated window regions asap, as - // using a RedrawLock for WM_SETCURSOR may show content through this window. - if (delegate_->IsUsingCustomFrame() && !ui::win::IsAeroGlassEnabled()) + LRESULT result = 0; + // Use a ScopedRedrawLock to avoid weird non-client painting for windows with + // custom frames when glass is not enabled. Otherwise, default handling is + // sufficient and does not produce the weird non-client painting artifacts. + if (delegate_->IsUsingCustomFrame() && !ui::win::IsAeroGlassEnabled() && + LOWORD(l_param) >= HTLEFT && LOWORD(l_param) <= HTBOTTOMRIGHT) { + // Prevent classic theme custom frame artifacts on these WM_SETCUROR calls. + result = DefWindowProcWithRedrawLock(message, w_param, l_param); + // Invalidate the window to paint over any outdated window regions asap, as + // using a RedrawLock for WM_SETCURSOR may show content through this window. InvalidateRect(hwnd(), NULL, FALSE); + } else { + SetMsgHandled(FALSE); + } return result; } -- cgit v1.1