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/display/screen_position_controller.h" | 5 #include "ash/display/screen_position_controller.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // (Remember that in the native X11 world, the two root windows | 85 // (Remember that in the native X11 world, the two root windows |
86 // are always stacked vertically regardless of the display | 86 // are always stacked vertically regardless of the display |
87 // layout in Ash). We need to figure out that (0, 1123) in the | 87 // layout in Ash). We need to figure out that (0, 1123) in the |
88 // primary root window's coordinates is actually (0, 123) in the | 88 // primary root window's coordinates is actually (0, 123) in the |
89 // extended root window's coordinates. | 89 // extended root window's coordinates. |
90 | 90 |
91 gfx::Point location_in_native(location_in_root); | 91 gfx::Point location_in_native(location_in_root); |
92 root_window->GetDispatcher()->ConvertPointToNativeScreen( | 92 root_window->GetDispatcher()->ConvertPointToNativeScreen( |
93 &location_in_native); | 93 &location_in_native); |
94 | 94 |
95 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 95 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
96 for (size_t i = 0; i < root_windows.size(); ++i) { | 96 for (size_t i = 0; i < root_windows.size(); ++i) { |
97 aura::WindowEventDispatcher* dispatcher = | |
98 root_windows[i]->GetDispatcher(); | |
99 const gfx::Rect native_bounds( | 97 const gfx::Rect native_bounds( |
100 dispatcher->GetHostOrigin(), | 98 root_windows[i]->GetHostOrigin(), |
101 dispatcher->GetHostSize()); // in px. | 99 root_windows[i]->GetHostSize()); // in px. |
102 if (native_bounds.Contains(location_in_native)) { | 100 if (native_bounds.Contains(location_in_native)) { |
| 101 root_window = root_windows[i]; |
103 location_in_root = location_in_native; | 102 location_in_root = location_in_native; |
104 dispatcher->ConvertPointFromNativeScreen(&location_in_root); | 103 root_window->GetDispatcher()->ConvertPointFromNativeScreen( |
| 104 &location_in_root); |
105 break; | 105 break; |
106 } | 106 } |
107 } | 107 } |
108 } | 108 } |
109 #else | 109 #else |
110 // TODO(yusukes): Support non-X11 platforms if necessary. | 110 // TODO(yusukes): Support non-X11 platforms if necessary. |
111 #endif | 111 #endif |
112 | 112 |
113 return std::make_pair(root_window->GetDispatcher(), location_in_root); | 113 return std::make_pair(root_window->GetDispatcher(), location_in_root); |
114 } | 114 } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 210 |
211 gfx::Point origin(bounds.origin()); | 211 gfx::Point origin(bounds.origin()); |
212 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( | 212 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( |
213 window).bounds().origin(); | 213 window).bounds().origin(); |
214 origin.Offset(-display_origin.x(), -display_origin.y()); | 214 origin.Offset(-display_origin.x(), -display_origin.y()); |
215 window->SetBounds(gfx::Rect(origin, bounds.size())); | 215 window->SetBounds(gfx::Rect(origin, bounds.size())); |
216 } | 216 } |
217 | 217 |
218 } // internal | 218 } // internal |
219 } // ash | 219 } // ash |
OLD | NEW |