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

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

Issue 13896026: Stick windows to sides of workspaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dock on left or right edge Created 7 years, 6 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
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // returns the number of pixels that couldn't be allocated to the attached 94 // returns the number of pixels that couldn't be allocated to the attached
95 // windows (due to min/max size constraints). 95 // windows (due to min/max size constraints).
96 // Note the return value can be positive or negative, a negative value 96 // Note the return value can be positive or negative, a negative value
97 // indicating that that many pixels couldn't be removed from the attached 97 // indicating that that many pixels couldn't be removed from the attached
98 // windows. 98 // windows.
99 int CalculateAttachedSizes( 99 int CalculateAttachedSizes(
100 int delta, 100 int delta,
101 int available_size, 101 int available_size,
102 std::vector<int>* sizes) const; 102 std::vector<int>* sizes) const;
103 103
104 // Returns a bitmask of all edges touching the dock bounds when dock is not
105 // opened yet or the edge representing the side that the dock is opened on.
106 int CalculateDockEdges(const gfx::Rect& bounds) const;
107
104 // Divides |amount| evenly between |sizes|. If |amount| is negative it 108 // Divides |amount| evenly between |sizes|. If |amount| is negative it
105 // indicates how many pixels |sizes| should be shrunk by. 109 // indicates how many pixels |sizes| should be shrunk by.
106 // Returns how many pixels failed to be allocated/removed from |sizes|. 110 // Returns how many pixels failed to be allocated/removed from |sizes|.
107 int GrowFairly(int amount, std::vector<WindowSize>& sizes) const; 111 int GrowFairly(int amount, std::vector<WindowSize>& sizes) const;
108 112
109 // Calculate the ratio of pixels that each WindowSize in |sizes| should 113 // Calculate the ratio of pixels that each WindowSize in |sizes| should
110 // receive when growing or shrinking. 114 // receive when growing or shrinking.
111 void CalculateGrowthRatios(const std::vector<WindowSize*>& sizes, 115 void CalculateGrowthRatios(const std::vector<WindowSize*>& sizes,
112 std::vector<float>* out_ratios) const; 116 std::vector<float>* out_ratios) const;
113 117
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // Gives a previews of where the the window will end up. Only used if there 187 // Gives a previews of where the the window will end up. Only used if there
184 // is a grid and the caption is being dragged. 188 // is a grid and the caption is being dragged.
185 scoped_ptr<PhantomWindowController> snap_phantom_window_controller_; 189 scoped_ptr<PhantomWindowController> snap_phantom_window_controller_;
186 190
187 // Used to determine the target position of a snap. 191 // Used to determine the target position of a snap.
188 scoped_ptr<SnapSizer> snap_sizer_; 192 scoped_ptr<SnapSizer> snap_sizer_;
189 193
190 // Last SnapType. 194 // Last SnapType.
191 SnapType snap_type_; 195 SnapType snap_type_;
192 196
197 // Last updated bitmask of all touched edges.
198 mutable int dock_edges_mask_;
199
193 // Number of mouse moves since the last bounds change. Only used for phantom 200 // Number of mouse moves since the last bounds change. Only used for phantom
194 // placement to track when the mouse is moved while pushed against the edge of 201 // placement to track when the mouse is moved while pushed against the edge of
195 // the screen. 202 // the screen.
196 int num_mouse_moves_since_bounds_change_; 203 int num_mouse_moves_since_bounds_change_;
197 204
198 // The mouse location passed to Drag(). 205 // The mouse location passed to Drag().
199 gfx::Point last_mouse_location_; 206 gfx::Point last_mouse_location_;
200 207
201 // Window the drag has magnetically attached to. 208 // Window the drag has magnetically attached to.
202 aura::Window* magnetism_window_; 209 aura::Window* magnetism_window_;
203 210
204 // Used to verify |magnetism_window_| is still valid. 211 // Used to verify |magnetism_window_| is still valid.
205 aura::WindowTracker window_tracker_; 212 aura::WindowTracker window_tracker_;
206 213
207 // If |magnetism_window_| is non-NULL this indicates how the two windows 214 // If |magnetism_window_| is non-NULL this indicates how the two windows
208 // should attach. 215 // should attach.
209 MatchedEdge magnetism_edge_; 216 MatchedEdge magnetism_edge_;
210 217
211 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); 218 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer);
212 }; 219 };
213 220
214 } // namespace internal 221 } // namespace internal
215 } // namespace ash 222 } // namespace ash
216 223
217 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ 224 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698