Chromium Code Reviews| 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/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
| 10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 // At this point we are not yet animating the window as it may not be | 191 // At this point we are not yet animating the window as it may not be |
| 192 // inside the docked area. | 192 // inside the docked area. |
| 193 dock_layout_->StartDragging(GetTarget()); | 193 dock_layout_->StartDragging(GetTarget()); |
| 194 // Reparent workspace windows during the drag to elevate them above workspace. | 194 // Reparent workspace windows during the drag to elevate them above workspace. |
| 195 // Other windows for which the DockedWindowResizer is instantiated include | 195 // Other windows for which the DockedWindowResizer is instantiated include |
| 196 // panels and windows that are already docked. Those do not need reparenting. | 196 // panels and windows that are already docked. Those do not need reparenting. |
| 197 if (GetTarget()->type() != ui::wm::WINDOW_TYPE_PANEL && | 197 if (GetTarget()->type() != ui::wm::WINDOW_TYPE_PANEL && |
| 198 GetTarget()->parent()->id() == kShellWindowId_DefaultContainer) { | 198 GetTarget()->parent()->id() == kShellWindowId_DefaultContainer) { |
| 199 // Reparent the window into the docked windows container in order to get it | 199 // Reparent the window into the docked windows container in order to get it |
| 200 // on top of other docked windows. | 200 // on top of other docked windows. |
| 201 aura::Window* docked_container = Shell::GetContainer( | 201 wm::DockWindow(GetTarget()); |
| 202 GetTarget()->GetRootWindow(), | |
| 203 kShellWindowId_DockedContainer); | |
| 204 wm::ReparentChildWithTransientChildren(GetTarget(), | |
| 205 GetTarget()->parent(), | |
| 206 docked_container); | |
| 207 } | 202 } |
| 208 if (is_docked_) | 203 if (is_docked_) |
| 209 dock_layout_->DockDraggedWindow(GetTarget()); | 204 dock_layout_->DockDraggedWindow(GetTarget()); |
| 210 } | 205 } |
| 211 | 206 |
| 212 void DockedWindowResizer::FinishedDragging( | 207 void DockedWindowResizer::FinishedDragging( |
| 213 aura::client::WindowMoveResult move_result) { | 208 aura::client::WindowMoveResult move_result) { |
| 214 if (!did_move_or_resize_) | 209 if (!did_move_or_resize_) |
| 215 return; | 210 return; |
| 216 did_move_or_resize_ = false; | 211 did_move_or_resize_ = false; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 // Check if the window needs to be docked or returned to workspace. | 266 // Check if the window needs to be docked or returned to workspace. |
| 272 DockedAction action = DOCKED_ACTION_NONE; | 267 DockedAction action = DOCKED_ACTION_NONE; |
| 273 aura::Window* dock_container = Shell::GetContainer( | 268 aura::Window* dock_container = Shell::GetContainer( |
| 274 window->GetRootWindow(), | 269 window->GetRootWindow(), |
| 275 kShellWindowId_DockedContainer); | 270 kShellWindowId_DockedContainer); |
| 276 if ((is_resized || !is_attached_panel) && | 271 if ((is_resized || !is_attached_panel) && |
| 277 is_docked_ != (window->parent() == dock_container)) { | 272 is_docked_ != (window->parent() == dock_container)) { |
| 278 if (is_docked_) { | 273 if (is_docked_) { |
| 279 wm::ReparentChildWithTransientChildren(window, | 274 wm::ReparentChildWithTransientChildren(window, |
| 280 window->parent(), | 275 window->parent(), |
| 281 dock_container); | 276 dock_container); |
|
varkha
2014/10/01 19:08:51
Can use DockWindow and maybe check for parent()->i
dtapuska
2014/10/01 20:17:42
Done.
| |
| 282 action = DOCKED_ACTION_DOCK; | 277 action = DOCKED_ACTION_DOCK; |
| 283 } else if (window->parent()->id() == kShellWindowId_DockedContainer) { | 278 } else if (window->parent()->id() == kShellWindowId_DockedContainer) { |
| 284 // Reparent the window back to workspace. | 279 // Reparent the window back to workspace. |
| 285 // We need to be careful to give ParentWindowWithContext a location in | 280 // We need to be careful to give ParentWindowWithContext a location in |
| 286 // the right root window (matching the logic in DragWindowResizer) based | 281 // the right root window (matching the logic in DragWindowResizer) based |
| 287 // on which root window a mouse pointer is in. We want to undock into the | 282 // on which root window a mouse pointer is in. We want to undock into the |
| 288 // right screen near the edge of a multiscreen setup (based on where the | 283 // right screen near the edge of a multiscreen setup (based on where the |
| 289 // mouse is). | 284 // mouse is). |
| 290 gfx::Rect near_last_location(last_location_, gfx::Size()); | 285 gfx::Rect near_last_location(last_location_, gfx::Size()); |
| 291 // Reparenting will cause Relayout and possible dock shrinking. | 286 // Reparenting will cause Relayout and possible dock shrinking. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 } else if (wm::GetWindowState(window)->IsDocked() && | 319 } else if (wm::GetWindowState(window)->IsDocked() && |
| 325 action == DOCKED_ACTION_UNDOCK) { | 320 action == DOCKED_ACTION_UNDOCK) { |
| 326 const wm::WMEvent event(wm::WM_EVENT_NORMAL); | 321 const wm::WMEvent event(wm::WM_EVENT_NORMAL); |
| 327 window_state_->OnWMEvent(&event); | 322 window_state_->OnWMEvent(&event); |
| 328 } | 323 } |
| 329 | 324 |
| 330 return action; | 325 return action; |
| 331 } | 326 } |
| 332 | 327 |
| 333 } // namespace ash | 328 } // namespace ash |
| OLD | NEW |