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/wm/workspace/workspace_window_resizer.h" | 5 #include "ash/wm/workspace/workspace_window_resizer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 // comments in wm::GetRootWindowRelativeToWindow() for details. | 117 // comments in wm::GetRootWindowRelativeToWindow() for details. |
118 | 118 |
119 int grid_size = event_flags & ui::EF_CONTROL_DOWN ? | 119 int grid_size = event_flags & ui::EF_CONTROL_DOWN ? |
120 0 : ash::Shell::GetInstance()->GetGridSize(); | 120 0 : ash::Shell::GetInstance()->GetGridSize(); |
121 gfx::Rect bounds = // in |window()->parent()|'s coordinates. | 121 gfx::Rect bounds = // in |window()->parent()|'s coordinates. |
122 CalculateBoundsForDrag(details_, location_in_parent, grid_size); | 122 CalculateBoundsForDrag(details_, location_in_parent, grid_size); |
123 | 123 |
124 if (wm::IsWindowNormal(window())) | 124 if (wm::IsWindowNormal(window())) |
125 AdjustBoundsForMainWindow(&bounds, grid_size); | 125 AdjustBoundsForMainWindow(&bounds, grid_size); |
126 if (bounds != window()->bounds()) { | 126 if (bounds != window()->bounds()) { |
127 if (!did_move_or_resize_) | 127 if (!did_move_or_resize_) { |
128 if (!details_.restore_bounds.IsEmpty()) | |
129 ClearRestoreBounds(window()); | |
sky
2012/09/06 19:45:11
Wait until the drag is complete before clearing th
Mr4D (OOO till 08-26)
2012/09/06 23:16:13
No. There is code which has special behavior when
| |
128 RestackWindows(); | 130 RestackWindows(); |
131 } | |
129 did_move_or_resize_ = true; | 132 did_move_or_resize_ = true; |
130 } | 133 } |
131 | 134 |
132 const bool in_original_root = (window()->GetRootWindow() == current_root); | 135 const bool in_original_root = (window()->GetRootWindow() == current_root); |
133 // Hide a phantom window for snapping if the cursor is in another root window. | 136 // Hide a phantom window for snapping if the cursor is in another root window. |
134 if (in_original_root) | 137 if (in_original_root) |
135 UpdateSnapPhantomWindow(location_in_parent, bounds, grid_size); | 138 UpdateSnapPhantomWindow(location_in_parent, bounds, grid_size); |
136 else | 139 else |
137 snap_phantom_window_controller_.reset(); | 140 snap_phantom_window_controller_.reset(); |
138 | 141 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 void WorkspaceWindowResizer::RevertDrag() { | 210 void WorkspaceWindowResizer::RevertDrag() { |
208 window()->layer()->SetOpacity(details_.initial_opacity); | 211 window()->layer()->SetOpacity(details_.initial_opacity); |
209 drag_phantom_window_controller_.reset(); | 212 drag_phantom_window_controller_.reset(); |
210 snap_phantom_window_controller_.reset(); | 213 snap_phantom_window_controller_.reset(); |
211 Shell::GetInstance()->mouse_cursor_filter()->HideSharedEdgeIndicator(); | 214 Shell::GetInstance()->mouse_cursor_filter()->HideSharedEdgeIndicator(); |
212 | 215 |
213 if (!did_move_or_resize_) | 216 if (!did_move_or_resize_) |
214 return; | 217 return; |
215 | 218 |
216 window()->SetBounds(details_.initial_bounds); | 219 window()->SetBounds(details_.initial_bounds); |
220 if (!details_.restore_bounds.IsEmpty()) | |
221 SetRestoreBoundsInScreen(details_.window, details_.restore_bounds); | |
222 | |
217 if (details_.window_component == HTRIGHT) { | 223 if (details_.window_component == HTRIGHT) { |
218 int last_x = details_.initial_bounds.right(); | 224 int last_x = details_.initial_bounds.right(); |
219 for (size_t i = 0; i < attached_windows_.size(); ++i) { | 225 for (size_t i = 0; i < attached_windows_.size(); ++i) { |
220 gfx::Rect bounds(attached_windows_[i]->bounds()); | 226 gfx::Rect bounds(attached_windows_[i]->bounds()); |
221 bounds.set_x(last_x); | 227 bounds.set_x(last_x); |
222 bounds.set_width(initial_size_[i]); | 228 bounds.set_width(initial_size_[i]); |
223 attached_windows_[i]->SetBounds(bounds); | 229 attached_windows_[i]->SetBounds(bounds); |
224 last_x = attached_windows_[i]->bounds().right(); | 230 last_x = attached_windows_[i]->bounds().right(); |
225 } | 231 } |
226 } else { | 232 } else { |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
611 gfx::Rect layer_bounds = layer_->bounds(); | 617 gfx::Rect layer_bounds = layer_->bounds(); |
612 layer_bounds.set_origin(gfx::Point(0, 0)); | 618 layer_bounds.set_origin(gfx::Point(0, 0)); |
613 layer_->SetBounds(layer_bounds); | 619 layer_->SetBounds(layer_bounds); |
614 layer_->SetVisible(false); | 620 layer_->SetVisible(false); |
615 // Detach it from the current container. | 621 // Detach it from the current container. |
616 layer_->parent()->Remove(layer_); | 622 layer_->parent()->Remove(layer_); |
617 } | 623 } |
618 | 624 |
619 } // namespace internal | 625 } // namespace internal |
620 } // namespace ash | 626 } // namespace ash |
OLD | NEW |