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/coordinate_conversion.h" |
12 #include "ash/wm/system_modal_container_layout_manager.h" | 12 #include "ash/wm/system_modal_container_layout_manager.h" |
13 #include "ash/wm/window_properties.h" | 13 #include "ash/wm/window_properties.h" |
14 #include "ash/wm/window_state.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/focus_client.h" | 17 #include "ui/aura/client/focus_client.h" |
17 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
18 #include "ui/aura/window_tracker.h" | 19 #include "ui/aura/window_tracker.h" |
19 #include "ui/compositor/dip_util.h" | 20 #include "ui/compositor/dip_util.h" |
20 #include "ui/gfx/display.h" | 21 #include "ui/gfx/display.h" |
21 #include "ui/gfx/screen.h" | 22 #include "ui/gfx/screen.h" |
22 #include "ui/views/corewm/window_util.h" | 23 #include "ui/views/corewm/window_util.h" |
23 | 24 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 aura::client::ActivationClient* activation_client = | 187 aura::client::ActivationClient* activation_client = |
187 aura::client::GetActivationClient(window->GetRootWindow()); | 188 aura::client::GetActivationClient(window->GetRootWindow()); |
188 aura::Window* active = activation_client->GetActiveWindow(); | 189 aura::Window* active = activation_client->GetActiveWindow(); |
189 | 190 |
190 aura::WindowTracker tracker; | 191 aura::WindowTracker tracker; |
191 if (focused) | 192 if (focused) |
192 tracker.Add(focused); | 193 tracker.Add(focused); |
193 if (active && focused != active) | 194 if (active && focused != active) |
194 tracker.Add(active); | 195 tracker.Add(active); |
195 | 196 |
197 window->parent()->RemoveChild(window); | |
oshima
2014/01/10 04:54:02
I had to remove this because this was causing prob
varkha
2014/01/10 05:44:02
Still lgtm.
| |
198 | |
199 // Set new bounds now so that the container's layout manager | |
200 // can adjust the bounds if necessary. | |
201 gfx::Point origin = bounds.origin(); | |
202 const gfx::Point display_origin = display.bounds().origin(); | |
203 origin.Offset(-display_origin.x(), -display_origin.y()); | |
204 gfx::Rect new_bounds = gfx::Rect(origin, bounds.size()); | |
205 | |
206 window->SetBounds(new_bounds); | |
207 | |
196 dst_container->AddChild(window); | 208 dst_container->AddChild(window); |
197 | 209 |
198 MoveAllTransientChildrenToNewRoot(display, window); | 210 MoveAllTransientChildrenToNewRoot(display, window); |
199 | 211 |
200 // Restore focused/active window. | 212 // Restore focused/active window. |
201 if (tracker.Contains(focused)) { | 213 if (tracker.Contains(focused)) { |
202 aura::client::GetFocusClient(window)->FocusWindow(focused); | 214 aura::client::GetFocusClient(window)->FocusWindow(focused); |
203 // TODO(beng): replace with GetRootWindow(). | 215 // TODO(beng): replace with GetRootWindow(). |
204 ash::Shell::GetInstance()->set_target_root_window( | 216 ash::Shell::GetInstance()->set_target_root_window( |
205 focused->GetRootWindow()); | 217 focused->GetRootWindow()); |
206 } else if (tracker.Contains(active)) { | 218 } else if (tracker.Contains(active)) { |
207 activation_client->ActivateWindow(active); | 219 activation_client->ActivateWindow(active); |
208 } | 220 } |
221 // TODO(oshima): We should not have to update the bounds again | |
222 // below in theory, but we currently do need as there is a code | |
223 // that assumes that the bounds will never be overridden by the | |
224 // layout mananger. We should have more explicit control how | |
225 // constraints are applied by the layout manager. | |
209 } | 226 } |
210 } | 227 } |
211 | |
212 gfx::Point origin(bounds.origin()); | 228 gfx::Point origin(bounds.origin()); |
213 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( | 229 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( |
214 window).bounds().origin(); | 230 window).bounds().origin(); |
215 origin.Offset(-display_origin.x(), -display_origin.y()); | 231 origin.Offset(-display_origin.x(), -display_origin.y()); |
216 window->SetBounds(gfx::Rect(origin, bounds.size())); | 232 window->SetBounds(gfx::Rect(origin, bounds.size())); |
217 } | 233 } |
218 | 234 |
219 } // internal | 235 } // internal |
220 } // ash | 236 } // ash |
OLD | NEW |