summaryrefslogtreecommitdiffstats
path: root/views/window/window_win.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-14 23:53:45 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-14 23:53:45 +0000
commit883ce2fa8fc0b8f8bf15fb4279ea2464a22cc052 (patch)
tree4eb19bb2c187ba53924b13a0e90d61c669a15c83 /views/window/window_win.cc
parente042db5288480d9ca61b155d8b8fa9ea42481554 (diff)
downloadchromium_src-883ce2fa8fc0b8f8bf15fb4279ea2464a22cc052.zip
chromium_src-883ce2fa8fc0b8f8bf15fb4279ea2464a22cc052.tar.gz
chromium_src-883ce2fa8fc0b8f8bf15fb4279ea2464a22cc052.tar.bz2
Reland 78062 with some NULL checks.
Revert 78062 - Migrate more of BrowserFrame's event handling down into WindowWin/WidgetWin and their delegate interfaces. BUG=72040 TEST=none Review URL: http://codereview.chromium.org/6683007 TBR=ben@chromium.org Review URL: http://codereview.chromium.org/6686059 Review URL: http://codereview.chromium.org/6677029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78129 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window/window_win.cc')
-rw-r--r--views/window/window_win.cc48
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,