Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: ash/display/screen_position_controller.cc

Issue 106303005: Fix AdjustBoundsToEnsureWindowVisibility to work with non primary display bounds (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update bounds without removing Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/wm/dock/docked_window_layout_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Set new bounds now so that the container's layout manager
198 // can adjust the bounds if necessary.
199 gfx::Point origin = bounds.origin();
200 const gfx::Point display_origin = display.bounds().origin();
201 origin.Offset(-display_origin.x(), -display_origin.y());
202 gfx::Rect new_bounds = gfx::Rect(origin, bounds.size());
203
204 window->SetBounds(new_bounds);
205
196 dst_container->AddChild(window); 206 dst_container->AddChild(window);
197 207
198 MoveAllTransientChildrenToNewRoot(display, window); 208 MoveAllTransientChildrenToNewRoot(display, window);
199 209
200 // Restore focused/active window. 210 // Restore focused/active window.
201 if (tracker.Contains(focused)) { 211 if (tracker.Contains(focused)) {
202 aura::client::GetFocusClient(window)->FocusWindow(focused); 212 aura::client::GetFocusClient(window)->FocusWindow(focused);
203 // TODO(beng): replace with GetRootWindow(). 213 // TODO(beng): replace with GetRootWindow().
204 ash::Shell::GetInstance()->set_target_root_window( 214 ash::Shell::GetInstance()->set_target_root_window(
205 focused->GetRootWindow()); 215 focused->GetRootWindow());
206 } else if (tracker.Contains(active)) { 216 } else if (tracker.Contains(active)) {
207 activation_client->ActivateWindow(active); 217 activation_client->ActivateWindow(active);
208 } 218 }
219 // TODO(oshima): We should not have to update the bounds again
220 // below in theory, but we currently do need as there is a code
221 // that assumes that the bounds will never be overridden by the
222 // layout mananger. We should have more explicit control how
223 // constraints are applied by the layout manager.
209 } 224 }
210 } 225 }
211
212 gfx::Point origin(bounds.origin()); 226 gfx::Point origin(bounds.origin());
213 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( 227 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow(
214 window).bounds().origin(); 228 window).bounds().origin();
215 origin.Offset(-display_origin.x(), -display_origin.y()); 229 origin.Offset(-display_origin.x(), -display_origin.y());
216 window->SetBounds(gfx::Rect(origin, bounds.size())); 230 window->SetBounds(gfx::Rect(origin, bounds.size()));
217 } 231 }
218 232
219 } // internal 233 } // internal
220 } // ash 234 } // ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/dock/docked_window_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698