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

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

Issue 14273008: Add ash-enable-sticky-edges for 'sticky' instead of 'snap' behavior. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 #ifndef ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ 5 #ifndef ASH_WM_WORKSPACE_WINDOW_RESIZER_H_
6 #define ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ 6 #define ASH_WM_WORKSPACE_WINDOW_RESIZER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/wm/window_resizer.h" 10 #include "ash/wm/window_resizer.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // Calculate the ratio of pixels that each WindowSize in |sizes| should 109 // Calculate the ratio of pixels that each WindowSize in |sizes| should
110 // receive when growing or shrinking. 110 // receive when growing or shrinking.
111 void CalculateGrowthRatios(const std::vector<WindowSize*>& sizes, 111 void CalculateGrowthRatios(const std::vector<WindowSize*>& sizes,
112 std::vector<float>* out_ratios) const; 112 std::vector<float>* out_ratios) const;
113 113
114 // Adds a WindowSize to |sizes| for each attached window. 114 // Adds a WindowSize to |sizes| for each attached window.
115 void CreateBucketsForAttached(std::vector<WindowSize>* sizes) const; 115 void CreateBucketsForAttached(std::vector<WindowSize>* sizes) const;
116 116
117 // If possible snaps the window to a neary window. Updates |bounds| if there 117 // If possible snaps the window to a neary window. Updates |bounds| if there
118 // was a close enough window. 118 // was a close enough window.
119 void MagneticallySnapToOtherWindows(gfx::Rect* bounds); 119 void MagneticallyStickToOtherWindows(gfx::Rect* bounds);
120 120
121 // If possible snaps the resize to a neary window. Updates |bounds| if there 121 // If possible snaps the resize to a neary window. Updates |bounds| if there
122 // was a close enough window. 122 // was a close enough window.
123 void MagneticallySnapResizeToOtherWindows(gfx::Rect* bounds); 123 void MagneticallyStickResizeToOtherWindows(gfx::Rect* bounds);
varkha 2013/04/16 02:12:12 nit: To be consistent with StickyResizeToWorkAreaB
stevenjb 2013/04/16 20:08:20 Done.
124 124
125 // Finds the neareset window to magentically snap to. Updates 125 // Finds the neareset window to magentically snap to. Updates
126 // |magnetism_window_| and |magnetism_edge_| appropriately. |edges| is a 126 // |magnetism_window_| and |magnetism_edge_| appropriately. |edges| is a
127 // bitmask of the MagnetismEdges to match again. Returns true if a match is 127 // bitmask of the MagnetismEdges to match again. Returns true if a match is
128 // found. 128 // found.
129 bool UpdateMagnetismWindow(const gfx::Rect& bounds, uint32 edges); 129 bool UpdateMagnetismWindow(const gfx::Rect& bounds, uint32 edges);
130 130
131 // Adjusts the bounds of the window: magnetically snapping, ensuring the 131 // Adjusts the bounds of the window: magnetically snapping, ensuring the
132 // window has enough on screen... |snap_size| is the distance from an edge of 132 // window has enough on screen. If |is_sticky| is true, windows will stick
133 // the work area before the window is snapped. A value of 0 results in no 133 // to the edges of the workspace and magnetically snap to other windows.
134 // snapping. 134 void AdjustBoundsForMainWindow(bool is_sticky, gfx::Rect* bounds);
135 void AdjustBoundsForMainWindow(int snap_size, gfx::Rect* bounds);
136 135
137 // Snaps the window bounds to the work area edges if necessary. 136 // Snaps the window bounds to the work area edges if necessary.
138 void SnapToWorkAreaEdges( 137 void StickToWorkAreaEdges(const gfx::Rect& work_area,
139 const gfx::Rect& work_area, 138 gfx::Rect* bounds) const;
140 int snap_size,
141 gfx::Rect* bounds) const;
142 139
143 // Snaps the window bounds to the work area during a resize. 140 // Snaps the window bounds to the work area during a resize.
144 void SnapResizeToWorkAreaBounds(const gfx::Rect& work_area, 141 void StickyResizeToWorkAreaBounds(const gfx::Rect& work_area,
145 int snap_size, 142 gfx::Rect* bounds) const;
146 gfx::Rect* bounds) const;
147 143
148 // Returns a coordinate along the primary axis. Used to share code for 144 // Returns a coordinate along the primary axis. Used to share code for
149 // left/right multi window resize and top/bottom resize. 145 // left/right multi window resize and top/bottom resize.
150 int PrimaryAxisSize(const gfx::Size& size) const; 146 int PrimaryAxisSize(const gfx::Size& size) const;
151 int PrimaryAxisCoordinate(int x, int y) const; 147 int PrimaryAxisCoordinate(int x, int y) const;
152 148
153 // Updates the bounds of the phantom window for window snapping. 149 // Updates the bounds of the phantom window for window snapping.
154 void UpdateSnapPhantomWindow(const gfx::Point& location, 150 void UpdateSnapPhantomWindow(const gfx::Point& location,
155 const gfx::Rect& bounds); 151 const gfx::Rect& bounds);
156 152
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // should attach. 205 // should attach.
210 MatchedEdge magnetism_edge_; 206 MatchedEdge magnetism_edge_;
211 207
212 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); 208 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer);
213 }; 209 };
214 210
215 } // namespace internal 211 } // namespace internal
216 } // namespace ash 212 } // namespace ash
217 213
218 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ 214 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698