diff --git a/utils/include/window_helper.h b/utils/include/window_helper.h index 6c0601bd..8dc8050b 100644 --- a/utils/include/window_helper.h +++ b/utils/include/window_helper.h @@ -64,6 +64,11 @@ public: return ((IsMainWindow(type)) && (mode == WindowMode::WINDOW_MODE_FULLSCREEN)); } + static inline bool IsMainNotFloatingWindow(WindowType type, WindowMode mode) + { + return ((IsMainWindow(type)) && (mode != WindowMode::WINDOW_MODE_FLOATING)); + } + static inline bool IsFloatintWindow(WindowMode mode) { return mode == WindowMode::WINDOW_MODE_FLOATING; diff --git a/wmserver/src/window_node_container.cpp b/wmserver/src/window_node_container.cpp index c51b4555..c3e8c91a 100644 --- a/wmserver/src/window_node_container.cpp +++ b/wmserver/src/window_node_container.cpp @@ -260,7 +260,6 @@ WMError WindowNodeContainer::RemoveWindowNode(sptr& node) WLOGFE("window node or surface node is nullptr, invalid"); return WMError::WM_ERROR_DESTROYED_OBJECT; } - if (node->parent_ == nullptr) { WLOGFW("can't find parent of this node"); } else { @@ -280,7 +279,6 @@ WMError WindowNodeContainer::RemoveWindowNode(sptr& node) child->GetCallingUid(), false, child->GetWindowType())); } } - // Remove node from RSTree for (auto& displayId : node->GetShowingDisplays()) { UpdateRSTree(node, displayId, false, node->isPlayAnimationHide_); @@ -291,13 +289,14 @@ WMError WindowNodeContainer::RemoveWindowNode(sptr& node) displayGroupController_->UpdateDisplayGroupWindowTree(); layoutPolicy_->RemoveWindowNode(node); + WindowMode lastMode = node->GetWindowMode(); if (HandleRemoveWindow(node) != WMError::WM_OK) { return WMError::WM_ERROR_NULLPTR; } - NotifyIfAvoidAreaChanged(node, AvoidControlType::AVOID_NODE_REMOVE); - if (WindowHelper::IsMainFullScreenWindow(node->GetWindowType(), node->GetWindowMode())) { + if (WindowHelper::IsMainNotFloatingWindow(node->GetWindowType(), lastMode)) { NotifyDockWindowStateChanged(node, true); } + NotifyIfAvoidAreaChanged(node, AvoidControlType::AVOID_NODE_REMOVE); UpdateWindowVisibilityInfos(infos); DumpScreenWindowTree(); NotifyAccessibilityWindowInfo(node, WindowUpdateType::WINDOW_UPDATE_REMOVED);