diff options
Diffstat (limited to 'views/window/window_win.cc')
-rw-r--r-- | views/window/window_win.cc | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/views/window/window_win.cc b/views/window/window_win.cc index 32583e3..4708df5 100644 --- a/views/window/window_win.cc +++ b/views/window/window_win.cc @@ -142,6 +142,16 @@ void EnableMenuItem(HMENU menu, UINT command, bool enabled) { EnableMenuItem(menu, command, flags); } +bool IsDwmRenderingWindowControls(HWND window) { + if (base::win::GetVersion() < base::win::VERSION_VISTA) + return false; + + DWMNCRENDERINGPOLICY policy; + DwmGetWindowAttribute(window, DWMWA_NCRENDERING_POLICY, &policy, + sizeof(policy)); + return policy == DWMNCRP_ENABLED; +} + // If the hung renderer warning doesn't fit on screen, the amount of padding to // be left between the edge of the window and the edge of the nearest monitor, // after the window is nudged back on screen. Pixels. @@ -432,6 +442,16 @@ LRESULT WindowWin::OnDwmCompositionChanged(UINT msg, WPARAM w_param, return 0; } +void WindowWin::OnEnterSizeMove() { + WidgetWin::OnEnterSizeMove(); + delegate_->OnNativeWindowBeginUserBoundsChange(); +} + +void WindowWin::OnExitSizeMove() { + WidgetWin::OnExitSizeMove(); + delegate_->OnNativeWindowEndUserBoundsChange(); +} + void WindowWin::OnFinalMessage(HWND window) { delegate_->OnNativeWindowDestroyed(); WidgetWin::OnFinalMessage(window); @@ -605,9 +625,19 @@ LRESULT WindowWin::OnNCCalcSize(BOOL mode, LPARAM l_param) { } LRESULT WindowWin::OnNCHitTest(const CPoint& point) { + // If the DWM is rendering the window controls, we need to give the DWM's + // default window procedure first chance to handle hit testing. + if (IsDwmRenderingWindowControls(GetNativeView())) { + LRESULT result; + if (DwmDefWindowProc(GetNativeView(), WM_NCHITTEST, 0, + MAKELPARAM(point.x, point.y), &result)) { + return result; + } + } + // First, give the NonClientView a chance to test the point to see if it // provides any of the non-client area. - CPoint temp = point; + POINT temp = point; MapWindowPoints(HWND_DESKTOP, GetNativeView(), &temp, 1); int component = delegate_->GetNonClientComponent(gfx::Point(temp)); if (component != HTNOWHERE) @@ -852,6 +882,14 @@ void WindowWin::OnWindowPosChanging(WINDOWPOS* window_pos) { //////////////////////////////////////////////////////////////////////////////// // WindowWin, NativeWindow implementation: +NativeWidget* WindowWin::AsNativeWidget() { + return this; +} + +const NativeWidget* WindowWin::AsNativeWidget() const { + return this; +} + gfx::Rect WindowWin::GetRestoredBounds() const { // If we're in fullscreen mode, we've changed the normal bounds to the monitor // rect, so return the saved bounds instead. @@ -984,14 +1022,6 @@ void WindowWin::SetAccessibleState(ui::AccessibilityTypes::State state) { } } -NativeWidget* WindowWin::AsNativeWidget() { - return this; -} - -const NativeWidget* WindowWin::AsNativeWidget() const { - return this; -} - void WindowWin::SetWindowBounds(const gfx::Rect& bounds, gfx::NativeWindow other_window) { SetChildBounds(GetNativeView(), GetParent(), other_window, bounds, |