summaryrefslogtreecommitdiffstats
path: root/views/window
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-15 18:38:28 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-15 18:38:28 +0000
commitc3e5312a57b506e1a6d26dace8e8c9320b9966a3 (patch)
tree2476d7ca57e528bb0c8818452f3010f03b60191f /views/window
parent004ec925e3f71aeba2acd1461741ccddd92eeedc (diff)
downloadchromium_src-c3e5312a57b506e1a6d26dace8e8c9320b9966a3.zip
chromium_src-c3e5312a57b506e1a6d26dace8e8c9320b9966a3.tar.gz
chromium_src-c3e5312a57b506e1a6d26dace8e8c9320b9966a3.tar.bz2
Revert 78222 - Add native capture API to Widget, and fix a bug in Window where we wouldn't let the window be closed from the X.
BUG=72040 TEST=none TBR=sky Review URL: http://codereview.chromium.org/6697016 TBR=ben@chromium.org Review URL: http://codereview.chromium.org/6695028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78241 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window')
-rw-r--r--views/window/window_win.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/views/window/window_win.cc b/views/window/window_win.cc
index 301b5099..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.
@@ -617,7 +627,7 @@ 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 (ShouldUseNativeFrame()) {
+ if (IsDwmRenderingWindowControls(GetNativeView())) {
LRESULT result;
if (DwmDefWindowProc(GetNativeView(), WM_NCHITTEST, 0,
MAKELPARAM(point.x, point.y), &result)) {
@@ -673,7 +683,7 @@ LRESULT WindowWin::OnNCMouseRange(UINT message,
// We SetCapture() to ensure we only show the menu when the button down and
// up are both on the caption. Note: this causes the button up to be
// WM_RBUTTONUP instead of WM_NCRBUTTONUP.
- SetNativeCapture();
+ SetCapture();
}
WidgetWin::OnNCMouseRange(message, w_param, l_param);