OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/shell_surface.h" | 5 #include "components/exo/shell_surface.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/frame/custom_frame_view_ash.h" | 9 #include "ash/frame/custom_frame_view_ash.h" |
10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 DCHECK(!widget_); | 1122 DCHECK(!widget_); |
1123 | 1123 |
1124 views::Widget::InitParams params; | 1124 views::Widget::InitParams params; |
1125 params.type = views::Widget::InitParams::TYPE_WINDOW; | 1125 params.type = views::Widget::InitParams::TYPE_WINDOW; |
1126 params.ownership = views::Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET; | 1126 params.ownership = views::Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET; |
1127 params.delegate = this; | 1127 params.delegate = this; |
1128 params.shadow_type = views::Widget::InitParams::SHADOW_TYPE_NONE; | 1128 params.shadow_type = views::Widget::InitParams::SHADOW_TYPE_NONE; |
1129 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 1129 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
1130 params.show_state = show_state; | 1130 params.show_state = show_state; |
1131 // Make shell surface a transient child if |parent_| has been set. | 1131 // Make shell surface a transient child if |parent_| has been set. |
1132 params.parent = | 1132 params.parent = parent_ ? parent_ |
1133 parent_ ? parent_ : WMHelper::GetInstance()->GetContainer(container_); | 1133 : WMHelper::GetInstance()->GetContainer( |
| 1134 primary_display_id_, container_); |
1134 params.bounds = gfx::Rect(origin_, gfx::Size()); | 1135 params.bounds = gfx::Rect(origin_, gfx::Size()); |
1135 bool activatable = activatable_; | 1136 bool activatable = activatable_; |
1136 // ShellSurfaces in system modal container are only activatable if input | 1137 // ShellSurfaces in system modal container are only activatable if input |
1137 // region is non-empty. See OnCommitSurface() for more details. | 1138 // region is non-empty. See OnCommitSurface() for more details. |
1138 if (container_ == ash::kShellWindowId_SystemModalContainer) | 1139 if (container_ == ash::kShellWindowId_SystemModalContainer) |
1139 activatable &= !surface_->GetHitTestBounds().IsEmpty(); | 1140 activatable &= !surface_->GetHitTestBounds().IsEmpty(); |
1140 params.activatable = activatable ? views::Widget::InitParams::ACTIVATABLE_YES | 1141 params.activatable = activatable ? views::Widget::InitParams::ACTIVATABLE_YES |
1141 : views::Widget::InitParams::ACTIVATABLE_NO; | 1142 : views::Widget::InitParams::ACTIVATABLE_NO; |
1142 | 1143 |
1143 // Note: NativeWidget owns this widget. | 1144 // Note: NativeWidget owns this widget. |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1664 gfx::Point ShellSurface::GetMouseLocation() const { | 1665 gfx::Point ShellSurface::GetMouseLocation() const { |
1665 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); | 1666 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); |
1666 gfx::Point location = | 1667 gfx::Point location = |
1667 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); | 1668 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); |
1668 aura::Window::ConvertPointToTarget( | 1669 aura::Window::ConvertPointToTarget( |
1669 root_window, widget_->GetNativeWindow()->parent(), &location); | 1670 root_window, widget_->GetNativeWindow()->parent(), &location); |
1670 return location; | 1671 return location; |
1671 } | 1672 } |
1672 | 1673 |
1673 } // namespace exo | 1674 } // namespace exo |
OLD | NEW |