diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-24 00:18:58 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-24 00:18:58 +0000 |
commit | 6b312562569d5a1aac945e6536614fc0f19339a3 (patch) | |
tree | 0ac7946ec9a97fb88f54a1cde1c0fe10ea98628d /views | |
parent | 9a43863448d68c0f0a2e95d02790b2b43f70ea2b (diff) | |
download | chromium_src-6b312562569d5a1aac945e6536614fc0f19339a3.zip chromium_src-6b312562569d5a1aac945e6536614fc0f19339a3.tar.gz chromium_src-6b312562569d5a1aac945e6536614fc0f19339a3.tar.bz2 |
Fix painting glitch by suppressing non-client painting for WindowWins only when resizing, and forcing a NCPaint after the size/move ends.
http://crbug.com/79640
TEST=classic mode, see bug
Review URL: http://codereview.chromium.org/6897031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82804 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/widget/widget_win.cc | 5 | ||||
-rw-r--r-- | views/window/window_win.cc | 15 | ||||
-rw-r--r-- | views/window/window_win.h | 3 |
3 files changed, 20 insertions, 3 deletions
diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index bc6cf23c..d05b725 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -1110,7 +1110,10 @@ void WidgetWin::RedrawLayeredWindowContents() { void WidgetWin::ClientAreaSizeChanged() { RECT r; - GetClientRect(&r); + if (GetThemeProvider()->ShouldUseNativeFrame()) + GetClientRect(&r); + else + GetWindowRect(&r); gfx::Size s(std::max(0, static_cast<int>(r.right - r.left)), std::max(0, static_cast<int>(r.bottom - r.top))); delegate_->OnSizeChanged(s); diff --git a/views/window/window_win.cc b/views/window/window_win.cc index b19c13d..1fb97ac 100644 --- a/views/window/window_win.cc +++ b/views/window/window_win.cc @@ -310,7 +310,8 @@ WindowWin::WindowWin(WindowDelegate* window_delegate) ignore_pos_changes_factory_(this), force_hidden_count_(0), is_right_mouse_pressed_on_caption_(false), - last_monitor_(NULL) { + last_monitor_(NULL), + is_in_size_move_(false) { SetNativeWindow(this); is_window_ = true; InitClass(); @@ -420,13 +421,23 @@ LRESULT WindowWin::OnDwmCompositionChanged(UINT msg, WPARAM w_param, } void WindowWin::OnEnterSizeMove() { + is_in_size_move_ = true; WidgetWin::OnEnterSizeMove(); delegate_->OnNativeWindowBeginUserBoundsChange(); } void WindowWin::OnExitSizeMove() { + is_in_size_move_ = false; WidgetWin::OnExitSizeMove(); delegate_->OnNativeWindowEndUserBoundsChange(); + + if (!GetThemeProvider()->ShouldUseNativeFrame()) { + // Sending SWP_FRAMECHANGED forces a non-client repaint, which fixes the + // glitch in rendering the bottom pixel of the window caused by us + // offsetting the client rect there (See comment in GetClientAreaInsets()). + SetWindowPos(NULL, 0, 0, 0, 0, + SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER); + } } void WindowWin::OnFinalMessage(HWND window) { @@ -669,7 +680,7 @@ LRESULT WindowWin::OnNCHitTest(const CPoint& point) { void WindowWin::OnNCPaint(HRGN rgn) { // When using a custom frame, we want to avoid calling DefWindowProc() since // that may render artifacts. - SetMsgHandled(!delegate_->IsUsingNativeFrame()); + SetMsgHandled(is_in_size_move_ && !delegate_->IsUsingNativeFrame()); } LRESULT WindowWin::OnNCUAHDrawCaption(UINT msg, WPARAM w_param, diff --git a/views/window/window_win.h b/views/window/window_win.h index 33f1d71..a0c3981 100644 --- a/views/window/window_win.h +++ b/views/window/window_win.h @@ -279,6 +279,9 @@ class WindowWin : public WidgetWin, DWORD drag_frame_saved_window_style_; DWORD drag_frame_saved_window_ex_style_; + // True when the window is being moved/sized. + bool is_in_size_move_; + DISALLOW_COPY_AND_ASSIGN(WindowWin); }; |