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

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

Issue 10008084: Add ctrl+drag feature for allowing resizing window with exact positioning. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add ctrl-drap for resizing window to pixel level. Created 8 years, 8 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/shell.h" 10 #include "ash/shell.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 aura::Window* window, 53 aura::Window* window,
54 const gfx::Point& location, 54 const gfx::Point& location,
55 int window_component, 55 int window_component,
56 int grid_size, 56 int grid_size,
57 const std::vector<aura::Window*>& attached_windows) { 57 const std::vector<aura::Window*>& attached_windows) {
58 Details details(window, location, window_component, grid_size); 58 Details details(window, location, window_component, grid_size);
59 return details.is_resizable ? 59 return details.is_resizable ?
60 new WorkspaceWindowResizer(details, attached_windows) : NULL; 60 new WorkspaceWindowResizer(details, attached_windows) : NULL;
61 } 61 }
62 62
63 void WorkspaceWindowResizer::Drag(const gfx::Point& location) { 63 void WorkspaceWindowResizer::Drag(const gfx::Point& location, int event_flags) {
64 gfx::Rect bounds = CalculateBoundsForDrag(details_, location); 64 bool disable_snap_to_grid = event_flags & ui::EF_CONTROL_DOWN ? true : false;
65 gfx::Rect bounds =
66 CalculateBoundsForDrag(details_, location, disable_snap_to_grid);
67
65 if (wm::IsWindowNormal(details_.window)) 68 if (wm::IsWindowNormal(details_.window))
66 AdjustBoundsForMainWindow(&bounds); 69 AdjustBoundsForMainWindow(&bounds);
67 if (bounds != details_.window->bounds()) { 70 if (bounds != details_.window->bounds()) {
68 if (!did_move_or_resize_) 71 if (!did_move_or_resize_)
69 RestackWindows(); 72 RestackWindows();
70 did_move_or_resize_ = true; 73 did_move_or_resize_ = true;
71 } 74 }
72 UpdatePhantomWindow(location, bounds); 75 UpdatePhantomWindow(location, bounds);
73 if (!attached_windows_.empty()) 76 if (!attached_windows_.empty())
74 LayoutAttachedWindows(bounds); 77 LayoutAttachedWindows(bounds);
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 gfx::Rect area(gfx::Screen::GetMonitorAreaNearestWindow(details_.window)); 418 gfx::Rect area(gfx::Screen::GetMonitorAreaNearestWindow(details_.window));
416 if (location.x() <= area.x()) 419 if (location.x() <= area.x())
417 return SNAP_LEFT_EDGE; 420 return SNAP_LEFT_EDGE;
418 if (location.x() >= area.right() - 1) 421 if (location.x() >= area.right() - 1)
419 return SNAP_RIGHT_EDGE; 422 return SNAP_RIGHT_EDGE;
420 return SNAP_NONE; 423 return SNAP_NONE;
421 } 424 }
422 425
423 } // namespace internal 426 } // namespace internal
424 } // namespace ash 427 } // namespace ash
OLDNEW
« ash/wm/default_window_resizer.cc ('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