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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 aura::client::ActivationClient* activation_client = | 185 aura::client::ActivationClient* activation_client = |
186 aura::client::GetActivationClient(window->GetRootWindow()); | 186 aura::client::GetActivationClient(window->GetRootWindow()); |
187 aura::Window* active = activation_client->GetActiveWindow(); | 187 aura::Window* active = activation_client->GetActiveWindow(); |
188 | 188 |
189 aura::WindowTracker tracker; | 189 aura::WindowTracker tracker; |
190 if (focused) | 190 if (focused) |
191 tracker.Add(focused); | 191 tracker.Add(focused); |
192 if (active && focused != active) | 192 if (active && focused != active) |
193 tracker.Add(active); | 193 tracker.Add(active); |
194 | 194 |
195 // Adjust the bounds before reparenting since the bounds may be taken | |
196 // into consideration to ensure window visibility when it gets added | |
197 // to layout. | |
198 if (window->type() != aura::client::WINDOW_TYPE_POPUP) { | |
199 gfx::Point origin(bounds.origin()); | |
200 const gfx::Point display_origin = | |
201 Shell::GetScreen()->GetDisplayNearestWindow( | |
202 dst_container).bounds().origin(); | |
203 origin.Offset(-display_origin.x(), -display_origin.y()); | |
204 gfx::Rect new_bounds(gfx::Rect(origin, bounds.size())); | |
205 window->SetBounds(new_bounds); | |
206 } | |
flackr
2013/11/01 16:52:28
This doesn't look related to simply enabling docke
varkha
2013/11/05 20:34:23
Done. https://codereview.chromium.org/57963003/
| |
195 dst_container->AddChild(window); | 207 dst_container->AddChild(window); |
196 | 208 |
197 MoveAllTransientChildrenToNewRoot(display, window); | 209 MoveAllTransientChildrenToNewRoot(display, window); |
198 | 210 |
199 // Restore focused/active window. | 211 // Restore focused/active window. |
200 if (tracker.Contains(focused)) { | 212 if (tracker.Contains(focused)) { |
201 aura::client::GetFocusClient(window)->FocusWindow(focused); | 213 aura::client::GetFocusClient(window)->FocusWindow(focused); |
202 // TODO(beng): replace with GetRootWindow(). | 214 // TODO(beng): replace with GetRootWindow(). |
203 ash::Shell::GetInstance()->set_target_root_window( | 215 ash::Shell::GetInstance()->set_target_root_window( |
204 focused->GetDispatcher()); | 216 focused->GetDispatcher()); |
205 } else if (tracker.Contains(active)) { | 217 } else if (tracker.Contains(active)) { |
206 activation_client->ActivateWindow(active); | 218 activation_client->ActivateWindow(active); |
207 } | 219 } |
220 if (window->type() != aura::client::WINDOW_TYPE_POPUP) | |
221 return; | |
208 } | 222 } |
209 } | 223 } |
210 | 224 |
211 gfx::Point origin(bounds.origin()); | 225 gfx::Point origin(bounds.origin()); |
212 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( | 226 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( |
213 window).bounds().origin(); | 227 window).bounds().origin(); |
214 origin.Offset(-display_origin.x(), -display_origin.y()); | 228 origin.Offset(-display_origin.x(), -display_origin.y()); |
215 window->SetBounds(gfx::Rect(origin, bounds.size())); | 229 window->SetBounds(gfx::Rect(origin, bounds.size())); |
216 } | 230 } |
217 | 231 |
218 } // internal | 232 } // internal |
219 } // ash | 233 } // ash |
OLD | NEW |