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 WSError ProcessPointDownSession(int32_t posX, int32_t posY) override; 28 29 WSError NotifyClientToUpdateRect(const std::string& updateReason, 30 std::shared_ptr<RSTransaction> rsTransaction) override; 31 void PresentFocusIfPointDown() override; 32 WSError TransferKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) override; 33 void PresentFoucusIfNeed(int32_t pointerAcrion) override; 34 WSError UpdateFocus(bool isFocused) override; 35 WSError UpdateWindowMode(WindowMode mode) override; 36 WSError SetSystemSceneBlockingFocus(bool blocking) override; 37 void BindKeyboardSession(sptr<SceneSession> session) override; 38 sptr<SceneSession> GetKeyboardSession() const override; 39 void SetKeyboardPanelRectUpdateCallback(const KeyboardPanelRectUpdateCallback& func); 40 void SetSkipSelfWhenShowOnVirtualScreen(bool isSkip) override; 41 void SyncScenePanelGlobalPosition(bool needSync) override; IsNeedSyncScenePanelGlobalPosition()42 bool IsNeedSyncScenePanelGlobalPosition() override { return isNeedSyncGlobalPos_; } 43 bool IsVisibleForeground() const override; 44 45 /* 46 * App Use Control 47 */ 48 bool GetIsUseControlSession() const override; 49 void SetIsUseControlSession(bool isUseControlSession) override; 50 51 protected: 52 void UpdatePointerArea(const WSRect& rect) override; 53 void NotifyClientToUpdateAvoidArea() override; 54 55 private: 56 KeyboardPanelRectUpdateCallback keyboardPanelRectUpdateCallback_; 57 bool isNeedSyncGlobalPos_ = true; // can only accessed in main thread 58 59 /* 60 * App Use Control 61 */ 62 bool isUseControlSession_ = false; // Indicates whether the session is used for controlling a main session. 63 }; 64 } // namespace OHOS::Rosen 65 #endif // OHOS_ROSEN_WINDOW_SCENE_SCB_SYSTEM_SESSION_H 66