1 /* 2 * Copyright (c) 2022 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 I_POINTER_DRAWING_MANAGER_H 17 #define I_POINTER_DRAWING_MANAGER_H 18 19 #include <map> 20 #include <memory> 21 22 #include "pixel_map.h" 23 24 #include "pointer_style.h" 25 #include "window_info.h" 26 #include "struct_multimodal.h" 27 #include "delegate_interface.h" 28 29 namespace OHOS { 30 namespace MMI { 31 class IPointerDrawingManager { 32 public: 33 IPointerDrawingManager() = default; 34 virtual ~IPointerDrawingManager() = default; 35 36 static std::shared_ptr<IPointerDrawingManager> GetInstance(); DrawPointer(int32_t displayId,int32_t physicalX,int32_t physicalY,const PointerStyle pointerStyle,Direction direction)37 virtual void DrawPointer(int32_t displayId, int32_t physicalX, int32_t physicalY, 38 const PointerStyle pointerStyle, Direction direction) {} UpdateDisplayInfo(const DisplayInfo & displayInfo)39 virtual void UpdateDisplayInfo(const DisplayInfo& displayInfo) {} OnDisplayInfo(const DisplayGroupInfo & displayGroupInfo)40 virtual void OnDisplayInfo(const DisplayGroupInfo& displayGroupInfo) {} OnWindowInfo(const WinInfo & info)41 virtual void OnWindowInfo(const WinInfo &info) {} Init()42 virtual bool Init() 43 { 44 return true; 45 } DeletePointerVisible(int32_t pid)46 virtual void DeletePointerVisible(int32_t pid) {} SetPointerVisible(int32_t pid,bool visible,int32_t priority,bool isHap)47 virtual int32_t SetPointerVisible(int32_t pid, bool visible, int32_t priority, bool isHap) 48 { 49 return 0; 50 } GetPointerVisible(int32_t pid)51 virtual bool GetPointerVisible(int32_t pid) 52 { 53 return true; 54 } SetPointerColor(int32_t color)55 virtual int32_t SetPointerColor(int32_t color) 56 { 57 return 0; 58 } GetPointerColor()59 virtual int32_t GetPointerColor() 60 { 61 return 0; 62 } 63 virtual int32_t SetPointerStyle(int32_t pid, int32_t windowId, PointerStyle pointerStyle, 64 bool isUiExtension = false) 65 { 66 return 0; 67 } ClearWindowPointerStyle(int32_t pid,int32_t windowId)68 virtual int32_t ClearWindowPointerStyle(int32_t pid, int32_t windowId) 69 { 70 return 0; 71 } 72 virtual int32_t GetPointerStyle(int32_t pid, int32_t windowId, PointerStyle &pointerStyle, 73 bool isUiExtension = false) 74 { 75 return 0; 76 } DrawPointerStyle(const PointerStyle & pointerStyle)77 virtual void DrawPointerStyle(const PointerStyle& pointerStyle) {} IsPointerVisible()78 virtual bool IsPointerVisible() 79 { 80 return false; 81 } SetPointerLocation(int32_t x,int32_t y)82 virtual void SetPointerLocation(int32_t x, int32_t y) {} SetMouseDisplayState(bool state)83 virtual void SetMouseDisplayState(bool state) {} GetMouseDisplayState()84 virtual bool GetMouseDisplayState() const 85 { 86 return false; 87 } SetCustomCursor(void * pixelMap,int32_t pid,int32_t windowId,int32_t focusX,int32_t focusY)88 virtual int32_t SetCustomCursor(void* pixelMap, int32_t pid, int32_t windowId, int32_t focusX, int32_t focusY) 89 { 90 return 0; 91 } SetMouseIcon(int32_t pid,int32_t windowId,void * pixelMap)92 virtual int32_t SetMouseIcon(int32_t pid, int32_t windowId, void* pixelMap) 93 { 94 return 0; 95 } SetMouseHotSpot(int32_t pid,int32_t windowId,int32_t hotSpotX,int32_t hotSpotY)96 virtual int32_t SetMouseHotSpot(int32_t pid, int32_t windowId, int32_t hotSpotX, int32_t hotSpotY) 97 { 98 return 0; 99 } SetPointerSize(int32_t size)100 virtual int32_t SetPointerSize(int32_t size) 101 { 102 return 0; 103 } GetPointerSize()104 virtual int32_t GetPointerSize() 105 { 106 return 0; 107 } GetLastMouseStyle()108 virtual PointerStyle GetLastMouseStyle() 109 { 110 return {}; 111 } GetMouseIconPath()112 virtual std::map<MOUSE_ICON, IconStyle> GetMouseIconPath() 113 { 114 return {}; 115 } SwitchPointerStyle()116 virtual int32_t SwitchPointerStyle() 117 { 118 return 0; 119 } DrawMovePointer(int32_t displayId,int32_t physicalX,int32_t physicalY)120 virtual void DrawMovePointer(int32_t displayId, int32_t physicalX, int32_t physicalY) {} Dump(int32_t fd,const std::vector<std::string> & args)121 virtual void Dump(int32_t fd, const std::vector<std::string> &args) {} ForceClearPointerVisiableStatus()122 virtual void ForceClearPointerVisiableStatus() {} InitPointerCallback()123 virtual void InitPointerCallback() {}; EnableHardwareCursorStats(int32_t pid,bool enable)124 virtual int32_t EnableHardwareCursorStats(int32_t pid, bool enable) 125 { 126 return 0; 127 } GetHardwareCursorStats(int32_t pid,uint32_t & frameCount,uint32_t & vsyncCount)128 virtual int32_t GetHardwareCursorStats(int32_t pid, uint32_t &frameCount, uint32_t &vsyncCount) 129 { 130 return 0; 131 } 132 #ifdef OHOS_BUILD_ENABLE_MAGICCURSOR GetPointerSnapshot(void * pixelMapPtr)133 virtual int32_t GetPointerSnapshot(void *pixelMapPtr) 134 { 135 return 0; 136 } 137 #endif // OHOS_BUILD_ENABLE_MAGICCURSOR InitPointerObserver()138 virtual void InitPointerObserver() {} OnSessionLost(int32_t pid)139 virtual void OnSessionLost(int32_t pid) {} SkipPointerLayer(bool isSkip)140 virtual int32_t SkipPointerLayer(bool isSkip) 141 { 142 return 0; 143 } SetDelegateProxy(std::shared_ptr<DelegateInterface> proxy)144 virtual void SetDelegateProxy(std::shared_ptr<DelegateInterface> proxy) {} DestroyPointerWindow()145 virtual void DestroyPointerWindow() {} 146 public: 147 static inline std::shared_ptr<IPointerDrawingManager> iPointDrawMgr_ { nullptr }; 148 }; 149 } // namespace MMI 150 } // namespace OHOS 151 #endif // I_POINTER_DRAWING_MANAGER_H 152