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 28 matching lines...) Expand all Loading... |
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_.GetAddressOf())); | 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 = compositor_.CopyTo(frame_info_.GetAddressOf()); |
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_.GetAddressOf())); | 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 = |
(...skipping 11 matching lines...) Expand all Loading... |
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.GetAddressOf())); | 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 = primary_content_outer.CopyTo(content_outer.GetAddressOf()); |
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)); |
88 | 88 |
89 hr = content_outer->SetContentRect(&rect); | 89 hr = content_outer->SetContentRect(&rect); |
90 CHECK(SUCCEEDED(hr)); | 90 CHECK(SUCCEEDED(hr)); |
91 } | 91 } |
(...skipping 15 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 |