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 "remoting/host/event_executor.h" | 5 #include "remoting/host/event_executor.h" |
6 | 6 |
7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
8 #include <Carbon/Carbon.h> | 8 #include <Carbon/Carbon.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 // Set the mouse position assuming single-monitor. | 187 // Set the mouse position assuming single-monitor. |
188 mouse_pos_ = SkIPoint::Make(event.x(), event.y()); | 188 mouse_pos_ = SkIPoint::Make(event.x(), event.y()); |
189 | 189 |
190 // Fetch the desktop configuration. | 190 // Fetch the desktop configuration. |
191 // TODO(wez): Optimize this out, or at least only enumerate displays in | 191 // TODO(wez): Optimize this out, or at least only enumerate displays in |
192 // response to display-changed events. VideoFrameCapturer's VideoFrames | 192 // response to display-changed events. VideoFrameCapturer's VideoFrames |
193 // could be augmented to include native cursor coordinates for use by | 193 // could be augmented to include native cursor coordinates for use by |
194 // MouseClampingFilter, removing the need for translation here. | 194 // MouseClampingFilter, removing the need for translation here. |
195 media::MacDesktopConfiguration desktop_config = | 195 media::MacDesktopConfiguration desktop_config = |
196 media::MacDesktopConfiguration::GetCurrent(); | 196 media::MacDesktopConfiguration::GetCurrent( |
| 197 media::MacDesktopConfiguration::TopLeftOrigin); |
197 | 198 |
198 // Translate the mouse position into desktop coordinates. | 199 // Translate the mouse position into desktop coordinates. |
199 mouse_pos_ += SkIPoint::Make(desktop_config.pixel_bounds.left(), | 200 mouse_pos_ += SkIPoint::Make(desktop_config.pixel_bounds.left(), |
200 desktop_config.pixel_bounds.top()); | 201 desktop_config.pixel_bounds.top()); |
201 | 202 |
202 // Convert from pixel to Density Independent Pixel coordinates. | 203 // Convert from pixel to Density Independent Pixel coordinates. |
203 mouse_pos_ = SkIPoint::Make( | 204 mouse_pos_ = SkIPoint::Make( |
204 SkScalarRound(mouse_pos_.x() / desktop_config.dip_to_pixel_scale), | 205 SkScalarRound(mouse_pos_.x() / desktop_config.dip_to_pixel_scale), |
205 SkScalarRound(mouse_pos_.y() / desktop_config.dip_to_pixel_scale)); | 206 SkScalarRound(mouse_pos_.y() / desktop_config.dip_to_pixel_scale)); |
206 | 207 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 280 |
280 } // namespace | 281 } // namespace |
281 | 282 |
282 scoped_ptr<EventExecutor> EventExecutor::Create( | 283 scoped_ptr<EventExecutor> EventExecutor::Create( |
283 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 284 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
284 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 285 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
285 return scoped_ptr<EventExecutor>(new EventExecutorMac(main_task_runner)); | 286 return scoped_ptr<EventExecutor>(new EventExecutorMac(main_task_runner)); |
286 } | 287 } |
287 | 288 |
288 } // namespace remoting | 289 } // namespace remoting |
OLD | NEW |