| 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 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 SetApplicationId(window, application_id_); | 1175 SetApplicationId(window, application_id_); |
| 1176 SetMainSurface(window, surface_); | 1176 SetMainSurface(window, surface_); |
| 1177 | 1177 |
| 1178 // Start tracking changes to window bounds and window state. | 1178 // Start tracking changes to window bounds and window state. |
| 1179 window->AddObserver(this); | 1179 window->AddObserver(this); |
| 1180 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); | 1180 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); |
| 1181 window_state->AddObserver(this); | 1181 window_state->AddObserver(this); |
| 1182 | 1182 |
| 1183 // Allow the client to request bounds that do not fill the entire work area | 1183 // Allow the client to request bounds that do not fill the entire work area |
| 1184 // when maximized, or the entire display when fullscreen. | 1184 // when maximized, or the entire display when fullscreen. |
| 1185 window_state->set_allow_set_bounds_in_maximized( | 1185 window_state->set_allow_set_bounds_direct(bounds_mode_ == BoundsMode::CLIENT); |
| 1186 bounds_mode_ == BoundsMode::CLIENT); | |
| 1187 | 1186 |
| 1188 // Notify client of initial state if different than normal. | 1187 // Notify client of initial state if different than normal. |
| 1189 if (window_state->GetStateType() != ash::wm::WINDOW_STATE_TYPE_NORMAL && | 1188 if (window_state->GetStateType() != ash::wm::WINDOW_STATE_TYPE_NORMAL && |
| 1190 !state_changed_callback_.is_null()) { | 1189 !state_changed_callback_.is_null()) { |
| 1191 state_changed_callback_.Run(ash::wm::WINDOW_STATE_TYPE_NORMAL, | 1190 state_changed_callback_.Run(ash::wm::WINDOW_STATE_TYPE_NORMAL, |
| 1192 window_state->GetStateType()); | 1191 window_state->GetStateType()); |
| 1193 } | 1192 } |
| 1194 | 1193 |
| 1195 // Disable movement if bounds are controlled by the client or fixed. | 1194 // Disable movement if bounds are controlled by the client or fixed. |
| 1196 bool movement_disabled = bounds_mode_ != BoundsMode::SHELL; | 1195 bool movement_disabled = bounds_mode_ != BoundsMode::SHELL; |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1453 | 1452 |
| 1454 void ShellSurface::UpdateWidgetBounds() { | 1453 void ShellSurface::UpdateWidgetBounds() { |
| 1455 DCHECK(widget_); | 1454 DCHECK(widget_); |
| 1456 | 1455 |
| 1457 // Return early if the shell is currently managing the bounds of the widget. | 1456 // Return early if the shell is currently managing the bounds of the widget. |
| 1458 // 1) When a window is either maximized/fullscreen/pinned, and the bounds | 1457 // 1) When a window is either maximized/fullscreen/pinned, and the bounds |
| 1459 // are not controlled by a client. | 1458 // are not controlled by a client. |
| 1460 ash::wm::WindowState* window_state = | 1459 ash::wm::WindowState* window_state = |
| 1461 ash::wm::GetWindowState(widget_->GetNativeWindow()); | 1460 ash::wm::GetWindowState(widget_->GetNativeWindow()); |
| 1462 if (window_state->IsMaximizedOrFullscreenOrPinned() && | 1461 if (window_state->IsMaximizedOrFullscreenOrPinned() && |
| 1463 !window_state->allow_set_bounds_in_maximized()) { | 1462 !window_state->allow_set_bounds_direct()) { |
| 1464 return; | 1463 return; |
| 1465 } | 1464 } |
| 1466 | 1465 |
| 1467 // 2) When a window is being dragged. | 1466 // 2) When a window is being dragged. |
| 1468 if (IsResizing()) | 1467 if (IsResizing()) |
| 1469 return; | 1468 return; |
| 1470 | 1469 |
| 1471 // Return early if there is pending configure requests. | 1470 // Return early if there is pending configure requests. |
| 1472 if (!pending_configs_.empty() || scoped_configure_) | 1471 if (!pending_configs_.empty() || scoped_configure_) |
| 1473 return; | 1472 return; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 | 1621 |
| 1623 // Put the black background layer behind the window if | 1622 // Put the black background layer behind the window if |
| 1624 // 1) the window is in immersive fullscreen, maximized or is active with | 1623 // 1) the window is in immersive fullscreen, maximized or is active with |
| 1625 // spoken feedback enabled. | 1624 // spoken feedback enabled. |
| 1626 // 2) the window can control the bounds of the window in fullscreen ( | 1625 // 2) the window can control the bounds of the window in fullscreen ( |
| 1627 // thus the background can be visible). | 1626 // thus the background can be visible). |
| 1628 // 3) the window has no transform (the transformed background may | 1627 // 3) the window has no transform (the transformed background may |
| 1629 // not cover the entire background, e.g. overview mode). | 1628 // not cover the entire background, e.g. overview mode). |
| 1630 if ((widget_->IsFullscreen() || widget_->IsMaximized() || | 1629 if ((widget_->IsFullscreen() || widget_->IsMaximized() || |
| 1631 underlay_capture_events) && | 1630 underlay_capture_events) && |
| 1632 ash::wm::GetWindowState(window)->allow_set_bounds_in_maximized() && | 1631 ash::wm::GetWindowState(window)->allow_set_bounds_direct() && |
| 1633 window->layer()->GetTargetTransform().IsIdentity()) { | 1632 window->layer()->GetTargetTransform().IsIdentity()) { |
| 1634 if (shadow_underlay_in_surface_) { | 1633 if (shadow_underlay_in_surface_) { |
| 1635 shadow_underlay_bounds = gfx::Rect(surface_->window()->bounds().size()); | 1634 shadow_underlay_bounds = gfx::Rect(surface_->window()->bounds().size()); |
| 1636 } else { | 1635 } else { |
| 1637 gfx::Point origin; | 1636 gfx::Point origin; |
| 1638 origin -= window->bounds().origin().OffsetFromOrigin(); | 1637 origin -= window->bounds().origin().OffsetFromOrigin(); |
| 1639 shadow_bounds.set_origin(origin); | 1638 shadow_bounds.set_origin(origin); |
| 1640 shadow_bounds.set_size(window->parent()->bounds().size()); | 1639 shadow_bounds.set_size(window->parent()->bounds().size()); |
| 1641 } | 1640 } |
| 1642 shadow_underlay_opacity = 1.0f; | 1641 shadow_underlay_opacity = 1.0f; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1698 gfx::Point ShellSurface::GetMouseLocation() const { | 1697 gfx::Point ShellSurface::GetMouseLocation() const { |
| 1699 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); | 1698 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); |
| 1700 gfx::Point location = | 1699 gfx::Point location = |
| 1701 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); | 1700 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); |
| 1702 aura::Window::ConvertPointToTarget( | 1701 aura::Window::ConvertPointToTarget( |
| 1703 root_window, widget_->GetNativeWindow()->parent(), &location); | 1702 root_window, widget_->GetNativeWindow()->parent(), &location); |
| 1704 return location; | 1703 return location; |
| 1705 } | 1704 } |
| 1706 | 1705 |
| 1707 } // namespace exo | 1706 } // namespace exo |
| OLD | NEW |