diff options
-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); }; |