| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // the same root window even if the bounds is outside of the display. | 155 // the same root window even if the bounds is outside of the display. |
| 156 if (!window->transient_parent() && | 156 if (!window->transient_parent() && |
| 157 !window->GetProperty(internal::kStayInSameRootWindowKey)) { | 157 !window->GetProperty(internal::kStayInSameRootWindowKey)) { |
| 158 aura::RootWindow* dst_root = | 158 aura::RootWindow* dst_root = |
| 159 Shell::GetInstance()->display_controller()->GetRootWindowForDisplayId( | 159 Shell::GetInstance()->display_controller()->GetRootWindowForDisplayId( |
| 160 display.id()); | 160 display.id()); |
| 161 DCHECK(dst_root); | 161 DCHECK(dst_root); |
| 162 aura::Window* dst_container = NULL; | 162 aura::Window* dst_container = NULL; |
| 163 if (dst_root != window->GetRootWindow()) { | 163 if (dst_root != window->GetRootWindow()) { |
| 164 int container_id = window->parent()->id(); | 164 int container_id = window->parent()->id(); |
| 165 // Dragging a docked window to another root window should show it floating |
| 166 // rather than docked in another screen's dock. |
| 167 if (container_id == kShellWindowId_DockContainer) |
| 168 container_id = kShellWindowId_WorkspaceContainer; |
| 165 // All containers that uses screen coordinates must have valid window ids. | 169 // All containers that uses screen coordinates must have valid window ids. |
| 166 DCHECK_GE(container_id, 0); | 170 DCHECK_GE(container_id, 0); |
| 167 // Don't move modal background. | 171 // Don't move modal background. |
| 168 if (!SystemModalContainerLayoutManager::IsModalBackground(window)) | 172 if (!SystemModalContainerLayoutManager::IsModalBackground(window)) |
| 169 dst_container = Shell::GetContainer(dst_root, container_id); | 173 dst_container = Shell::GetContainer(dst_root, container_id); |
| 170 } | 174 } |
| 171 | 175 |
| 172 if (dst_container && window->parent() != dst_container) { | 176 if (dst_container && window->parent() != dst_container) { |
| 173 aura::Window* focused = aura::client::GetFocusClient(window)-> | 177 aura::Window* focused = aura::client::GetFocusClient(window)-> |
| 174 GetFocusedWindow(); | 178 GetFocusedWindow(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 203 | 207 |
| 204 gfx::Point origin(bounds.origin()); | 208 gfx::Point origin(bounds.origin()); |
| 205 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( | 209 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( |
| 206 window).bounds().origin(); | 210 window).bounds().origin(); |
| 207 origin.Offset(-display_origin.x(), -display_origin.y()); | 211 origin.Offset(-display_origin.x(), -display_origin.y()); |
| 208 window->SetBounds(gfx::Rect(origin, bounds.size())); | 212 window->SetBounds(gfx::Rect(origin, bounds.size())); |
| 209 } | 213 } |
| 210 | 214 |
| 211 } // internal | 215 } // internal |
| 212 } // ash | 216 } // ash |
| OLD | NEW |