1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "core/components_ng/pattern/window_scene/scene/input_scene.h"
17 
18 #include "core/components_ng/pattern/window_scene/helper/window_scene_helper.h"
19 #include "core/components_ng/render/adapter/rosen_render_context.h"
20 #include "ui/rs_canvas_node.h"
21 
22 namespace OHOS::Ace::NG {
InputScene(const sptr<Rosen::Session> & session)23 InputScene::InputScene(const sptr<Rosen::Session>& session) : SystemWindowScene(session)
24 {}
25 
OnAttachToFrameNode()26 void InputScene::OnAttachToFrameNode()
27 {
28     SystemWindowScene::OnAttachToFrameNode();
29     auto host = GetHost();
30     CHECK_NULL_VOID(host);
31     auto context = AceType::DynamicCast<NG::RosenRenderContext>(host->GetRenderContext());
32     CHECK_NULL_VOID(context);
33     auto rsNode = Rosen::RSCanvasNode::Create();
34     CHECK_NULL_VOID(rsNode);
35     context->SetRSNode(rsNode);
36     rsNode->SetBoundsChangedCallback(boundsChangedCallback_);
37 }
38 
GetWindowPatternType() const39 uint32_t InputScene::GetWindowPatternType() const
40 {
41     return static_cast<uint32_t>(WindowPatternType::INPUT_SCENE);
42 }
43 } // namespace OHOS::Ace::NG
44