Files
windowmanager/wmserver/include/minimize_app.h
T
l00574490 1a08f2961a fix bug
Signed-off-by: l00574490 <liuqi149@huawei.com>
Change-Id: I3a2a2017ffffc39262c47ff5ce87059e0db95dd5
2022-07-11 22:32:11 +08:00

68 lines
2.2 KiB
C++

/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_ROSEN_MINIMIZE_APP_H
#define OHOS_ROSEN_MINIMIZE_APP_H
#include <map>
#include <vector>
#include <refbase.h>
#include "wm_common.h"
#include "window_node.h"
namespace OHOS {
namespace Rosen {
enum class MinimizeReason : uint32_t {
MINIMIZE_BUTTON,
MINIMIZE_ALL,
LAYOUT_TILE,
LAYOUT_CASCADE,
MAX_APP_COUNT,
SPLIT_REPLACE,
SPLIT_QUIT,
GESTURE_ANIMATION,
OTHER_WINDOW,
};
class MinimizeApp : public RefBase {
public:
MinimizeApp() = delete;
~MinimizeApp() = default;
static void AddNeedMinimizeApp(const sptr<WindowNode>& node, MinimizeReason reason);
static void ExecuteMinimizeAll();
static void ExecuteMinimizeTargetReason(MinimizeReason reason);
static void SetMinimizedByOtherConfig(bool isMinimizedByOther);
static void ClearNodesWithReason(MinimizeReason reason);
static bool IsNodeNeedMinimize(const sptr<WindowNode>& node);
static std::vector<wptr<WindowNode>> GetNeedMinimizeAppNodes();
static sptr<WindowNode> GetRecoverdNodeFromMinimizeList();
private:
static inline bool IsFromUser(MinimizeReason reason)
{
return (reason == MinimizeReason::MINIMIZE_ALL || reason == MinimizeReason::MINIMIZE_BUTTON ||
reason == MinimizeReason::MAX_APP_COUNT || reason == MinimizeReason::LAYOUT_TILE ||
reason == MinimizeReason::SPLIT_REPLACE || reason == MinimizeReason::SPLIT_QUIT);
}
static std::map<MinimizeReason, std::vector<wptr<WindowNode>>> needMinimizeAppNodes_;
static bool isMinimizedByOtherWindow_;
static std::recursive_mutex mutex_;
};
} // Rosen
} // OHOS
#endif // OHOS_ROSEN_MINIMIZE_APP_H