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

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

Issue 15008002: Make touch-resizing windows to screen edge possible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 7 years, 7 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 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 // static 225 // static
226 const int WorkspaceWindowResizer::kMinOnscreenSize = 20; 226 const int WorkspaceWindowResizer::kMinOnscreenSize = 20;
227 227
228 // static 228 // static
229 const int WorkspaceWindowResizer::kMinOnscreenHeight = 32; 229 const int WorkspaceWindowResizer::kMinOnscreenHeight = 32;
230 230
231 // static 231 // static
232 const int WorkspaceWindowResizer::kScreenEdgeInset = 8; 232 const int WorkspaceWindowResizer::kScreenEdgeInset = 8;
233 233
234 // static
235 const int WorkspaceWindowResizer::kScreenEdgeInsetForTouchResize = 16;
236
234 // Represents the width or height of a window with constraints on its minimum 237 // Represents the width or height of a window with constraints on its minimum
235 // and maximum size. 0 represents a lack of a constraint. 238 // and maximum size. 0 represents a lack of a constraint.
236 class WindowSize { 239 class WindowSize {
237 public: 240 public:
238 WindowSize(int size, int min, int max) 241 WindowSize(int size, int min, int max)
239 : size_(size), 242 : size_(size),
240 min_(min), 243 min_(min),
241 max_(max) { 244 max_(max) {
242 // Grow the min/max bounds to include the starting size. 245 // Grow the min/max bounds to include the starting size.
243 if (is_underflowing()) 246 if (is_underflowing())
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 int event_flags) { 323 int event_flags) {
321 last_mouse_location_ = location_in_parent; 324 last_mouse_location_ = location_in_parent;
322 325
323 int sticky_size; 326 int sticky_size;
324 if (event_flags & ui::EF_CONTROL_DOWN) { 327 if (event_flags & ui::EF_CONTROL_DOWN) {
325 sticky_size = 0; 328 sticky_size = 0;
326 } else if (CommandLine::ForCurrentProcess()->HasSwitch( 329 } else if (CommandLine::ForCurrentProcess()->HasSwitch(
327 switches::kAshEnableStickyEdges)) { 330 switches::kAshEnableStickyEdges)) {
328 sticky_size = kStickyDistancePixels; 331 sticky_size = kStickyDistancePixels;
329 } else { 332 } else {
330 sticky_size = kScreenEdgeInset; 333 if ((details_.bounds_change & kBoundsChange_Resizes) && details_.is_touch)
334 sticky_size = kScreenEdgeInsetForTouchResize;
335 else
336 sticky_size = kScreenEdgeInset;
331 } 337 }
332 // |bounds| is in |window()->parent()|'s coordinates. 338 // |bounds| is in |window()->parent()|'s coordinates.
333 gfx::Rect bounds = CalculateBoundsForDrag(details_, location_in_parent); 339 gfx::Rect bounds = CalculateBoundsForDrag(details_, location_in_parent);
334 340
335 if (wm::IsWindowNormal(window())) 341 if (wm::IsWindowNormal(window()))
336 AdjustBoundsForMainWindow(sticky_size, &bounds); 342 AdjustBoundsForMainWindow(sticky_size, &bounds);
337 343
338 if (bounds != window()->bounds()) { 344 if (bounds != window()->bounds()) {
339 if (!did_move_or_resize_) { 345 if (!did_move_or_resize_) {
340 if (!details_.restore_bounds.IsEmpty()) 346 if (!details_.restore_bounds.IsEmpty())
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 gfx::Rect area(ScreenAsh::GetDisplayBoundsInParent(window())); 850 gfx::Rect area(ScreenAsh::GetDisplayBoundsInParent(window()));
845 if (location.x() <= area.x()) 851 if (location.x() <= area.x())
846 return SNAP_LEFT_EDGE; 852 return SNAP_LEFT_EDGE;
847 if (location.x() >= area.right() - 1) 853 if (location.x() >= area.right() - 1)
848 return SNAP_RIGHT_EDGE; 854 return SNAP_RIGHT_EDGE;
849 return SNAP_NONE; 855 return SNAP_NONE;
850 } 856 }
851 857
852 } // namespace internal 858 } // namespace internal
853 } // namespace ash 859 } // namespace ash
OLDNEW
« ash/wm/workspace/workspace_window_resizer.h ('K') | « ash/wm/workspace/workspace_window_resizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698