check visibility for change focus and active window

Signed-off-by: xiahaiqin <xiahaiqin1@huawei.com>
Change-Id: I1eb6f29258e75fde11d1075e084accb85a78fdfc
This commit is contained in:
xiahaiqin
2022-07-14 19:10:02 +08:00
parent e7790d536a
commit 6ea7258ee6
2 changed files with 12 additions and 3 deletions
+7 -2
View File
@@ -415,6 +415,10 @@ bool WindowNodeContainer::UpdateRSTree(sptr<WindowNode>& node, DisplayId display
WLOGFI("UpdateRSTree windowId: %{public}d, displayId: %{public}" PRIu64", isAdd: %{public}d",
node->GetWindowId(), displayId, isAdd);
if (isAdd) {
if (!node->currentVisibility_) {
WLOGFI("window: %{public}d is invisible, do not need update RS tree", node->GetWindowId());
return;
}
auto& surfaceNode = node->leashWinSurfaceNode_ != nullptr ? node->leashWinSurfaceNode_ : node->surfaceNode_;
dms.UpdateRSTree(displayId, surfaceNode, true);
for (auto& child : node->children_) {
@@ -1283,7 +1287,7 @@ sptr<WindowNode> WindowNodeContainer::GetNextFocusableWindow(uint32_t windowId)
bool previousFocusedWindowFound = false;
WindowNodeOperationFunc func = [windowId, &nextFocusableWindow, &previousFocusedWindowFound](
sptr<WindowNode> node) {
if (previousFocusedWindowFound && node->GetWindowProperty()->GetFocusable()) {
if (previousFocusedWindowFound && node->GetWindowProperty()->GetFocusable() && node->currentVisibility_) {
nextFocusableWindow = node;
return true;
}
@@ -1328,7 +1332,8 @@ sptr<WindowNode> WindowNodeContainer::GetNextActiveWindow(uint32_t windowId) con
}
int index = std::distance(windowNodes.begin(), iter);
for (size_t i = static_cast<size_t>(index) + 1; i < windowNodes.size(); i++) {
if (windowNodes[i]->GetWindowType() == WindowType::WINDOW_TYPE_DOCK_SLICE) {
if (windowNodes[i]->GetWindowType() == WindowType::WINDOW_TYPE_DOCK_SLICE
|| !windowNodes[i]->currentVisibility_) {
continue;
}
return windowNodes[i];
+5 -1
View File
@@ -419,6 +419,10 @@ void WindowRoot::DestroyLeakStartingWindow()
WMError WindowRoot::PostProcessAddWindowNode(sptr<WindowNode>& node, sptr<WindowNode>& parentNode,
sptr<WindowNodeContainer>& container)
{
if (!node->currentVisibility_) {
WLOGFI("window is isVisible, do not need process");
return WMError::WM_DO_NOTHING;
}
if (WindowHelper::IsSubWindow(node->GetWindowType())) {
if (parentNode == nullptr) {
WLOGFE("window type is invalid");
@@ -880,7 +884,7 @@ WMError WindowRoot::RequestActiveWindow(uint32_t windowId)
WLOGFE("window container could not be found");
return WMError::WM_ERROR_NULLPTR;
}
auto res = container->SetActiveWindow(windowId, false);
auto res = container->SetActiveWindow(windowId, false);
WLOGFI("windowId:%{public}u, name:%{public}s, orientation:%{public}u, type:%{public}u, isMainWindow:%{public}d",
windowId, node->GetWindowName().c_str(), static_cast<uint32_t>(node->GetRequestedOrientation()),
node->GetWindowType(), WindowHelper::IsMainWindow(node->GetWindowType()));