| 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/common/frame/custom_frame_view_ash.h" | 9 #include "ash/common/frame/custom_frame_view_ash.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| (...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 SetApplicationId(window, application_id_); | 1151 SetApplicationId(window, application_id_); |
| 1152 SetMainSurface(window, surface_); | 1152 SetMainSurface(window, surface_); |
| 1153 | 1153 |
| 1154 // Start tracking changes to window bounds and window state. | 1154 // Start tracking changes to window bounds and window state. |
| 1155 window->AddObserver(this); | 1155 window->AddObserver(this); |
| 1156 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); | 1156 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); |
| 1157 window_state->AddObserver(this); | 1157 window_state->AddObserver(this); |
| 1158 | 1158 |
| 1159 // Allow the client to request bounds that do not fill the entire work area | 1159 // Allow the client to request bounds that do not fill the entire work area |
| 1160 // when maximized, or the entire display when fullscreen. | 1160 // when maximized, or the entire display when fullscreen. |
| 1161 window_state->set_allow_set_bounds_in_maximized( | 1161 window_state->set_allow_set_bounds_direct(bounds_mode_ == BoundsMode::CLIENT); |
| 1162 bounds_mode_ == BoundsMode::CLIENT); | |
| 1163 | 1162 |
| 1164 // Notify client of initial state if different than normal. | 1163 // Notify client of initial state if different than normal. |
| 1165 if (window_state->GetStateType() != ash::wm::WINDOW_STATE_TYPE_NORMAL && | 1164 if (window_state->GetStateType() != ash::wm::WINDOW_STATE_TYPE_NORMAL && |
| 1166 !state_changed_callback_.is_null()) { | 1165 !state_changed_callback_.is_null()) { |
| 1167 state_changed_callback_.Run(ash::wm::WINDOW_STATE_TYPE_NORMAL, | 1166 state_changed_callback_.Run(ash::wm::WINDOW_STATE_TYPE_NORMAL, |
| 1168 window_state->GetStateType()); | 1167 window_state->GetStateType()); |
| 1169 } | 1168 } |
| 1170 | 1169 |
| 1171 // Disable movement if bounds are controlled by the client or fixed. | 1170 // Disable movement if bounds are controlled by the client or fixed. |
| 1172 bool movement_disabled = bounds_mode_ != BoundsMode::SHELL; | 1171 bool movement_disabled = bounds_mode_ != BoundsMode::SHELL; |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 | 1395 |
| 1397 void ShellSurface::UpdateWidgetBounds() { | 1396 void ShellSurface::UpdateWidgetBounds() { |
| 1398 DCHECK(widget_); | 1397 DCHECK(widget_); |
| 1399 | 1398 |
| 1400 // Return early if the shell is currently managing the bounds of the widget. | 1399 // Return early if the shell is currently managing the bounds of the widget. |
| 1401 // 1) When a window is either maximized/fullscreen/pinned, and the bounds | 1400 // 1) When a window is either maximized/fullscreen/pinned, and the bounds |
| 1402 // are not controlled by a client. | 1401 // are not controlled by a client. |
| 1403 ash::wm::WindowState* window_state = | 1402 ash::wm::WindowState* window_state = |
| 1404 ash::wm::GetWindowState(widget_->GetNativeWindow()); | 1403 ash::wm::GetWindowState(widget_->GetNativeWindow()); |
| 1405 if (window_state->IsMaximizedOrFullscreenOrPinned() && | 1404 if (window_state->IsMaximizedOrFullscreenOrPinned() && |
| 1406 !window_state->allow_set_bounds_in_maximized()) { | 1405 !window_state->allow_set_bounds_direct()) { |
| 1407 return; | 1406 return; |
| 1408 } | 1407 } |
| 1409 | 1408 |
| 1410 // 2) When a window is being dragged. | 1409 // 2) When a window is being dragged. |
| 1411 if (IsResizing()) | 1410 if (IsResizing()) |
| 1412 return; | 1411 return; |
| 1413 | 1412 |
| 1414 // Return early if there is pending configure requests. | 1413 // Return early if there is pending configure requests. |
| 1415 if (!pending_configs_.empty() || scoped_configure_) | 1414 if (!pending_configs_.empty() || scoped_configure_) |
| 1416 return; | 1415 return; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 | 1540 |
| 1542 // Put the black background layer behind the window if | 1541 // Put the black background layer behind the window if |
| 1543 // 1) the window is in immersive fullscreen, maximized or is active with | 1542 // 1) the window is in immersive fullscreen, maximized or is active with |
| 1544 // spoken feedback enabled. | 1543 // spoken feedback enabled. |
| 1545 // 2) the window can control the bounds of the window in fullscreen ( | 1544 // 2) the window can control the bounds of the window in fullscreen ( |
| 1546 // thus the background can be visible). | 1545 // thus the background can be visible). |
| 1547 // 3) the window has no transform (the transformed background may | 1546 // 3) the window has no transform (the transformed background may |
| 1548 // not cover the entire background, e.g. overview mode). | 1547 // not cover the entire background, e.g. overview mode). |
| 1549 if ((widget_->IsFullscreen() || widget_->IsMaximized() || | 1548 if ((widget_->IsFullscreen() || widget_->IsMaximized() || |
| 1550 underlay_capture_events) && | 1549 underlay_capture_events) && |
| 1551 ash::wm::GetWindowState(window)->allow_set_bounds_in_maximized() && | 1550 ash::wm::GetWindowState(window)->allow_set_bounds_direct() && |
| 1552 window->layer()->GetTargetTransform().IsIdentity()) { | 1551 window->layer()->GetTargetTransform().IsIdentity()) { |
| 1553 if (shadow_underlay_in_surface_) { | 1552 if (shadow_underlay_in_surface_) { |
| 1554 shadow_underlay_bounds = gfx::Rect(surface_->window()->bounds().size()); | 1553 shadow_underlay_bounds = gfx::Rect(surface_->window()->bounds().size()); |
| 1555 } else { | 1554 } else { |
| 1556 gfx::Point origin; | 1555 gfx::Point origin; |
| 1557 origin -= window->bounds().origin().OffsetFromOrigin(); | 1556 origin -= window->bounds().origin().OffsetFromOrigin(); |
| 1558 shadow_bounds.set_origin(origin); | 1557 shadow_bounds.set_origin(origin); |
| 1559 shadow_bounds.set_size(window->parent()->bounds().size()); | 1558 shadow_bounds.set_size(window->parent()->bounds().size()); |
| 1560 } | 1559 } |
| 1561 shadow_underlay_opacity = 1.0f; | 1560 shadow_underlay_opacity = 1.0f; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1608 // small style shadow for them. | 1607 // small style shadow for them. |
| 1609 if (!activatable_) | 1608 if (!activatable_) |
| 1610 shadow->SetElevation(wm::ShadowElevation::SMALL); | 1609 shadow->SetElevation(wm::ShadowElevation::SMALL); |
| 1611 // We don't have rounded corners unless frame is enabled. | 1610 // We don't have rounded corners unless frame is enabled. |
| 1612 if (!frame_enabled_) | 1611 if (!frame_enabled_) |
| 1613 shadow->SetRoundedCornerRadius(0); | 1612 shadow->SetRoundedCornerRadius(0); |
| 1614 } | 1613 } |
| 1615 } | 1614 } |
| 1616 | 1615 |
| 1617 } // namespace exo | 1616 } // namespace exo |
| OLD | NEW |