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

Side by Side Diff: ash/wm/workspace/workspace_window_resizer.cc

Issue 10918077: Adding proper dragging behavior for L/R maximized windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed. Created 8 years, 3 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
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/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
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());
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
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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 gfx::Rect layer_bounds = layer_->bounds(); 621 gfx::Rect layer_bounds = layer_->bounds();
616 layer_bounds.set_origin(gfx::Point(0, 0)); 622 layer_bounds.set_origin(gfx::Point(0, 0));
617 layer_->SetBounds(layer_bounds); 623 layer_->SetBounds(layer_bounds);
618 layer_->SetVisible(false); 624 layer_->SetVisible(false);
619 // Detach it from the current container. 625 // Detach it from the current container.
620 layer_->parent()->Remove(layer_); 626 layer_->parent()->Remove(layer_);
621 } 627 }
622 628
623 } // namespace internal 629 } // namespace internal
624 } // namespace ash 630 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698