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/window_util.h" | 5 #include "ash/wm/window_util.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
13 #include "ash/wm/activation_controller.h" | 13 #include "ash/wm/activation_controller.h" |
14 #include "ash/wm/window_properties.h" | 14 #include "ash/wm/window_properties.h" |
15 #include "ui/aura/client/activation_client.h" | 15 #include "ui/aura/client/activation_client.h" |
16 #include "ui/aura/client/aura_constants.h" | 16 #include "ui/aura/client/aura_constants.h" |
17 #include "ui/aura/root_window.h" | 17 #include "ui/aura/root_window.h" |
18 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
19 #include "ui/aura/window_delegate.h" | 19 #include "ui/aura/window_delegate.h" |
20 #include "ui/compositor/layer.h" | 20 #include "ui/compositor/layer.h" |
21 #include "ui/gfx/display.h" | 21 #include "ui/gfx/display.h" |
22 #include "ui/gfx/rect.h" | 22 #include "ui/gfx/rect.h" |
23 #include "ui/gfx/screen.h" | 23 #include "ui/gfx/screen.h" |
24 #include "ui/views/corewm/window_util.h" | 24 #include "ui/views/corewm/window_util.h" |
| 25 #include "ui/views/view.h" |
| 26 #include "ui/views/widget/widget.h" |
25 | 27 |
26 namespace ash { | 28 namespace ash { |
27 namespace wm { | 29 namespace wm { |
28 | 30 |
29 // TODO(beng): replace many of these functions with the corewm versions. | 31 // TODO(beng): replace many of these functions with the corewm versions. |
30 void ActivateWindow(aura::Window* window) { | 32 void ActivateWindow(aura::Window* window) { |
31 views::corewm::ActivateWindow(window); | 33 views::corewm::ActivateWindow(window); |
32 } | 34 } |
33 | 35 |
34 void DeactivateWindow(aura::Window* window) { | 36 void DeactivateWindow(aura::Window* window) { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 int x_offset = 0; | 196 int x_offset = 0; |
195 if (work_area.right() < bounds->x()) { | 197 if (work_area.right() < bounds->x()) { |
196 x_offset = work_area.right() - bounds->x() - min_width; | 198 x_offset = work_area.right() - bounds->x() - min_width; |
197 } else if (bounds->right() < work_area.x()) { | 199 } else if (bounds->right() < work_area.x()) { |
198 x_offset = work_area.x() - bounds->right() + min_width; | 200 x_offset = work_area.x() - bounds->right() + min_width; |
199 } | 201 } |
200 bounds->Offset(x_offset, y_offset); | 202 bounds->Offset(x_offset, y_offset); |
201 } | 203 } |
202 } | 204 } |
203 | 205 |
| 206 void MoveWindowToEventRoot(aura::Window* window, const ui::Event& event) { |
| 207 views::View* target = static_cast<views::View*>(event.target()); |
| 208 if (!target) |
| 209 return; |
| 210 aura::RootWindow* target_root = |
| 211 target->GetWidget()->GetNativeView()->GetRootWindow(); |
| 212 if (!target_root || target_root == window->GetRootWindow()) |
| 213 return; |
| 214 aura::Window* window_container = |
| 215 ash::Shell::GetContainer(target_root, window->parent()->id()); |
| 216 // Move the window to the target launcher. |
| 217 window_container->AddChild(window); |
| 218 } |
| 219 |
204 } // namespace wm | 220 } // namespace wm |
205 } // namespace ash | 221 } // namespace ash |
OLD | NEW |