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 std::shared_ptr<RSSurfaceNode> GetSurfaceNode(); 45 46 bool IsVisibleForeground() const override; 47 48 protected: 49 void UpdatePointerArea(const WSRect& rect) override; 50 void NotifyClientToUpdateAvoidArea() override; 51 52 private: 53 KeyboardPanelRectUpdateCallback keyboardPanelRectUpdateCallback_; 54 bool isNeedSyncGlobalPos_ = true; // only accessed in main thread 55 }; 56 } // namespace OHOS::Rosen 57 #endif // OHOS_ROSEN_WINDOW_SCENE_SCB_SYSTEM_SESSION_H 58