OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/dock/docked_window_resizer.h" | 5 #include "ash/wm/dock/docked_window_resizer.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/display/display_controller.h" | |
8 #include "ash/launcher/launcher.h" | 9 #include "ash/launcher/launcher.h" |
9 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
10 #include "ash/screen_ash.h" | 11 #include "ash/screen_ash.h" |
11 #include "ash/shelf/shelf_types.h" | 12 #include "ash/shelf/shelf_types.h" |
12 #include "ash/shelf/shelf_widget.h" | 13 #include "ash/shelf/shelf_widget.h" |
13 #include "ash/shell.h" | 14 #include "ash/shell.h" |
14 #include "ash/shell_window_ids.h" | 15 #include "ash/shell_window_ids.h" |
15 #include "ash/wm/coordinate_conversion.h" | 16 #include "ash/wm/coordinate_conversion.h" |
16 #include "ash/wm/dock/docked_window_layout_manager.h" | 17 #include "ash/wm/dock/docked_window_layout_manager.h" |
17 #include "ash/wm/property_util.h" | 18 #include "ash/wm/property_util.h" |
18 #include "ash/wm/window_properties.h" | 19 #include "ash/wm/window_properties.h" |
19 #include "ash/wm/workspace/magnetism_matcher.h" | 20 #include "ash/wm/workspace/magnetism_matcher.h" |
20 #include "ash/wm/workspace/phantom_window_controller.h" | |
21 #include "ash/wm/workspace/workspace_window_resizer.h" | 21 #include "ash/wm/workspace/workspace_window_resizer.h" |
22 #include "base/command_line.h" | 22 #include "base/command_line.h" |
23 #include "ui/aura/client/aura_constants.h" | 23 #include "ui/aura/client/aura_constants.h" |
24 #include "ui/aura/env.h" | 24 #include "ui/aura/env.h" |
25 #include "ui/aura/root_window.h" | 25 #include "ui/aura/root_window.h" |
26 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
27 #include "ui/aura/window_delegate.h" | 27 #include "ui/aura/window_delegate.h" |
28 #include "ui/base/hit_test.h" | 28 #include "ui/base/hit_test.h" |
29 #include "ui/base/ui_base_types.h" | 29 #include "ui/base/ui_base_types.h" |
30 #include "ui/gfx/screen.h" | 30 #include "ui/gfx/screen.h" |
31 #include "ui/views/widget/widget.h" | 31 #include "ui/views/widget/widget.h" |
32 | 32 |
33 namespace ash { | 33 namespace ash { |
34 namespace internal { | 34 namespace internal { |
35 | 35 |
36 namespace { | 36 namespace { |
37 | 37 |
38 DockedWindowLayoutManager* GetDockedLayoutManagerAtPoint( | 38 DockedWindowLayoutManager* GetDockedLayoutManagerAtPoint( |
39 const gfx::Point& point) { | 39 const gfx::Point& point) { |
40 gfx::Display display = ScreenAsh::FindDisplayContainingPoint(point); | |
41 if (!display.is_valid()) | |
42 return NULL; | |
43 aura::RootWindow* root = Shell::GetInstance()->display_controller()-> | |
44 GetRootWindowForDisplayId(display.id()); | |
40 aura::Window* dock_container = Shell::GetContainer( | 45 aura::Window* dock_container = Shell::GetContainer( |
41 wm::GetRootWindowAt(point), | 46 root, kShellWindowId_DockedContainer); |
42 kShellWindowId_DockedContainer); | |
43 return static_cast<DockedWindowLayoutManager*>( | 47 return static_cast<DockedWindowLayoutManager*>( |
44 dock_container->layout_manager()); | 48 dock_container->layout_manager()); |
45 } | 49 } |
46 | 50 |
47 } // namespace | 51 } // namespace |
48 | 52 |
49 DockedWindowResizer::~DockedWindowResizer() { | 53 DockedWindowResizer::~DockedWindowResizer() { |
50 if (destroyed_) | 54 if (destroyed_) |
51 *destroyed_ = true; | 55 *destroyed_ = true; |
52 } | 56 } |
(...skipping 13 matching lines...) Expand all Loading... | |
66 void DockedWindowResizer::Drag(const gfx::Point& location, int event_flags) { | 70 void DockedWindowResizer::Drag(const gfx::Point& location, int event_flags) { |
67 last_location_ = location; | 71 last_location_ = location; |
68 wm::ConvertPointToScreen(GetTarget()->parent(), &last_location_); | 72 wm::ConvertPointToScreen(GetTarget()->parent(), &last_location_); |
69 bool destroyed = false; | 73 bool destroyed = false; |
70 if (!did_move_or_resize_) { | 74 if (!did_move_or_resize_) { |
71 did_move_or_resize_ = true; | 75 did_move_or_resize_ = true; |
72 StartedDragging(); | 76 StartedDragging(); |
73 } | 77 } |
74 gfx::Point offset; | 78 gfx::Point offset; |
75 gfx::Rect bounds(CalculateBoundsForDrag(details_, location)); | 79 gfx::Rect bounds(CalculateBoundsForDrag(details_, location)); |
80 LOG(INFO) << "Drag to " << bounds.ToString(); | |
76 bool set_tracked_by_workspace = MaybeSnapToEdge(bounds, &offset); | 81 bool set_tracked_by_workspace = MaybeSnapToEdge(bounds, &offset); |
77 | 82 |
78 // Temporarily clear kWindowTrackedByWorkspaceKey for windows that are snapped | 83 // Temporarily clear kWindowTrackedByWorkspaceKey for windows that are snapped |
79 // to screen edges e.g. when they are docked. This prevents the windows from | 84 // to screen edges e.g. when they are docked. This prevents the windows from |
80 // getting snapped to other nearby windows during the drag. | 85 // getting snapped to other nearby windows during the drag. |
81 bool tracked_by_workspace = GetTrackedByWorkspace(GetTarget()); | 86 bool tracked_by_workspace = GetTrackedByWorkspace(GetTarget()); |
82 if (set_tracked_by_workspace) | 87 if (set_tracked_by_workspace) |
83 SetTrackedByWorkspace(GetTarget(), false); | 88 SetTrackedByWorkspace(GetTarget(), false); |
84 gfx::Point modified_location(location.x() + offset.x(), | 89 gfx::Point modified_location(location.x() + offset.x(), |
85 location.y() + offset.y()); | 90 location.y() + offset.y()); |
86 destroyed_ = &destroyed; | 91 destroyed_ = &destroyed; |
87 next_window_resizer_->Drag(modified_location, event_flags); | 92 next_window_resizer_->Drag(modified_location, event_flags); |
88 | 93 |
89 // TODO(varkha): Refactor the way WindowResizer calls into other window | 94 // TODO(varkha): Refactor the way WindowResizer calls into other window |
90 // resizers to avoid the awkward pattern here for checking if | 95 // resizers to avoid the awkward pattern here for checking if |
91 // next_window_resizer_ destroys the resizer object. | 96 // next_window_resizer_ destroys the resizer object. |
92 if (destroyed) | 97 if (destroyed) |
93 return; | 98 return; |
94 destroyed_ = NULL; | 99 destroyed_ = NULL; |
95 if (set_tracked_by_workspace) | 100 if (set_tracked_by_workspace) |
96 SetTrackedByWorkspace(GetTarget(), tracked_by_workspace); | 101 SetTrackedByWorkspace(GetTarget(), tracked_by_workspace); |
97 | 102 |
98 DockedWindowLayoutManager* new_dock_layout = | 103 DockedWindowLayoutManager* new_dock_layout = |
99 GetDockedLayoutManagerAtPoint(last_location_); | 104 GetDockedLayoutManagerAtPoint(last_location_); |
100 if (new_dock_layout != dock_layout_) { | 105 if (new_dock_layout && new_dock_layout != dock_layout_) { |
101 // The window is being dragged to a new display. If the previous | 106 // The window is being dragged to a new display. If the previous |
102 // container is the current parent of the window it will be informed of | 107 // container is the current parent of the window it will be informed of |
103 // the end of drag when the window is reparented, otherwise let the | 108 // the end of drag when the window is reparented, otherwise let the |
104 // previous container know the drag is complete. If we told the | 109 // previous container know the drag is complete. If we told the |
105 // window's parent that the drag was complete it would begin | 110 // window's parent that the drag was complete it would begin |
106 // positioning the window. | 111 // positioning the window. |
107 if (is_docked_) | 112 if (is_docked_) |
108 dock_layout_->UndockDraggedWindow(); | 113 dock_layout_->UndockDraggedWindow(); |
109 if (dock_layout_ != initial_dock_layout_) | 114 if (dock_layout_ != initial_dock_layout_) |
110 dock_layout_->FinishDragging(); | 115 dock_layout_->FinishDragging(); |
111 is_docked_ = false; | 116 is_docked_ = false; |
112 dock_layout_ = new_dock_layout; | 117 dock_layout_ = new_dock_layout; |
113 // The window's initial layout manager already knows that the drag is | 118 // The window's initial layout manager already knows that the drag is |
114 // in progress for this window. | 119 // in progress for this window. |
115 if (new_dock_layout != initial_dock_layout_) | 120 if (new_dock_layout != initial_dock_layout_) |
116 new_dock_layout->StartDragging(GetTarget()); | 121 new_dock_layout->StartDragging(GetTarget()); |
117 } | 122 } |
118 | 123 // Window could get marked as docked by the SnapSizer, so update the state. |
119 // Show snapping animation when a window touches a screen edge or when | 124 is_docked_ = dock_layout_->is_dragged_window_docked(); |
120 // it is about to get docked. | |
121 DockedAlignment new_docked_alignment = GetDraggedWindowAlignment(); | |
122 if (new_docked_alignment != DOCKED_ALIGNMENT_NONE) { | |
123 if (!is_docked_) { | |
124 dock_layout_->DockDraggedWindow(GetTarget()); | |
125 is_docked_ = true; | |
126 } | |
127 UpdateSnapPhantomWindow(); | |
128 } else { | |
129 if (is_docked_) { | |
130 dock_layout_->UndockDraggedWindow(); | |
131 is_docked_ = false; | |
132 } | |
133 // Clear phantom window when a window gets undocked. | |
134 snap_phantom_window_controller_.reset(); | |
135 } | |
136 } | 125 } |
137 | 126 |
138 void DockedWindowResizer::CompleteDrag(int event_flags) { | 127 void DockedWindowResizer::CompleteDrag(int event_flags) { |
139 snap_phantom_window_controller_.reset(); | |
140 | |
141 // Temporarily clear kWindowTrackedByWorkspaceKey for panels so that they | 128 // Temporarily clear kWindowTrackedByWorkspaceKey for panels so that they |
142 // don't get forced into the workspace that may be shrunken because of docked | 129 // don't get forced into the workspace that may be shrunken because of docked |
143 // windows. | 130 // windows. |
144 bool tracked_by_workspace = GetTrackedByWorkspace(GetTarget()); | 131 bool tracked_by_workspace = GetTrackedByWorkspace(GetTarget()); |
145 bool set_tracked_by_workspace = was_docked_; | 132 bool set_tracked_by_workspace = was_docked_; |
146 if (set_tracked_by_workspace) | 133 if (set_tracked_by_workspace) |
147 SetTrackedByWorkspace(GetTarget(), false); | 134 SetTrackedByWorkspace(GetTarget(), false); |
148 // The root window can change when dragging into a different screen. | 135 // The root window can change when dragging into a different screen. |
149 next_window_resizer_->CompleteDrag(event_flags); | 136 next_window_resizer_->CompleteDrag(event_flags); |
150 FinishedDragging(); | 137 FinishedDragging(); |
151 if (set_tracked_by_workspace) | 138 if (set_tracked_by_workspace) |
152 SetTrackedByWorkspace(GetTarget(), tracked_by_workspace); | 139 SetTrackedByWorkspace(GetTarget(), tracked_by_workspace); |
153 } | 140 } |
154 | 141 |
155 void DockedWindowResizer::RevertDrag() { | 142 void DockedWindowResizer::RevertDrag() { |
156 snap_phantom_window_controller_.reset(); | |
157 | |
158 // Temporarily clear kWindowTrackedByWorkspaceKey for panels so that they | 143 // Temporarily clear kWindowTrackedByWorkspaceKey for panels so that they |
159 // don't get forced into the workspace that may be shrunken because of docked | 144 // don't get forced into the workspace that may be shrunken because of docked |
160 // windows. | 145 // windows. |
161 bool tracked_by_workspace = GetTrackedByWorkspace(GetTarget()); | 146 bool tracked_by_workspace = GetTrackedByWorkspace(GetTarget()); |
162 bool set_tracked_by_workspace = was_docked_; | 147 bool set_tracked_by_workspace = was_docked_; |
163 if (set_tracked_by_workspace) | 148 if (set_tracked_by_workspace) |
164 SetTrackedByWorkspace(GetTarget(), false); | 149 SetTrackedByWorkspace(GetTarget(), false); |
165 next_window_resizer_->RevertDrag(); | 150 next_window_resizer_->RevertDrag(); |
151 // Restore docked state to what it was before the drag if necessary. | |
152 if (was_docked_ && !is_docked_) { | |
153 dock_layout_->DockDraggedWindow(GetTarget()); | |
154 is_docked_ = was_docked_; | |
155 } | |
166 FinishedDragging(); | 156 FinishedDragging(); |
167 if (set_tracked_by_workspace) | 157 if (set_tracked_by_workspace) |
168 SetTrackedByWorkspace(GetTarget(), tracked_by_workspace); | 158 SetTrackedByWorkspace(GetTarget(), tracked_by_workspace); |
169 } | 159 } |
170 | 160 |
171 aura::Window* DockedWindowResizer::GetTarget() { | 161 aura::Window* DockedWindowResizer::GetTarget() { |
172 return next_window_resizer_->GetTarget(); | 162 return next_window_resizer_->GetTarget(); |
173 } | 163 } |
174 | 164 |
175 const gfx::Point& DockedWindowResizer::GetInitialLocation() const { | 165 const gfx::Point& DockedWindowResizer::GetInitialLocation() const { |
(...skipping 14 matching lines...) Expand all Loading... | |
190 aura::Window* dock_container = Shell::GetContainer( | 180 aura::Window* dock_container = Shell::GetContainer( |
191 details.window->GetRootWindow(), | 181 details.window->GetRootWindow(), |
192 kShellWindowId_DockedContainer); | 182 kShellWindowId_DockedContainer); |
193 dock_layout_ = static_cast<DockedWindowLayoutManager*>( | 183 dock_layout_ = static_cast<DockedWindowLayoutManager*>( |
194 dock_container->layout_manager()); | 184 dock_container->layout_manager()); |
195 initial_dock_layout_ = dock_layout_; | 185 initial_dock_layout_ = dock_layout_; |
196 was_docked_ = details.window->parent() == dock_container; | 186 was_docked_ = details.window->parent() == dock_container; |
197 is_docked_ = was_docked_; | 187 is_docked_ = was_docked_; |
198 } | 188 } |
199 | 189 |
200 DockedAlignment DockedWindowResizer::GetDraggedWindowAlignment() { | |
201 aura::Window* window = GetTarget(); | |
202 DockedWindowLayoutManager* layout_manager = | |
203 GetDockedLayoutManagerAtPoint(last_location_); | |
204 const DockedAlignment alignment = layout_manager->CalculateAlignment(); | |
205 const gfx::Rect& bounds(window->GetBoundsInScreen()); | |
206 | |
207 // Check if the window is touching the edge - it may need to get docked. | |
208 if (alignment == DOCKED_ALIGNMENT_NONE) | |
209 return layout_manager->GetAlignmentOfWindow(window); | |
210 | |
211 // Both bounds and pointer location are checked because some drags involve | |
212 // stickiness at the workspace-to-dock boundary and so the |location| may be | |
213 // outside of the |bounds|. | |
214 // It is also possible that all the docked windows are minimized or hidden | |
215 // in which case the dragged window needs to be exactly touching the same | |
216 // edge that those docked windows were aligned before they got minimized. | |
217 // TODO(varkha): Consider eliminating sticky behavior on that boundary when | |
218 // a pointer enters docked area. | |
219 if ((layout_manager->docked_bounds().Intersects(bounds) && | |
220 layout_manager->docked_bounds().Contains(last_location_)) || | |
221 alignment == layout_manager->GetAlignmentOfWindow(window)) { | |
222 // A window is being added to other docked windows (on the same side). | |
223 return alignment; | |
224 } | |
225 return DOCKED_ALIGNMENT_NONE; | |
226 } | |
227 | |
228 bool DockedWindowResizer::MaybeSnapToEdge(const gfx::Rect& bounds, | 190 bool DockedWindowResizer::MaybeSnapToEdge(const gfx::Rect& bounds, |
229 gfx::Point* offset) { | 191 gfx::Point* offset) { |
230 aura::Window* dock_container = Shell::GetContainer( | 192 // Windows only snap magnetically when they were previously docked. |
231 wm::GetRootWindowAt(last_location_), | 193 if (!was_docked_) |
232 kShellWindowId_DockedContainer); | 194 return false; |
233 DockedAlignment dock_alignment = | 195 DockedAlignment dock_alignment = dock_layout_->CalculateAlignment(); |
234 GetDockedLayoutManagerAtPoint(last_location_)->CalculateAlignment(); | |
235 gfx::Rect dock_bounds = ScreenAsh::ConvertRectFromScreen( | 196 gfx::Rect dock_bounds = ScreenAsh::ConvertRectFromScreen( |
236 GetTarget()->parent(), dock_container->GetBoundsInScreen()); | 197 GetTarget()->parent(), |
237 // Windows only snap magnetically when they are close to the edge of the | 198 dock_layout_->dock_container()->GetBoundsInScreen()); |
238 // screen and when the cursor is over other docked windows. | |
239 // When a window being dragged is the last window that was previously | |
240 // docked it is still allowed to magnetically snap to either side. | |
241 bool can_snap = was_docked_ || | |
242 (GetDraggedWindowAlignment() != DOCKED_ALIGNMENT_NONE); | |
243 if (!can_snap) | |
244 return false; | |
245 | 199 |
246 // Distance in pixels that the cursor must move past an edge for a window | 200 // Distance in pixels that the cursor must move past an edge for a window |
247 // to move beyond that edge. Same constant as in WorkspaceWindowResizer | 201 // to move beyond that edge. Same constant as in WorkspaceWindowResizer |
248 // is used for consistency. | 202 // is used for consistency. |
249 const int kStickyDistance = WorkspaceWindowResizer::kStickyDistancePixels; | 203 const int kStickyDistance = WorkspaceWindowResizer::kStickyDistancePixels; |
250 | 204 |
251 // Short-range magnetism when retaining docked state. Same constant as in | 205 // Short-range magnetism when retaining docked state. Same constant as in |
252 // MagnetismMatcher is used for consistency. | 206 // MagnetismMatcher is used for consistency. |
253 const int kSnapToDockDistance = MagnetismMatcher::kMagneticDistance; | 207 const int kSnapToDockDistance = MagnetismMatcher::kMagneticDistance; |
254 | 208 |
255 if (dock_alignment == DOCKED_ALIGNMENT_LEFT || | 209 if (dock_alignment == DOCKED_ALIGNMENT_LEFT || |
256 (dock_alignment == DOCKED_ALIGNMENT_NONE && was_docked_)) { | 210 dock_alignment == DOCKED_ALIGNMENT_NONE) { |
257 const int distance = bounds.x() - dock_bounds.x(); | 211 const int distance = bounds.x() - dock_bounds.x(); |
258 if (distance < (was_docked_ ? kSnapToDockDistance : 0) && | 212 if (distance < kSnapToDockDistance && distance > -kStickyDistance) { |
259 distance > -kStickyDistance) { | |
260 offset->set_x(-distance); | 213 offset->set_x(-distance); |
261 return true; | 214 return true; |
262 } | 215 } |
263 } | 216 } |
264 if (dock_alignment == DOCKED_ALIGNMENT_RIGHT || | 217 if (dock_alignment == DOCKED_ALIGNMENT_RIGHT || |
265 (dock_alignment == DOCKED_ALIGNMENT_NONE && was_docked_)) { | 218 dock_alignment == DOCKED_ALIGNMENT_NONE) { |
266 const int distance = dock_bounds.right() - bounds.right(); | 219 const int distance = dock_bounds.right() - bounds.right(); |
267 if (distance < (was_docked_ ? kSnapToDockDistance : 0) && | 220 if (distance < kSnapToDockDistance && distance > -kStickyDistance) { |
268 distance > -kStickyDistance) { | |
269 offset->set_x(distance); | 221 offset->set_x(distance); |
270 return true; | 222 return true; |
271 } | 223 } |
272 } | 224 } |
273 return false; | 225 return false; |
274 } | 226 } |
275 | 227 |
276 void DockedWindowResizer::StartedDragging() { | 228 void DockedWindowResizer::StartedDragging() { |
277 // Tell the dock layout manager that we are dragging this window. | 229 // Tell the dock layout manager that we are dragging this window. |
278 // At this point we are not yet animating the window as it may not be | 230 // At this point we are not yet animating the window as it may not be |
(...skipping 16 matching lines...) Expand all Loading... | |
295 } | 247 } |
296 if (is_docked_) | 248 if (is_docked_) |
297 dock_layout_->DockDraggedWindow(GetTarget()); | 249 dock_layout_->DockDraggedWindow(GetTarget()); |
298 } | 250 } |
299 | 251 |
300 void DockedWindowResizer::FinishedDragging() { | 252 void DockedWindowResizer::FinishedDragging() { |
301 if (!did_move_or_resize_) | 253 if (!did_move_or_resize_) |
302 return; | 254 return; |
303 | 255 |
304 aura::Window* window = GetTarget(); | 256 aura::Window* window = GetTarget(); |
305 bool should_dock = was_docked_; | 257 bool should_dock = is_docked_; |
flackr
2013/09/06 02:18:43
if should_dock == is_docked_, can we just use is_d
varkha
2013/09/09 15:38:42
Done.
| |
306 const bool attached_panel = | 258 bool attached_panel = false; |
259 if (details_.bounds_change & WindowResizer::kBoundsChange_Resizes) { | |
260 // No longer restore to pre-docked bounds if a window has been resized. | |
261 if (is_docked_) | |
262 ClearRestoreBounds(window); | |
263 } else { | |
264 attached_panel = | |
flackr
2013/09/06 02:18:43
Won't moving this check here make it possible to d
varkha
2013/09/09 15:38:42
No. is_docked_ will be false unless the window was
flackr
2013/09/09 19:06:57
I still think it feels wrong to only have attached
varkha
2013/09/09 20:37:54
See more explicit logic for preventing panel attac
| |
307 window->type() == aura::client::WINDOW_TYPE_PANEL && | 265 window->type() == aura::client::WINDOW_TYPE_PANEL && |
flackr
2013/09/06 02:18:43
nit: indent 4 spaces.
varkha
2013/09/09 15:38:42
Done.
| |
308 window->GetProperty(kPanelAttachedKey); | 266 window->GetProperty(kPanelAttachedKey); |
309 // If a window was previously docked then keep it docked if it is resized and | |
310 // still aligned at the screen edge. | |
311 if ((was_docked_ || | |
312 ((details_.bounds_change & WindowResizer::kBoundsChange_Repositions) && | |
313 !(details_.bounds_change & WindowResizer::kBoundsChange_Resizes)))) { | |
314 should_dock = GetDraggedWindowAlignment() != DOCKED_ALIGNMENT_NONE; | |
315 } | 267 } |
316 | 268 |
317 // Check if the window needs to be docked or returned to workspace. | 269 // Check if the window needs to be docked or returned to workspace. |
318 aura::Window* dock_container = Shell::GetContainer( | 270 aura::Window* dock_container = Shell::GetContainer( |
319 window->GetRootWindow(), | 271 window->GetRootWindow(), |
320 kShellWindowId_DockedContainer); | 272 kShellWindowId_DockedContainer); |
321 if (!attached_panel && | 273 if (!attached_panel && |
322 should_dock != (window->parent() == dock_container)) { | 274 should_dock != (window->parent() == dock_container)) { |
323 if (should_dock) { | 275 if (should_dock) { |
324 dock_container->AddChild(window); | 276 dock_container->AddChild(window); |
(...skipping 11 matching lines...) Expand all Loading... | |
336 } | 288 } |
337 } | 289 } |
338 dock_layout_->FinishDragging(); | 290 dock_layout_->FinishDragging(); |
339 | 291 |
340 // If we started the drag in one root window and moved into another root | 292 // If we started the drag in one root window and moved into another root |
341 // but then canceled the drag we may need to inform the original layout | 293 // but then canceled the drag we may need to inform the original layout |
342 // manager that the drag is finished. | 294 // manager that the drag is finished. |
343 if (initial_dock_layout_ != dock_layout_) | 295 if (initial_dock_layout_ != dock_layout_) |
344 initial_dock_layout_->FinishDragging(); | 296 initial_dock_layout_->FinishDragging(); |
345 is_docked_ = false; | 297 is_docked_ = false; |
346 } | 298 // Retain restore bounds when dragging inside the docked area. |
347 | 299 if (was_docked_ && |
flackr
2013/09/06 02:18:43
was_docked_ is true iff the window was docked befo
varkha
2013/09/09 15:38:42
That part is already handled by existing code in W
flackr
2013/09/09 19:06:57
I think it would make more sense to add an excepti
varkha
2013/09/09 20:37:54
I have noticed that I no longer need this since th
| |
348 void DockedWindowResizer::UpdateSnapPhantomWindow() { | 300 window->parent()->id() == kShellWindowId_DockedContainer && |
349 if (!did_move_or_resize_ || details_.window_component != HTCAPTION) | 301 !(details_.bounds_change & WindowResizer::kBoundsChange_Resizes)) { |
350 return; | 302 gfx::Rect initial_bounds = ScreenAsh::ConvertRectToScreen( |
351 | 303 window->parent(), details_.initial_bounds_in_parent); |
352 if (!snap_phantom_window_controller_) { | 304 SetRestoreBoundsInScreen(window, details_.restore_bounds.IsEmpty() ? |
353 snap_phantom_window_controller_.reset( | 305 initial_bounds : |
354 new PhantomWindowController(GetTarget())); | 306 details_.restore_bounds); |
355 } | 307 } |
356 snap_phantom_window_controller_->Show(dock_layout_->dragged_bounds()); | |
357 } | 308 } |
358 | 309 |
359 } // namespace internal | 310 } // namespace internal |
360 } // namespace ash | 311 } // namespace ash |
OLD | NEW |