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

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

Issue 68033003: Undocks window first before side-snapping bounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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
« ash/wm/window_state.cc ('K') | « ash/wm/window_state.cc ('k') | no next file » | 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/wm/workspace/snap_sizer.h" 5 #include "ash/wm/workspace/snap_sizer.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/screen_ash.h" 10 #include "ash/screen_ash.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 SnapSizer::~SnapSizer() { 160 SnapSizer::~SnapSizer() {
161 } 161 }
162 162
163 void SnapSizer::SnapWindow(wm::WindowState* window_state, 163 void SnapSizer::SnapWindow(wm::WindowState* window_state,
164 SnapSizer::Edge edge) { 164 SnapSizer::Edge edge) {
165 if (!window_state->CanSnap()) 165 if (!window_state->CanSnap())
166 return; 166 return;
167 internal::SnapSizer sizer(window_state, gfx::Point(), edge, 167 internal::SnapSizer sizer(window_state, gfx::Point(), edge,
168 internal::SnapSizer::OTHER_INPUT); 168 internal::SnapSizer::OTHER_INPUT);
169 window_state->SetWindowShowType(edge == LEFT_EDGE ?
170 wm::SHOW_TYPE_LEFT_SNAPPED : wm::SHOW_TYPE_RIGHT_SNAPPED);
169 SnapWindowToBounds(window_state, edge, 171 SnapWindowToBounds(window_state, edge,
170 sizer.GetSnapBounds(window_state->window()->bounds())); 172 sizer.GetSnapBounds(window_state->window()->bounds()));
171 } 173 }
172 174
173 void SnapSizer::SnapWindowToTargetBounds() { 175 void SnapSizer::SnapWindowToTargetBounds() {
176 window_state_->SetWindowShowType(edge_ == LEFT_EDGE ?
177 wm::SHOW_TYPE_LEFT_SNAPPED : wm::SHOW_TYPE_RIGHT_SNAPPED);
178 target_bounds_ = GetTargetBounds();
174 SnapWindowToBounds(window_state_, edge_, target_bounds()); 179 SnapWindowToBounds(window_state_, edge_, target_bounds());
175 } 180 }
176 181
177 void SnapSizer::Update(const gfx::Point& location) { 182 void SnapSizer::Update(const gfx::Point& location) {
178 // See description above for details on this behavior. 183 // See description above for details on this behavior.
179 num_moves_since_adjust_++; 184 num_moves_since_adjust_++;
180 if ((base::TimeTicks::Now() - time_last_update_).InMilliseconds() > 185 if ((base::TimeTicks::Now() - time_last_update_).InMilliseconds() >
181 kDelayBeforeIncreaseMS) { 186 kDelayBeforeIncreaseMS) {
182 ChangeBounds(location.x(), 187 ChangeBounds(location.x(),
183 CalculateIncrement(location.x(), last_update_x_)); 188 CalculateIncrement(location.x(), last_update_x_));
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } 291 }
287 292
288 bool SnapSizer::AlongEdge(int x) const { 293 bool SnapSizer::AlongEdge(int x) const {
289 gfx::Rect area(ScreenAsh::GetDisplayWorkAreaBoundsInParent( 294 gfx::Rect area(ScreenAsh::GetDisplayWorkAreaBoundsInParent(
290 window_state_->window())); 295 window_state_->window()));
291 return (x <= area.x()) || (x >= area.right() - 1); 296 return (x <= area.x()) || (x >= area.right() - 1);
292 } 297 }
293 298
294 } // namespace internal 299 } // namespace internal
295 } // namespace ash 300 } // namespace ash
OLDNEW
« ash/wm/window_state.cc ('K') | « ash/wm/window_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698