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_ACE_NG_WINDOW_SCENE_WINDOW_EVENT_PROCESS_H 17 #define OHOS_ACE_NG_WINDOW_SCENE_WINDOW_EVENT_PROCESS_H 18 19 #include "singleton.h" 20 21 #include "base/geometry/ng/point_t.h" 22 #include "base/geometry/ng/rect_t.h" 23 #include "core/components_ng/pattern/window_scene/scene/window_node.h" 24 #include "session/host/include/session.h" 25 26 namespace OHOS::Ace::NG { 27 class WindowEventProcess { 28 DECLARE_DELAYED_SINGLETON(WindowEventProcess); 29 public: 30 DISALLOW_COPY_AND_MOVE(WindowEventProcess); 31 void ProcessWindowMouseEvent(int32_t nodeId, sptr<Rosen::Session> session, 32 const std::shared_ptr<MMI::PointerEvent>& pointerEvent); 33 void ProcessWindowDragEvent(int32_t nodeId, sptr<Rosen::Session> session, 34 const std::shared_ptr<MMI::PointerEvent>& pointerEvent); 35 void CleanWindowDragEvent(); 36 37 private: 38 void UpdateWindowMouseRecord(int32_t nodeId, sptr<Rosen::Session> session, 39 const std::shared_ptr<MMI::PointerEvent>& pointerEvent); 40 void CleanWindowMouseRecord(); 41 void ProcessEnterLeaveEvent(int32_t nodeId, sptr<Rosen::Session> session, 42 const std::shared_ptr<MMI::PointerEvent>& pointerEvent); 43 void DispatchPointerEvent(sptr<Rosen::Session> session, 44 const std::shared_ptr<MMI::PointerEvent>& pointerEvent); 45 private: 46 int32_t lastWindowNodeId_ { -1 }; 47 wptr<Rosen::Session> lastWeakSession_ { nullptr }; 48 std::shared_ptr<MMI::PointerEvent> lastPointEvent_ { nullptr }; 49 50 int32_t lastDragWindowNodeId_ { -1 }; 51 wptr<Rosen::Session> lastDragSession_ { nullptr }; 52 std::shared_ptr<MMI::PointerEvent> lastDragPointEvent_ { nullptr }; 53 }; 54 } // namespace OHOS::Ace::NG 55 #endif // OHOS_ACE_NG_WINDOW_SCENE_WINDOW_EVENT_PROCESS_H 56