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

Side by Side Diff: ash/display/mirror_window_controller.cc

Issue 2648583003: Handle floating point coordinates from ozone to exosphere (Closed)
Patch Set: added F variant to screen position client. fixed exo tests. Created 3 years, 11 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
« no previous file with comments | « no previous file | ash/display/screen_position_controller.h » ('j') | components/exo/touch.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ash/display/mirror_window_controller.h" 5 #include "ash/display/mirror_window_controller.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #if defined(USE_X11) 9 #if defined(USE_X11)
10 #include <X11/extensions/XInput2.h> 10 #include <X11/extensions/XInput2.h>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 // ScreenPositionClient for mirroring windows. 50 // ScreenPositionClient for mirroring windows.
51 class MirroringScreenPositionClient 51 class MirroringScreenPositionClient
52 : public aura::client::ScreenPositionClient { 52 : public aura::client::ScreenPositionClient {
53 public: 53 public:
54 explicit MirroringScreenPositionClient(MirrorWindowController* controller) 54 explicit MirroringScreenPositionClient(MirrorWindowController* controller)
55 : controller_(controller) {} 55 : controller_(controller) {}
56 56
57 void ConvertPointToScreen(const aura::Window* window, 57 void ConvertPointToScreen(const aura::Window* window,
58 gfx::Point* point) override { 58 gfx::Point* point) override {
59 gfx::PointF point_f(*point);
60 ConvertPointToScreenF(window, &point_f);
61 *point = gfx::ToFlooredPoint(point_f);
62 }
63
64 void ConvertPointToScreenF(const aura::Window* window,
65 gfx::PointF* point) override {
59 const aura::Window* root = window->GetRootWindow(); 66 const aura::Window* root = window->GetRootWindow();
60 aura::Window::ConvertPointToTarget(window, root, point); 67 aura::Window::ConvertPointToTargetF(window, root, point);
61 const display::Display& display = 68 const display::Display& display =
62 controller_->GetDisplayForRootWindow(root); 69 controller_->GetDisplayForRootWindow(root);
63 const gfx::Point display_origin = display.bounds().origin(); 70 const gfx::Point display_origin = display.bounds().origin();
64 point->Offset(display_origin.x(), display_origin.y()); 71 point->Offset(display_origin.x(), display_origin.y());
65 } 72 }
66 73
67 void ConvertPointFromScreen(const aura::Window* window, 74 void ConvertPointFromScreen(const aura::Window* window,
68 gfx::Point* point) override { 75 gfx::Point* point) override {
76 gfx::PointF point_f(*point);
77 ConvertPointFromScreenF(window, &point_f);
78 *point = gfx::ToFlooredPoint(point_f);
79 }
80
81 void ConvertPointFromScreenF(const aura::Window* window,
82 gfx::PointF* point) override {
69 const aura::Window* root = window->GetRootWindow(); 83 const aura::Window* root = window->GetRootWindow();
70 const display::Display& display = 84 const display::Display& display =
71 controller_->GetDisplayForRootWindow(root); 85 controller_->GetDisplayForRootWindow(root);
72 const gfx::Point display_origin = display.bounds().origin(); 86 const gfx::Point display_origin = display.bounds().origin();
73 point->Offset(-display_origin.x(), -display_origin.y()); 87 point->Offset(-display_origin.x(), -display_origin.y());
74 aura::Window::ConvertPointToTarget(root, window, point); 88 aura::Window::ConvertPointToTargetF(root, window, point);
75 } 89 }
76 90
77 void ConvertHostPointToScreen(aura::Window* root_window, 91 void ConvertHostPointToScreen(aura::Window* root_window,
78 gfx::Point* point) override { 92 gfx::Point* point) override {
79 aura::Window* not_used; 93 aura::Window* not_used;
80 ScreenPositionController::ConvertHostPointToRelativeToRootWindow( 94 ScreenPositionController::ConvertHostPointToRelativeToRootWindow(
81 root_window, controller_->GetAllRootWindows(), point, &not_used); 95 root_window, controller_->GetAllRootWindows(), point, &not_used);
82 ConvertPointToScreen(root_window, point); 96 ConvertPointToScreen(root_window, point);
83 } 97 }
84 98
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 // EventProcessor may be accessed after this call if the mirroring window 388 // EventProcessor may be accessed after this call if the mirroring window
375 // was deleted as a result of input event (e.g. shortcut), so don't delete 389 // was deleted as a result of input event (e.g. shortcut), so don't delete
376 // now. 390 // now.
377 if (delay_host_deletion) 391 if (delay_host_deletion)
378 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, host_info); 392 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, host_info);
379 else 393 else
380 delete host_info; 394 delete host_info;
381 } 395 }
382 396
383 } // namespace ash 397 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/display/screen_position_controller.h » ('j') | components/exo/touch.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698