| 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" |
| 11 #include "ash/wm/coordinate_conversion.h" |
| 11 #include "ash/wm/system_modal_container_layout_manager.h" | 12 #include "ash/wm/system_modal_container_layout_manager.h" |
| 12 #include "ash/wm/window_properties.h" | 13 #include "ash/wm/window_properties.h" |
| 13 #include "ash/wm/workspace_controller.h" | 14 #include "ash/wm/workspace_controller.h" |
| 14 #include "ui/aura/client/activation_client.h" | 15 #include "ui/aura/client/activation_client.h" |
| 15 #include "ui/aura/client/capture_client.h" | 16 #include "ui/aura/client/capture_client.h" |
| 16 #include "ui/aura/client/stacking_client.h" | 17 #include "ui/aura/client/stacking_client.h" |
| 17 #include "ui/aura/focus_manager.h" | 18 #include "ui/aura/focus_manager.h" |
| 18 #include "ui/aura/root_window.h" | 19 #include "ui/aura/root_window.h" |
| 19 #include "ui/aura/window_tracker.h" | 20 #include "ui/aura/window_tracker.h" |
| 20 #include "ui/gfx/display.h" | 21 #include "ui/gfx/display.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 const aura::Window* window, | 70 const aura::Window* window, |
| 70 gfx::Point* point) { | 71 gfx::Point* point) { |
| 71 const aura::RootWindow* root = window->GetRootWindow(); | 72 const aura::RootWindow* root = window->GetRootWindow(); |
| 72 const gfx::Point display_origin = | 73 const gfx::Point display_origin = |
| 73 gfx::Screen::GetDisplayNearestWindow( | 74 gfx::Screen::GetDisplayNearestWindow( |
| 74 const_cast<aura::RootWindow*>(root)).bounds().origin(); | 75 const_cast<aura::RootWindow*>(root)).bounds().origin(); |
| 75 point->Offset(-display_origin.x(), -display_origin.y()); | 76 point->Offset(-display_origin.x(), -display_origin.y()); |
| 76 aura::Window::ConvertPointToTarget(root, window, point); | 77 aura::Window::ConvertPointToTarget(root, window, point); |
| 77 } | 78 } |
| 78 | 79 |
| 80 void ScreenPositionController::ConvertNativePointToScreen( |
| 81 aura::Window* window, |
| 82 gfx::Point* point) { |
| 83 std::pair<aura::RootWindow*, gfx::Point> pair = |
| 84 wm::GetRootWindowRelativeToWindow(window, *point); |
| 85 *point = pair.second; |
| 86 ConvertPointToScreen(pair.first, point); |
| 87 } |
| 88 |
| 79 void ScreenPositionController::SetBounds(aura::Window* window, | 89 void ScreenPositionController::SetBounds(aura::Window* window, |
| 80 const gfx::Rect& bounds, | 90 const gfx::Rect& bounds, |
| 81 const gfx::Display& display) { | 91 const gfx::Display& display) { |
| 82 DCHECK_NE(-1, display.id()); | 92 DCHECK_NE(-1, display.id()); |
| 83 if (!window->parent()->GetProperty(internal::kUsesScreenCoordinatesKey)) { | 93 if (!window->parent()->GetProperty(internal::kUsesScreenCoordinatesKey)) { |
| 84 window->SetBounds(bounds); | 94 window->SetBounds(bounds); |
| 85 return; | 95 return; |
| 86 } | 96 } |
| 87 | 97 |
| 88 // Don't move a transient windows to other root window. | 98 // Don't move a transient windows to other root window. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 144 |
| 135 gfx::Point origin(bounds.origin()); | 145 gfx::Point origin(bounds.origin()); |
| 136 const gfx::Point display_origin = | 146 const gfx::Point display_origin = |
| 137 gfx::Screen::GetDisplayNearestWindow(window).bounds().origin(); | 147 gfx::Screen::GetDisplayNearestWindow(window).bounds().origin(); |
| 138 origin.Offset(-display_origin.x(), -display_origin.y()); | 148 origin.Offset(-display_origin.x(), -display_origin.y()); |
| 139 window->SetBounds(gfx::Rect(origin, bounds.size())); | 149 window->SetBounds(gfx::Rect(origin, bounds.size())); |
| 140 } | 150 } |
| 141 | 151 |
| 142 } // internal | 152 } // internal |
| 143 } // ash | 153 } // ash |
| OLD | NEW |