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

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

Issue 153893005: Makes it easier to snap or dock windows near the edges when using touch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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
« no previous file with comments | « ash/wm/workspace/snap_sizer.h ('k') | ash/wm/workspace/workspace_window_resizer.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/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_util.h" 10 #include "ash/screen_util.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 const gfx::Rect& snap_bounds) { 127 const gfx::Rect& snap_bounds) {
128 if (edge == SnapSizer::LEFT_EDGE) { 128 if (edge == SnapSizer::LEFT_EDGE) {
129 window_state->SnapLeft(snap_bounds); 129 window_state->SnapLeft(snap_bounds);
130 } else { 130 } else {
131 window_state->SnapRight(snap_bounds); 131 window_state->SnapRight(snap_bounds);
132 } 132 }
133 } 133 }
134 134
135 } // namespace 135 } // namespace
136 136
137 // static
138 const int SnapSizer::kScreenEdgeInsetForTouchDrag = 32;
139
137 SnapSizer::SnapSizer(wm::WindowState* window_state, 140 SnapSizer::SnapSizer(wm::WindowState* window_state,
138 const gfx::Point& start, 141 const gfx::Point& start,
139 Edge edge, 142 Edge edge,
140 InputType input_type) 143 InputType input_type)
141 : window_state_(window_state), 144 : window_state_(window_state),
142 edge_(edge), 145 edge_(edge),
143 time_last_update_(base::TimeTicks::Now()), 146 time_last_update_(base::TimeTicks::Now()),
144 size_index_(0), 147 size_index_(0),
145 end_of_sequence_(false), 148 end_of_sequence_(false),
146 resize_disabled_(false), 149 resize_disabled_(false),
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 last_adjust_x_ = x; 281 last_adjust_x_ = x;
279 } 282 }
280 283
281 gfx::Rect SnapSizer::GetTargetBounds() const { 284 gfx::Rect SnapSizer::GetTargetBounds() const {
282 return GetTargetBoundsForSize(size_index_); 285 return GetTargetBoundsForSize(size_index_);
283 } 286 }
284 287
285 bool SnapSizer::AlongEdge(int x) const { 288 bool SnapSizer::AlongEdge(int x) const {
286 gfx::Rect area(ScreenUtil::GetDisplayWorkAreaBoundsInParent( 289 gfx::Rect area(ScreenUtil::GetDisplayWorkAreaBoundsInParent(
287 window_state_->window())); 290 window_state_->window()));
288 return (x <= area.x()) || (x >= area.right() - 1); 291 int inset =
292 input_type_ == TOUCH_DRAG_INPUT ? kScreenEdgeInsetForTouchDrag : 0;
293 return (x <= area.x() + inset) || (x >= area.right() - 1 - inset);
289 } 294 }
290 295
291 } // namespace internal 296 } // namespace internal
292 } // namespace ash 297 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/snap_sizer.h ('k') | ash/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698