Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: remoting/host/input_injector_mac.cc

Issue 243943002: Fixed multi-monitor mouse coordinates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/input_injector.h" 5 #include "remoting/host/input_injector.h"
6 6
7 #include <ApplicationServices/ApplicationServices.h> 7 #include <ApplicationServices/ApplicationServices.h>
8 #include <Carbon/Carbon.h> 8 #include <Carbon/Carbon.h>
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 // Fetch the desktop configuration. 241 // Fetch the desktop configuration.
242 // TODO(wez): Optimize this out, or at least only enumerate displays in 242 // TODO(wez): Optimize this out, or at least only enumerate displays in
243 // response to display-changed events. VideoFrameCapturer's VideoFrames 243 // response to display-changed events. VideoFrameCapturer's VideoFrames
244 // could be augmented to include native cursor coordinates for use by 244 // could be augmented to include native cursor coordinates for use by
245 // MouseClampingFilter, removing the need for translation here. 245 // MouseClampingFilter, removing the need for translation here.
246 webrtc::MacDesktopConfiguration desktop_config = 246 webrtc::MacDesktopConfiguration desktop_config =
247 webrtc::MacDesktopConfiguration::GetCurrent( 247 webrtc::MacDesktopConfiguration::GetCurrent(
248 webrtc::MacDesktopConfiguration::TopLeftOrigin); 248 webrtc::MacDesktopConfiguration::TopLeftOrigin);
249 249
250 // Translate the mouse position into desktop coordinates. 250 // Translate the mouse position into desktop coordinates.
251 mouse_pos_.add(webrtc::DesktopVector(desktop_config.pixel_bounds.left(), 251 mouse_pos_ = mouse_pos_.add(
252 desktop_config.pixel_bounds.top())); 252 webrtc::DesktopVector(desktop_config.pixel_bounds.left(),
253 desktop_config.pixel_bounds.top()));
253 254
254 // Constrain the mouse position to the desktop coordinates. 255 // Constrain the mouse position to the desktop coordinates.
255 mouse_pos_.set( 256 mouse_pos_.set(
256 std::max(desktop_config.pixel_bounds.left(), 257 std::max(desktop_config.pixel_bounds.left(),
257 std::min(desktop_config.pixel_bounds.right(), mouse_pos_.x())), 258 std::min(desktop_config.pixel_bounds.right(), mouse_pos_.x())),
258 std::max(desktop_config.pixel_bounds.top(), 259 std::max(desktop_config.pixel_bounds.top(),
259 std::min(desktop_config.pixel_bounds.bottom(), mouse_pos_.y()))); 260 std::min(desktop_config.pixel_bounds.bottom(), mouse_pos_.y())));
260 261
261 // Convert from pixel to Density Independent Pixel coordinates. 262 // Convert from pixel to Density Independent Pixel coordinates.
262 mouse_pos_.set(mouse_pos_.x() / desktop_config.dip_to_pixel_scale, 263 mouse_pos_.set(mouse_pos_.x() / desktop_config.dip_to_pixel_scale,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 335
335 } // namespace 336 } // namespace
336 337
337 scoped_ptr<InputInjector> InputInjector::Create( 338 scoped_ptr<InputInjector> InputInjector::Create(
338 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 339 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
339 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { 340 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
340 return scoped_ptr<InputInjector>(new InputInjectorMac(main_task_runner)); 341 return scoped_ptr<InputInjector>(new InputInjectorMac(main_task_runner));
341 } 342 }
342 343
343 } // namespace remoting 344 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698