Index: athena/screen/screen_manager_impl.cc |
diff --git a/athena/screen/screen_manager_impl.cc b/athena/screen/screen_manager_impl.cc |
index a154d522f2edcec74117a63d3aacab35e7fd2054..27bcf7576bac87f6bd92cf91495bda02d5085952 100644 |
--- a/athena/screen/screen_manager_impl.cc |
+++ b/athena/screen/screen_manager_impl.cc |
@@ -25,6 +25,7 @@ |
#include "ui/wm/core/base_focus_rules.h" |
#include "ui/wm/core/capture_controller.h" |
#include "ui/wm/core/focus_controller.h" |
+#include "ui/wm/core/window_util.h" |
namespace athena { |
namespace { |
@@ -43,12 +44,10 @@ bool GrabsInput(aura::Window* container) { |
// Returns the container which contains |window|. |
aura::Window* GetContainer(aura::Window* window) { |
- // No containers for NULL or the root window itself. |
- if (!window || !window->parent()) |
- return NULL; |
- if (window->parent()->IsRootWindow()) |
- return window; |
- return GetContainer(window->parent()); |
+ aura::Window* container = window; |
+ while (container && !container->GetProperty(kContainerParamsKey)) |
+ container = container->parent(); |
+ return container; |
} |
class AthenaFocusRules : public wm::BaseFocusRules { |
@@ -95,6 +94,9 @@ class AthenaWindowTreeClient : public aura::client::WindowTreeClient { |
virtual aura::Window* GetDefaultParent(aura::Window* context, |
aura::Window* window, |
const gfx::Rect& bounds) OVERRIDE { |
+ aura::Window* transient_parent = wm::GetTransientParent(window); |
+ if (transient_parent) |
+ return GetContainer(transient_parent); |
return container_; |
} |