diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-20 22:01:54 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-20 22:01:54 +0000 |
commit | 58d7a13ade5521cea32ed0e1ff4ea4e9b2fa2470 (patch) | |
tree | 345dcc0a2548f1715df8f3c83ef9c930128b8551 | |
parent | 80a2320ddabee9ea9a8e0b93aefea9fddd8ed276 (diff) | |
download | chromium_src-58d7a13ade5521cea32ed0e1ff4ea4e9b2fa2470.zip chromium_src-58d7a13ade5521cea32ed0e1ff4ea4e9b2fa2470.tar.gz chromium_src-58d7a13ade5521cea32ed0e1ff4ea4e9b2fa2470.tar.bz2 |
Fix crash on older versions of windows that don't have DWM APIs.
http://crbug.com/17290
TEST=none
Review URL: http://codereview.chromium.org/155798
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21112 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | views/window/window_win.cc | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/views/window/window_win.cc b/views/window/window_win.cc index 2cf833e..871e132c 100644 --- a/views/window/window_win.cc +++ b/views/window/window_win.cc @@ -194,14 +194,18 @@ void WindowWin::FrameTypeChanged() { // type. non_client_view_->UpdateFrame(); - // We need to toggle the rendering policy of the DWM/glass frame as we change - // from opaque to glass. The logic of these values seems inverted to me, but - // it works, so I'm not going to complain. - DWMNCRENDERINGPOLICY policy = - non_client_view_->UseNativeFrame() ? DWMNCRP_ENABLED - : DWMNCRP_DISABLED; - DwmSetWindowAttribute(GetNativeView(), DWMWA_NCRENDERING_POLICY, - &policy, sizeof(DWMNCRENDERINGPOLICY)); + if (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA) { + // We need to toggle the rendering policy of the DWM/glass frame as we + // change from opaque to glass. "Non client rendering enabled" means that + // the DWM's glass non-client rendering is enabled, which is why + // DWMNCRP_ENABLED is used for the native frame case. _DISABLED means the + // DWM doesn't render glass, and so is used in the custom frame case. + DWMNCRENDERINGPOLICY policy = + non_client_view_->UseNativeFrame() ? DWMNCRP_ENABLED + : DWMNCRP_DISABLED; + DwmSetWindowAttribute(GetNativeView(), DWMWA_NCRENDERING_POLICY, + &policy, sizeof(DWMNCRENDERINGPOLICY)); + } // Send a frame change notification, since the non-client metrics have // changed. |