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 "ash/wm/coordinate_conversion.h" | 5 #include "ash/wm/coordinate_conversion.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ui/aura/client/screen_position_client.h" | 9 #include "ui/aura/client/screen_position_client.h" |
10 #include "ui/aura/root_window.h" | 10 #include "ui/aura/root_window.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 const gfx::Display& display = gfx::Screen::GetDisplayMatching(rect); | 28 const gfx::Display& display = gfx::Screen::GetDisplayMatching(rect); |
29 return Shell::GetInstance()->display_controller()-> | 29 return Shell::GetInstance()->display_controller()-> |
30 GetRootWindowForDisplayId(display.id()); | 30 GetRootWindowForDisplayId(display.id()); |
31 } | 31 } |
32 | 32 |
33 std::pair<aura::RootWindow*, gfx::Point> GetRootWindowRelativeToWindow( | 33 std::pair<aura::RootWindow*, gfx::Point> GetRootWindowRelativeToWindow( |
34 aura::Window* window, | 34 aura::Window* window, |
35 const gfx::Point& location) { | 35 const gfx::Point& location) { |
36 aura::RootWindow* root_window = window->GetRootWindow(); | 36 aura::RootWindow* root_window = window->GetRootWindow(); |
37 gfx::Point location_in_root(location); | 37 gfx::Point location_in_root(location); |
38 aura::Window::ConvertPointToWindow(window, root_window, &location_in_root); | 38 aura::Window::ConvertPointToTarget(window, root_window, &location_in_root); |
39 | 39 |
40 #if defined(USE_X11) | 40 #if defined(USE_X11) |
41 // This conversion is necessary for dealing with the "pointer warp" feature in | 41 // This conversion is necessary for dealing with the "pointer warp" feature in |
42 // ash/display/display_controller.cc. For example, if we have two displays, | 42 // ash/display/display_controller.cc. For example, if we have two displays, |
43 // say 1000x1000 (primary) and 500x500 (extended one on the right), and start | 43 // say 1000x1000 (primary) and 500x500 (extended one on the right), and start |
44 // dragging a window at (999, 123), and then move the pointer to the right, | 44 // dragging a window at (999, 123), and then move the pointer to the right, |
45 // the pointer suddenly warps to the extended display. The destination is | 45 // the pointer suddenly warps to the extended display. The destination is |
46 // (0, 123) in the secondary root window's coordinates, or (1000, 123) in the | 46 // (0, 123) in the secondary root window's coordinates, or (1000, 123) in the |
47 // screen coordinates. However, since the mouse is captured during drag, a | 47 // screen coordinates. However, since the mouse is captured during drag, a |
48 // weird LocatedEvent, something like (0, 1123) in the *primary* root window's | 48 // weird LocatedEvent, something like (0, 1123) in the *primary* root window's |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 | 83 |
84 void ConvertPointFromScreen(aura::Window* window, | 84 void ConvertPointFromScreen(aura::Window* window, |
85 gfx::Point* point_in_screen) { | 85 gfx::Point* point_in_screen) { |
86 aura::client::GetScreenPositionClient(window->GetRootWindow())-> | 86 aura::client::GetScreenPositionClient(window->GetRootWindow())-> |
87 ConvertPointFromScreen(window, point_in_screen); | 87 ConvertPointFromScreen(window, point_in_screen); |
88 } | 88 } |
89 | 89 |
90 } // namespace wm | 90 } // namespace wm |
91 } // namespace ash | 91 } // namespace ash |
OLD | NEW |