| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/widget/native_widget_win.h" | 5 #include "ui/views/widget/native_widget_win.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 2207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2218 skia::EndPlatformPaint(layered_window_contents_->sk_canvas()); | 2218 skia::EndPlatformPaint(layered_window_contents_->sk_canvas()); |
| 2219 } | 2219 } |
| 2220 | 2220 |
| 2221 void NativeWidgetWin::LockUpdates() { | 2221 void NativeWidgetWin::LockUpdates() { |
| 2222 // We skip locked updates when Aero is on for two reasons: | 2222 // We skip locked updates when Aero is on for two reasons: |
| 2223 // 1. Because it isn't necessary | 2223 // 1. Because it isn't necessary |
| 2224 // 2. Because toggling the WS_VISIBLE flag may occur while the GPU process is | 2224 // 2. Because toggling the WS_VISIBLE flag may occur while the GPU process is |
| 2225 // attempting to present a child window's backbuffer onscreen. When these | 2225 // attempting to present a child window's backbuffer onscreen. When these |
| 2226 // two actions race with one another, the child window will either flicker | 2226 // two actions race with one another, the child window will either flicker |
| 2227 // or will simply stop updating entirely. | 2227 // or will simply stop updating entirely. |
| 2228 if (!IsAeroGlassEnabled() && ++lock_updates_count_ == 1) { | 2228 if (!IsAeroGlassEnabled() && ++lock_updates_count_ == 1) |
| 2229 SetWindowLong(GWL_STYLE, GetWindowLong(GWL_STYLE) & ~WS_VISIBLE); | 2229 SetWindowLong(GWL_STYLE, GetWindowLong(GWL_STYLE) & ~WS_VISIBLE); |
| 2230 } | |
| 2231 // TODO(msw): Remove nested LockUpdates VLOG info for crbug.com/93530. | |
| 2232 VLOG_IF(1, (lock_updates_count_ > 1)) << "Nested LockUpdates call: " | |
| 2233 << lock_updates_count_ << " locks for widget " << this; | |
| 2234 } | 2230 } |
| 2235 | 2231 |
| 2236 void NativeWidgetWin::UnlockUpdates() { | 2232 void NativeWidgetWin::UnlockUpdates() { |
| 2237 // TODO(msw): Remove nested LockUpdates VLOG info for crbug.com/93530. | |
| 2238 VLOG_IF(1, (lock_updates_count_ > 1)) << "Nested UnlockUpdates call: " | |
| 2239 << lock_updates_count_ << " locks for widget " << this; | |
| 2240 if (!IsAeroGlassEnabled() && --lock_updates_count_ <= 0) { | 2233 if (!IsAeroGlassEnabled() && --lock_updates_count_ <= 0) { |
| 2241 SetWindowLong(GWL_STYLE, GetWindowLong(GWL_STYLE) | WS_VISIBLE); | 2234 SetWindowLong(GWL_STYLE, GetWindowLong(GWL_STYLE) | WS_VISIBLE); |
| 2242 lock_updates_count_ = 0; | 2235 lock_updates_count_ = 0; |
| 2243 } | 2236 } |
| 2244 } | 2237 } |
| 2245 | 2238 |
| 2246 bool NativeWidgetWin::WidgetSizeIsClientSize() const { | 2239 bool NativeWidgetWin::WidgetSizeIsClientSize() const { |
| 2247 const Widget* widget = GetWidget()->GetTopLevelWidget(); | 2240 const Widget* widget = GetWidget()->GetTopLevelWidget(); |
| 2248 return IsZoomed() || (widget && widget->ShouldUseNativeFrame()); | 2241 return IsZoomed() || (widget && widget->ShouldUseNativeFrame()); |
| 2249 } | 2242 } |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2497 return (GetKeyState(VK_LBUTTON) & 0x80) || | 2490 return (GetKeyState(VK_LBUTTON) & 0x80) || |
| 2498 (GetKeyState(VK_RBUTTON) & 0x80) || | 2491 (GetKeyState(VK_RBUTTON) & 0x80) || |
| 2499 (GetKeyState(VK_MBUTTON) & 0x80) || | 2492 (GetKeyState(VK_MBUTTON) & 0x80) || |
| 2500 (GetKeyState(VK_XBUTTON1) & 0x80) || | 2493 (GetKeyState(VK_XBUTTON1) & 0x80) || |
| 2501 (GetKeyState(VK_XBUTTON2) & 0x80); | 2494 (GetKeyState(VK_XBUTTON2) & 0x80); |
| 2502 } | 2495 } |
| 2503 | 2496 |
| 2504 } // namespace internal | 2497 } // namespace internal |
| 2505 | 2498 |
| 2506 } // namespace views | 2499 } // namespace views |
| OLD | NEW |