OLD | NEW |
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/screen_ash.h" | 9 #include "ash/screen_ash.h" |
10 #include "ash/wm/window_resizer.h" | 10 #include "ash/wm/window_resizer.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 // Windows are initially snapped to the percent at index 0. The index into | 22 // Windows are initially snapped to the percent at index 0. The index into |
23 // |kPercents| is changed if any of the following happen: | 23 // |kPercents| is changed if any of the following happen: |
24 // . The user stops moving the mouse for |kDelayBeforeIncreaseMS| and then moves | 24 // . The user stops moving the mouse for |kDelayBeforeIncreaseMS| and then moves |
25 // the mouse again. | 25 // the mouse again. |
26 // . The mouse moves |kPixelsBeforeAdjust| horizontal pixels. | 26 // . The mouse moves |kPixelsBeforeAdjust| horizontal pixels. |
27 // . The mouse is against the edge of the screen and the mouse is moved | 27 // . The mouse is against the edge of the screen and the mouse is moved |
28 // |kMovesBeforeAdjust| times. | 28 // |kMovesBeforeAdjust| times. |
29 const int kDelayBeforeIncreaseMS = 500; | 29 const int kDelayBeforeIncreaseMS = 500; |
30 const int kMovesBeforeAdjust = 50; | 30 const int kMovesBeforeAdjust = 50; |
31 const int kPixelsBeforeAdjust = 200; | 31 const int kPixelsBeforeAdjust = 100; |
32 | 32 |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 SnapSizer::SnapSizer(aura::Window* window, | 35 SnapSizer::SnapSizer(aura::Window* window, |
36 const gfx::Point& start, | 36 const gfx::Point& start, |
37 Edge edge, | 37 Edge edge, |
38 int grid_size) | 38 int grid_size) |
39 : window_(window), | 39 : window_(window), |
40 edge_(edge), | 40 edge_(edge), |
41 grid_size_(grid_size), | 41 grid_size_(grid_size), |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 | 113 |
114 bool SnapSizer::AlongEdge(int x) const { | 114 bool SnapSizer::AlongEdge(int x) const { |
115 // TODO: need to support multi-monitor. | 115 // TODO: need to support multi-monitor. |
116 gfx::Rect area(gfx::Screen::GetMonitorAreaNearestWindow(window_)); | 116 gfx::Rect area(gfx::Screen::GetMonitorAreaNearestWindow(window_)); |
117 return (x <= area.x()) || (x >= area.right() - 1); | 117 return (x <= area.x()) || (x >= area.right() - 1); |
118 } | 118 } |
119 | 119 |
120 } // namespace internal | 120 } // namespace internal |
121 } // namespace ash | 121 } // namespace ash |
OLD | NEW |