1 /* 2 * Copyright (c) 2021-2024 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 INPUT_WINDOWS_MANAGER_H 17 #define INPUT_WINDOWS_MANAGER_H 18 19 #include <vector> 20 21 #include "nocopyable.h" 22 #include "pixel_map.h" 23 #include "window_manager_lite.h" 24 25 #include "i_input_windows_manager.h" 26 #include "input_display_bind_helper.h" 27 #include "input_event_data_transformation.h" 28 #include "knuckle_drawing_manager.h" 29 #include "knuckle_dynamic_drawing_manager.h" 30 31 namespace OHOS { 32 namespace MMI { 33 struct WindowInfoEX { 34 WindowInfo window; 35 bool flag { false }; 36 }; 37 38 struct SwitchFocusKey { 39 int32_t keyCode { -1 }; 40 int32_t pressedKey { -1 }; 41 }; 42 43 class InputWindowsManager final : public IInputWindowsManager { 44 public: 45 InputWindowsManager(); 46 ~InputWindowsManager(); 47 DISALLOW_COPY_AND_MOVE(InputWindowsManager); 48 49 void Init(UDSServer& udsServer); 50 void SetMouseFlag(bool state); 51 bool GetMouseFlag(); 52 #ifdef OHOS_BUILD_ENABLE_POINTER 53 void JudgMouseIsDownOrUp(bool dragState); 54 #endif // OHOS_BUILD_ENABLE_POINTER 55 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 56 int32_t GetClientFd(std::shared_ptr<PointerEvent> pointerEvent); 57 int32_t GetClientFd(std::shared_ptr<PointerEvent> pointerEvent, int32_t windowId); 58 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 59 bool HandleWindowInputType(const WindowInfo &window, std::shared_ptr<PointerEvent> pointerEvent); 60 void UpdateCaptureMode(const DisplayGroupInfo &displayGroupInfo); 61 void UpdateDisplayInfo(DisplayGroupInfo &displayGroupInfo); 62 void UpdateDisplayInfoExtIfNeed(DisplayGroupInfo &displayGroupInfo, bool needUpdateDisplayExt); 63 void UpdateWindowInfo(const WindowGroupInfo &windowGroupInfo); 64 #if defined(OHOS_BUILD_ENABLE_POINTER) && defined(OHOS_BUILD_ENABLE_POINTER_DRAWING) 65 void SetWindowPointerStyle(WindowArea area, int32_t pid, int32_t windowId); 66 void UpdateWindowPointerVisible(int32_t pid); 67 #endif // OHOS_BUILD_ENABLE_POINTER && OHOS_BUILD_ENABLE_POINTER_DRAWING 68 int32_t ClearWindowPointerStyle(int32_t pid, int32_t windowId); 69 void Dump(int32_t fd, const std::vector<std::string> &args); 70 void DumpDisplayInfo(int32_t fd); 71 int32_t GetWindowPid(int32_t windowId, const std::vector<WindowInfo> &windowsInfo) const; 72 int32_t GetWindowPid(int32_t windowId) const; 73 int32_t SetMouseCaptureMode(int32_t windowId, bool isCaptureMode); 74 bool GetMouseIsCaptureMode() const; 75 void DeviceStatusChanged(int32_t deviceId, const std::string &sysUid, const std::string devStatus); 76 int32_t GetDisplayBindInfo(DisplayBindInfos &infos); 77 int32_t SetDisplayBind(int32_t deviceId, int32_t displayId, std::string &msg); 78 int32_t AppendExtraData(const ExtraData& extraData); 79 bool IsWindowVisible(int32_t pid); 80 void ClearExtraData(); 81 ExtraData GetExtraData() const; 82 const std::vector<WindowInfo>& GetWindowGroupInfoByDisplayId(int32_t displayId) const; 83 std::pair<double, double> TransformWindowXY(const WindowInfo &window, double logicX, double logicY) const; 84 std::pair<double, double> TransformDisplayXY(const DisplayInfo &info, double logicX, double logicY) const; 85 int32_t GetCurrentUserId(); 86 bool GetCancelEventFlag(std::shared_ptr<PointerEvent> pointerEvent); 87 void SetFoldState (); 88 #ifdef OHOS_BUILD_ENABLE_KEYBOARD 89 std::vector<std::pair<int32_t, TargetInfo>> GetPidAndUpdateTarget(std::shared_ptr<KeyEvent> keyEvent); 90 void ReissueEvent(std::shared_ptr<KeyEvent> keyEvent, int32_t focusWindowId); 91 std::vector<std::pair<int32_t, TargetInfo>> UpdateTarget(std::shared_ptr<KeyEvent> keyEvent); 92 bool IsKeyPressed(int32_t pressedKey, std::vector<KeyEvent::KeyItem> &keyItems); 93 bool IsOnTheWhitelist(std::shared_ptr<KeyEvent> keyEvent); 94 void HandleKeyEventWindowId(std::shared_ptr<KeyEvent> keyEvent); 95 int32_t focusWindowId_ { -1 }; 96 #endif // OHOS_BUILD_ENABLE_KEYBOARD 97 int32_t CheckWindowIdPermissionByPid(int32_t windowId, int32_t pid); 98 99 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 100 MouseLocation GetMouseInfo(); 101 CursorPosition GetCursorPos(); 102 CursorPosition ResetCursorPos(); 103 void SetGlobalDefaultPointerStyle(); 104 void UpdateAndAdjustMouseLocation(int32_t& displayId, double& x, double& y, bool isRealData = true); 105 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 106 #ifdef OHOS_BUILD_ENABLE_POINTER 107 const DisplayGroupInfo& GetDisplayGroupInfo(); 108 int32_t SetHoverScrollState(bool state); 109 bool GetHoverScrollState() const; 110 bool SelectPointerChangeArea(int32_t windowId, int32_t logicalX, int32_t logicalY); 111 #endif // OHOS_BUILD_ENABLE_POINTER 112 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 113 int32_t SetPointerStyle(int32_t pid, int32_t windowId, PointerStyle pointerStyle, bool isUiExtension = false); 114 int32_t GetPointerStyle(int32_t pid, int32_t windowId, PointerStyle &pointerStyle, 115 bool isUiExtension = false) const; 116 void SetUiExtensionInfo(bool isUiExtension, int32_t uiExtensionPid, int32_t uiExtensionWindoId); 117 void DispatchPointer(int32_t pointerAction, int32_t windowId = -1); 118 void SendPointerEvent(int32_t pointerAction); 119 bool IsMouseSimulate() const; 120 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 121 #ifdef OHOS_BUILD_ENABLE_POINTER 122 PointerStyle GetLastPointerStyle() const; 123 #ifdef OHOS_BUILD_ENABLE_POINTER_DRAWING 124 bool IsNeedRefreshLayer(int32_t windowId); 125 #endif // OHOS_BUILD_ENABLE_POINTER_DRAWING 126 #endif //OHOS_BUILD_ENABLE_POINTER 127 128 #ifdef OHOS_BUILD_ENABLE_TOUCH 129 void AdjustDisplayCoordinate(const DisplayInfo& displayInfo, double& physicalX, double& physicalY) const; 130 bool TouchPointToDisplayPoint(int32_t deviceId, struct libinput_event_touch* touch, 131 EventTouch& touchInfo, int32_t& targetDisplayId); 132 #endif // OHOS_BUILD_ENABLE_TOUCH 133 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 134 void ReverseRotateScreen(const DisplayInfo& info, const double x, const double y, Coordinate2D& cursorPos) const; 135 void RotateScreen(const DisplayInfo& info, PhysicalCoordinate& coord) const; 136 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 137 #ifdef OHOS_BUILD_ENABLE_TOUCH 138 bool TransformTipPoint(struct libinput_event_tablet_tool* tip, PhysicalCoordinate& coord, int32_t& displayId) const; 139 bool CalculateTipPoint(struct libinput_event_tablet_tool* tip, 140 int32_t& targetDisplayId, PhysicalCoordinate& coord) const; 141 const DisplayInfo *GetDefaultDisplayInfo() const; 142 void ReverseXY(int32_t &x, int32_t &y); 143 void SendCancelEventWhenLock(); 144 #endif // OHOS_BUILD_ENABLE_TOUCH 145 146 #ifdef OHOS_BUILD_ENABLE_ANCO 147 void UpdateWindowInfoExt(const WindowGroupInfo &windowGroupInfo, const DisplayGroupInfo &displayGroupInfo); 148 void UpdateShellWindow(const WindowInfo &window); 149 void UpdateDisplayInfoExt(const DisplayGroupInfo &displayGroupInfo); 150 bool IsInAncoWindow(const WindowInfo &window, int32_t x, int32_t y) const; 151 bool IsAncoWindow(const WindowInfo &window) const; 152 bool IsAncoWindowFocus(const WindowInfo &window) const; 153 void SimulatePointerExt(std::shared_ptr<PointerEvent> pointerEvent); 154 void DumpAncoWindows(std::string& out) const; 155 void CleanShellWindowIds(); 156 bool IsKnuckleOnAncoWindow(std::shared_ptr<PointerEvent> pointerEvent); 157 #endif // OHOS_BUILD_ENABLE_ANCO 158 159 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 160 bool UpdateDisplayId(int32_t& displayId); 161 void DrawTouchGraphic(std::shared_ptr<PointerEvent> pointerEvent); 162 int32_t UpdateTargetPointer(std::shared_ptr<PointerEvent> pointerEvent); 163 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 164 const DisplayInfo* GetPhysicalDisplay(int32_t id) const; 165 const DisplayInfo* GetPhysicalDisplay(int32_t id, const DisplayGroupInfo &displayGroupInfo) const; 166 167 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 168 void UpdatePointerChangeAreas(); 169 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 170 std::optional<WindowInfo> GetWindowAndDisplayInfo(int32_t windowId, int32_t displayId); 171 void GetTargetWindowIds(int32_t pointerItemId, int32_t sourceType, std::vector<int32_t> &windowIds); 172 void AddTargetWindowIds(int32_t pointerItemId, int32_t sourceType, int32_t windowId); 173 void ClearTargetWindowId(int32_t pointerId); 174 bool IsTransparentWin(std::unique_ptr<Media::PixelMap> &pixelMap, int32_t logicalX, int32_t logicalY); 175 int32_t SetCurrentUser(int32_t userId); 176 DisplayMode GetDisplayMode() const; 177 void SetWindowStateNotifyPid(int32_t pid); 178 int32_t GetWindowStateNotifyPid(); 179 int32_t GetPidByWindowId(int32_t pid); 180 #ifdef OHOS_BUILD_ENABLE_ANCO 181 int32_t AncoAddChannel(sptr<IAncoChannel> channel); 182 int32_t AncoRemoveChannel(sptr<IAncoChannel> channel); 183 #endif // OHOS_BUILD_ENABLE_ANCO 184 185 int32_t SetPixelMapData(int32_t infoId, void *pixelMap); 186 void CleanInvalidPiexMap(); 187 void HandleWindowPositionChange(); 188 189 private: 190 bool IgnoreTouchEvent(std::shared_ptr<PointerEvent> pointerEvent); 191 void ReissueCancelTouchEvent(std::shared_ptr<PointerEvent> pointerEvent); 192 int32_t GetDisplayId(std::shared_ptr<InputEvent> inputEvent) const; 193 void PrintWindowInfo(const std::vector<WindowInfo> &windowsInfo); 194 void PrintDisplayInfo(); 195 void PrintWindowGroupInfo(const WindowGroupInfo &windowGroupInfo); 196 void CheckFocusWindowChange(const DisplayGroupInfo &displayGroupInfo); 197 void CheckZorderWindowChange(const std::vector<WindowInfo> &oldWindowsInfo, 198 const std::vector<WindowInfo> &newWindowsInfo); 199 void UpdateDisplayIdAndName(); 200 void UpdatePointerAction(std::shared_ptr<PointerEvent> pointerEvent); 201 bool IsNeedDrawPointer(PointerEvent::PointerItem &pointerItem) const; 202 void UpdateDisplayInfoByIncrementalInfo(const WindowInfo &window, DisplayGroupInfo &displayGroupInfo); 203 void UpdateWindowsInfoPerDisplay(const DisplayGroupInfo &displayGroupInfo); 204 std::pair<int32_t, int32_t> TransformSampleWindowXY(int32_t logicX, int32_t logicY) const; 205 bool IsValidZorderWindow(const WindowInfo &window, const std::shared_ptr<PointerEvent>& pointerEvent); 206 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 207 void UpdateTopBottomArea(const Rect &windowArea, std::vector<int32_t> &pointerChangeAreas, 208 std::vector<Rect> &windowHotAreas); 209 void UpdateLeftRightArea(const Rect &windowArea, std::vector<int32_t> &pointerChangeAreas, 210 std::vector<Rect> &windowHotAreas); 211 void UpdateInnerAngleArea(const Rect &windowArea, std::vector<int32_t> &pointerChangeAreas, 212 std::vector<Rect> &windowHotAreas); 213 void CoordinateCorrection(int32_t width, int32_t height, int32_t &integerX, int32_t &integerY); 214 void GetWidthAndHeight(const DisplayInfo* displayInfo, int32_t &width, int32_t &height); 215 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 216 void SetPrivacyModeFlag(SecureFlag privacyMode, std::shared_ptr<InputEvent> event); 217 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 218 void FoldScreenRotation(std::shared_ptr<PointerEvent> pointerEvent); 219 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 220 void PrintChangedWindowByEvent(int32_t eventType, const WindowInfo &newWindowInfo); 221 void PrintChangedWindowBySync(const DisplayGroupInfo &newDisplayInfo); 222 bool IsMouseDrawing(int32_t currentAction); 223 bool ParseConfig(); 224 bool ParseJson(const std::string &configFile); 225 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 226 void SendUIExtentionPointerEvent(int32_t logicalX, int32_t logicalY, 227 const WindowInfo& windowInfo, std::shared_ptr<PointerEvent> pointerEvent); 228 void DispatchUIExtentionPointerEvent(int32_t logicalX, int32_t logicalY, 229 std::shared_ptr<PointerEvent> pointerEvent); 230 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 231 #ifdef OHOS_BUILD_ENABLE_POINTER 232 void GetPointerStyleByArea(WindowArea area, int32_t pid, int32_t winId, PointerStyle& pointerStyle); 233 int32_t UpdateMouseTarget(std::shared_ptr<PointerEvent> pointerEvent); 234 void UpdatePointerEvent(int32_t logicalX, int32_t logicalY, 235 const std::shared_ptr<PointerEvent>& pointerEvent, const WindowInfo& touchWindow); 236 void NotifyPointerToWindow(); 237 void OnSessionLost(SessionPtr session); 238 void InitPointerStyle(); 239 #endif // OHOS_BUILD_ENABLE_POINTER 240 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 241 int32_t UpdatePoinerStyle(int32_t pid, int32_t windowId, PointerStyle pointerStyle); 242 int32_t UpdateSceneBoardPointerStyle(int32_t pid, int32_t windowId, PointerStyle pointerStyle, 243 bool isUiExtension = false); 244 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 245 #ifdef OHOS_BUILD_ENABLE_POINTER 246 int32_t UpdateTouchPadTarget(std::shared_ptr<PointerEvent> pointerEvent); 247 #endif // OHOS_BUILD_ENABLE_POINTER 248 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 249 std::optional<WindowInfo> SelectWindowInfo(int32_t logicalX, int32_t logicalY, 250 const std::shared_ptr<PointerEvent>& pointerEvent); 251 void CheckUIExtentionWindowPointerHotArea(int32_t logicalX, int32_t logicalY, 252 const std::vector<WindowInfo>& windowInfos, int32_t& windowId); 253 std::optional<WindowInfo> GetWindowInfo(int32_t logicalX, int32_t logicalY); 254 bool IsInsideDisplay(const DisplayInfo& displayInfo, int32_t physicalX, int32_t physicalY); 255 void FindPhysicalDisplay(const DisplayInfo& displayInfo, int32_t& physicalX, 256 int32_t& physicalY, int32_t& displayId); 257 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 258 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 259 void InitMouseDownInfo(); 260 bool SelectPointerChangeArea(const WindowInfo &windowInfo, PointerStyle &pointerStyle, 261 int32_t logicalX, int32_t logicalY); 262 void UpdatePointerChangeAreas(const DisplayGroupInfo &displayGroupInfo); 263 #ifdef OHOS_BUILD_ENABLE_POINTER_DRAWING 264 void AdjustDisplayRotation(); 265 void SetPointerEvent(int32_t pointerAction, std::shared_ptr<PointerEvent> pointerEvent); 266 void DispatchPointerCancel(int32_t displayId); 267 #endif // OHOS_BUILD_ENABLE_POINTER_DRAWING 268 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 269 270 #if defined(OHOS_BUILD_ENABLE_POINTER) && defined(OHOS_BUILD_ENABLE_POINTER_DRAWING) 271 void PointerDrawingManagerOnDisplayInfo(const DisplayGroupInfo &displayGroupInfo, bool isDisplayRemoved = false); 272 void DrawPointer(bool isDisplayRemoved); 273 bool NeedUpdatePointDrawFlag(const std::vector<WindowInfo> &windows); 274 #endif // OHOS_BUILD_ENABLE_POINTER && OHOS_BUILD_ENABLE_POINTER_DRAWING 275 276 #ifdef OHOS_BUILD_ENABLE_TOUCH 277 bool SkipAnnotationWindow(uint32_t flag, int32_t toolType); 278 bool SkipNavigationWindow(WindowInputType windowType, int32_t toolType); 279 void HandleGestureInjection(bool gestureInject); 280 int32_t UpdateTouchScreenTarget(std::shared_ptr<PointerEvent> pointerEvent); 281 #endif // OHOS_BUILD_ENABLE_TOUCH 282 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 283 bool IsValidNavigationWindow(const WindowInfo& touchWindow, double physicalX, double physicalY); 284 bool IsNavigationWindowInjectEvent(std::shared_ptr<PointerEvent> pointerEvent); 285 void UpdateTransformDisplayXY(std::shared_ptr<PointerEvent> pointerEvent, 286 const std::vector<WindowInfo>& windowsInfo, const DisplayInfo& displayInfo); 287 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 288 #ifdef OHOS_BUILD_ENABLE_TOUCH 289 void PullEnterLeaveEvent(int32_t logicalX, int32_t logicalY, 290 const std::shared_ptr<PointerEvent> pointerEvent, const WindowInfo* touchWindow); 291 void DispatchTouch(int32_t pointerAction); 292 const DisplayInfo* FindPhysicalDisplayInfo(const std::string& uniq) const; 293 void GetPhysicalDisplayCoord(struct libinput_event_touch* touch, 294 const DisplayInfo& info, EventTouch& touchInfo); 295 void SetAntiMisTake(bool state); 296 void SetAntiMisTakeStatus(bool state); 297 void CheckUIExtentionWindowDefaultHotArea(std::pair<int32_t, int32_t> logicalXY, bool isHotArea, 298 const std::shared_ptr<PointerEvent> pointerEvent, const std::vector<WindowInfo>& windowInfos, 299 const WindowInfo* touchWindow); 300 void GetUIExtentionWindowInfo(std::vector<WindowInfo> &uiExtentionWindowInfo, int32_t windowId, 301 WindowInfo **touchWindow, bool &isUiExtentionWindow); 302 #endif // OHOS_BUILD_ENABLE_TOUCH 303 304 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 305 bool IsInHotArea(int32_t x, int32_t y, const std::vector<Rect> &rects, const WindowInfo &window) const; 306 bool InWhichHotArea(int32_t x, int32_t y, const std::vector<Rect> &rects, PointerStyle &pointerStyle) const; 307 bool InWhichHotArea(int32_t x, int32_t y, const std::vector<Rect> &rects) const; 308 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 309 template <class T> 310 void CreateAntiMisTakeObserver(T& item); 311 312 #ifdef OHOS_BUILD_ENABLE_JOYSTICK 313 int32_t UpdateJoystickTarget(std::shared_ptr<PointerEvent> pointerEvent); 314 #endif // OHOS_BUILD_ENABLE_JOYSTICK 315 316 #if defined(OHOS_BUILD_ENABLE_POINTER) && defined(OHOS_BUILD_ENABLE_CROWN) 317 int32_t UpdateCrownTarget(std::shared_ptr<PointerEvent> pointerEvent); 318 #endif // OHOS_BUILD_ENABLE_POINTER && OHOS_BUILD_ENABLE_CROWN 319 320 #ifdef OHOS_BUILD_ENABLE_FINGERSENSE_WRAPPER 321 void UpdateDisplayMode(); 322 #endif // OHOS_BUILD_ENABLE_FINGERSENSE_WRAPPER 323 #ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR 324 void UpdateKeyEventDisplayId(std::shared_ptr<KeyEvent> keyEvent, int32_t focusWindowId); 325 bool OnDisplayRemoved(const DisplayGroupInfo &displayGroupInfo); 326 #endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR 327 WINDOW_UPDATE_ACTION UpdateWindowInfo(DisplayGroupInfo &displayGroupInfo); 328 void OnGestureSendEvent(std::shared_ptr<PointerEvent> event); 329 330 private: 331 UDSServer* udsServer_ { nullptr }; 332 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 333 bool isUiExtension_ { false }; 334 int32_t uiExtensionPid_ { -1 }; 335 int32_t uiExtensionWindowId_ { -1 }; 336 std::pair<int32_t, int32_t> firstBtnDownWindowInfo_ {-1, -1}; 337 int32_t lastLogicX_ { -1 }; 338 int32_t lastLogicY_ { -1 }; 339 WindowInfo lastWindowInfo_; 340 std::shared_ptr<PointerEvent> lastPointerEvent_ { nullptr }; 341 std::map<int32_t, std::map<int32_t, PointerStyle>> pointerStyle_; 342 std::map<int32_t, std::map<int32_t, PointerStyle>> uiExtensionPointerStyle_; 343 WindowInfo mouseDownInfo_; 344 PointerStyle globalStyle_; 345 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 346 #ifdef OHOS_BUILD_ENABLE_TOUCH 347 int32_t lastTouchLogicX_ { -1 }; 348 int32_t lastTouchLogicY_ { -1 }; 349 WindowInfo lastTouchWindowInfo_; 350 std::shared_ptr<PointerEvent> lastTouchEvent_ { nullptr }; 351 std::shared_ptr<PointerEvent> lastTouchEventOnBackGesture_ { nullptr }; 352 #endif // OHOS_BUILD_ENABLE_TOUCH 353 DisplayGroupInfo displayGroupInfoTmp_; 354 DisplayGroupInfo displayGroupInfo_; 355 std::map<int32_t, WindowGroupInfo> windowsPerDisplay_; 356 PointerStyle lastPointerStyle_ {.id = -1}; 357 PointerStyle dragPointerStyle_ {.id = -1}; 358 MouseLocation mouseLocation_ = { -1, -1 }; 359 CursorPosition cursorPos_ {}; 360 std::map<int32_t, WindowInfoEX> touchItemDownInfos_; 361 std::map<int32_t, std::vector<Rect>> windowsHotAreas_; 362 InputDisplayBindHelper bindInfo_; 363 struct CaptureModeInfo { 364 int32_t windowId { -1 }; 365 bool isCaptureMode { false }; 366 } captureModeInfo_; 367 ExtraData extraData_; 368 bool haveSetObserver_ { false }; 369 bool dragFlag_ { false }; 370 bool isDragBorder_ { false }; 371 bool pointerDrawFlag_ { false }; 372 DisplayMode displayMode_ { DisplayMode::UNKNOWN }; 373 struct AntiMisTake { 374 std::string switchName; 375 bool isOpen { false }; 376 } antiMistake_; 377 bool isOpenAntiMisTakeObserver_ { false }; 378 std::shared_ptr<KnuckleDrawingManager> knuckleDrawMgr_ { nullptr }; 379 bool mouseFlag_ {false}; 380 std::map<int32_t, std::vector<int32_t>> targetTouchWinIds_; 381 std::map<int32_t, std::vector<int32_t>> targetMouseWinIds_; 382 int32_t pointerActionFlag_ { -1 }; 383 int32_t currentUserId_ { -1 }; 384 std::shared_ptr<KnuckleDynamicDrawingManager> knuckleDynamicDrawingManager_ { nullptr }; 385 std::shared_ptr<PointerEvent> lastPointerEventforWindowChange_ { nullptr }; 386 bool cancelTouchStatus_ { false }; 387 Direction lastDirection_ = static_cast<Direction>(-1); 388 std::map<int32_t, WindowInfo> lastMatchedWindow_; 389 std::vector<SwitchFocusKey> vecWhiteList_; 390 bool isParseConfig_ { false }; 391 int32_t windowStateNotifyPid_ { -1 }; 392 std::map<int32_t, std::unique_ptr<Media::PixelMap>> transparentWins_; 393 std::shared_ptr<PointerEvent> lastPointerEventforGesture_ { nullptr }; 394 bool isSendGestureDown_ { false }; 395 bool IsFoldable_ { false }; 396 int32_t timerId_ { -1 }; 397 }; 398 } // namespace MMI 399 } // namespace OHOS 400 #endif // INPUT_WINDOWS_MANAGER_H 401