OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2493 lock_updates_count_ = 0; | 2493 lock_updates_count_ = 0; |
2494 } | 2494 } |
2495 } | 2495 } |
2496 | 2496 |
2497 bool NativeWidgetWin::WidgetSizeIsClientSize() const { | 2497 bool NativeWidgetWin::WidgetSizeIsClientSize() const { |
2498 const Widget* widget = GetWidget()->GetTopLevelWidget(); | 2498 const Widget* widget = GetWidget()->GetTopLevelWidget(); |
2499 return IsZoomed() || (widget && widget->ShouldUseNativeFrame()); | 2499 return IsZoomed() || (widget && widget->ShouldUseNativeFrame()); |
2500 } | 2500 } |
2501 | 2501 |
2502 void NativeWidgetWin::ClientAreaSizeChanged() { | 2502 void NativeWidgetWin::ClientAreaSizeChanged() { |
2503 RECT r; | 2503 RECT r = {0, 0, 0, 0}; |
2504 if (WidgetSizeIsClientSize()) | 2504 if (WidgetSizeIsClientSize()) { |
2505 GetClientRect(&r); | 2505 // TODO(beng): investigate whether this could be done |
2506 else | 2506 // from other branch of if-else. |
| 2507 if (!IsMinimized()) |
| 2508 GetClientRect(&r); |
| 2509 } else |
2507 GetWindowRect(&r); | 2510 GetWindowRect(&r); |
2508 gfx::Size s(std::max(0, static_cast<int>(r.right - r.left)), | 2511 gfx::Size s(std::max(0, static_cast<int>(r.right - r.left)), |
2509 std::max(0, static_cast<int>(r.bottom - r.top))); | 2512 std::max(0, static_cast<int>(r.bottom - r.top))); |
2510 delegate_->OnNativeWidgetSizeChanged(s); | 2513 delegate_->OnNativeWidgetSizeChanged(s); |
2511 if (use_layered_buffer_) | 2514 if (use_layered_buffer_) |
2512 layered_window_contents_.reset( | 2515 layered_window_contents_.reset( |
2513 new gfx::Canvas(s, ui::SCALE_FACTOR_100P, false)); | 2516 new gfx::Canvas(s, ui::SCALE_FACTOR_100P, false)); |
2514 } | 2517 } |
2515 | 2518 |
2516 void NativeWidgetWin::UpdateDWMFrame() { | 2519 void NativeWidgetWin::UpdateDWMFrame() { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2766 // static | 2769 // static |
2767 bool NativeWidgetPrivate::IsTouchDown() { | 2770 bool NativeWidgetPrivate::IsTouchDown() { |
2768 // This currently isn't necessary because we're not generating touch events on | 2771 // This currently isn't necessary because we're not generating touch events on |
2769 // windows. When we do, this will need to be updated. | 2772 // windows. When we do, this will need to be updated. |
2770 return false; | 2773 return false; |
2771 } | 2774 } |
2772 | 2775 |
2773 } // namespace internal | 2776 } // namespace internal |
2774 | 2777 |
2775 } // namespace views | 2778 } // namespace views |
OLD | NEW |