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

Side by Side Diff: ash/wm/drag_window_resizer.cc

Issue 106303005: Fix AdjustBoundsToEnsureWindowVisibility to work with non primary display bounds (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
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/wm/drag_window_resizer.h" 5 #include "ash/wm/drag_window_resizer.h"
6 6
7 #include "ash/display/mouse_cursor_event_filter.h" 7 #include "ash/display/mouse_cursor_event_filter.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "ash/system/tray/system_tray.h" 11 #include "ash/system/tray/system_tray.h"
12 #include "ash/system/user/tray_user.h" 12 #include "ash/system/user/tray_user.h"
13 #include "ash/wm/coordinate_conversion.h" 13 #include "ash/wm/coordinate_conversion.h"
14 #include "ash/wm/drag_window_controller.h" 14 #include "ash/wm/drag_window_controller.h"
15 #include "ash/wm/window_state.h" 15 #include "ash/wm/window_state.h"
16 #include "ash/wm/window_util.h"
16 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
17 #include "ui/aura/client/aura_constants.h" 18 #include "ui/aura/client/aura_constants.h"
18 #include "ui/aura/env.h" 19 #include "ui/aura/env.h"
19 #include "ui/aura/root_window.h" 20 #include "ui/aura/root_window.h"
20 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
21 #include "ui/aura/window_delegate.h" 22 #include "ui/aura/window_delegate.h"
22 #include "ui/base/hit_test.h" 23 #include "ui/base/hit_test.h"
23 #include "ui/base/ui_base_types.h" 24 #include "ui/base/ui_base_types.h"
24 #include "ui/gfx/screen.h" 25 #include "ui/gfx/screen.h"
25 26
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 ScreenAsh::ConvertRectToScreen(GetTarget()->parent(), bounds); 142 ScreenAsh::ConvertRectToScreen(GetTarget()->parent(), bounds);
142 143
143 // Adjust the position so that the cursor is on the window. 144 // Adjust the position so that the cursor is on the window.
144 if (!dst_bounds.Contains(last_mouse_location_in_screen)) { 145 if (!dst_bounds.Contains(last_mouse_location_in_screen)) {
145 if (last_mouse_location_in_screen.x() < dst_bounds.x()) 146 if (last_mouse_location_in_screen.x() < dst_bounds.x())
146 dst_bounds.set_x(last_mouse_location_in_screen.x()); 147 dst_bounds.set_x(last_mouse_location_in_screen.x());
147 else if (last_mouse_location_in_screen.x() > dst_bounds.right()) 148 else if (last_mouse_location_in_screen.x() > dst_bounds.right())
148 dst_bounds.set_x( 149 dst_bounds.set_x(
149 last_mouse_location_in_screen.x() - dst_bounds.width()); 150 last_mouse_location_in_screen.x() - dst_bounds.width());
150 } 151 }
152 ash::wm::AdjustBoundsToEnsureMinimumWindowVisibility(
153 dst_display.bounds(), &dst_bounds);
154
151 GetTarget()->SetBoundsInScreen(dst_bounds, dst_display); 155 GetTarget()->SetBoundsInScreen(dst_bounds, dst_display);
152 } 156 }
153 } 157 }
154 158
155 void DragWindowResizer::RevertDrag() { 159 void DragWindowResizer::RevertDrag() {
156 next_window_resizer_->RevertDrag(); 160 next_window_resizer_->RevertDrag();
157 161
158 drag_window_controller_.reset(); 162 drag_window_controller_.reset();
159 GetTarget()->layer()->SetOpacity(details_.initial_opacity); 163 GetTarget()->layer()->SetOpacity(details_.initial_opacity);
160 } 164 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 if (!tray_user->TransferWindowToUser(details_.window)) { 292 if (!tray_user->TransferWindowToUser(details_.window)) {
289 GetTarget()->layer()->SetOpacity(old_opacity); 293 GetTarget()->layer()->SetOpacity(old_opacity);
290 return false; 294 return false;
291 } 295 }
292 RevertDrag(); 296 RevertDrag();
293 return true; 297 return true;
294 } 298 }
295 299
296 } // namespace internal 300 } // namespace internal
297 } // namespace ash 301 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698