add tile switch to cascade strategy

Signed-off-by: jincanran <jincanran@huawei.com>
Change-Id: Id8599766cd8556ddb775d0d792b9353debb580c5
This commit is contained in:
jincanran
2022-02-17 14:39:50 +08:00
parent 40e7a609cd
commit 2e6627e283
6 changed files with 25 additions and 12 deletions
+9
View File
@@ -35,6 +35,15 @@ enum class WindowStateChangeReason : uint32_t {
NORMAL,
KEYGUARD,
};
enum class WindowUpdateReason : uint32_t {
UPDATE_ALL,
UPDATE_MODE,
UPDATE_RECT,
UPDATE_FLAGS,
UPDATE_TYPE,
UPDATE_OTHER_PROPS,
};
}
}
#endif // OHOS_ROSEN_WM_COMMON_INNER_H
+1 -1
View File
@@ -33,7 +33,7 @@ public:
~WindowNodeContainer();
WMError AddWindowNode(sptr<WindowNode>& node, sptr<WindowNode>& parentNode);
WMError RemoveWindowNode(sptr<WindowNode>& node);
WMError UpdateWindowNode(sptr<WindowNode>& node);
WMError UpdateWindowNode(sptr<WindowNode>& node, WindowUpdateReason reason);
WMError DestroyWindowNode(sptr<WindowNode>& node, std::vector<uint32_t>& windowIds);
const std::vector<uint32_t>& Destroy();
void AssignZOrder();
+1 -1
View File
@@ -44,7 +44,7 @@ public:
WMError AddWindowNode(uint32_t parentId, sptr<WindowNode>& node);
WMError RemoveWindowNode(uint32_t windowId);
WMError DestroyWindow(uint32_t windowId, bool onlySelf);
WMError UpdateWindowNode(uint32_t windowId);
WMError UpdateWindowNode(uint32_t windowId, WindowUpdateReason reason);
bool isVerticalDisplay(sptr<WindowNode>& node) const;
WMError RequestFocus(uint32_t windowId);
+5 -5
View File
@@ -148,7 +148,7 @@ WMError WindowController::ResizeRect(uint32_t windowId, const Rect& rect, Window
}
property->SetWindowRect(newRect);
WMError res = windowRoot_->UpdateWindowNode(windowId);
WMError res = windowRoot_->UpdateWindowNode(windowId, WindowUpdateReason::UPDATE_RECT);
if (res != WMError::WM_OK) {
return res;
}
@@ -202,7 +202,7 @@ WMError WindowController::SetWindowMode(uint32_t windowId, WindowMode dstMode)
return res;
}
}
res = windowRoot_->UpdateWindowNode(windowId);
res = windowRoot_->UpdateWindowNode(windowId, WindowUpdateReason::UPDATE_MODE);
if (res != WMError::WM_OK) {
WLOGFE("Set window mode failed, update node failed");
return res;
@@ -315,7 +315,7 @@ WMError WindowController::SetWindowType(uint32_t windowId, WindowType type)
auto property = node->GetWindowProperty();
property->SetWindowType(type);
UpdateWindowAnimation(node);
WMError res = windowRoot_->UpdateWindowNode(windowId);
WMError res = windowRoot_->UpdateWindowNode(windowId, WindowUpdateReason::UPDATE_TYPE);
if (res != WMError::WM_OK) {
return res;
}
@@ -333,7 +333,7 @@ WMError WindowController::SetWindowFlags(uint32_t windowId, uint32_t flags)
}
auto property = node->GetWindowProperty();
property->SetWindowFlags(flags);
WMError res = windowRoot_->UpdateWindowNode(windowId);
WMError res = windowRoot_->UpdateWindowNode(windowId, WindowUpdateReason::UPDATE_FLAGS);
if (res != WMError::WM_OK) {
return res;
}
@@ -350,7 +350,7 @@ WMError WindowController::SetSystemBarProperty(uint32_t windowId, WindowType typ
return WMError::WM_ERROR_NULLPTR;
}
node->SetSystemBarProperty(type, property);
WMError res = windowRoot_->UpdateWindowNode(windowId);
WMError res = windowRoot_->UpdateWindowNode(windowId, WindowUpdateReason::UPDATE_OTHER_PROPS);
if (res != WMError::WM_OK) {
return res;
}
+7 -3
View File
@@ -137,13 +137,17 @@ WMError WindowNodeContainer::AddWindowNode(sptr<WindowNode>& node, sptr<WindowNo
return WMError::WM_OK;
}
WMError WindowNodeContainer::UpdateWindowNode(sptr<WindowNode>& node)
WMError WindowNodeContainer::UpdateWindowNode(sptr<WindowNode>& node, WindowUpdateReason reason)
{
if (!node->surfaceNode_) {
WLOGFE("surface node is nullptr!");
return WMError::WM_ERROR_NULLPTR;
}
SwitchLayoutPolicy(WindowLayoutMode::CASCADE);
if (layoutMode_ == WindowLayoutMode::TILE) {
if (WindowHelper::IsMainWindow(node->GetWindowType()) && reason != WindowUpdateReason::UPDATE_OTHER_PROPS) {
SwitchLayoutPolicy(WindowLayoutMode::CASCADE);
}
}
layoutPolicy_->UpdateWindowNode(node);
if (avoidController_->IsAvoidAreaNode(node)) {
avoidController_->UpdateAvoidAreaNode(node);
@@ -906,7 +910,7 @@ WMError WindowNodeContainer::UpdateWindowPairInfo(sptr<WindowNode>& triggerNode,
WindowMode::WINDOW_MODE_SPLIT_SECONDARY : WindowMode::WINDOW_MODE_SPLIT_PRIMARY;
pairNode->SetWindowMode(pairDstMode);
pairNode->GetWindowToken()->UpdateWindowMode(pairDstMode);
WMError ret = UpdateWindowNode(pairNode);
WMError ret = UpdateWindowNode(pairNode, WindowUpdateReason::UPDATE_MODE);
if (ret != WMError::WM_OK) {
WLOGFE("Update window pair info failed");
return ret;
+2 -2
View File
@@ -191,7 +191,7 @@ WMError WindowRoot::RemoveWindowNode(uint32_t windowId)
return container->RemoveWindowNode(node);
}
WMError WindowRoot::UpdateWindowNode(uint32_t windowId)
WMError WindowRoot::UpdateWindowNode(uint32_t windowId, WindowUpdateReason reason)
{
auto node = GetWindowNode(windowId);
if (node == nullptr) {
@@ -203,7 +203,7 @@ WMError WindowRoot::UpdateWindowNode(uint32_t windowId)
WLOGFE("add window failed, window container could not be found");
return WMError::WM_ERROR_NULLPTR;
}
return container->UpdateWindowNode(node);
return container->UpdateWindowNode(node, reason);
}
WMError WindowRoot::EnterSplitWindowMode(sptr<WindowNode>& node)