OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/gfx/win/direct_manipulation.h" | 5 #include "ui/gfx/win/direct_manipulation.h" |
6 | 6 |
7 #include "base/win/windows_version.h" | 7 #include "base/win/windows_version.h" |
8 | 8 |
9 namespace gfx { | 9 namespace gfx { |
10 namespace win { | 10 namespace win { |
(...skipping 22 matching lines...) Expand all Loading... |
33 // Remove the CHECK statements here and below and replace them with logs | 33 // Remove the CHECK statements here and below and replace them with logs |
34 // when this code stabilizes. | 34 // when this code stabilizes. |
35 HRESULT hr = manager_.CreateInstance(CLSID_DirectManipulationManager, | 35 HRESULT hr = manager_.CreateInstance(CLSID_DirectManipulationManager, |
36 nullptr, CLSCTX_INPROC_SERVER); | 36 nullptr, CLSCTX_INPROC_SERVER); |
37 CHECK(SUCCEEDED(hr)); | 37 CHECK(SUCCEEDED(hr)); |
38 | 38 |
39 hr = compositor_.CreateInstance(CLSID_DCompManipulationCompositor, | 39 hr = compositor_.CreateInstance(CLSID_DCompManipulationCompositor, |
40 nullptr, CLSCTX_INPROC_SERVER); | 40 nullptr, CLSCTX_INPROC_SERVER); |
41 CHECK(SUCCEEDED(hr)); | 41 CHECK(SUCCEEDED(hr)); |
42 | 42 |
43 hr = manager_->GetUpdateManager(IID_PPV_ARGS(update_manager_.Receive())); | 43 hr = manager_->GetUpdateManager(IID_PPV_ARGS(update_manager_.GetAddressOf())); |
44 CHECK(SUCCEEDED(hr)); | 44 CHECK(SUCCEEDED(hr)); |
45 | 45 |
46 hr = compositor_->SetUpdateManager(update_manager_.Get()); | 46 hr = compositor_->SetUpdateManager(update_manager_.Get()); |
47 CHECK(SUCCEEDED(hr)); | 47 CHECK(SUCCEEDED(hr)); |
48 | 48 |
49 hr = frame_info_.QueryFrom(compositor_.Get()); | 49 hr = frame_info_.QueryFrom(compositor_.Get()); |
50 CHECK(SUCCEEDED(hr)); | 50 CHECK(SUCCEEDED(hr)); |
51 | 51 |
52 hr = manager_->CreateViewport(frame_info_.Get(), window, | 52 hr = manager_->CreateViewport(frame_info_.Get(), window, |
53 IID_PPV_ARGS(view_port_outer_.Receive())); | 53 IID_PPV_ARGS(view_port_outer_.GetAddressOf())); |
54 CHECK(SUCCEEDED(hr)); | 54 CHECK(SUCCEEDED(hr)); |
55 | 55 |
56 // | 56 // |
57 // Enable the desired configuration for each viewport. | 57 // Enable the desired configuration for each viewport. |
58 // | 58 // |
59 DIRECTMANIPULATION_CONFIGURATION configuration = | 59 DIRECTMANIPULATION_CONFIGURATION configuration = |
60 DIRECTMANIPULATION_CONFIGURATION_INTERACTION | 60 DIRECTMANIPULATION_CONFIGURATION_INTERACTION |
61 | DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_X | 61 | DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_X |
62 | DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_Y | 62 | DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_Y |
63 | DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_INERTIA | 63 | DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_INERTIA |
64 | DIRECTMANIPULATION_CONFIGURATION_RAILS_X | 64 | DIRECTMANIPULATION_CONFIGURATION_RAILS_X |
65 | DIRECTMANIPULATION_CONFIGURATION_RAILS_Y | 65 | DIRECTMANIPULATION_CONFIGURATION_RAILS_Y |
66 | DIRECTMANIPULATION_CONFIGURATION_SCALING | 66 | DIRECTMANIPULATION_CONFIGURATION_SCALING |
67 | DIRECTMANIPULATION_CONFIGURATION_SCALING_INERTIA; | 67 | DIRECTMANIPULATION_CONFIGURATION_SCALING_INERTIA; |
68 | 68 |
69 hr = view_port_outer_->ActivateConfiguration(configuration); | 69 hr = view_port_outer_->ActivateConfiguration(configuration); |
70 CHECK(SUCCEEDED(hr)); | 70 CHECK(SUCCEEDED(hr)); |
71 } | 71 } |
72 | 72 |
73 void DirectManipulationHelper::SetBounds(const gfx::Rect& bounds) { | 73 void DirectManipulationHelper::SetBounds(const gfx::Rect& bounds) { |
74 base::win::ScopedComPtr<IDirectManipulationPrimaryContent> | 74 base::win::ScopedComPtr<IDirectManipulationPrimaryContent> |
75 primary_content_outer; | 75 primary_content_outer; |
76 HRESULT hr = view_port_outer_->GetPrimaryContent( | 76 HRESULT hr = view_port_outer_->GetPrimaryContent( |
77 IID_PPV_ARGS(primary_content_outer.Receive())); | 77 IID_PPV_ARGS(primary_content_outer.GetAddressOf())); |
78 CHECK(SUCCEEDED(hr)); | 78 CHECK(SUCCEEDED(hr)); |
79 | 79 |
80 base::win::ScopedComPtr<IDirectManipulationContent> content_outer; | 80 base::win::ScopedComPtr<IDirectManipulationContent> content_outer; |
81 hr = content_outer.QueryFrom(primary_content_outer.Get()); | 81 hr = content_outer.QueryFrom(primary_content_outer.Get()); |
82 CHECK(SUCCEEDED(hr)); | 82 CHECK(SUCCEEDED(hr)); |
83 | 83 |
84 RECT rect = bounds.ToRECT(); | 84 RECT rect = bounds.ToRECT(); |
85 | 85 |
86 hr = view_port_outer_->SetViewportRect(&rect); | 86 hr = view_port_outer_->SetViewportRect(&rect); |
87 CHECK(SUCCEEDED(hr)); | 87 CHECK(SUCCEEDED(hr)); |
(...skipping 19 matching lines...) Expand all Loading... |
107 HRESULT hr = view_port_outer_->SetContact(DIRECTMANIPULATION_MOUSEFOCUS); | 107 HRESULT hr = view_port_outer_->SetContact(DIRECTMANIPULATION_MOUSEFOCUS); |
108 if (SUCCEEDED(hr)) { | 108 if (SUCCEEDED(hr)) { |
109 BOOL handled = FALSE; | 109 BOOL handled = FALSE; |
110 manager_->ProcessInput(&msg, &handled); | 110 manager_->ProcessInput(&msg, &handled); |
111 view_port_outer_->ReleaseContact(DIRECTMANIPULATION_MOUSEFOCUS); | 111 view_port_outer_->ReleaseContact(DIRECTMANIPULATION_MOUSEFOCUS); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 } // namespace win. | 115 } // namespace win. |
116 } // namespace gfx. | 116 } // namespace gfx. |
OLD | NEW |