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 "views/widget/native_widget_win.h" | 5 #include "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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 } | 453 } |
454 | 454 |
455 void NativeWidgetWin::PopForceHidden() { | 455 void NativeWidgetWin::PopForceHidden() { |
456 if (--force_hidden_count_ <= 0) { | 456 if (--force_hidden_count_ <= 0) { |
457 force_hidden_count_ = 0; | 457 force_hidden_count_ = 0; |
458 ShowWindow(SW_SHOW); | 458 ShowWindow(SW_SHOW); |
459 } | 459 } |
460 } | 460 } |
461 | 461 |
462 //////////////////////////////////////////////////////////////////////////////// | 462 //////////////////////////////////////////////////////////////////////////////// |
| 463 // NativeWidgetWin, CompositorDelegate implementation: |
| 464 |
| 465 void NativeWidgetWin::ScheduleCompositorPaint() { |
| 466 RECT rect; |
| 467 ::GetClientRect(GetNativeView(), &rect); |
| 468 InvalidateRect(GetNativeView(), &rect, FALSE); |
| 469 } |
| 470 |
| 471 //////////////////////////////////////////////////////////////////////////////// |
463 // NativeWidgetWin, NativeWidget implementation: | 472 // NativeWidgetWin, NativeWidget implementation: |
464 | 473 |
465 void NativeWidgetWin::InitNativeWidget(const Widget::InitParams& params) { | 474 void NativeWidgetWin::InitNativeWidget(const Widget::InitParams& params) { |
466 SetInitParams(params); | 475 SetInitParams(params); |
467 | 476 |
468 GetMonitorAndRects(params.bounds.ToRECT(), &last_monitor_, | 477 GetMonitorAndRects(params.bounds.ToRECT(), &last_monitor_, |
469 &last_monitor_rect_, &last_work_area_); | 478 &last_monitor_rect_, &last_work_area_); |
470 | 479 |
471 // Create the window. | 480 // Create the window. |
472 gfx::NativeView parent = params.parent_widget ? | 481 gfx::NativeView parent = params.parent_widget ? |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 // creation time. | 1249 // creation time. |
1241 ClientAreaSizeChanged(); | 1250 ClientAreaSizeChanged(); |
1242 | 1251 |
1243 #if defined(VIEWS_COMPOSITOR) | 1252 #if defined(VIEWS_COMPOSITOR) |
1244 if (View::get_use_acceleration_when_possible()) { | 1253 if (View::get_use_acceleration_when_possible()) { |
1245 if (Widget::compositor_factory()) { | 1254 if (Widget::compositor_factory()) { |
1246 compositor_ = (*Widget::compositor_factory())(); | 1255 compositor_ = (*Widget::compositor_factory())(); |
1247 } else { | 1256 } else { |
1248 CRect window_rect; | 1257 CRect window_rect; |
1249 GetClientRect(&window_rect); | 1258 GetClientRect(&window_rect); |
1250 compositor_ = ui::Compositor::Create( | 1259 compositor_ = ui::Compositor::Create(this, |
1251 hwnd(), | 1260 hwnd(), |
1252 gfx::Size(window_rect.Width(), window_rect.Height())); | 1261 gfx::Size(window_rect.Width(), window_rect.Height())); |
1253 } | 1262 } |
1254 if (compositor_.get()) | 1263 if (compositor_.get()) |
1255 delegate_->AsWidget()->GetRootView()->SetPaintToLayer(true); | 1264 delegate_->AsWidget()->GetRootView()->SetPaintToLayer(true); |
1256 } | 1265 } |
1257 #endif | 1266 #endif |
1258 | 1267 |
1259 delegate_->OnNativeWidgetCreated(); | 1268 delegate_->OnNativeWidgetCreated(); |
1260 | 1269 |
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2529 return (GetKeyState(VK_LBUTTON) & 0x80) || | 2538 return (GetKeyState(VK_LBUTTON) & 0x80) || |
2530 (GetKeyState(VK_RBUTTON) & 0x80) || | 2539 (GetKeyState(VK_RBUTTON) & 0x80) || |
2531 (GetKeyState(VK_MBUTTON) & 0x80) || | 2540 (GetKeyState(VK_MBUTTON) & 0x80) || |
2532 (GetKeyState(VK_XBUTTON1) & 0x80) || | 2541 (GetKeyState(VK_XBUTTON1) & 0x80) || |
2533 (GetKeyState(VK_XBUTTON2) & 0x80); | 2542 (GetKeyState(VK_XBUTTON2) & 0x80); |
2534 } | 2543 } |
2535 | 2544 |
2536 } // namespace internal | 2545 } // namespace internal |
2537 | 2546 |
2538 } // namespace views | 2547 } // namespace views |
OLD | NEW |