summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authormsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-03 01:47:27 +0000
committermsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-03 01:47:27 +0000
commit867c39d6c6e53100b6d787a2a994b899407d6810 (patch)
tree11ee5293550282ee8e59f2fd6bb84a0a8c6e8172 /views
parent8bbe419073681b99c8fa2d2a5ebf192c3326ee73 (diff)
downloadchromium_src-867c39d6c6e53100b6d787a2a994b899407d6810.zip
chromium_src-867c39d6c6e53100b6d787a2a994b899407d6810.tar.gz
chromium_src-867c39d6c6e53100b6d787a2a994b899407d6810.tar.bz2
Workaround windows classic theme rendering artifacts.
Wrap DefWindowProc for WM_NCLBUTTONDOWN with ScopedRedrawLock. Update the saved window style to handle max/restore, etc. BUG=89820 TEST=No windows classic theme caption button rendering artifacts when clicking the title bar area. No related mouse event, window re-sizing/style regressions. Review URL: http://codereview.chromium.org/7828038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99498 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/widget/native_widget_win.cc34
1 files changed, 15 insertions, 19 deletions
diff --git a/views/widget/native_widget_win.cc b/views/widget/native_widget_win.cc
index 173ad25..7b47e96 100644
--- a/views/widget/native_widget_win.cc
+++ b/views/widget/native_widget_win.cc
@@ -1501,24 +1501,6 @@ LRESULT NativeWidgetWin::OnMouseRange(UINT message,
SetMouseCapture();
}
- /*
- TODO(beng): This fixes some situations where the windows-classic appearance
- non-client area is rendered over our custom frame, however it
- causes mouse-releases to the non-client area to be eaten, so it
- can't be enabled.
- if (message == WM_NCLBUTTONDOWN) {
- // NativeWidgetWin::OnNCLButtonDown set the message as un-handled. This
- // normally means NativeWidgetWin::ProcessWindowMessage will pass it to
- // DefWindowProc. Sadly, DefWindowProc for WM_NCLBUTTONDOWN does weird
- // non-client painting, so we need to call it directly here inside a
- // scoped update lock.
- ScopedRedrawLock lock(this);
- NativeWidgetWin::OnMouseRange(message, w_param, l_param);
- DefWindowProc(GetNativeView(), WM_NCLBUTTONDOWN, w_param, l_param);
- SetMsgHandled(TRUE);
- }
- */
-
MSG msg = { hwnd(), message, w_param, l_param, 0,
{ GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } };
MouseEvent event(msg);
@@ -1544,7 +1526,21 @@ LRESULT NativeWidgetWin::OnMouseRange(UINT message,
delegate_->OnMouseEvent(MouseWheelEvent(msg))) ? 0 : 1;
}
- SetMsgHandled(delegate_->OnMouseEvent(event));
+ bool handled = delegate_->OnMouseEvent(event);
+
+ if (!handled && message == WM_NCLBUTTONDOWN) {
+ // TODO(msw): Eliminate undesired painting, or re-evaluate this workaround.
+ // DefWindowProc for WM_NCLBUTTONDOWN does weird non-client painting, so we
+ // need to call it directly here inside a ScopedRedrawLock. This may cause
+ // other negative side-effects (ex/ stifling non-client mouse releases).
+ ScopedRedrawLock lock(this);
+ DefWindowProc(GetNativeView(), message, w_param, l_param);
+ // Update the saved window style, which may change (maximized to restored).
+ saved_window_style_ = GetWindowLong(GWL_STYLE);
+ handled = true;
+ }
+
+ SetMsgHandled(handled);
return 0;
}