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 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 DCHECK(!widget_); | 1144 DCHECK(!widget_); |
1145 | 1145 |
1146 views::Widget::InitParams params; | 1146 views::Widget::InitParams params; |
1147 params.type = views::Widget::InitParams::TYPE_WINDOW; | 1147 params.type = views::Widget::InitParams::TYPE_WINDOW; |
1148 params.ownership = views::Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET; | 1148 params.ownership = views::Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET; |
1149 params.delegate = this; | 1149 params.delegate = this; |
1150 params.shadow_type = views::Widget::InitParams::SHADOW_TYPE_NONE; | 1150 params.shadow_type = views::Widget::InitParams::SHADOW_TYPE_NONE; |
1151 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 1151 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
1152 params.show_state = show_state; | 1152 params.show_state = show_state; |
1153 // Make shell surface a transient child if |parent_| has been set. | 1153 // Make shell surface a transient child if |parent_| has been set. |
1154 params.parent = | 1154 params.parent = parent_ ? parent_ |
1155 parent_ ? parent_ : WMHelper::GetInstance()->GetContainer(container_); | 1155 : WMHelper::GetInstance()->GetContainer( |
| 1156 primary_display_id_, container_); |
1156 params.bounds = gfx::Rect(origin_, gfx::Size()); | 1157 params.bounds = gfx::Rect(origin_, gfx::Size()); |
1157 bool activatable = activatable_; | 1158 bool activatable = activatable_; |
1158 // ShellSurfaces in system modal container are only activatable if input | 1159 // ShellSurfaces in system modal container are only activatable if input |
1159 // region is non-empty. See OnCommitSurface() for more details. | 1160 // region is non-empty. See OnCommitSurface() for more details. |
1160 if (container_ == ash::kShellWindowId_SystemModalContainer) | 1161 if (container_ == ash::kShellWindowId_SystemModalContainer) |
1161 activatable &= !surface_->GetHitTestBounds().IsEmpty(); | 1162 activatable &= !surface_->GetHitTestBounds().IsEmpty(); |
1162 params.activatable = activatable ? views::Widget::InitParams::ACTIVATABLE_YES | 1163 params.activatable = activatable ? views::Widget::InitParams::ACTIVATABLE_YES |
1163 : views::Widget::InitParams::ACTIVATABLE_NO; | 1164 : views::Widget::InitParams::ACTIVATABLE_NO; |
1164 | 1165 |
1165 // Note: NativeWidget owns this widget. | 1166 // Note: NativeWidget owns this widget. |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 gfx::Point ShellSurface::GetMouseLocation() const { | 1699 gfx::Point ShellSurface::GetMouseLocation() const { |
1699 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); | 1700 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); |
1700 gfx::Point location = | 1701 gfx::Point location = |
1701 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); | 1702 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); |
1702 aura::Window::ConvertPointToTarget( | 1703 aura::Window::ConvertPointToTarget( |
1703 root_window, widget_->GetNativeWindow()->parent(), &location); | 1704 root_window, widget_->GetNativeWindow()->parent(), &location); |
1704 return location; | 1705 return location; |
1705 } | 1706 } |
1706 | 1707 |
1707 } // namespace exo | 1708 } // namespace exo |
OLD | NEW |