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 bool JudgeCaramaInFore(); 53 #ifdef OHOS_BUILD_ENABLE_POINTER 54 void JudgMouseIsDownOrUp(bool dragState); 55 #endif // OHOS_BUILD_ENABLE_POINTER 56 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 57 int32_t GetClientFd(std::shared_ptr<PointerEvent> pointerEvent); 58 int32_t GetClientFd(std::shared_ptr<PointerEvent> pointerEvent, int32_t windowId); 59 bool AdjustFingerFlag(std::shared_ptr<PointerEvent> pointerEvent); 60 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 61 bool HandleWindowInputType(const WindowInfo &window, std::shared_ptr<PointerEvent> pointerEvent); 62 void UpdateCaptureMode(const DisplayGroupInfo &displayGroupInfo); 63 void UpdateDisplayInfo(DisplayGroupInfo &displayGroupInfo); 64 void UpdateDisplayInfoExtIfNeed(DisplayGroupInfo &displayGroupInfo, bool needUpdateDisplayExt); 65 void UpdateWindowInfo(const WindowGroupInfo &windowGroupInfo); 66 #if defined(OHOS_BUILD_ENABLE_POINTER) && defined(OHOS_BUILD_ENABLE_POINTER_DRAWING) 67 void SetWindowPointerStyle(WindowArea area, int32_t pid, int32_t windowId); 68 void UpdateWindowPointerVisible(int32_t pid); 69 #endif // OHOS_BUILD_ENABLE_POINTER && OHOS_BUILD_ENABLE_POINTER_DRAWING 70 int32_t ClearWindowPointerStyle(int32_t pid, int32_t windowId); 71 void Dump(int32_t fd, const std::vector<std::string> &args); 72 int32_t GetWindowPid(int32_t windowId, const std::vector<WindowInfo> &windowsInfo) const; 73 int32_t GetWindowPid(int32_t windowId) const; 74 int32_t SetMouseCaptureMode(int32_t windowId, bool isCaptureMode); 75 bool GetMouseIsCaptureMode() const; 76 void DeviceStatusChanged(int32_t deviceId, const std::string &sysUid, const std::string devStatus); 77 int32_t GetDisplayBindInfo(DisplayBindInfos &infos); 78 int32_t SetDisplayBind(int32_t deviceId, int32_t displayId, std::string &msg); 79 int32_t AppendExtraData(const ExtraData& extraData); 80 bool IsWindowVisible(int32_t pid); 81 void ClearExtraData(); 82 ExtraData GetExtraData() const; 83 const std::vector<WindowInfo>& GetWindowGroupInfoByDisplayId(int32_t displayId) const; 84 std::pair<double, double> TransformWindowXY(const WindowInfo &window, double logicX, double logicY) const; 85 bool CheckPidInSession(int32_t pid); 86 std::pair<double, double> TransformDisplayXY(const DisplayInfo &info, double logicX, double logicY) const; 87 int32_t GetCurrentUserId(); 88 bool GetCancelEventFlag(std::shared_ptr<PointerEvent> pointerEvent); 89 void SetFoldState (); 90 #ifdef OHOS_BUILD_ENABLE_KEYBOARD 91 std::vector<std::pair<int32_t, TargetInfo>> GetPidAndUpdateTarget(std::shared_ptr<KeyEvent> keyEvent); 92 std::vector<std::pair<int32_t, TargetInfo>> UpdateTarget(std::shared_ptr<KeyEvent> keyEvent); 93 bool IsKeyPressed(int32_t pressedKey, std::vector<KeyEvent::KeyItem> &keyItems); 94 bool IsOnTheWhitelist(std::shared_ptr<KeyEvent> keyEvent); 95 void HandleKeyEventWindowId(std::shared_ptr<KeyEvent> keyEvent); 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 #endif // OHOS_BUILD_ENABLE_POINTER 111 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 112 int32_t SetPointerStyle(int32_t pid, int32_t windowId, PointerStyle pointerStyle, bool isUiExtension = false); 113 int32_t GetPointerStyle(int32_t pid, int32_t windowId, PointerStyle &pointerStyle, 114 bool isUiExtension = false) const; 115 void SetUiExtensionInfo(bool isUiExtension, int32_t uiExtensionPid, int32_t uiExtensionWindoId); 116 void DispatchPointer(int32_t pointerAction, int32_t windowId = -1); 117 void SendPointerEvent(int32_t pointerAction); 118 bool IsMouseSimulate() const; 119 bool HasMouseHideFlag() 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 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 144 void FoldScreenRotation(std::shared_ptr<PointerEvent> pointerEvent); 145 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 146 void SendCancelEventWhenLock(); 147 #endif // OHOS_BUILD_ENABLE_TOUCH 148 149 #ifdef OHOS_BUILD_ENABLE_ANCO 150 void UpdateWindowInfoExt(const WindowGroupInfo &windowGroupInfo, const DisplayGroupInfo &displayGroupInfo); 151 void UpdateShellWindow(const WindowInfo &window); 152 void UpdateDisplayInfoExt(const DisplayGroupInfo &displayGroupInfo); 153 bool IsInAncoWindow(const WindowInfo &window, int32_t x, int32_t y) const; 154 bool IsAncoWindow(const WindowInfo &window) const; 155 bool IsAncoWindowFocus(const WindowInfo &window) const; 156 void SimulatePointerExt(std::shared_ptr<PointerEvent> pointerEvent); 157 void SimulateKeyExt(std::shared_ptr<KeyEvent> keyEvent); 158 void DumpAncoWindows(std::string& out) const; 159 void CleanShellWindowIds(); 160 bool IsKnuckleOnAncoWindow(std::shared_ptr<PointerEvent> pointerEvent); 161 #endif // OHOS_BUILD_ENABLE_ANCO 162 163 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 164 bool UpdateDisplayId(int32_t& displayId); 165 void DrawTouchGraphic(std::shared_ptr<PointerEvent> pointerEvent); 166 int32_t UpdateTargetPointer(std::shared_ptr<PointerEvent> pointerEvent); 167 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 168 const DisplayInfo* GetPhysicalDisplay(int32_t id) const; 169 170 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 171 void UpdatePointerChangeAreas(); 172 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 173 std::optional<WindowInfo> GetWindowAndDisplayInfo(int32_t windowId, int32_t displayId); 174 void GetTargetWindowIds(int32_t pointerItemId, int32_t sourceType, std::vector<int32_t> &windowIds); 175 void AddTargetWindowIds(int32_t pointerItemId, int32_t sourceType, int32_t windowId); 176 void ClearTargetWindowId(int32_t pointerId); 177 bool IsTransparentWin(std::unique_ptr<Media::PixelMap> &pixelMap, int32_t logicalX, int32_t logicalY); 178 int32_t SetCurrentUser(int32_t userId); 179 DisplayMode GetDisplayMode() const; 180 void SetWindowStateNotifyPid(int32_t pid); 181 int32_t GetWindowStateNotifyPid(); 182 int32_t GetPidByWindowId(int32_t pid); 183 #ifdef OHOS_BUILD_ENABLE_ANCO 184 int32_t AncoAddChannel(sptr<IAncoChannel> channel); 185 int32_t AncoRemoveChannel(sptr<IAncoChannel> channel); 186 #endif // OHOS_BUILD_ENABLE_ANCO 187 188 int32_t SetPixelMapData(int32_t infoId, void *pixelMap); 189 void CleanInvalidPiexMap(); 190 void HandleWindowPositionChange(); 191 void SendCancelEventWhenWindowChange(int32_t pointerId); 192 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 193 int32_t ShiftAppPointerEvent(const ShiftWindowParam ¶m, bool autoGenDown); 194 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 195 196 private: 197 bool IgnoreTouchEvent(std::shared_ptr<PointerEvent> pointerEvent); 198 void ReissueCancelTouchEvent(std::shared_ptr<PointerEvent> pointerEvent); 199 int32_t GetDisplayId(std::shared_ptr<InputEvent> inputEvent) const; 200 void PrintWindowInfo(const std::vector<WindowInfo> &windowsInfo); 201 void PrintDisplayInfo(); 202 void PrintWindowGroupInfo(const WindowGroupInfo &windowGroupInfo); 203 void CheckFocusWindowChange(const DisplayGroupInfo &displayGroupInfo); 204 void CheckZorderWindowChange(const std::vector<WindowInfo> &oldWindowsInfo, 205 const std::vector<WindowInfo> &newWindowsInfo); 206 void UpdateDisplayIdAndName(); 207 void UpdateCustomStyle(int32_t windowId, PointerStyle pointerStyle); 208 void UpdatePointerAction(std::shared_ptr<PointerEvent> pointerEvent); 209 bool IsNeedDrawPointer(PointerEvent::PointerItem &pointerItem) const; 210 void UpdateDisplayInfoByIncrementalInfo(const WindowInfo &window, DisplayGroupInfo &displayGroupInfo); 211 void UpdateWindowsInfoPerDisplay(const DisplayGroupInfo &displayGroupInfo); 212 std::pair<int32_t, int32_t> TransformSampleWindowXY(int32_t logicX, int32_t logicY) const; 213 bool IsValidZorderWindow(const WindowInfo &window, const std::shared_ptr<PointerEvent>& pointerEvent); 214 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 215 void UpdateTopBottomArea(const Rect &windowArea, std::vector<int32_t> &pointerChangeAreas, 216 std::vector<Rect> &windowHotAreas); 217 void UpdateLeftRightArea(const Rect &windowArea, std::vector<int32_t> &pointerChangeAreas, 218 std::vector<Rect> &windowHotAreas); 219 void UpdateInnerAngleArea(const Rect &windowArea, std::vector<int32_t> &pointerChangeAreas, 220 std::vector<Rect> &windowHotAreas); 221 void CoordinateCorrection(int32_t width, int32_t height, int32_t &integerX, int32_t &integerY); 222 void GetWidthAndHeight(const DisplayInfo* displayInfo, int32_t &width, int32_t &height, bool isRealData = true); 223 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 224 void SetPrivacyModeFlag(SecureFlag privacyMode, std::shared_ptr<InputEvent> event); 225 void PrintChangedWindowByEvent(int32_t eventType, const WindowInfo &newWindowInfo); 226 void PrintChangedWindowBySync(const DisplayGroupInfo &newDisplayInfo); 227 bool IsMouseDrawing(int32_t currentAction); 228 bool ParseConfig(); 229 bool ParseJson(const std::string &configFile); 230 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 231 void SendUIExtentionPointerEvent(int32_t logicalX, int32_t logicalY, 232 const WindowInfo& windowInfo, std::shared_ptr<PointerEvent> pointerEvent); 233 void DispatchUIExtentionPointerEvent(int32_t logicalX, int32_t logicalY, 234 std::shared_ptr<PointerEvent> pointerEvent); 235 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 236 #ifdef OHOS_BUILD_ENABLE_POINTER 237 void GetPointerStyleByArea(WindowArea area, int32_t pid, int32_t winId, PointerStyle& pointerStyle); 238 int32_t UpdateMouseTarget(std::shared_ptr<PointerEvent> pointerEvent); 239 void UpdatePointerEvent(int32_t logicalX, int32_t logicalY, 240 const std::shared_ptr<PointerEvent>& pointerEvent, const WindowInfo& touchWindow); 241 void NotifyPointerToWindow(); 242 void OnSessionLost(SessionPtr session); 243 void InitPointerStyle(); 244 #endif // OHOS_BUILD_ENABLE_POINTER 245 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 246 int32_t UpdatePoinerStyle(int32_t pid, int32_t windowId, PointerStyle pointerStyle); 247 int32_t UpdateSceneBoardPointerStyle(int32_t pid, int32_t windowId, PointerStyle pointerStyle, 248 bool isUiExtension = false); 249 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 250 #ifdef OHOS_BUILD_ENABLE_POINTER 251 int32_t UpdateTouchPadTarget(std::shared_ptr<PointerEvent> pointerEvent); 252 #endif // OHOS_BUILD_ENABLE_POINTER 253 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 254 std::optional<WindowInfo> SelectWindowInfo(int32_t logicalX, int32_t logicalY, 255 const std::shared_ptr<PointerEvent>& pointerEvent); 256 void CheckUIExtentionWindowPointerHotArea(int32_t logicalX, int32_t logicalY, 257 const std::vector<WindowInfo>& windowInfos, int32_t& windowId); 258 std::optional<WindowInfo> GetWindowInfo(int32_t logicalX, int32_t logicalY); 259 bool IsInsideDisplay(const DisplayInfo& displayInfo, int32_t physicalX, int32_t physicalY); 260 void FindPhysicalDisplay(const DisplayInfo& displayInfo, int32_t& physicalX, 261 int32_t& physicalY, int32_t& displayId); 262 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 263 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 264 void InitMouseDownInfo(); 265 bool SelectPointerChangeArea(const WindowInfo &windowInfo, PointerStyle &pointerStyle, 266 int32_t logicalX, int32_t logicalY); 267 void UpdatePointerChangeAreas(const DisplayGroupInfo &displayGroupInfo); 268 #ifdef OHOS_BUILD_ENABLE_POINTER_DRAWING 269 void AdjustDisplayRotation(); 270 void SetPointerEvent(int32_t pointerAction, std::shared_ptr<PointerEvent> pointerEvent); 271 void DispatchPointerCancel(int32_t displayId); 272 #endif // OHOS_BUILD_ENABLE_POINTER_DRAWING 273 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 274 275 #if defined(OHOS_BUILD_ENABLE_POINTER) && defined(OHOS_BUILD_ENABLE_POINTER_DRAWING) 276 void PointerDrawingManagerOnDisplayInfo(const DisplayGroupInfo &displayGroupInfo); 277 bool NeedUpdatePointDrawFlag(const std::vector<WindowInfo> &windows); 278 #endif // OHOS_BUILD_ENABLE_POINTER && OHOS_BUILD_ENABLE_POINTER_DRAWING 279 280 void UpdateFixedXY(const DisplayInfo& displayInfo, std::shared_ptr<PointerEvent> &pointerEvent); 281 #ifdef OHOS_BUILD_ENABLE_ONE_HAND_MODE 282 void UpdatePointerItemInOneHandMode(const DisplayInfo &displayInfo, std::shared_ptr<PointerEvent> &pointerEvent); 283 void UpdateDisplayXYInOneHandMode(double& physicalX, double& physicalY, const DisplayInfo &displayInfo, 284 float oneHandScale); 285 #endif // OHOS_BUILD_ENABLE_ONE_HAND_MODE 286 #ifdef OHOS_BUILD_ENABLE_TOUCH 287 bool SkipAnnotationWindow(uint32_t flag, int32_t toolType); 288 bool SkipNavigationWindow(WindowInputType windowType, int32_t toolType); 289 int32_t UpdateTouchScreenTarget(std::shared_ptr<PointerEvent> pointerEvent); 290 bool IsValidNavigationWindow(const WindowInfo& touchWindow, double physicalX, double physicalY); 291 bool IsNavigationWindowInjectEvent(std::shared_ptr<PointerEvent> pointerEvent); 292 void UpdateTransformDisplayXY(std::shared_ptr<PointerEvent> pointerEvent, std::vector<WindowInfo>& windowsInfo, 293 const DisplayInfo& displayInfo); 294 void PullEnterLeaveEvent(int32_t logicalX, int32_t logicalY, 295 const std::shared_ptr<PointerEvent> pointerEvent, const WindowInfo* touchWindow); 296 void DispatchTouch(int32_t pointerAction); 297 const DisplayInfo* FindPhysicalDisplayInfo(const std::string& uniq) const; 298 void GetPhysicalDisplayCoord(struct libinput_event_touch* touch, 299 const DisplayInfo& info, EventTouch& touchInfo); 300 void SetAntiMisTake(bool state); 301 void SetAntiMisTakeStatus(bool state); 302 void CheckUIExtentionWindowDefaultHotArea(std::pair<int32_t, int32_t> logicalXY, bool isHotArea, 303 const std::shared_ptr<PointerEvent> pointerEvent, const std::vector<WindowInfo>& windowInfos, 304 const WindowInfo** touchWindow); 305 void GetUIExtentionWindowInfo(std::vector<WindowInfo> &uiExtentionWindowInfo, int32_t windowId, 306 WindowInfo **touchWindow, bool &isUiExtentionWindow); 307 #endif // OHOS_BUILD_ENABLE_TOUCH 308 309 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 310 bool IsInHotArea(int32_t x, int32_t y, const std::vector<Rect> &rects, const WindowInfo &window) const; 311 bool InWhichHotArea(int32_t x, int32_t y, const std::vector<Rect> &rects, PointerStyle &pointerStyle) const; 312 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 313 template <class T> 314 void CreateAntiMisTakeObserver(T& item); 315 316 #ifdef OHOS_BUILD_ENABLE_JOYSTICK 317 int32_t UpdateJoystickTarget(std::shared_ptr<PointerEvent> pointerEvent); 318 #endif // OHOS_BUILD_ENABLE_JOYSTICK 319 320 #if defined(OHOS_BUILD_ENABLE_POINTER) && defined(OHOS_BUILD_ENABLE_CROWN) 321 int32_t UpdateCrownTarget(std::shared_ptr<PointerEvent> pointerEvent); 322 #endif // OHOS_BUILD_ENABLE_POINTER && OHOS_BUILD_ENABLE_CROWN 323 324 void UpdateDisplayMode(); 325 #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) 326 std::optional<WindowInfo> GetWindowInfoById(int32_t windowId) const; 327 int32_t ShiftAppMousePointerEvent(const ShiftWindowInfo &shiftWindowInfo, bool autoGenDown); 328 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH 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 int32_t firstBtnDownWindowId_ { -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, WindowInfoEX> shellTouchItemDownInfos_; 362 std::map<int32_t, WindowInfoEX> accessTouchItemDownInfos_; 363 std::map<int32_t, std::vector<Rect>> windowsHotAreas_; 364 InputDisplayBindHelper bindInfo_; 365 struct CaptureModeInfo { 366 int32_t windowId { -1 }; 367 bool isCaptureMode { false }; 368 } captureModeInfo_; 369 ExtraData extraData_; 370 bool haveSetObserver_ { false }; 371 bool dragFlag_ { false }; 372 bool isDragBorder_ { false }; 373 bool pointerDrawFlag_ { false }; 374 DisplayMode displayMode_ { DisplayMode::UNKNOWN }; 375 struct AntiMisTake { 376 std::string switchName; 377 bool isOpen { false }; 378 } antiMistake_; 379 bool isOpenAntiMisTakeObserver_ { false }; 380 std::shared_ptr<KnuckleDrawingManager> knuckleDrawMgr_ { nullptr }; 381 bool mouseFlag_ {false}; 382 std::map<int32_t, std::vector<int32_t>> targetTouchWinIds_; 383 std::map<int32_t, std::vector<int32_t>> targetMouseWinIds_; 384 int32_t pointerActionFlag_ { -1 }; 385 int32_t currentUserId_ { -1 }; 386 std::shared_ptr<KnuckleDynamicDrawingManager> knuckleDynamicDrawingManager_ { nullptr }; 387 std::shared_ptr<PointerEvent> lastPointerEventforWindowChange_ { nullptr }; 388 bool cancelTouchStatus_ { false }; 389 Direction lastDirection_ = static_cast<Direction>(-1); 390 std::map<int32_t, WindowInfo> lastMatchedWindow_; 391 std::vector<SwitchFocusKey> vecWhiteList_; 392 bool isParseConfig_ { false }; 393 int32_t windowStateNotifyPid_ { -1 }; 394 std::map<int32_t, std::unique_ptr<Media::PixelMap>> transparentWins_; 395 bool IsFoldable_ { false }; 396 }; 397 } // namespace MMI 398 } // namespace OHOS 399 #endif // INPUT_WINDOWS_MANAGER_H 400