| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // the screen coordinates. However, since the mouse is captured | 82 // the screen coordinates. However, since the mouse is captured |
| 83 // by X during drag, a weird LocatedEvent, something like (0, 1123) | 83 // by X during drag, a weird LocatedEvent, something like (0, 1123) |
| 84 // in the *primary* root window's coordinates, is sent to Chrome | 84 // in the *primary* root window's coordinates, is sent to Chrome |
| 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()->host()->ConvertPointToNativeScreen( |
| 93 &location_in_native); | 93 &location_in_native); |
| 94 | 94 |
| 95 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 95 aura::Window::Windows 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 = | 97 aura::WindowEventDispatcher* dispatcher = |
| 98 root_windows[i]->GetDispatcher(); | 98 root_windows[i]->GetDispatcher(); |
| 99 const gfx::Rect native_bounds( | 99 const gfx::Rect native_bounds = dispatcher->host()->GetBounds(); |
| 100 dispatcher->GetHostOrigin(), | |
| 101 dispatcher->GetHostSize()); // in px. | |
| 102 if (native_bounds.Contains(location_in_native)) { | 100 if (native_bounds.Contains(location_in_native)) { |
| 103 root_window = root_windows[i]; | 101 root_window = root_windows[i]; |
| 104 location_in_root = location_in_native; | 102 location_in_root = location_in_native; |
| 105 dispatcher->ConvertPointFromNativeScreen(&location_in_root); | 103 dispatcher->host()->ConvertPointFromNativeScreen(&location_in_root); |
| 106 break; | 104 break; |
| 107 } | 105 } |
| 108 } | 106 } |
| 109 } | 107 } |
| 110 #else | 108 #else |
| 111 // TODO(yusukes): Support non-X11 platforms if necessary. | 109 // TODO(yusukes): Support non-X11 platforms if necessary. |
| 112 #endif | 110 #endif |
| 113 | 111 |
| 114 return std::make_pair(root_window, location_in_root); | 112 return std::make_pair(root_window, location_in_root); |
| 115 } | 113 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 209 |
| 212 gfx::Point origin(bounds.origin()); | 210 gfx::Point origin(bounds.origin()); |
| 213 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( | 211 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( |
| 214 window).bounds().origin(); | 212 window).bounds().origin(); |
| 215 origin.Offset(-display_origin.x(), -display_origin.y()); | 213 origin.Offset(-display_origin.x(), -display_origin.y()); |
| 216 window->SetBounds(gfx::Rect(origin, bounds.size())); | 214 window->SetBounds(gfx::Rect(origin, bounds.size())); |
| 217 } | 215 } |
| 218 | 216 |
| 219 } // internal | 217 } // internal |
| 220 } // ash | 218 } // ash |
| OLD | NEW |