| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 } // namespace | 55 } // namespace |
| 56 | 56 |
| 57 namespace internal { | 57 namespace internal { |
| 58 | 58 |
| 59 void ScreenPositionController::ConvertPointToScreen( | 59 void ScreenPositionController::ConvertPointToScreen( |
| 60 const aura::Window* window, | 60 const aura::Window* window, |
| 61 gfx::Point* point) { | 61 gfx::Point* point) { |
| 62 const aura::RootWindow* root = window->GetRootWindow(); | 62 const aura::RootWindow* root = window->GetRootWindow(); |
| 63 aura::Window::ConvertPointToTarget(window, root, point); | 63 aura::Window::ConvertPointToTarget(window, root, point); |
| 64 const gfx::Point display_origin = | 64 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( |
| 65 gfx::Screen::GetDisplayNearestWindow( | 65 const_cast<aura::RootWindow*>(root)).bounds().origin(); |
| 66 const_cast<aura::RootWindow*>(root)).bounds().origin(); | |
| 67 point->Offset(display_origin.x(), display_origin.y()); | 66 point->Offset(display_origin.x(), display_origin.y()); |
| 68 } | 67 } |
| 69 | 68 |
| 70 void ScreenPositionController::ConvertPointFromScreen( | 69 void ScreenPositionController::ConvertPointFromScreen( |
| 71 const aura::Window* window, | 70 const aura::Window* window, |
| 72 gfx::Point* point) { | 71 gfx::Point* point) { |
| 73 const aura::RootWindow* root = window->GetRootWindow(); | 72 const aura::RootWindow* root = window->GetRootWindow(); |
| 74 const gfx::Point display_origin = | 73 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( |
| 75 gfx::Screen::GetDisplayNearestWindow( | 74 const_cast<aura::RootWindow*>(root)).bounds().origin(); |
| 76 const_cast<aura::RootWindow*>(root)).bounds().origin(); | |
| 77 point->Offset(-display_origin.x(), -display_origin.y()); | 75 point->Offset(-display_origin.x(), -display_origin.y()); |
| 78 aura::Window::ConvertPointToTarget(root, window, point); | 76 aura::Window::ConvertPointToTarget(root, window, point); |
| 79 } | 77 } |
| 80 | 78 |
| 81 void ScreenPositionController::ConvertNativePointToScreen( | 79 void ScreenPositionController::ConvertNativePointToScreen( |
| 82 aura::Window* window, | 80 aura::Window* window, |
| 83 gfx::Point* point) { | 81 gfx::Point* point) { |
| 84 std::pair<aura::RootWindow*, gfx::Point> pair = | 82 std::pair<aura::RootWindow*, gfx::Point> pair = |
| 85 wm::GetRootWindowRelativeToWindow( | 83 wm::GetRootWindowRelativeToWindow( |
| 86 window, | 84 window, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 141 |
| 144 // Restore focused/active window. | 142 // Restore focused/active window. |
| 145 if (tracker.Contains(focused)) | 143 if (tracker.Contains(focused)) |
| 146 window->GetFocusManager()->SetFocusedWindow(focused, NULL); | 144 window->GetFocusManager()->SetFocusedWindow(focused, NULL); |
| 147 else if (tracker.Contains(active)) | 145 else if (tracker.Contains(active)) |
| 148 activation_client->ActivateWindow(active); | 146 activation_client->ActivateWindow(active); |
| 149 } | 147 } |
| 150 } | 148 } |
| 151 | 149 |
| 152 gfx::Point origin(bounds.origin()); | 150 gfx::Point origin(bounds.origin()); |
| 153 const gfx::Point display_origin = | 151 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( |
| 154 gfx::Screen::GetDisplayNearestWindow(window).bounds().origin(); | 152 window).bounds().origin(); |
| 155 origin.Offset(-display_origin.x(), -display_origin.y()); | 153 origin.Offset(-display_origin.x(), -display_origin.y()); |
| 156 window->SetBounds(gfx::Rect(origin, bounds.size())); | 154 window->SetBounds(gfx::Rect(origin, bounds.size())); |
| 157 } | 155 } |
| 158 | 156 |
| 159 } // internal | 157 } // internal |
| 160 } // ash | 158 } // ash |
| OLD | NEW |