summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-21 16:41:34 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-21 16:41:34 +0000
commite4f2d631670f61c442fca79ce08050a90fb35505 (patch)
tree5c0bb0352e609b4aa3f4dc23b38deb99e8eb4853 /chrome
parent70a41f29d64a3f5198149016293ab9ae5d23a03d (diff)
downloadchromium_src-e4f2d631670f61c442fca79ce08050a90fb35505.zip
chromium_src-e4f2d631670f61c442fca79ce08050a90fb35505.tar.gz
chromium_src-e4f2d631670f61c442fca79ce08050a90fb35505.tar.bz2
Makes resize of custom frame window a bit smoother. I tried a whole
slew of variations, and this is the best I could get. From nc calc size we now return WVR_REDRAW, which indicates we need to redraw the frame. Without this I believe windows was copying some bits around for us resulting in the jitter. Additionally in OnNCPaint we do nothing if the root view's size isn't the same as the window's size. This is done as during resizes we get a WM_NCPAINT *before* a WM_SIZE. We also get a WM_NCPAINT after the WM_SIZE, so that it's ok to ignore the first one. BUG=1293978 TEST=make sure sizing of task manager/keyword editor doesn't break. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1157 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/views/custom_frame_window.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/chrome/views/custom_frame_window.cc b/chrome/views/custom_frame_window.cc
index 7679e3f..e045e8b 100644
--- a/chrome/views/custom_frame_window.cc
+++ b/chrome/views/custom_frame_window.cc
@@ -986,8 +986,10 @@ LRESULT CustomFrameWindow::OnNCCalcSize(BOOL mode, LPARAM l_param) {
RECT* rect = reinterpret_cast<RECT*>(l_param);
*rect = non_client_view_->CalculateClientAreaBounds(
rect->right - rect->left, rect->bottom - rect->top).ToRECT();
+ return 0;
}
- return 0;
+ // We need to repaint all when the window bounds change.
+ return WVR_REDRAW;
}
LRESULT CustomFrameWindow::OnNCHitTest(const CPoint& point) {
@@ -1043,6 +1045,17 @@ void CustomFrameWindow::OnNCPaint(HRGN rgn) {
CRect window_rect;
GetWindowRect(&window_rect);
+ if (window_rect.Width() != root_view_->GetWidth() ||
+ window_rect.Height() != root_view_->GetHeight()) {
+ // If the size of the window differs from the size of the root view it
+ // means we're being asked to paint before we've gotten a WM_SIZE. This can
+ // happen when the user is interactively resizing the window. To avoid
+ // mass flickering we don't do anything here. Once we get the WM_SIZE we'll
+ // reset the region of the window which triggers another WM_NCPAINT and
+ // all is well.
+ return;
+ }
+
CRect dirty_region;
// A value of 1 indicates paint all.
if (!rgn || rgn == reinterpret_cast<HRGN>(1)) {