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 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 | 1290 |
1291 // Bug 964884: detach the IME attached to this window. | 1291 // Bug 964884: detach the IME attached to this window. |
1292 // We should attach IMEs only when we need to input CJK strings. | 1292 // We should attach IMEs only when we need to input CJK strings. |
1293 ImmAssociateContextEx(hwnd(), NULL, 0); | 1293 ImmAssociateContextEx(hwnd(), NULL, 0); |
1294 | 1294 |
1295 // We need to allow the delegate to size its contents since the window may not | 1295 // We need to allow the delegate to size its contents since the window may not |
1296 // receive a size notification when its initial bounds are specified at window | 1296 // receive a size notification when its initial bounds are specified at window |
1297 // creation time. | 1297 // creation time. |
1298 ClientAreaSizeChanged(); | 1298 ClientAreaSizeChanged(); |
1299 | 1299 |
1300 #if defined(VIEWS_COMPOSITOR) | |
1301 if (View::get_use_acceleration_when_possible()) { | |
1302 if (ui::Compositor::compositor_factory()) { | |
1303 compositor_ = (*Widget::compositor_factory())(this); | |
1304 } else { | |
1305 CRect window_rect; | |
1306 GetClientRect(&window_rect); | |
1307 compositor_ = ui::Compositor::Create(this, | |
1308 hwnd(), | |
1309 gfx::Size(window_rect.Width(), window_rect.Height())); | |
1310 } | |
1311 if (compositor_.get()) { | |
1312 delegate_->AsWidget()->GetRootView()->SetPaintToLayer(true); | |
1313 compositor_->SetRootLayer(delegate_->AsWidget()->GetRootView()->layer()); | |
1314 } | |
1315 } | |
1316 #endif | |
1317 | |
1318 delegate_->OnNativeWidgetCreated(); | 1300 delegate_->OnNativeWidgetCreated(); |
1319 | 1301 |
1320 // Get access to a modifiable copy of the system menu. | 1302 // Get access to a modifiable copy of the system menu. |
1321 GetSystemMenu(hwnd(), false); | 1303 GetSystemMenu(hwnd(), false); |
1322 return 0; | 1304 return 0; |
1323 } | 1305 } |
1324 | 1306 |
1325 void NativeWidgetWin::OnDestroy() { | 1307 void NativeWidgetWin::OnDestroy() { |
1326 delegate_->OnNativeWidgetDestroying(); | 1308 delegate_->OnNativeWidgetDestroying(); |
1327 if (drop_target_.get()) { | 1309 if (drop_target_.get()) { |
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2626 return (GetKeyState(VK_LBUTTON) & 0x80) || | 2608 return (GetKeyState(VK_LBUTTON) & 0x80) || |
2627 (GetKeyState(VK_RBUTTON) & 0x80) || | 2609 (GetKeyState(VK_RBUTTON) & 0x80) || |
2628 (GetKeyState(VK_MBUTTON) & 0x80) || | 2610 (GetKeyState(VK_MBUTTON) & 0x80) || |
2629 (GetKeyState(VK_XBUTTON1) & 0x80) || | 2611 (GetKeyState(VK_XBUTTON1) & 0x80) || |
2630 (GetKeyState(VK_XBUTTON2) & 0x80); | 2612 (GetKeyState(VK_XBUTTON2) & 0x80); |
2631 } | 2613 } |
2632 | 2614 |
2633 } // namespace internal | 2615 } // namespace internal |
2634 | 2616 |
2635 } // namespace views | 2617 } // namespace views |
OLD | NEW |