• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 #ifndef OHOS_ROSEN_WINDOW_SCENE_SCB_SYSTEM_SESSION_H
17 #define OHOS_ROSEN_WINDOW_SCENE_SCB_SYSTEM_SESSION_H
18 
19 #include "session/host/include/scene_session.h"
20 
21 namespace OHOS::Rosen {
22 using KeyboardPanelRectUpdateCallback = std::function<void()>;
23 class SCBSystemSession : public SceneSession {
24 public:
25     SCBSystemSession(const SessionInfo& info, const sptr<SpecificSessionCallback>& specificCallback);
26     ~SCBSystemSession();
27     void RegisterBufferAvailableCallback(const SystemSessionBufferAvailableCallback& func) override;
28     WSError ProcessPointDownSession(int32_t posX, int32_t posY) override;
29 
30     WSError NotifyClientToUpdateRect(const std::string& updateReason,
31         std::shared_ptr<RSTransaction> rsTransaction) override;
32     void PresentFocusIfPointDown() override;
33     WSError TransferKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) override;
34     void PresentFoucusIfNeed(int32_t pointerAcrion) override;
35     WSError UpdateFocus(bool isFocused) override;
36     WSError UpdateWindowMode(WindowMode mode) override;
37     WSError SetSystemSceneBlockingFocus(bool blocking) override;
38     void BindKeyboardSession(sptr<SceneSession> session) override;
39     sptr<SceneSession> GetKeyboardSession() const override;
40     void SetKeyboardPanelRectUpdateCallback(const KeyboardPanelRectUpdateCallback& func);
41     void SetSkipSelfWhenShowOnVirtualScreen(bool isSkip) override;
42     void SyncScenePanelGlobalPosition(bool needSync) override;
IsNeedSyncScenePanelGlobalPosition()43     bool IsNeedSyncScenePanelGlobalPosition() override { return isNeedSyncGlobalPos_; }
44     bool IsVisibleForeground() const override;
45 
46     /*
47      * App Use Control
48      */
49     bool GetIsUseControlSession() const override;
50     void SetIsUseControlSession(bool isUseControlSession) override;
51 
52 protected:
53     void UpdatePointerArea(const WSRect& rect) override;
54     void NotifyClientToUpdateAvoidArea() override;
55 
56 private:
57     KeyboardPanelRectUpdateCallback keyboardPanelRectUpdateCallback_;
58     bool isNeedSyncGlobalPos_ = true; // only accessed in main thread
59 
60     /*
61      * App Use Control
62      */
63     bool isUseControlSession_ = false; // Indicates whether the session is used for controlling a main session.
64 };
65 } // namespace OHOS::Rosen
66 #endif // OHOS_ROSEN_WINDOW_SCENE_SCB_SYSTEM_SESSION_H
67