mirror of
https://github.com/openharmony/windowmanager.git
synced 2026-07-21 04:25:28 -04:00
!930 no operation with ToggleShownStateForAllAppWindows interface when the top window is recent
Merge pull request !930 from xiaojianfeng/master
This commit is contained in:
@@ -73,7 +73,7 @@ public:
|
||||
sptr<WindowNode> GetNextActiveWindow(uint32_t windowId) const;
|
||||
void MinimizeAllAppWindows(DisplayId displayId);
|
||||
void MinimizeOldestAppWindow();
|
||||
void ToggleShownStateForAllAppWindows(std::function<bool(uint32_t, WindowMode)> restoreFunc, bool restore);
|
||||
WMError ToggleShownStateForAllAppWindows(std::function<bool(uint32_t, WindowMode)> restoreFunc, bool restore);
|
||||
void RestoreAllAppWindows(std::function<bool(uint32_t, WindowMode)> restoreFunc);
|
||||
bool IsAppWindowsEmpty() const;
|
||||
void ProcessWindowStateChange(WindowState state, WindowStateChangeReason reason);
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
std::shared_ptr<RSSurfaceNode> GetSurfaceNodeByAbilityToken(const sptr<IRemoteObject>& abilityToken) const;
|
||||
WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId);
|
||||
void MinimizeAllAppWindows(DisplayId displayId);
|
||||
void ToggleShownStateForAllAppWindows();
|
||||
WMError ToggleShownStateForAllAppWindows();
|
||||
WMError MaxmizeWindow(uint32_t windowId);
|
||||
WMError SetWindowLayoutMode(DisplayId displayId, WindowLayoutMode mode);
|
||||
|
||||
|
||||
@@ -634,8 +634,7 @@ WMError WindowController::ToggleShownStateForAllAppWindows()
|
||||
if (isScreenLocked_) {
|
||||
return WMError::WM_DO_NOTHING;
|
||||
}
|
||||
windowRoot_->ToggleShownStateForAllAppWindows();
|
||||
return WMError::WM_OK;
|
||||
return windowRoot_->ToggleShownStateForAllAppWindows();
|
||||
}
|
||||
|
||||
WMError WindowController::MaxmizeWindow(uint32_t windowId)
|
||||
|
||||
@@ -1316,10 +1316,15 @@ void WindowNodeContainer::MinimizeOldestAppWindow()
|
||||
WLOGFI("no window needs to minimize");
|
||||
}
|
||||
|
||||
void WindowNodeContainer::ToggleShownStateForAllAppWindows(
|
||||
WMError WindowNodeContainer::ToggleShownStateForAllAppWindows(
|
||||
std::function<bool(uint32_t, WindowMode)> restoreFunc, bool restore)
|
||||
{
|
||||
WLOGFI("ToggleShownStateForAllAppWindows");
|
||||
for (auto node : aboveAppWindowNode_->children_) {
|
||||
if (node->GetWindowType() == WindowType::WINDOW_TYPE_LAUNCHER_RECENT) {
|
||||
return WMError::WM_DO_NOTHING;
|
||||
}
|
||||
}
|
||||
// to do, backup reentry: 1.ToggleShownStateForAllAppWindows fast; 2.this display should reset backupWindowIds_.
|
||||
if (!restore && appWindowNode_->children_.empty() && !backupWindowIds_.empty()) {
|
||||
backupWindowIds_.clear();
|
||||
@@ -1359,6 +1364,7 @@ void WindowNodeContainer::ToggleShownStateForAllAppWindows(
|
||||
} else {
|
||||
WLOGFI("do nothing because shown app windows is empty or backup windows is empty.");
|
||||
}
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
|
||||
void WindowNodeContainer::RestoreAllAppWindows(std::function<bool(uint32_t, WindowMode)> restoreFunc)
|
||||
|
||||
@@ -274,7 +274,7 @@ void WindowRoot::MinimizeAllAppWindows(DisplayId displayId)
|
||||
return container->MinimizeAllAppWindows(displayId);
|
||||
}
|
||||
|
||||
void WindowRoot::ToggleShownStateForAllAppWindows()
|
||||
WMError WindowRoot::ToggleShownStateForAllAppWindows()
|
||||
{
|
||||
std::vector<DisplayId> displays = DisplayManagerServiceInner::GetInstance().GetAllDisplayIds();
|
||||
std::vector<sptr<WindowNodeContainer>> containers;
|
||||
@@ -288,8 +288,9 @@ void WindowRoot::ToggleShownStateForAllAppWindows()
|
||||
containers.emplace_back(container);
|
||||
isAllAppWindowsEmpty = isAllAppWindowsEmpty && container->IsAppWindowsEmpty();
|
||||
}
|
||||
WMError res = WMError::WM_OK;
|
||||
std::for_each(containers.begin(), containers.end(),
|
||||
[this, isAllAppWindowsEmpty] (sptr<WindowNodeContainer> container) {
|
||||
[this, isAllAppWindowsEmpty, &res] (sptr<WindowNodeContainer> container) {
|
||||
auto restoreFunc = [this](uint32_t windowId, WindowMode mode) {
|
||||
auto windowNode = GetWindowNode(windowId);
|
||||
if (windowNode == nullptr) {
|
||||
@@ -310,12 +311,15 @@ void WindowRoot::ToggleShownStateForAllAppWindows()
|
||||
WindowManagerService::GetInstance().HandleAddWindow(property);
|
||||
return true;
|
||||
};
|
||||
WMError tmpRes = WMError::WM_OK;
|
||||
if (isAllAppWindowsEmpty) {
|
||||
container->ToggleShownStateForAllAppWindows(restoreFunc, true);
|
||||
tmpRes = container->ToggleShownStateForAllAppWindows(restoreFunc, true);
|
||||
} else {
|
||||
container->ToggleShownStateForAllAppWindows(restoreFunc, false);
|
||||
tmpRes = container->ToggleShownStateForAllAppWindows(restoreFunc, false);
|
||||
}
|
||||
res = (res == WMError::WM_OK) ? tmpRes : res;
|
||||
});
|
||||
return res;
|
||||
}
|
||||
|
||||
WMError WindowRoot::MaxmizeWindow(uint32_t windowId)
|
||||
|
||||
Reference in New Issue
Block a user