diff --git a/multimodalinput_mini.gni b/multimodalinput_mini.gni index 8366b951f5fca052b9e103da88de2dd495d22be1..18202d687cc6768a988a476339a42b26e7614387 100644 --- a/multimodalinput_mini.gni +++ b/multimodalinput_mini.gni @@ -415,6 +415,7 @@ if (input_ext_feature_keyboard_ext_flag) { } if (input_feature_product == "pc") { + input_default_defines += [ "OHOS_BUILD_ENABLE_HARDWARE_CURSOR" ] input_default_defines += [ "OHOS_BUILD_PC_PRIORITY" ] input_default_defines += [ "OHOS_BUILD_PC_UNIT_TEST" ] input_default_defines += [ "OHOS_BUILD_MOUSE_REPORTING_RATE" ] diff --git a/service/BUILD.gn b/service/BUILD.gn index 5ca09046772aa766afe225e6101f0b3ac9248011..111ee03fb10c5e63a5307f3268c49bfafccfe461 100644 --- a/service/BUILD.gn +++ b/service/BUILD.gn @@ -378,7 +378,6 @@ ohos_shared_library("libmmi-server") { "hisysevent:libhisysevent", "libinput:libinput-third-mmi", "preferences:native_preferences", - "window_manager:libdm_lite", "window_manager:libwsutils", ] @@ -758,7 +757,6 @@ ohos_unittest("KeyShortcutManagerTest") { "preferences:native_preferences", "safwk:system_ability_fwk", "samgr:samgr_proxy", - "window_manager:libdm_lite", "window_manager:libwm_lite", ] @@ -2703,7 +2701,6 @@ ohos_unittest("DeviceManagerTest") { "init:libbegetutil", "ipc:ipc_core", "libinput:libinput-third-mmi", - "window_manager:libdm_lite", ] } diff --git a/service/hardware_cursor_pointer_manager/include/hardware_cursor_pointer_manager.h b/service/hardware_cursor_pointer_manager/include/hardware_cursor_pointer_manager.h index e5d65fe959ede524f1fab60a981615410188a1ad..6989a947fb0a7257c9217613c7cd12ca535396e6 100644 --- a/service/hardware_cursor_pointer_manager/include/hardware_cursor_pointer_manager.h +++ b/service/hardware_cursor_pointer_manager/include/hardware_cursor_pointer_manager.h @@ -26,6 +26,7 @@ namespace OHOS { namespace MMI { class HardwareCursorPointerManager { public: +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR HardwareCursorPointerManager() = default; ~HardwareCursorPointerManager() = default; void SetTargetDevice(uint32_t devId); @@ -42,6 +43,7 @@ private: uint32_t devId_ { 0 }; sptr powerInterface_ = nullptr; std::mutex mtx_; +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR }; } // namespace MMI } // namespace OHOS diff --git a/service/hardware_cursor_pointer_manager/src/hardware_cursor_pointer_manager.cpp b/service/hardware_cursor_pointer_manager/src/hardware_cursor_pointer_manager.cpp index a1abeceb3d627d37af663394959b164593e03800..fa9639e03b55670179a7d1ed63638c1d89b69670 100644 --- a/service/hardware_cursor_pointer_manager/src/hardware_cursor_pointer_manager.cpp +++ b/service/hardware_cursor_pointer_manager/src/hardware_cursor_pointer_manager.cpp @@ -26,6 +26,7 @@ namespace OHOS { namespace MMI { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR void HardwareCursorPointerManager::SetTargetDevice(uint32_t devId) { if (static_cast(devId) < 0) { @@ -136,5 +137,6 @@ sptr HardwareCurs std::lock_guard guard(mtx_); return powerInterface_; } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR } // namespace MMI } // namespace OHOS \ No newline at end of file diff --git a/service/message_handle/src/server_msg_handler.cpp b/service/message_handle/src/server_msg_handler.cpp index 3ee102fac7b6f9e82ad0feb906c2bf00af879ebb..24d8ea75ff8746fa4fed75776d443aa73ba924a2 100644 --- a/service/message_handle/src/server_msg_handler.cpp +++ b/service/message_handle/src/server_msg_handler.cpp @@ -434,7 +434,13 @@ int32_t ServerMsgHandler::AccelerateMotion(std::shared_ptr pointer auto displayInfo = WIN_MGR->GetPhysicalDisplay(cursorPos.displayId); CHKPR(displayInfo, ERROR_NULL_POINTER); #ifndef OHOS_BUILD_EMULATOR - Direction displayDirection = WIN_MGR->GetDisplayDirection(displayInfo.get()); + Direction displayDirection = static_cast(( + ((displayInfo->direction - displayInfo->displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + if (WIN_MGR->IsSupported()) { + direction = displayInfo->direction; + } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR CalculateOffset(displayDirection, offset); #endif // OHOS_BUILD_EMULATOR int32_t ret = RET_OK; diff --git a/service/mouse_event_normalize/include/mouse_transform_processor.h b/service/mouse_event_normalize/include/mouse_transform_processor.h index ff155b14709a6ba3760a894552ee2615617a326f..4df07a98e32faf410d090c48b471d97208c77f9e 100644 --- a/service/mouse_event_normalize/include/mouse_transform_processor.h +++ b/service/mouse_event_normalize/include/mouse_transform_processor.h @@ -135,8 +135,6 @@ private: double HandleAxisAccelateTouchPad(double axisValue); #endif // OHOS_BUILD_ENABLE_WATCH void CalculateOffset(const DisplayInfo* displayInfo, Offset &offset); - bool IsWindowRotation(const DisplayInfo* displayInfo); - Direction GetDisplayDirection(const DisplayInfo *displayInfo); void HandleReportMouseResponseTime(std::string &connectType, std::map &curMap); void CalculateMouseResponseTimeProbability(struct libinput_event *event); std::map> mouseResponseMap = {}; diff --git a/service/mouse_event_normalize/src/mouse_transform_processor.cpp b/service/mouse_event_normalize/src/mouse_transform_processor.cpp index 6e0c8756801ecb79c40b0c206f0b8fb9d4fa24bc..48339dd2cc29c0ae4d38afe24ab001c2f7a9f0e3 100644 --- a/service/mouse_event_normalize/src/mouse_transform_processor.cpp +++ b/service/mouse_event_normalize/src/mouse_transform_processor.cpp @@ -65,11 +65,6 @@ const char* DEVICE_TYPE_M_TABLET3 { "MRDIL" }; const std::string PRODUCT_TYPE = OHOS::system::GetParameter("const.build.product", "HYM"); const std::string MOUSE_FILE_NAME { "mouse_settings.xml" }; const std::string TOUCHPAD_FILE_NAME { "touchpad_settings.xml" }; -const int32_t ROTATE_POLICY = system::GetIntParameter("const.window.device.rotate_policy", 0); -const std::string FOLDABLE_DEVICE_POLICY = system::GetParameter("const.window.foldabledevice.rotate_policy", ""); -constexpr int32_t WINDOW_ROTATE { 0 }; -constexpr char ROTATE_WINDOW_ROTATE { '0' }; -constexpr int32_t FOLDABLE_DEVICE { 2 }; constexpr int32_t WAIT_TIME_FOR_BUTTON_UP { 35 }; constexpr int32_t ANGLE_90 { 90 }; constexpr int32_t ANGLE_360 { 360 }; @@ -411,41 +406,17 @@ void MouseTransformProcessor::HandleReportMouseResponseTime( MMI_HILOGI("Mouse write end , ret:%{public}d", ret); } -bool MouseTransformProcessor::IsWindowRotation(const DisplayInfo* displayInfo) -{ - MMI_HILOGD("ROTATE_POLICY: %{public}d, FOLDABLE_DEVICE_POLICY:%{public}s", - ROTATE_POLICY, FOLDABLE_DEVICE_POLICY.c_str()); - return (ROTATE_POLICY == WINDOW_ROTATE || - (ROTATE_POLICY == FOLDABLE_DEVICE && - ((displayInfo->displayMode == DisplayMode::MAIN && - FOLDABLE_DEVICE_POLICY[0] == ROTATE_WINDOW_ROTATE) || - (displayInfo->displayMode == DisplayMode::FULL && - FOLDABLE_DEVICE_POLICY[FOLDABLE_DEVICE] == ROTATE_WINDOW_ROTATE)))); -} - -Direction MouseTransformProcessor::GetDisplayDirection(const DisplayInfo *displayInfo) -{ - Direction displayDirection = DIRECTION0; - if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) { - displayDirection = static_cast(( - ((displayInfo->direction - displayInfo->displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); - } - if (WIN_MGR->GetHardCursorEnabled()) { - if (IsWindowRotation(displayInfo)) { - displayDirection = static_cast((((displayInfo->direction - displayInfo->displayDirection) * - ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); - } else { - displayDirection = displayInfo->direction; - } - } - return displayDirection; -} - void MouseTransformProcessor::CalculateOffset(const DisplayInfo* displayInfo, Offset &offset) { #ifndef OHOS_BUILD_EMULATOR if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) { - Direction direction = GetDisplayDirection(displayInfo); + Direction direction = static_cast(( + ((displayInfo->direction - displayInfo->displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + if (WIN_MGR->IsSupported()) { + direction = displayInfo->direction; + } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR std::negate neg; if (direction == DIRECTION90) { double tmp = offset.dx; diff --git a/service/touch_event_normalize/test/BUILD.gn b/service/touch_event_normalize/test/BUILD.gn index faf3aad43a414f9a429dc4089db678c99d462409..4b6d47e9c60ccb91999b5c1594d2e5ab02f7bcc9 100644 --- a/service/touch_event_normalize/test/BUILD.gn +++ b/service/touch_event_normalize/test/BUILD.gn @@ -569,7 +569,6 @@ ohos_unittest("TouchTransformProcessorTestWithMock") { "preferences:native_preferences", "safwk:system_ability_fwk", "samgr:samgr_proxy", - "window_manager:libdm_lite", "window_manager:libwm", "window_manager:libwsutils", ] diff --git a/service/window_manager/include/i_input_windows_manager.h b/service/window_manager/include/i_input_windows_manager.h index 32081a1c2ac4a9cf884d7d3df5b00ce0704e562b..9c5b371afdc2e23a0901d3fbd0f4df8e7aac2780 100644 --- a/service/window_manager/include/i_input_windows_manager.h +++ b/service/window_manager/include/i_input_windows_manager.h @@ -172,8 +172,10 @@ public: #endif // OHOS_BUILD_ENABLE_ANCO #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) virtual int32_t ShiftAppPointerEvent(const ShiftWindowParam ¶m, bool autoGenDown) = 0; - virtual Direction GetDisplayDirection(const DisplayInfo *displayInfo) = 0; #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + virtual bool IsSupported() = 0; +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR #if defined(OHOS_BUILD_ENABLE_TOUCH) && defined(OHOS_BUILD_ENABLE_MONITOR) virtual void AttachTouchGestureMgr(std::shared_ptr touchGestureMgr) = 0; virtual void CancelAllTouches(std::shared_ptr event, bool isDisplayChanged = false) = 0; @@ -187,7 +189,6 @@ public: static std::shared_ptr GetInstance(); static void DestroyInstance(); - virtual bool GetHardCursorEnabled() = 0; private: static std::mutex mutex_; diff --git a/service/window_manager/include/i_pointer_drawing_manager.h b/service/window_manager/include/i_pointer_drawing_manager.h index f27123471512e55f4e483ca22a952d754990ca60..c2df9d0215136b5361e6bd594d854224ac685fec 100644 --- a/service/window_manager/include/i_pointer_drawing_manager.h +++ b/service/window_manager/include/i_pointer_drawing_manager.h @@ -174,16 +174,18 @@ public: { return 0; } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + virtual bool IsSupported() + { + return false; + } virtual void AttachAllSurfaceNode() {} virtual void DetachAllSurfaceNode() {} virtual int32_t CheckHwcReady() { return 0; } - virtual bool GetHardCursorEnabled() - { - return false; - } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR }; } // namespace MMI } // namespace OHOS diff --git a/service/window_manager/include/input_windows_manager.h b/service/window_manager/include/input_windows_manager.h index 100f49386c18f7d7052318b32ee12fb2d01ef8fc..86175a0942d85162fa2f767973f2535e4cd62dd6 100644 --- a/service/window_manager/include/input_windows_manager.h +++ b/service/window_manager/include/input_windows_manager.h @@ -211,10 +211,11 @@ public: void CleanInvalidPiexMap(int32_t groupId = DEFAULT_GROUP_ID); void HandleWindowPositionChange(const DisplayGroupInfo &displayGroupInfo); void SendCancelEventWhenWindowChange(int32_t pointerId, int32_t groupId = DEFAULT_GROUP_ID); - bool GetHardCursorEnabled(); +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + bool IsSupported(); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) int32_t ShiftAppPointerEvent(const ShiftWindowParam ¶m, bool autoGenDown); - Direction GetDisplayDirection(const DisplayInfo *displayInfo); #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH #if defined(OHOS_BUILD_ENABLE_TOUCH) && defined(OHOS_BUILD_ENABLE_MONITOR) void AttachTouchGestureMgr(std::shared_ptr touchGestureMgr); @@ -266,6 +267,7 @@ private: void UpdateInnerAngleArea(const Rect &windowArea, std::vector &pointerChangeAreas, std::vector &windowHotAreas); void CoordinateCorrection(int32_t width, int32_t height, int32_t &integerX, int32_t &integerY); + Direction GetDisplayDirection(const DisplayInfo *displayInfo); void GetWidthAndHeight(const DisplayInfo* displayInfo, int32_t &width, int32_t &height, bool isRealData = true); void UpdateCurrentDisplay(int32_t displayId) const; #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH @@ -413,6 +415,7 @@ void HandleOneHandMode(const DisplayInfo &displayInfo, std::shared_ptr keyEvent, int32_t focusWindowId, int32_t groupId = DEFAULT_GROUP_ID); bool OnDisplayRemovedOrCombinationChanged(const DisplayGroupInfo &displayGroupInfo); void ChangeWindowArea(int32_t x, int32_t y, WindowInfo &windowInfo); @@ -421,6 +424,7 @@ void HandleOneHandMode(const DisplayInfo &displayInfo, std::shared_ptr GetWindowInfoById(int32_t windowId) const; diff --git a/service/window_manager/include/pointer_drawing_manager.h b/service/window_manager/include/pointer_drawing_manager.h index a42178dd0c428a28945964865d8f033b3909c72c..a4be0aa8b1b2af3239beee9fbf4199e2ea5518ba 100644 --- a/service/window_manager/include/pointer_drawing_manager.h +++ b/service/window_manager/include/pointer_drawing_manager.h @@ -20,9 +20,11 @@ #include "transaction/rs_interfaces.h" #include "device_observer.h" +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR #include "hardware_cursor_pointer_manager.h" #include "dm_common.h" #include "screen_manager_lite.h" +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR #include "i_pointer_drawing_manager.h" #include "mouse_event_normalize.h" #include "screen_pointer.h" @@ -52,6 +54,7 @@ private: std::shared_ptr pixelMap_ { nullptr }; }; +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR class ScreenModeChangeListener final : public OHOS::Rosen::ScreenManagerLite::IScreenModeChangeListener { public: using callback_t = std::function> &)>; @@ -66,6 +69,7 @@ public: private: callback_t callback_; }; +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR class DelegateInterface; class PointerDrawingManager final : public IPointerDrawingManager, public IDeviceObserver { @@ -136,7 +140,9 @@ public: } void DestroyPointerWindow() override; void DrawScreenCenterPointer(const PointerStyle& pointerStyle) override; +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR void OnScreenModeChange(const std::vector> &screens); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR int32_t UpdateMouseLayer(const PointerStyle& pointerStyle, int32_t displayId, int32_t physicalX, int32_t physicalY) override; @@ -183,8 +189,6 @@ private: int32_t CreatePointerSwitchObserver(isMagicCursor& item); void UpdateStyleOptions(); int32_t GetIndependentPixels(); - bool IsWindowRotation(const DisplayInfo *displayInfo); - Direction GetDisplayDirection(const DisplayInfo *displayInfo); bool CheckPointerStyleParam(int32_t windowId, PointerStyle pointerStyle); std::map& GetMouseIcons(); void UpdateIconPath(const MOUSE_ICON mouseStyle, std::string iconPath); @@ -208,6 +212,7 @@ private: ICON_TYPE MouseIcon2IconType(MOUSE_ICON m); void SetSurfaceNodeBounds(); int32_t DrawNewDpiPointer() override; +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR bool SetDynamicHardWareCursorLocation(int32_t physicalX, int32_t physicalY, MOUSE_ICON mouseStyle); void RenderThreadLoop(); void SoftCursorRenderThreadLoop(); @@ -223,6 +228,7 @@ private: void PostTaskRSLocation(int32_t physicalX, int32_t physicalY, std::shared_ptr surfaceNode); int32_t InitVsync(MOUSE_ICON mouseStyle); void DumpScreenInfo(std::ostringstream& oss); + bool IsSupported() override; int32_t DrawSoftCursor(std::shared_ptr sn, const RenderConfig &cfg); int32_t DrawHardCursor(std::shared_ptr sp, const RenderConfig &cfg); std::vector> GetMirrorScreenPointers(); @@ -246,11 +252,11 @@ private: void AttachAllSurfaceNode() override; void DetachAllSurfaceNode() override; int32_t CheckHwcReady() override; +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR std::shared_ptr GetSurfaceNode(); void SetSurfaceNode(std::shared_ptr ptr); void AdjustMouseFocusToSoftRenderOrigin(Direction direction, const MOUSE_ICON pointerStyle, int32_t &physicalX, int32_t &physicalY); - bool GetHardCursorEnabled() override; private: struct PidInfo { int32_t pid { 0 }; @@ -300,6 +306,7 @@ private: std::unique_ptr renderThread_ { nullptr }; bool isInit_ { false }; std::mutex mtx_; +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR std::shared_ptr hardwareCursorPointerManager_ { nullptr }; sptr screenModeChangeListener_ { nullptr }; std::unordered_map> screenPointers_; @@ -313,6 +320,7 @@ private: std::unique_ptr moveRetryThread_ { nullptr }; int32_t moveRetryTimerId_ { -1 }; int32_t moveRetryCount_ { 0 }; +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR float hardwareCanvasSize_ { HARDWARE_CANVAS_SIZE }; #ifdef OHOS_BUILD_ENABLE_MAGICCURSOR std::shared_ptr pixelMap_ { nullptr }; diff --git a/service/window_manager/include/screen_pointer.h b/service/window_manager/include/screen_pointer.h index 948b2cb18ca1426553dd86242ff70053d73da900..ffde2209c8af79dece2db63a30f3ce27a380ed8a 100644 --- a/service/window_manager/include/screen_pointer.h +++ b/service/window_manager/include/screen_pointer.h @@ -44,7 +44,7 @@ public: bool InitSurface(); void UpdateScreenInfo(screen_info_ptr_t si); bool UpdatePadding(uint32_t mainWidth, uint32_t mainHeight); - void OnDisplayInfo(const DisplayInfo &di, bool isWindowRotation); + void OnDisplayInfo(const DisplayInfo &di); buffer_ptr_t GetDefaultBuffer(); buffer_ptr_t GetTransparentBuffer(); @@ -171,8 +171,6 @@ private: mode_t mode_{mode_t::SCREEN_MAIN}; rotation_t rotation_{rotation_t::ROTATION_0}; float dpi_{1.0f}; - Direction displayDirection_{DIRECTION0}; - bool isWindowRotation_{false}; // screen scale and padding info float scale_{1.0f}; diff --git a/service/window_manager/src/input_windows_manager.cpp b/service/window_manager/src/input_windows_manager.cpp index 0a0a80ac3b086e2f6b515b86b9fa268aecc49231..aa1b5b1aa3959c8fe1138ec0da2ee38db47861c2 100644 --- a/service/window_manager/src/input_windows_manager.cpp +++ b/service/window_manager/src/input_windows_manager.cpp @@ -785,15 +785,15 @@ std::vector> InputWindowsManager::GetPidAndUpdate } int32_t groupId = FindDisplayGroupId(keyEvent->GetTargetDisplayId()); const int32_t focusWindowId = GetFocusWindowId(groupId); - if (GetHardCursorEnabled()) { - UpdateKeyEventDisplayId(keyEvent, focusWindowId_); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + UpdateKeyEventDisplayId(keyEvent, focusWindowId, groupId); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR WindowInfo* windowInfo = nullptr; std::vector windowsInfo = GetWindowGroupInfoByDisplayId(keyEvent->GetTargetDisplayId()); bool isUIExtention = false; auto iter = windowsInfo.begin(); for (; iter != windowsInfo.end(); ++iter) { - if (iter->id == focusWindowId_) { + if (iter->id == focusWindowId) { windowInfo = &(*iter); if (!iter->uiExtentionWindowInfo.empty() && !IsOnTheWhitelist(keyEvent)) { isUIExtention = true; @@ -1147,30 +1147,26 @@ WINDOW_UPDATE_ACTION InputWindowsManager::UpdateWindowInfo(DisplayGroupInfo &dis [](const WindowInfo &lwindow, const WindowInfo &rwindow) -> bool { return lwindow.zOrder > rwindow.zOrder; }); - if (GetHardCursorEnabled()) - { - for (auto &windowInfo : displayGroupInfo.windowsInfo) - { - if (windowInfo.isDisplayCoord) - { - continue; - } - auto displayInfo = GetPhysicalDisplay(windowInfo.displayId, displayGroupInfo); - CHKPR(displayInfo, action); - ChangeWindowArea(displayInfo->x, displayInfo->y, windowInfo); - if (!windowInfo.uiExtentionWindowInfo.empty()) - { - for (auto &item : windowInfo.uiExtentionWindowInfo) - { - ChangeWindowArea(displayInfo->x, displayInfo->y, item); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + for (auto &windowInfo : displayGroupInfo.windowsInfo) { + if (windowInfo.isDisplayCoord) { + continue; + } + auto displayInfo = GetPhysicalDisplay(windowInfo.displayId, displayGroupInfo); + CHKPR(displayInfo, action); + ChangeWindowArea(displayInfo->x, displayInfo->y, windowInfo); + if (!windowInfo.uiExtentionWindowInfo.empty()) { + for (auto &item : windowInfo.uiExtentionWindowInfo) { + ChangeWindowArea(displayInfo->x, displayInfo->y, item); } - windowInfo.isDisplayCoord = true; } + windowInfo.isDisplayCoord = true; } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR return action; } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR void InputWindowsManager::ChangeWindowArea(int32_t x, int32_t y, WindowInfo &windowInfo) { windowInfo.area.x += x; @@ -1247,15 +1243,16 @@ CursorPosition InputWindowsManager::ResetCursorPos(const DisplayGroupInfo &disp DisplayInfo displayInfo = displayGroupInfo.displaysInfo[0]; int32_t x = displayInfo.validWidth * HALF_RATIO; int32_t y = displayInfo.validHeight * HALF_RATIO; - if (GetHardCursorEnabled()) { - (void)GetMainScreenDisplayInfo(displayGroupInfo.displaysInfo, displayInfo); - x = displayInfo.validWidth * HALF_RATIO; - y = displayInfo.validHeight * HALF_RATIO; - Direction direction = GetDisplayDirection(&displayInfo); - if (direction == DIRECTION90 || direction == DIRECTION270) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + (void)GetMainScreenDisplayInfo(displayGroupInfo.displaysInfo, displayInfo); + x = displayInfo.validWidth * HALF_RATIO; + y = displayInfo.validHeight * HALF_RATIO; + if (IsSupported()) { + if (displayInfo.direction == DIRECTION90 || displayInfo.direction == DIRECTION270) { std::swap(x, y); } } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR cursorPosMap_[groupId].displayId = displayInfo.id; cursorPosMap_[groupId].cursorPos.x = x; cursorPosMap_[groupId].cursorPos.y = y; @@ -1309,6 +1306,7 @@ bool InputWindowsManager::IsPointerOnCenter(const CursorPosition ¤tPos, co } return false; } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR void InputWindowsManager::HandleValidDisplayChange(const DisplayGroupInfo &displayGroupInfo) { @@ -1321,9 +1319,9 @@ CursorPosition InputWindowsManager::GetCursorPos(const DisplayGroupInfo &display int32_t groupId = displayGroupInfo.groupId; if ((cursorPosMap_[groupId].displayId < 0) && !displayGroupInfoMap_[groupId].displaysInfo.empty()) { DisplayInfo displayInfo = displayGroupInfo.displaysInfo[0]; - if (GetHardCursorEnabled()) { - (void)GetMainScreenDisplayInfo(displayGroupInfo.displaysInfo, displayInfo); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + (void)GetMainScreenDisplayInfo(displayGroupInfo.displaysInfo, displayInfo); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR cursorPosMap_[groupId].displayId = displayInfo.id; cursorPosMap_[groupId].cursorPos.x = displayInfo.validWidth * HALF_RATIO; cursorPosMap_[groupId].cursorPos.y = displayInfo.validHeight * HALF_RATIO; @@ -1790,21 +1788,19 @@ void InputWindowsManager::UpdateDisplayInfo(DisplayGroupInfo &displayGroupInfo) auto action = UpdateWindowInfo(displayGroupInfo); CheckFocusWindowChange(displayGroupInfo); UpdateCaptureMode(displayGroupInfo); - bool isDisplayChanged = false; - if (GetHardCursorEnabled()) { - isDisplayChanged = OnDisplayRemovedOrCombinationChanged(displayGroupInfo); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + bool isDisplayChanged = OnDisplayRemovedOrCombinationChanged(displayGroupInfo); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR DisplayGroupInfo displayGroupInfoTemp; displayGroupInfoMapTmp_[displayGroupInfo.groupId] = displayGroupInfo; bFlag = (!Rosen::SceneBoardJudgement::IsSceneBoardEnabled() || action == WINDOW_UPDATE_ACTION::ADD_END) && ((currentUserId_ < 0) || (currentUserId_ == displayGroupInfo.currentUserId)); if (bFlag) { - if (GetHardCursorEnabled()) { - bool isDisplayUpdate = OnDisplayRemovedOrCombinationChanged(displayGroupInfo); - if (isDisplayUpdate) { - ResetPointerPosition(displayGroupInfo); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + if (isDisplayChanged) { + ResetPointerPosition(displayGroupInfo); } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR PrintChangedWindowBySync(displayGroupInfo); CleanInvalidPiexMap(groupId); HandleValidDisplayChange(displayGroupInfo); @@ -1838,11 +1834,11 @@ void InputWindowsManager::UpdateDisplayInfo(DisplayGroupInfo &displayGroupInfo) bFlag = (iter != pointerDrawFlagMap_.end()) ? true : false; if (!displayGroupInfo.displaysInfo.empty() && bFlag) { AdjustDisplayRotation(groupId); - if (GetHardCursorEnabled()) { - PointerDrawingManagerOnDisplayInfo(displayGroupInfo, isDisplayChanged); - } else { - PointerDrawingManagerOnDisplayInfo(displayGroupInfo); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + PointerDrawingManagerOnDisplayInfo(displayGroupInfo, isDisplayChanged); +#else + PointerDrawingManagerOnDisplayInfo(displayGroupInfo); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR } lastDpiMap_[groupId] = displayGroupInfoTemp.displaysInfo.empty() ? DEFAULT_DPI : @@ -1890,10 +1886,11 @@ void InputWindowsManager::AdjustDisplayRotation(int32_t groupId) cursorPosMap_[groupId].displayDirection = displayInfo->displayDirection; } UpdateAndAdjustMouseLocation(cursorPosCur.displayId, coord.x, coord.y); - if (GetHardCursorEnabled() && extraData_.appended && - (extraData_.sourceType == PointerEvent::SOURCE_TYPE_MOUSE)) { - AdjustDragPosition(groupId); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + if (IsSupported() && extraData_.appended && (extraData_.sourceType == PointerEvent::SOURCE_TYPE_MOUSE)) { + AdjustDragPosition(groupId); + } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR IPointerDrawingManager::GetInstance()->UpdateDisplayInfo(*displayInfo); int32_t displayId = -1; @@ -2831,7 +2828,13 @@ void InputWindowsManager::RotateScreen(const DisplayInfo& info, PhysicalCoordina void InputWindowsManager::RotateDisplayScreen(const DisplayInfo& info, PhysicalCoordinate& coord) { - Direction displayDirection = GetDisplayDirection(&info); + Direction displayDirection = static_cast( + (((info.direction - info.displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + if (IsSupported()) { + displayDirection = info.direction; + } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR bool isEnable = Rosen::SceneBoardJudgement::IsSceneBoardEnabled(); double oldX = coord.x; double oldY = coord.y; @@ -4114,7 +4117,13 @@ std::vector InputWindowsManager::HandleHardwareCursor(std::shared_ptr cursorPos = {DEFAULT_POSITION, DEFAULT_POSITION}; Direction direction = DIRECTION0; if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) { - direction = GetDisplayDirection(physicalDisplayInfo.get()); + direction = static_cast((((physicalDisplayInfo->direction - + physicalDisplayInfo->displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + if (IsSupported()) { + direction = physicalDisplayInfo->direction; + } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR TOUCH_DRAWING_MGR->GetOriginalTouchScreenCoordinates(direction, physicalDisplayInfo->validWidth, physicalDisplayInfo->validHeight, physicalX, physicalY); } @@ -4184,16 +4193,18 @@ int32_t InputWindowsManager::UpdateMouseTarget(std::shared_ptr poi } else { IPointerDrawingManager::GetInstance()->SetMouseDisplayState(true); } - if (GetHardCursorEnabled()) { - std::vector cursorPos = HandleHardwareCursor(physicalDisplayInfo, physicalX, physicalY); - if (cursorPos.empty()) { - MMI_HILOGW("cursorPos is empty"); - return RET_ERR; - } - IPointerDrawingManager::GetInstance()->DrawMovePointer(displayId, cursorPos[0], cursorPos[1]); - } else { - IPointerDrawingManager::GetInstance()->DrawMovePointer(displayId, physicalX, physicalY); +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + std::vector cursorPos = HandleHardwareCursor(physicalDisplayInfo, physicalX, physicalY); + if (cursorPos.size() < CURSOR_POSITION_EXPECTED_SIZE) { + MMI_HILOGW("cursorPos is invalid"); + return RET_ERR; } + IPointerDrawingManager::GetInstance()->DrawMovePointer(physicalDisplayInfo->uniqueId, + cursorPos[0], cursorPos[1]); +#else + IPointerDrawingManager::GetInstance()->DrawMovePointer(physicalDisplayInfo->uniqueId, + physicalX, physicalY); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR MMI_HILOGI("UpdateMouseTarget id:%{public}d, logicalX:%{public}d, logicalY:%{public}d," "displayX:%{public}d, displayY:%{public}d", physicalDisplayInfo->uniqueId, logicalX, logicalY, pointerItem.GetDisplayX(), pointerItem.GetDisplayY()); @@ -4302,7 +4313,13 @@ int32_t InputWindowsManager::UpdateMouseTarget(std::shared_ptr poi } Direction direction = DIRECTION0; if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) { - direction = GetDisplayDirection(physicalDisplayInfo.get()); + direction = static_cast((((physicalDisplayInfo->direction - physicalDisplayInfo->displayDirection) * + ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + if (IsSupported()) { + direction = physicalDisplayInfo->direction; + } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR #ifdef OHOS_BUILD_ENABLE_TOUCH_DRAWING TOUCH_DRAWING_MGR->GetOriginalTouchScreenCoordinates(direction, physicalDisplayInfo->validWidth, physicalDisplayInfo->validHeight, physicalX, physicalY); @@ -5719,11 +5736,13 @@ bool InputWindowsManager::CalculateLayout(const DisplayInfo &displayInfo, const { Direction direction = GetDisplayDirection(&displayInfo); Vector2D logical = physical; - if (GetHardCursorEnabled()) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + if (IsSupported()) { auto screenRect = RotateRect(direction, {displayInfo.width, displayInfo.height}); auto transforms = RotateAndFitScreen(direction, screenRect); logical = MMI::ApplyTransformSteps(transforms, physical); } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR layout.x = logical.x + displayInfo.x; layout.y = logical.y + displayInfo.y; @@ -5834,11 +5853,13 @@ void InputWindowsManager::FindPhysicalDisplay(const DisplayInfo& displayInfo, do } physical = logical; Direction direction = GetDisplayDirection(&item); - if (GetHardCursorEnabled()) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + if (IsSupported()) { auto screenRect = RotateRect(direction, { item.width, item.height }); auto transforms = RotateAndFitScreen(direction, screenRect); physical = ResetTransformSteps(transforms, logical); } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR physicalX = physical.x; physicalY = physical.y; displayId = item.id; @@ -5874,14 +5895,11 @@ Direction InputWindowsManager::GetDisplayDirection(const DisplayInfo *displayInf { Direction displayDirection = static_cast(( ((displayInfo->direction - displayInfo->displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); - if (GetHardCursorEnabled()) { - if (TOUCH_DRAWING_MGR->IsWindowRotation()) { - displayDirection = static_cast((((displayInfo->direction - displayInfo->displayDirection) * - ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); - } else { - displayDirection = displayInfo->direction; - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + if (IsSupported()) { + displayDirection = displayInfo->direction; } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR if (!Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) { displayDirection = displayInfo->direction; } @@ -5957,7 +5975,13 @@ void InputWindowsManager::ReverseRotateScreen(const DisplayInfo& info, const dou void InputWindowsManager::ReverseRotateDisplayScreen(const DisplayInfo& info, const double x, const double y, Coordinate2D& cursorPos) const { - Direction displayDirection = WIN_MGR->GetDisplayDirection(&info); + Direction displayDirection = static_cast(( + ((info.direction - info.displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + if (WIN_MGR->IsSupported()) { + direction = info.direction; + } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR MMI_HILOGD( "X:%{private}.2f, Y:%{private}.2f, info.WH:{%{private}d %{private}d}, info.validWH:{%{private}d %{private}d}", x, @@ -6101,9 +6125,9 @@ MouseLocation InputWindowsManager::GetMouseInfo() curMouseLocation.displayId, curMouseLocation.physicalX, curMouseLocation.physicalY); if ((curMouseLocation.displayId < 0) && !displaysInfoVector.empty()) { DisplayInfo displayInfo = displaysInfoVector[0]; - if (GetHardCursorEnabled()) { - (void)GetMainScreenDisplayInfo(displaysInfoVector, displayInfo); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + (void)GetMainScreenDisplayInfo(displaysInfoVector, displayInfo); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR const auto iter = mouseLocationMap_.find(MAIN_GROUPID); if (iter != mouseLocationMap_.end()) { mouseLocationMap_[MAIN_GROUPID].displayId = displayInfo.id; @@ -6131,9 +6155,9 @@ CursorPosition InputWindowsManager::GetCursorPos() } if ((cursorPos.displayId < 0) && !displaysInfoVector.empty()) { DisplayInfo displayInfo = displaysInfoVector[0]; - if (GetHardCursorEnabled()) { - (void)GetMainScreenDisplayInfo(displaysInfoVector, displayInfo); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + (void)GetMainScreenDisplayInfo(displaysInfoVector, displayInfo); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR const auto iter = cursorPosMap_.find(MAIN_GROUPID); if (iter != cursorPosMap_.end()) { cursorPosMap_[MAIN_GROUPID].displayId = displayInfo.id; @@ -6152,15 +6176,16 @@ CursorPosition InputWindowsManager::ResetCursorPos() DisplayInfo displayInfo = displaysInfoVector[0]; int32_t x = displayInfo.validWidth * HALF_RATIO; int32_t y = displayInfo.validHeight * HALF_RATIO; - if (GetHardCursorEnabled()) { - (void)GetMainScreenDisplayInfo(displaysInfoVector, displayInfo); - x = displayInfo.validWidth * HALF_RATIO; - y = displayInfo.validHeight * HALF_RATIO; - Direction displayDirection = GetDisplayDirection(&displayInfo); - if (displayDirection == DIRECTION90 || displayDirection == DIRECTION270) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + (void)GetMainScreenDisplayInfo(displaysInfoVector, displayInfo); + x = displayInfo.validWidth * HALF_RATIO; + y = displayInfo.validHeight * HALF_RATIO; + if (IsSupported()) { + if (displayInfo.direction == DIRECTION90 || displayInfo.direction == DIRECTION270) { std::swap(x, y); } } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR const auto iter = cursorPosMap_.find(MAIN_GROUPID); if (iter != cursorPosMap_.end()) { cursorPosMap_[MAIN_GROUPID].displayId = displayInfo.id; @@ -6827,6 +6852,7 @@ bool InputWindowsManager::IsKnuckleOnAncoWindow(std::shared_ptr po } #endif // OHOS_BUILD_ENABLE_ANCO +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR void InputWindowsManager::UpdateKeyEventDisplayId(std::shared_ptr keyEvent, int32_t focusWindowId, int32_t groupId) { @@ -6874,10 +6900,11 @@ bool InputWindowsManager::OnDisplayRemovedOrCombinationChanged(const DisplayGrou return false; } -bool InputWindowsManager::GetHardCursorEnabled() +bool InputWindowsManager::IsSupported() { - return IPointerDrawingManager::GetInstance()->GetHardCursorEnabled(); + return IPointerDrawingManager::GetInstance()->IsSupported(); } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR int32_t InputWindowsManager::GetCurrentUserId() { diff --git a/service/window_manager/src/pointer_drawing_manager.cpp b/service/window_manager/src/pointer_drawing_manager.cpp index 6e39facb94b542299a52a3c2ee951bd542c87a48..9d6f70ad9ece33073ccd429f286f238e21ea840f 100644 --- a/service/window_manager/src/pointer_drawing_manager.cpp +++ b/service/window_manager/src/pointer_drawing_manager.cpp @@ -53,9 +53,6 @@ #include "common_event_manager.h" #include "common_event_support.h" -#include -#include "param/sys_param.h" - #undef MMI_LOG_DOMAIN #define MMI_LOG_DOMAIN MMI_LOG_CURSOR #undef MMI_LOG_TAG @@ -79,11 +76,6 @@ const char* MAGIC_POINTER_COLOR { "magicPointerColor" }; const char* MAGIC_POINTER_SIZE { "magicPointerSize"}; const char* POINTER_CURSOR_RENDER_RECEIVER_NAME { "PointerCursorReceiver" }; const std::vector DEVICE_TYPES = {}; -const int32_t ROTATE_POLICY = system::GetIntParameter("const.window.device.rotate_policy", 0); -const std::string FOLDABLE_DEVICE_POLICY = system::GetParameter("const.window.foldabledevice.rotate_policy", ""); -constexpr int32_t WINDOW_ROTATE { 0 }; -constexpr char ROTATE_WINDOW_ROTATE { '0' }; -constexpr int32_t FOLDABLE_DEVICE { 2 }; constexpr int32_t BASELINE_DENSITY { 160 }; constexpr int32_t CALCULATE_MIDDLE { 2 }; [[ maybe_unused ]] constexpr int32_t MAGIC_INDEPENDENT_PIXELS { 30 }; @@ -149,6 +141,7 @@ constexpr int32_t PC_PRIORITY { 2 }; namespace OHOS { namespace MMI { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR class DisplyStatusReceiver : public EventFwk::CommonEventSubscriber { public: explicit DisplyStatusReceiver(const OHOS::EventFwk::CommonEventSubscribeInfo& subscribeInfo) @@ -161,9 +154,6 @@ public: void OnReceiveEvent(const EventFwk::CommonEventData &eventData) { - if (!IPointerDrawingManager::GetInstance()->GetHardCursorEnabled()) { - return; - } std::string action = eventData.GetWant().GetAction(); if (action.empty()) { MMI_HILOGE("action is empty"); @@ -191,6 +181,7 @@ public: } } }; +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR static bool IsSingleDisplayFoldDevice() { @@ -229,7 +220,8 @@ void PointerDrawingManager::InitPointerCallback() MAGIC_CURSOR->RsRemoteInitCallbackForMagicCursor(); } #endif // OHOS_BUILD_ENABLE_MAGICCURSOR - if (GetHardCursorEnabled() && !initEventhandlerFlag_.load()) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + if (!initEventhandlerFlag_.load()) { std::string productType = OHOS::system::GetParameter("const.build.product", "HYM"); if (std::find(DEVICE_TYPES.begin(), DEVICE_TYPES.end(), productType) != DEVICE_TYPES.end()) { renderThread_ = std::make_unique([this] { this->RenderThreadLoop(); }); @@ -239,6 +231,7 @@ void PointerDrawingManager::InitPointerCallback() } initEventhandlerFlag_.store(true); } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR } void PointerDrawingManager::DestroyPointerWindow() @@ -293,33 +286,34 @@ PointerDrawingManager::PointerDrawingManager() MAGIC_CURSOR->InitStyle(); #endif // OHOS_BUILD_ENABLE_MAGICCURSOR InitStyle(); +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR hardwareCursorPointerManager_ = std::make_shared(); - if (GetHardCursorEnabled()) { - g_hardwareCanvasSize = GetCanvasSize(); - g_focalPoint = GetFocusCoordinates(); - } + g_hardwareCanvasSize = GetCanvasSize(); + g_focalPoint = GetFocusCoordinates(); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR } PointerDrawingManager::~PointerDrawingManager() { MMI_HILOGI("~PointerDrawingManager enter"); - if (GetHardCursorEnabled()) { - if (runner_ != nullptr) { - runner_->Stop(); - } - if ((renderThread_ != nullptr) && renderThread_->joinable()) { - renderThread_->join(); - } - if (softCursorRunner_ != nullptr) { - softCursorRunner_->Stop(); - } - if ((softCursorRenderThread_ != nullptr) && softCursorRenderThread_->joinable()) { - softCursorRenderThread_->join(); - } - if ((moveRetryThread_ != nullptr) && moveRetryThread_->joinable()) { - moveRetryThread_->join(); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + if (runner_ != nullptr) { + runner_->Stop(); } + if ((renderThread_ != nullptr) && renderThread_->joinable()) { + renderThread_->join(); + } + + if (softCursorRunner_ != nullptr) { + softCursorRunner_->Stop(); + } + if ((softCursorRenderThread_ != nullptr) && softCursorRenderThread_->joinable()) { + softCursorRenderThread_->join(); + } + if ((moveRetryThread_ != nullptr) && moveRetryThread_->joinable()) { + moveRetryThread_->join(); + } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR MMI_HILOGI("~PointerDrawingManager complete"); } @@ -344,27 +338,41 @@ bool PointerDrawingManager::SetCursorLocation(int32_t displayId, int32_t physica } auto surfaceNodePtr = GetSurfaceNode(); CHKPF(surfaceNodePtr); - if (GetHardCursorEnabled()) { - if (!magicCursorSetBounds) { - if (lastMouseStyle_.id != MOUSE_ICON::LOADING && lastMouseStyle_.id != MOUSE_ICON::RUNNING) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPF(hardwareCursorPointerManager_); + if (g_isHdiRemoteDied) { + hardwareCursorPointerManager_->SetHdiServiceState(false); + } + if (!magicCursorSetBounds) { + if (hardwareCursorPointerManager_->IsSupported()) { + if (lastMouseStyle_.id != MOUSE_ICON::LOADING && + lastMouseStyle_.id != MOUSE_ICON::RUNNING) { // Change the coordinates issued by RS to asynchronous, // without blocking the issuance of HardwareCursor coordinates. SoftwareCursorMoveAsync(physicalX, physicalY, iconType); } - } - if (lastMouseStyle_.id != MOUSE_ICON::LOADING && lastMouseStyle_.id != MOUSE_ICON::RUNNING) { - ResetMoveRetryTimer(); - if (HardwareCursorMove(physicalX, physicalY, iconType) != RET_OK) { - MoveRetryAsync(physicalX, physicalY, iconType); - } - } - } else { - if (!magicCursorSetBounds) { + } else { surfaceNodePtr->SetBounds(physicalX, physicalY, surfaceNodePtr->GetStagingProperties().GetBounds().z_, surfaceNodePtr->GetStagingProperties().GetBounds().w_); Rosen::RSTransaction::FlushImplicitTransaction(); } } + CHKPF(hardwareCursorPointerManager_); + if (hardwareCursorPointerManager_->IsSupported() && + lastMouseStyle_.id != MOUSE_ICON::LOADING && + lastMouseStyle_.id != MOUSE_ICON::RUNNING) { + ResetMoveRetryTimer(); + if (HardwareCursorMove(physicalX, physicalY, iconType) != RET_OK) { + MoveRetryAsync(physicalX, physicalY, iconType); + } + } +#else + if (!magicCursorSetBounds) { + surfaceNodePtr->SetBounds(physicalX, physicalY, surfaceNodePtr->GetStagingProperties().GetBounds().z_, + surfaceNodePtr->GetStagingProperties().GetBounds().w_); + Rosen::RSTransaction::FlushImplicitTransaction(); + } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR return true; } @@ -405,9 +413,9 @@ int32_t PointerDrawingManager::DrawMovePointer(int32_t displayId, int32_t physic } } #endif // OHOS_BUILD_ENABLE_MAGICCURSOR - if (GetHardCursorEnabled()) { - UpdateBindDisplayId(displayId); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + UpdateBindDisplayId(displayId); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR if (lastMouseStyle_ == pointerStyle && !mouseIconUpdate_ && lastDirection_ == direction) { if (!SetCursorLocation(displayId, physicalX, physicalY, MouseIcon2IconType(MOUSE_ICON(lastMouseStyle_.id)))) { return RET_ERR; @@ -421,7 +429,9 @@ int32_t PointerDrawingManager::DrawMovePointer(int32_t displayId, int32_t physic lastDirection_ = direction; } lastMouseStyle_ = pointerStyle; - if (GetHardCursorEnabled()) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPR(hardwareCursorPointerManager_, RET_ERR); + if (hardwareCursorPointerManager_->IsSupported()) { UpdatePointerVisible(); } else { int32_t UpdateLayerRes = UpdateMouseLayer(pointerStyle, displayId, physicalX, physicalY); @@ -430,6 +440,13 @@ int32_t PointerDrawingManager::DrawMovePointer(int32_t displayId, int32_t physic } UpdatePointerVisible(); } +#else + int32_t UpdateLayerRes = UpdateMouseLayer(pointerStyle, displayId, physicalX, physicalY); + if (UpdateLayerRes != RET_OK) { + MMI_HILOGE("Update Mouse Layer failed."); + } + UpdatePointerVisible(); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR mouseIconUpdate_ = false; MMI_HILOGD("Leave, display:%{public}d, physicalX:%{public}d, physicalY:%{public}d", displayId, physicalX, physicalY); @@ -457,9 +474,9 @@ void PointerDrawingManager::DrawMovePointer(int32_t displayId, int32_t physicalX { CALL_DEBUG_ENTER; displayId_ = displayId; - if (GetHardCursorEnabled()) { - UpdateBindDisplayId(displayId); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + UpdateBindDisplayId(displayId); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR if (GetSurfaceNode() != nullptr) { if (!SetCursorLocation(displayId, physicalX, physicalY, MouseIcon2IconType(MOUSE_ICON(lastMouseStyle_.id)))) { MMI_HILOGE("SetCursorLocation failed"); @@ -472,7 +489,12 @@ void PointerDrawingManager::DrawMovePointer(int32_t displayId, int32_t physicalX void PointerDrawingManager::SetHardwareCursorPosition(int32_t displayId, int32_t physicalX, int32_t physicalY, PointerStyle pointerStyle) { - if (GetHardCursorEnabled() && lastMouseStyle_.id != MOUSE_ICON::LOADING && +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPV(hardwareCursorPointerManager_); + if (g_isHdiRemoteDied) { + hardwareCursorPointerManager_->SetHdiServiceState(false); + } + if (hardwareCursorPointerManager_->IsSupported() && lastMouseStyle_.id != MOUSE_ICON::LOADING && lastMouseStyle_.id != MOUSE_ICON::RUNNING) { auto align = MouseIcon2IconType(MOUSE_ICON(lastMouseStyle_.id)); ResetMoveRetryTimer(); @@ -480,6 +502,7 @@ void PointerDrawingManager::SetHardwareCursorPosition(int32_t displayId, int32_t MoveRetryAsync(physicalX, physicalY, align); } } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR } void PointerDrawingManager::DrawPointer(int32_t displayId, int32_t physicalX, int32_t physicalY, @@ -695,6 +718,7 @@ bool PointerDrawingManager::HasMagicCursor() return hasMagicCursor_.isShow; } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR int32_t PointerDrawingManager::InitVsync(MOUSE_ICON mouseStyle) { if (g_isReStartVsync) { @@ -715,7 +739,7 @@ int32_t PointerDrawingManager::InitVsync(MOUSE_ICON mouseStyle) sptr PointerDrawingManager::RetryGetSurfaceBuffer(sptr layer) { sptr buffer; - if (GetHardCursorEnabled()) { + if (hardwareCursorPointerManager_->IsSupported()) { for (size_t i = 0; i < RETRY_TIMES; i++) { buffer = GetSurfaceBuffer(layer); if (buffer != nullptr && buffer->GetVirAddr() != nullptr) { @@ -742,6 +766,7 @@ int32_t PointerDrawingManager::GetMainScreenDisplayInfo(const DisplayGroupInfo & mainScreenDisplayInfo = displayGroupInfo.displaysInfo[0]; return RET_OK; } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR int32_t PointerDrawingManager::InitLayer(const MOUSE_ICON mouseStyle) { @@ -751,7 +776,9 @@ int32_t PointerDrawingManager::InitLayer(const MOUSE_ICON mouseStyle) return MAGIC_CURSOR->InitLayer(mouseStyle); } #endif // OHOS_BUILD_ENABLE_MAGICCURSOR - if (GetHardCursorEnabled()) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPR(hardwareCursorPointerManager_, RET_ERR); + if (hardwareCursorPointerManager_->IsSupported()) { MMI_HILOGI("mouseStyle:%{public}u", static_cast(mouseStyle)); if ((mouseStyle == MOUSE_ICON::LOADING) || (mouseStyle == MOUSE_ICON::RUNNING)) { return InitVsync(mouseStyle); @@ -765,6 +792,7 @@ int32_t PointerDrawingManager::InitLayer(const MOUSE_ICON mouseStyle) HardwareCursorRender(mouseStyle); return RET_OK; } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR return DrawCursor(mouseStyle); } @@ -948,6 +976,7 @@ std::shared_ptr PointerDrawingManager::ExtractDrawingImag return image; } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR void PointerDrawingManager::PostTask(std::function task) { CHKPV(hardwareCursorPointerManager_); @@ -997,7 +1026,7 @@ int32_t PointerDrawingManager::DrawDynamicHardwareCursor(std::shared_ptrGetScreenId(), cfg.style_); + sp->GetScreenId(), cfg.style); auto sret = buffer->FlushCache(); if (sret != RET_OK) { MMI_HILOGE("FlushCache ret: %{public}d", sret); @@ -1014,9 +1043,9 @@ void PointerDrawingManager::HardwareCursorDynamicRender(MOUSE_ICON mouseStyle) screenPointers = screenPointers_; } RenderConfig cfg { - .style_ = mouseStyle, - .align_ = MouseIcon2IconType(mouseStyle), - .path_ = mouseIcons_[mouseStyle].iconPath, + .style = mouseStyle, + .align = MouseIcon2IconType(mouseStyle), + .path = mouseIcons_[mouseStyle].iconPath, .color = GetPointerColor(), .size = GetPointerSize(), .direction = displayInfo_.direction, @@ -1072,7 +1101,7 @@ int32_t PointerDrawingManager::DrawDynamicSoftCursor(std::shared_ptrCancelBuffer(buffer); return RET_ERR; } - MMI_HILOGI("DrawDynamicSoftCursor on sn success, styel = %{public}d", cfg.style_); + MMI_HILOGI("DrawDynamicSoftCursor on sn success, styel = %{public}d", cfg.style); return RET_OK; } @@ -1085,9 +1114,9 @@ void PointerDrawingManager::SoftwareCursorDynamicRender(MOUSE_ICON mouseStyle) } for (auto it : screenPointers) { RenderConfig cfg { - .style_ = mouseStyle, - .align_ = MouseIcon2IconType(mouseStyle), - .path_ = mouseIcons_[mouseStyle].iconPath, + .style = mouseStyle, + .align = MouseIcon2IconType(mouseStyle), + .path = mouseIcons_[mouseStyle].iconPath, .color = GetPointerColor(), .size = GetPointerSize(), .direction = displayInfo_.direction, @@ -1109,9 +1138,9 @@ void PointerDrawingManager::SoftwareCursorDynamicRender(MOUSE_ICON mouseStyle) } DrawDynamicSoftCursor(sn, cfg); } else { - cfg.style_ = MOUSE_ICON::TRANSPARENT_ICON; - cfg.align_ = MouseIcon2IconType(cfg.style_); - cfg.path_ = mouseIcons_[cfg.style_].iconPath; + cfg.style = MOUSE_ICON::TRANSPARENT_ICON; + cfg.align = MouseIcon2IconType(cfg.style); + cfg.path = mouseIcons_[cfg.style].iconPath; DrawDynamicSoftCursor(it.second->GetSurfaceNode(), cfg); } } @@ -1219,6 +1248,7 @@ void PointerDrawingManager::MoveRetryThreadLoop() moveRetryRunner_->Run(); } } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR void PointerDrawingManager::DrawRunningPointerAnimate(const MOUSE_ICON mouseStyle) { @@ -1285,9 +1315,12 @@ void PointerDrawingManager::AdjustMouseFocus(Direction direction, ICON_TYPE icon int32_t &physicalX, int32_t &physicalY) { CALL_DEBUG_ENTER; - if (GetHardCursorEnabled()) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPV(hardwareCursorPointerManager_); + if (hardwareCursorPointerManager_->IsSupported()) { return; } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR switch (direction) { case DIRECTION0: { AdjustMouseFocusByDirection0(iconType, physicalX, physicalY); @@ -1317,10 +1350,14 @@ void PointerDrawingManager::AdjustMouseFocusByDirection0(ICON_TYPE iconType, int CALL_DEBUG_ENTER; int32_t height = imageHeight_; int32_t width = imageWidth_; - if (GetHardCursorEnabled() && currentMouseStyle_.id == MOUSE_ICON::DEVELOPER_DEFINED_ICON) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPV(hardwareCursorPointerManager_); + if (hardwareCursorPointerManager_->IsSupported() && + currentMouseStyle_.id == MOUSE_ICON::DEVELOPER_DEFINED_ICON) { height = cursorHeight_; width = cursorWidth_; } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR switch (iconType) { case ANGLE_SW: { physicalY -= height; @@ -1356,10 +1393,14 @@ void PointerDrawingManager::AdjustMouseFocusByDirection90(ICON_TYPE iconType, in CALL_DEBUG_ENTER; int32_t height = imageHeight_; int32_t width = imageWidth_; - if (GetHardCursorEnabled() && currentMouseStyle_.id == MOUSE_ICON::DEVELOPER_DEFINED_ICON) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPV(hardwareCursorPointerManager_); + if (hardwareCursorPointerManager_->IsSupported() && + currentMouseStyle_.id == MOUSE_ICON::DEVELOPER_DEFINED_ICON) { height = cursorHeight_; width = cursorWidth_; } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR switch (iconType) { case ANGLE_SW: { physicalY += height; @@ -1395,10 +1436,14 @@ void PointerDrawingManager::AdjustMouseFocusByDirection180(ICON_TYPE iconType, i CALL_DEBUG_ENTER; int32_t height = imageHeight_; int32_t width = imageWidth_; - if (GetHardCursorEnabled() && currentMouseStyle_.id == MOUSE_ICON::DEVELOPER_DEFINED_ICON) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPV(hardwareCursorPointerManager_); + if (hardwareCursorPointerManager_->IsSupported() && + currentMouseStyle_.id == MOUSE_ICON::DEVELOPER_DEFINED_ICON) { height = cursorHeight_; width = cursorWidth_; } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR switch (iconType) { case ANGLE_SW: { physicalY += height; @@ -1434,10 +1479,14 @@ void PointerDrawingManager::AdjustMouseFocusByDirection270(ICON_TYPE iconType, i CALL_DEBUG_ENTER; int32_t height = imageHeight_; int32_t width = imageWidth_; - if (GetHardCursorEnabled() && currentMouseStyle_.id == MOUSE_ICON::DEVELOPER_DEFINED_ICON) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPV(hardwareCursorPointerManager_); + if (hardwareCursorPointerManager_->IsSupported() && + currentMouseStyle_.id == MOUSE_ICON::DEVELOPER_DEFINED_ICON) { height = cursorHeight_; width = cursorWidth_; } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR switch (iconType) { case ANGLE_SW: { physicalY -= height; @@ -1473,8 +1522,15 @@ void PointerDrawingManager::SetMouseDisplayState(bool state) CALL_DEBUG_ENTER; if (mouseDisplayState_ != state) { mouseDisplayState_ = state; - if (mouseDisplayState_ && !GetHardCursorEnabled()) { + if (mouseDisplayState_) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPV(hardwareCursorPointerManager_); + if (!hardwareCursorPointerManager_->IsSupported()) { + InitLayer(MOUSE_ICON(lastMouseStyle_.id)); + } +#else InitLayer(MOUSE_ICON(lastMouseStyle_.id)); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR } MMI_HILOGI("The state:%{public}s", state ? "true" : "false"); UpdatePointerVisible(); @@ -1486,36 +1542,6 @@ bool PointerDrawingManager::GetMouseDisplayState() const return mouseDisplayState_; } -bool PointerDrawingManager::IsWindowRotation(const DisplayInfo *displayInfo) -{ - MMI_HILOGD("ROTATE_POLICY: %{public}d, FOLDABLE_DEVICE_POLICY:%{public}s", - ROTATE_POLICY, FOLDABLE_DEVICE_POLICY.c_str()); - return (ROTATE_POLICY == WINDOW_ROTATE || - (ROTATE_POLICY == FOLDABLE_DEVICE && - ((displayInfo->displayMode == DisplayMode::MAIN && - FOLDABLE_DEVICE_POLICY[0] == ROTATE_WINDOW_ROTATE) || - (displayInfo->displayMode == DisplayMode::FULL && - FOLDABLE_DEVICE_POLICY[FOLDABLE_DEVICE] == ROTATE_WINDOW_ROTATE)))); -} - -Direction PointerDrawingManager::GetDisplayDirection(const DisplayInfo *displayInfo) -{ - Direction direction = static_cast(( - ((displayInfo->direction - displayInfo->displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); - if (GetHardCursorEnabled()) { - if (IsWindowRotation(displayInfo)) { - direction = static_cast((((displayInfo->direction - displayInfo->displayDirection) * - ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); - } else { - direction = displayInfo->direction; - } - } - if (!Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) { - direction = displayInfo->direction; - } - return direction; -} - void PointerDrawingManager::FixCursorPosition(int32_t &physicalX, int32_t &physicalY) { if (physicalX < 0) { @@ -1526,57 +1552,70 @@ void PointerDrawingManager::FixCursorPosition(int32_t &physicalX, int32_t &physi physicalY = 0; } const int32_t cursorUnit = 16; - Direction direction = GetDisplayDirection(&displayInfo_); + Direction direction = static_cast(( + ((displayInfo_.direction - displayInfo_.displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPV(hardwareCursorPointerManager_); + if (g_isHdiRemoteDied) { + hardwareCursorPointerManager_->SetHdiServiceState(false); + } + if (hardwareCursorPointerManager_->IsSupported()) { + direction = displayInfo_.direction; + } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR if (!Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) { direction = displayInfo_.direction; } - if (GetHardCursorEnabled()) { - if (direction == DIRECTION0) { - if (physicalX > (displayInfo_.validWidth - imageWidth_ / cursorUnit)) { - physicalX = displayInfo_.validWidth - imageWidth_ / cursorUnit; - } - if (physicalY > (displayInfo_.validHeight - imageHeight_ / cursorUnit)) { - physicalY = displayInfo_.validHeight - imageHeight_ / cursorUnit; - } - } else if (direction == DIRECTION90) { - if (physicalX > (displayInfo_.validHeight - imageHeight_ / cursorUnit)) { - physicalX = displayInfo_.validHeight - imageHeight_ / cursorUnit; - } - if (physicalY < imageWidth_ / cursorUnit) { - physicalY = imageWidth_ / cursorUnit; - } - } else if (direction == DIRECTION180) { - if (physicalX < imageHeight_ / cursorUnit) { - physicalX = imageHeight_ / cursorUnit; - } - if (physicalY < imageWidth_ / cursorUnit) { - physicalY = imageWidth_ / cursorUnit; - } - } else if (direction == DIRECTION270) { - if (physicalX < imageHeight_ / cursorUnit) { - physicalX = imageHeight_ / cursorUnit; - } - if (physicalY > (displayInfo_.validWidth - imageWidth_ / cursorUnit)) { - physicalY = displayInfo_.validWidth - imageWidth_ / cursorUnit; - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + if (!hardwareCursorPointerManager_->IsSupported()) { + return; + } + if (direction == DIRECTION0) { + if (physicalX > (displayInfo_.validWidth - imageWidth_ / cursorUnit)) { + physicalX = displayInfo_.validWidth - imageWidth_ / cursorUnit; + } + if (physicalY > (displayInfo_.validHeight - imageHeight_ / cursorUnit)) { + physicalY = displayInfo_.validHeight - imageHeight_ / cursorUnit; + } + } else if (direction == DIRECTION90) { + if (physicalX > (displayInfo_.validHeight - imageHeight_ / cursorUnit)) { + physicalX = displayInfo_.validHeight - imageHeight_ / cursorUnit; + } + if (physicalY < imageWidth_ / cursorUnit) { + physicalY = imageWidth_ / cursorUnit; + } + } else if (direction == DIRECTION180) { + if (physicalX < imageHeight_ / cursorUnit) { + physicalX = imageHeight_ / cursorUnit; + } + if (physicalY < imageWidth_ / cursorUnit) { + physicalY = imageWidth_ / cursorUnit; + } + } else if (direction == DIRECTION270) { + if (physicalX < imageHeight_ / cursorUnit) { + physicalX = imageHeight_ / cursorUnit; + } + if (physicalY > (displayInfo_.validWidth - imageWidth_ / cursorUnit)) { + physicalY = displayInfo_.validWidth - imageWidth_ / cursorUnit; + } + } +#else + if (direction == DIRECTION0 || direction == DIRECTION180) { + if (physicalX > (displayInfo_.validWidth - imageWidth_ / cursorUnit)) { + physicalX = displayInfo_.validWidth - imageWidth_ / cursorUnit; + } + if (physicalY > (displayInfo_.validHeight - imageHeight_ / cursorUnit)) { + physicalY = displayInfo_.validHeight - imageHeight_ / cursorUnit; } } else { - if (direction == DIRECTION0 || direction == DIRECTION180) { - if (physicalX > (displayInfo_.validWidth - imageWidth_ / cursorUnit)) { - physicalX = displayInfo_.validWidth - imageWidth_ / cursorUnit; - } - if (physicalY > (displayInfo_.validHeight - imageHeight_ / cursorUnit)) { - physicalY = displayInfo_.validHeight - imageHeight_ / cursorUnit; - } - } else { - if (physicalX > (displayInfo_.validHeight - imageHeight_ / cursorUnit)) { - physicalX = displayInfo_.validHeight - imageHeight_ / cursorUnit; - } - if (physicalY > (displayInfo_.validWidth - imageWidth_ / cursorUnit)) { - physicalY = displayInfo_.validWidth - imageWidth_ / cursorUnit; - } + if (physicalX > (displayInfo_.validHeight - imageHeight_ / cursorUnit)) { + physicalX = displayInfo_.validHeight - imageHeight_ / cursorUnit; + } + if (physicalY > (displayInfo_.validWidth - imageWidth_ / cursorUnit)) { + physicalY = displayInfo_.validWidth - imageWidth_ / cursorUnit; } } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR } void PointerDrawingManager::AttachToDisplay() @@ -1589,7 +1628,12 @@ void PointerDrawingManager::AttachToDisplay() } MMI_HILOGI("The screenId_:%{public}" PRIu64"", screenId_); - if (GetHardCursorEnabled()) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPV(hardwareCursorPointerManager_); + if (g_isHdiRemoteDied) { + hardwareCursorPointerManager_->SetHdiServiceState(false); + } + if (hardwareCursorPointerManager_->IsSupported()) { auto sp = GetScreenPointer(screenId_); CHKPV(sp); SetSurfaceNode(sp->GetSurfaceNode()); @@ -1603,6 +1647,7 @@ void PointerDrawingManager::AttachToDisplay() } } } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR auto surfaceNodePtr = GetSurfaceNode(); CHKPV(surfaceNodePtr); surfaceNodePtr->AttachToDisplay(screenId_); @@ -1610,9 +1655,15 @@ void PointerDrawingManager::AttachToDisplay() void PointerDrawingManager::CreateCanvasNode() { - if (GetHardCursorEnabled()) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPV(hardwareCursorPointerManager_); + if (g_isHdiRemoteDied) { + hardwareCursorPointerManager_->SetHdiServiceState(false); + } + if (hardwareCursorPointerManager_->IsSupported()) { return; } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR auto surfaceNodePtr = GetSurfaceNode(); CHKPV(surfaceNodePtr); canvasNode_ = Rosen::RSCanvasNode::Create(); @@ -1630,6 +1681,7 @@ void PointerDrawingManager::CreateCanvasNode() surfaceNodePtr->AddChild(canvasNode_, DEFAULT_VALUE); } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR int32_t PointerDrawingManager::CreatePointerWindowForScreenPointer(int32_t displayId, int32_t physicalX, int32_t physicalY) { @@ -1674,6 +1726,7 @@ int32_t PointerDrawingManager::CreatePointerWindowForScreenPointer(int32_t displ sp->MoveSoft(physicalX, physicalY, MouseIcon2IconType(MOUSE_ICON(lastMouseStyle_.id))); return RET_OK; } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR int32_t PointerDrawingManager::CreatePointerWindowForNoScreenPointer(int32_t displayId, int32_t physicalX, int32_t physicalY) @@ -1703,7 +1756,12 @@ void PointerDrawingManager::CreatePointerWindow(int32_t displayId, int32_t physi CALL_INFO_TRACE; BytraceAdapter::StartRsSurfaceNode(displayId); - if (GetHardCursorEnabled()) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPV(hardwareCursorPointerManager_); + if (g_isHdiRemoteDied) { + hardwareCursorPointerManager_->SetHdiServiceState(false); + } + if (hardwareCursorPointerManager_->IsSupported()) { g_isHdiRemoteDied = false; if (CreatePointerWindowForScreenPointer(displayId, physicalX, physicalY) != RET_OK) { return; @@ -1713,6 +1771,11 @@ void PointerDrawingManager::CreatePointerWindow(int32_t displayId, int32_t physi return; } } +#else + if (CreatePointerWindowForNoScreenPointer(displayId, physicalX, physicalY) != RET_OK) { + return; + } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR MMI_HILOGI("CreatePointerWindow The screenId_:%{public}" PRIu64, screenId_); screenId_ = static_cast(displayId); AttachToDisplay(); @@ -1739,7 +1802,12 @@ sptr PointerDrawingManager::GetSurfaceBuffer(sptrSetHdiServiceState(false); + } + if (hardwareCursorPointerManager_->IsSupported()) { CALCULATE_CANVAS_SIZE(CALCULATE_CANVAS_SIZE_, CHANGE) = GetCanvasSize(); auto canvasSize = static_cast(CALCULATE_CANVAS_SIZE_CHANGE); width = canvasSize; @@ -1748,6 +1816,10 @@ sptr PointerDrawingManager::GetSurfaceBuffer(sptrSetHdiServiceState(false); + } + if (hardwareCursorPointerManager_->IsSupported()) { if (screenPointers_.count(static_cast(displayInfo.uniqueId))) { auto sp = screenPointers_[displayInfo.uniqueId]; CHKPV(sp); - sp->OnDisplayInfo(displayInfo, IsWindowRotation(&displayInfo)); + sp->OnDisplayInfo(displayInfo); if (sp->IsMain()) { UpdateMirrorScreens(sp, displayInfo); } } } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR hasDisplay_ = true; displayInfo_ = displayInfo; @@ -2268,7 +2346,8 @@ int32_t PointerDrawingManager::SetPointerSize(int32_t size) #ifdef OHOS_BUILD_ENABLE_MAGICCURSOR MAGIC_CURSOR->SetPointerSize(imageWidth_, imageHeight_); #endif // OHOS_BUILD_ENABLE_MAGICCURSOR - Direction direction = GetDisplayDirection(&displayInfo_); + Direction direction = static_cast(( + ((displayInfo_.direction - displayInfo_.displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); AdjustMouseFocusToSoftRenderOrigin(direction, MOUSE_ICON(lastMouseStyle_.id), physicalX, physicalY); #ifdef OHOS_BUILD_ENABLE_MAGICCURSOR if (HasMagicCursor()) { @@ -2331,20 +2410,20 @@ void PointerDrawingManager::OnDisplayInfo(const DisplayGroupInfo &displayGroupIn } } DisplayInfo displayInfo = displayGroupInfo.displaysInfo[0]; - if (GetHardCursorEnabled()) { - (void)GetMainScreenDisplayInfo(displayGroupInfo, displayInfo); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + (void)GetMainScreenDisplayInfo(displayGroupInfo, displayInfo); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR UpdateDisplayInfo(displayInfo); lastPhysicalX_ = displayInfo.validWidth / CALCULATE_MIDDLE; lastPhysicalY_ = displayInfo.validHeight / CALCULATE_MIDDLE; MouseEventHdr->OnDisplayLost(displayInfo_.uniqueId); auto surfaceNodePtr = GetSurfaceNode(); if (surfaceNodePtr != nullptr) { - if (!GetHardCursorEnabled()) { - MMI_HILOGI("Pointer window DetachToDisplay start screenId_:%{public}" PRIu64, screenId_); - surfaceNodePtr->DetachToDisplay(screenId_); - SetSurfaceNode(nullptr); - } +#ifndef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + MMI_HILOGI("Pointer window DetachToDisplay start screenId_:%{public}" PRIu64, screenId_); + surfaceNodePtr->DetachToDisplay(screenId_); + SetSurfaceNode(nullptr); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR Rosen::RSTransaction::FlushImplicitTransaction(); MMI_HILOGD("Pointer window destroy success"); } @@ -2381,7 +2460,8 @@ void PointerDrawingManager::UpdatePointerDevice(bool hasPointerDevice, bool isPo DrawManager(); auto surfaceNodePtr = GetSurfaceNode(); if (!hasPointerDevice_ && (surfaceNodePtr != nullptr)) { - if (GetHardCursorEnabled()) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + { std::lock_guard lock(mtx_); for (auto sp : screenPointers_) { if (sp.second != nullptr && sp.second->IsMirror()) { @@ -2389,6 +2469,7 @@ void PointerDrawingManager::UpdatePointerDevice(bool hasPointerDevice, bool isPo } } } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR MMI_HILOGD("Pointer window destroy start"); surfaceNodePtr->DetachToDisplay(screenId_); SetSurfaceNode(nullptr); @@ -2398,6 +2479,7 @@ void PointerDrawingManager::UpdatePointerDevice(bool hasPointerDevice, bool isPo } } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR void PointerDrawingManager::AttachAllSurfaceNode() { std::lock_guard lock(mtx_); @@ -2444,6 +2526,7 @@ void PointerDrawingManager::DetachAllSurfaceNode() } Rosen::RSTransaction::FlushImplicitTransaction(); } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR void PointerDrawingManager::DrawManager() { @@ -2466,7 +2549,8 @@ void PointerDrawingManager::DrawManager() WIN_MGR->GetPointerStyle(pid_, windowId_, pointerStyle); MMI_HILOGI("Pid_:%{public}d, windowId_:%{public}d, pointerStyle.id:%{public}d", pid_, windowId_, pointerStyle.id); - Direction direction = GetDisplayDirection(&displayInfo_); + Direction direction = static_cast(( + ((displayInfo_.direction - displayInfo_.displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); lastDrawPointerStyle_ = pointerStyle; if (lastPhysicalX_ == -1 || lastPhysicalY_ == -1) { DrawPointer(displayInfo_.uniqueId, displayInfo_.validWidth / CALCULATE_MIDDLE, @@ -2519,7 +2603,12 @@ void PointerDrawingManager::UpdatePointerVisible() CHKPV(surfaceNodePtr); if (IsPointerVisible() && mouseDisplayState_) { surfaceNodePtr->SetVisible(true); - if (GetHardCursorEnabled()) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPV(hardwareCursorPointerManager_); + if (g_isHdiRemoteDied) { + hardwareCursorPointerManager_->SetHdiServiceState(false); + } + if (hardwareCursorPointerManager_->IsSupported()) { if (InitLayer(MOUSE_ICON(lastMouseStyle_.id)) != RET_OK) { MMI_HILOGE("Init Layer failed"); return; @@ -2529,15 +2618,22 @@ void PointerDrawingManager::UpdatePointerVisible() MMI_HILOGE("SetCursorLocation fail"); } } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR MMI_HILOGI("Pointer window show success, mouseDisplayState_:%{public}s, displayId_:%{public}d", mouseDisplayState_ ? "true" : "false", displayId_); } else { - if (GetHardCursorEnabled()) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPV(hardwareCursorPointerManager_); + if (g_isHdiRemoteDied) { + hardwareCursorPointerManager_->SetHdiServiceState(false); + } + if (hardwareCursorPointerManager_->IsSupported()) { PostSoftCursorTask([this]() { SoftwareCursorRender(MOUSE_ICON::TRANSPARENT_ICON); }); HideHardwareCursors(); } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR surfaceNodePtr->SetVisible(false); MMI_HILOGI("Pointer window hide success, mouseDisplayState_:%{public}s displayId_:%{public}d", mouseDisplayState_ ? "true" : "false", displayId_); @@ -2697,21 +2793,27 @@ void PointerDrawingManager::SetPointerLocation(int32_t x, int32_t y, int32_t dis auto surfaceNodePtr = GetSurfaceNode(); CHKPV(surfaceNodePtr); displayId_ = displayId; - if (GetHardCursorEnabled()) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPV(hardwareCursorPointerManager_); + if (g_isHdiRemoteDied) { + hardwareCursorPointerManager_->SetHdiServiceState(false); + } + if (hardwareCursorPointerManager_->IsSupported()) { if (!SetCursorLocation(displayId_, x, y, MouseIcon2IconType(MOUSE_ICON(lastMouseStyle_.id)))) { MMI_HILOGE("SetCursorLocation fail"); return; } - } else { - Direction direction = static_cast(( - ((displayInfo_.direction - displayInfo_.displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); - AdjustMouseFocusToSoftRenderOrigin(direction, MOUSE_ICON(lastMouseStyle_.id), x, y); - surfaceNodePtr->SetBounds(x, - y, - surfaceNodePtr->GetStagingProperties().GetBounds().z_, - surfaceNodePtr->GetStagingProperties().GetBounds().w_); - Rosen::RSTransaction::FlushImplicitTransaction(); } +#else + Direction direction = static_cast(( + ((displayInfo_.direction - displayInfo_.displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); + AdjustMouseFocusToSoftRenderOrigin(direction, MOUSE_ICON(lastMouseStyle_.id), x, y); + surfaceNodePtr->SetBounds(x, + y, + surfaceNodePtr->GetStagingProperties().GetBounds().z_, + surfaceNodePtr->GetStagingProperties().GetBounds().w_); + Rosen::RSTransaction::FlushImplicitTransaction(); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR MMI_HILOGD("Pointer window move success"); } @@ -2916,15 +3018,26 @@ void PointerDrawingManager::DrawPointerStyle(const PointerStyle& pointerStyle) if (hasDisplay_ && (hasPointerDevice_ || simulate)) { if (GetSurfaceNode() != nullptr) { AttachToDisplay(); - if (GetHardCursorEnabled()) { - PostTask([]() { - Rosen::RSTransaction::FlushImplicitTransaction(); - }); - } else { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + PostTask([]() { Rosen::RSTransaction::FlushImplicitTransaction(); - } + }); +#else + Rosen::RSTransaction::FlushImplicitTransaction(); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR } - Direction direction = GetDisplayDirection(&displayInfo_); + Direction direction = static_cast(( + ((displayInfo_.direction - displayInfo_.displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPV(hardwareCursorPointerManager_); + if (g_isHdiRemoteDied) { + hardwareCursorPointerManager_->SetHdiServiceState(false); + } + if (hardwareCursorPointerManager_->IsSupported()) { + direction = static_cast(( + (displayInfo_.direction * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); + } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR if (lastPhysicalX_ == -1 || lastPhysicalY_ == -1) { DrawPointer(displayInfo_.uniqueId, displayInfo_.validWidth / CALCULATE_MIDDLE, displayInfo_.validHeight / CALCULATE_MIDDLE, pointerStyle, direction); @@ -2951,12 +3064,18 @@ void PointerDrawingManager::CheckMouseIconPath() int32_t PointerDrawingManager::EnableHardwareCursorStats(int32_t pid, bool enable) { CALL_DEBUG_ENTER; - if (GetHardCursorEnabled()) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPR(hardwareCursorPointerManager_, ERROR_NULL_POINTER); + if (g_isHdiRemoteDied) { + hardwareCursorPointerManager_->SetHdiServiceState(false); + } + if (hardwareCursorPointerManager_->IsSupported()) { if ((hardwareCursorPointerManager_->EnableStats(enable)) != RET_OK) { MMI_HILOGE("Enable stats failed"); return RET_ERR; } } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR MMI_HILOGI("EnableHardwareCursorStats, enable:%{private}d", enable); return RET_OK; } @@ -2964,28 +3083,37 @@ int32_t PointerDrawingManager::EnableHardwareCursorStats(int32_t pid, bool enabl int32_t PointerDrawingManager::GetHardwareCursorStats(int32_t pid, uint32_t &frameCount, uint32_t &vsyncCount) { CALL_DEBUG_ENTER; - if (GetHardCursorEnabled()) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPR(hardwareCursorPointerManager_, ERROR_NULL_POINTER); + if (g_isHdiRemoteDied) { + hardwareCursorPointerManager_->SetHdiServiceState(false); + } + if (hardwareCursorPointerManager_->IsSupported()) { if ((hardwareCursorPointerManager_->GetCursorStats(frameCount, vsyncCount)) != RET_OK) { MMI_HILOGE("Query stats failed"); return RET_ERR; } } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR MMI_HILOGI("GetHardwareCursorStats, frameCount:%{private}d, vsyncCount:%{private}d", frameCount, vsyncCount); return RET_OK; } void PointerDrawingManager::SubscribeScreenModeChange() { - if (!GetHardCursorEnabled()) { - return; - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR std::vector> screenInfos; + OHOS::Rosen::ScreenManagerLite::GetInstance().GetPhysicalScreenInfos(screenInfos); if (!screenInfos.empty()) { OnScreenModeChange(screenInfos); } auto callback = [this](const std::vector> &screens) { - if (GetHardCursorEnabled()) { + CHKPV(hardwareCursorPointerManager_); + if (g_isHdiRemoteDied) { + hardwareCursorPointerManager_->SetHdiServiceState(false); + } + if (hardwareCursorPointerManager_->IsSupported()) { this->OnScreenModeChange(screens); } }; @@ -3010,6 +3138,7 @@ void PointerDrawingManager::SubscribeScreenModeChange() EventFwk::CommonEventSubscribeInfo commonEventSubscribeInfo(matchingSkills); OHOS::EventFwk::CommonEventManager::SubscribeCommonEvent( std::make_shared(commonEventSubscribeInfo)); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR } void PointerDrawingManager::InitStyle() @@ -3074,9 +3203,15 @@ void PointerDrawingManager::InitStyle() void PointerDrawingManager::RotateDegree(Direction direction) { - if (GetHardCursorEnabled()) { - return; - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPV(hardwareCursorPointerManager_); + if (g_isHdiRemoteDied) { + hardwareCursorPointerManager_->SetHdiServiceState(false); + } + if (hardwareCursorPointerManager_->IsSupported()) { + return; + } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR auto surfaceNodePtr = GetSurfaceNode(); CHKPV(surfaceNodePtr); surfaceNodePtr->SetPivot(0, 0); @@ -3161,16 +3296,11 @@ void PointerDrawingManager::Dump(int32_t fd, const std::vector &arg DumpFullTable(oss, "Visible Info", pidTitles, pidInfos); oss << std::endl; - std::vector hardCursorTitles = {"isHardCursorEnabled"}; - std::vector> hardCursorInfos; - hardCursorInfos.push_back({GetHardCursorEnabled() ? "true" : "false"}); - DumpFullTable(oss, "Hard Cursor Info", hardCursorTitles, hardCursorInfos); - oss << std::endl; - std::string dumpInfo = oss.str(); dprintf(fd, dumpInfo.c_str()); } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR void PointerDrawingManager::UpdateBindDisplayId(int32_t displayId) { if (lastDisplayId_ == displayId) { @@ -3179,7 +3309,11 @@ void PointerDrawingManager::UpdateBindDisplayId(int32_t displayId) MMI_HILOGI("Mouse traversal occurs, lastDisplayId_:%{public}d, displayId:%{public}d", lastDisplayId_, displayId); - if (GetHardCursorEnabled()) { + CHKPV(hardwareCursorPointerManager_); + if (g_isHdiRemoteDied) { + hardwareCursorPointerManager_->SetHdiServiceState(false); + } + if (hardwareCursorPointerManager_->IsSupported()) { // 隐藏上一个屏幕的软、硬光标 PostSoftCursorTask([this]() { SoftwareCursorRender(MOUSE_ICON::TRANSPARENT_ICON); @@ -3211,6 +3345,12 @@ void PointerDrawingManager::UpdateBindDisplayId(int32_t displayId) lastDisplayId_ = displayId; } +bool PointerDrawingManager::IsSupported() +{ + CHKPF(hardwareCursorPointerManager_); + return hardwareCursorPointerManager_->IsSupported(); +} + void PointerDrawingManager::OnScreenModeChange(const std::vector> &screens) { MMI_HILOGI("OnScreenModeChange enter, screen size:%{public}zu", screens.size()); @@ -3222,7 +3362,7 @@ void PointerDrawingManager::OnScreenModeChange(const std::vector lock(mtx_); // construct ScreenPointers for new screens for (auto si : screens) { - MMI_HILOGI("Got screen, id:%{public}llu, shape=(%{public}u,%{public}u), rotation=%{public}u, " + MMI_HILOGI("Got screen, id:%{public}lu, shape=(%{public}u,%{public}u), rotation=%{public}u, " "dpi=%{public}f", si->GetRsId(), GetScreenInfoWidth(si), GetScreenInfoHeight(si), si->GetRotation(), si->GetVirtualPixelRatio()); if (si->GetType() != OHOS::Rosen::ScreenType::REAL) { @@ -3280,9 +3420,9 @@ void PointerDrawingManager::CreateRenderConfig(RenderConfig& cfg, std::shared_pt MOUSE_ICON mouseStyle, bool isHard) { CHKPV(sp); - cfg.style_ = mouseStyle; - cfg.align_ = MouseIcon2IconType(mouseStyle); - cfg.path_ = mouseIcons_[mouseStyle].iconPath; + cfg.style = mouseStyle; + cfg.align = MouseIcon2IconType(mouseStyle); + cfg.path = mouseIcons_[mouseStyle].iconPath; cfg.color = static_cast(GetPointerColor()); cfg.size = static_cast(GetPointerSize()); cfg.isHard = isHard; @@ -3342,9 +3482,9 @@ void PointerDrawingManager::SoftwareCursorRender(MOUSE_ICON mouseStyle) MMI_HILOGI("SoftwareCursorRender, screen:%{public}u, mode:%{public}u, dpi:%{public}f, direction:%{public}d," "screenId_:%{public}" PRIu64, it.first, it.second->GetMode(), cfg.dpi, cfg.direction, screenId_); if (!it.second->IsMirror() && it.first != screenId_) { - cfg.style_ = MOUSE_ICON::TRANSPARENT_ICON; - cfg.align_ = MouseIcon2IconType(cfg.style_); - cfg.path_ = mouseIcons_[cfg.style_].iconPath; + cfg.style = MOUSE_ICON::TRANSPARENT_ICON; + cfg.align = MouseIcon2IconType(cfg.style); + cfg.path = mouseIcons_[cfg.style].iconPath; } DrawSoftCursor(it.second->GetSurfaceNode(), cfg); } @@ -3384,7 +3524,7 @@ int32_t PointerDrawingManager::DrawSoftCursor(std::shared_ptrCancelBuffer(buffer); return RET_ERR; } - MMI_HILOGI("DrawSoftCursor on SurfaceNode success, style=%{public}d", cfg.style_); + MMI_HILOGI("DrawSoftCursor on SurfaceNode success, style=%{public}d", cfg.style); return RET_OK; } @@ -3407,7 +3547,7 @@ int32_t PointerDrawingManager::DrawHardCursor(std::shared_ptr sp, } MMI_HILOGI("DrawHardCursor on ScreenPointer success, screenId=%{public}u, style=%{public}d", - sp->GetScreenId(), cfg.style_); + sp->GetScreenId(), cfg.style); auto sret = buffer->FlushCache(); if (sret != RET_OK) { MMI_HILOGE("FlushCache ret: %{public}d", sret); @@ -3586,6 +3726,8 @@ void PointerDrawingManager::HideHardwareCursors() } } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR + void PointerDrawingManager::DrawScreenCenterPointer(const PointerStyle& pointerStyle) { CALL_DEBUG_ENTER; @@ -3596,7 +3738,8 @@ void PointerDrawingManager::DrawScreenCenterPointer(const PointerStyle& pointerS } Direction direction = static_cast(( ((displayInfo_.direction - displayInfo_.displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); - if (GetHardCursorEnabled()) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + if (IsSupported()) { direction = displayInfo_.direction; int32_t x = displayInfo_.width / CALCULATE_MIDDLE; int32_t y = displayInfo_.height / CALCULATE_MIDDLE; @@ -3605,10 +3748,11 @@ void PointerDrawingManager::DrawScreenCenterPointer(const PointerStyle& pointerS } MMI_HILOGD("DrawScreenCenterPointer, x=%{public}d, y=%{public}d", x, y); DrawPointer(displayInfo_.uniqueId, x, y, pointerStyle, direction); - } else { - DrawPointer(displayInfo_.id, displayInfo_.validWidth / CALCULATE_MIDDLE, - displayInfo_.validHeight / CALCULATE_MIDDLE, pointerStyle, direction); } +#else + DrawPointer(displayInfo_.uniqueId, displayInfo_.validWidth / CALCULATE_MIDDLE, + displayInfo_.validHeight / CALCULATE_MIDDLE, pointerStyle, direction); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR } } @@ -3652,9 +3796,12 @@ std::shared_ptr PointerDrawingManager::GetUserIconCopy() void PointerDrawingManager::SetSurfaceNodeBounds() { - if (GetHardCursorEnabled()) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + CHKPV(hardwareCursorPointerManager_); + if (hardwareCursorPointerManager_->IsSupported()) { return; } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR if (canvasWidth_ < cursorWidth_ && canvasHeight_ < cursorHeight_) { canvasWidth_ = cursorWidth_; canvasHeight_ = cursorHeight_; @@ -3669,9 +3816,9 @@ int32_t PointerDrawingManager::SetCustomCursor(int32_t pid, int32_t windowId, Cu { CALL_DEBUG_ENTER; followSystem_ = options.followSystem; - if (GetHardCursorEnabled()) { - userIconFollowSystem_ = false; - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + userIconFollowSystem_ = false; +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR int32_t ret = UpdateCursorProperty(cursor); if (ret != RET_OK) { MMI_HILOGE("UpdateCursorProperty is failed"); @@ -3768,38 +3915,5 @@ void PointerDrawingManager::AdjustMouseFocusToSoftRenderOrigin(Direction directi AdjustMouseFocus(direction, ICON_TYPE(mouseIcons_[pointerStyle].alignmentWay), physicalX, physicalY); } } - -int ConvertToInt(const char *originValue, int defaultValue) -{ - if (originValue == nullptr) { - return defaultValue; - } - int value; - auto result = std::from_chars(originValue, originValue + std::strlen(originValue), value); - if (result.ec == std::errc()) { - return value; - } else { - return defaultValue; - } -} - -bool PointerDrawingManager::GetHardCursorEnabled() -{ - bool isHardCursorEnabled = true; - CHKPF(hardwareCursorPointerManager_); - if (g_isHdiRemoteDied) { - hardwareCursorPointerManager_->SetHdiServiceState(false); - } - if (!hardwareCursorPointerManager_->IsSupported()) { - isHardCursorEnabled = false; - } - static CachedHandle g_Handle = CachedParameterCreate("rosen.hardCursor.enabled", "1"); - int changed = 0; - const char *enable = CachedParameterGetChanged(g_Handle, &changed); - if (ConvertToInt(enable, 1) == 0) { - isHardCursorEnabled = false; - } - return isHardCursorEnabled; -} } // namespace MMI } // namespace OHOS diff --git a/service/window_manager/src/screen_pointer.cpp b/service/window_manager/src/screen_pointer.cpp index e4fd4dbb508d7278f22b1e9297bf1e6388fed8ba..2941177905b337267652862f7cbf751ce8892aa1 100644 --- a/service/window_manager/src/screen_pointer.cpp +++ b/service/window_manager/src/screen_pointer.cpp @@ -42,8 +42,6 @@ constexpr int32_t STRIDE_ALIGNMENT{8}; constexpr uint32_t RENDER_STRIDE{4}; constexpr uint32_t POINTER_SIZE_DEFAULT { 1 }; constexpr uint32_t POINTER_SIZE_HPR { 2 }; -constexpr int32_t ANGLE_90 { 90 }; -constexpr int32_t ANGLE_360 { 360 }; uint32_t GetScreenInfoWidth(screen_info_ptr_t si) @@ -311,7 +309,7 @@ void ScreenPointer::UpdateScreenInfo(const sptr si) "rotation=%{public}u, dpi=%{public}f", screenId_, width_, height_, mode_, rotation_, dpi_); } -void ScreenPointer::OnDisplayInfo(const DisplayInfo &di, bool isWindowRotation) +void ScreenPointer::OnDisplayInfo(const DisplayInfo &di) { if (screenId_ != uint32_t(di.uniqueId)) { return; @@ -322,8 +320,6 @@ void ScreenPointer::OnDisplayInfo(const DisplayInfo &di, bool isWindowRotation) if (!IsMirror()) { rotation_ = static_cast(di.direction); } - displayDirection_ = di.displayDirection; - isWindowRotation_ = isWindowRotation; MMI_HILOGD("Update with DisplayInfo, id=%{public}u, shape=(%{public}u, %{public}u), mode=%{public}u, " "rotation=%{public}u, dpi=%{public}f", screenId_, width_, height_, mode_, rotation_, dpi_); if (isCurrentOffScreenRendering_) { @@ -380,9 +376,6 @@ void ScreenPointer::Rotate(rotation_t rotation, int32_t& x, int32_t& y) if (IsMirror() && (rotation_ == rotation_t::ROTATION_90 || rotation_ == rotation_t::ROTATION_270)) { std::swap(width, height); } - if (IsMain() && isWindowRotation_ && (displayDirection_ == DIRECTION90 || displayDirection_ == DIRECTION270)) { - std::swap(width, height); - } if (rotation == rotation_t(DIRECTION90)) { x = height - tmpY; @@ -414,6 +407,7 @@ void ScreenPointer::CalculateHwcPositionForExtend(int32_t& x, int32_t& y) bool ScreenPointer::Move(int32_t x, int32_t y, ICON_TYPE align) { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR CHKPF(hwcMgr_); if (IsPositionOutScreen(x, y)) { MMI_HILOGE("Position out of screen"); @@ -426,11 +420,6 @@ bool ScreenPointer::Move(int32_t x, int32_t y, ICON_TYPE align) } else if (GetIsCurrentOffScreenRendering() && !IsMirror()) { CalculateHwcPositionForExtend(x, y); } - if (IsMain() && isWindowRotation_) { - Direction direction = static_cast((((DIRECTION0 - displayDirection_) * - ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); - Rotate(rotation_t(direction), x, y); - } px = x - FOCUS_POINT; py = y - FOCUS_POINT; @@ -446,6 +435,7 @@ bool ScreenPointer::Move(int32_t x, int32_t y, ICON_TYPE align) MMI_HILOGE("SetPosition failed, screenId=%{public}u, pos=(%{public}d, %{public}d)", screenId_, px, py); return false; } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR return true; } @@ -459,7 +449,7 @@ bool ScreenPointer::MoveSoft(int32_t x, int32_t y, ICON_TYPE align) int32_t py = 0; if (IsMirror()) { CalculateHwcPositionForMirror(x, y); - } else if (!IsExtend() && !isWindowRotation_) { + } else if (!IsExtend()) { Rotate(rotation_, x, y); } px = x - FOCUS_POINT; @@ -477,6 +467,7 @@ bool ScreenPointer::MoveSoft(int32_t x, int32_t y, ICON_TYPE align) bool ScreenPointer::SetInvisible() { +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR CHKPF(hwcMgr_); auto buffer = GetTransparentBuffer(); @@ -501,6 +492,7 @@ bool ScreenPointer::SetInvisible() return false; } MMI_HILOGI("SetInvisible success, screenId=%{public}u", screenId_); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR return true; } diff --git a/service/window_manager/test/input_windows_manager_test.cpp b/service/window_manager/test/input_windows_manager_test.cpp index 3eda2f2d1d742aeb605c0306ddce75f7fc38b042..fadbd85ba632764582d73f54b2c2145d14572a6c 100644 --- a/service/window_manager/test/input_windows_manager_test.cpp +++ b/service/window_manager/test/input_windows_manager_test.cpp @@ -6634,6 +6634,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_005, ASSERT_NO_FATAL_FAILURE(WIN_MGR->UpdateDisplayInfo(displayGroupInfo)); } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR /** * @tc.name: InputWindowsManagerTest_UpdateKeyEventDisplayId_001 * @tc.desc: Test the funcation UpdateKeyEventDisplayId @@ -6774,6 +6775,8 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_Poin EXPECT_EQ(pointerPos.displayId, displayInfo1.id); } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR + /** * @tc.name: InputWindowsManagerTest_IgnoreTouchEvent_002 * @tc.desc: Test the funcation IgnoreTouchEvent diff --git a/service/window_manager/test/pointer_drawing_manager_test.cpp b/service/window_manager/test/pointer_drawing_manager_test.cpp index 6fe1d536e3a97ebc88979a66c14045264e615477..1346033fa1f72476961c3c24fb30a4d4c52dd306 100644 --- a/service/window_manager/test/pointer_drawing_manager_test.cpp +++ b/service/window_manager/test/pointer_drawing_manager_test.cpp @@ -2305,6 +2305,7 @@ HWTEST_F(PointerDrawingManagerTest, PointerDrawingManagerTest_DrawScreenCenterPo ASSERT_NO_FATAL_FAILURE(pointerDrawingManager.DrawScreenCenterPointer(pointerStyle)); } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR /** * @tc.name: PointerDrawingManagerTest_UpdateBindDisplayId_001 * @tc.desc: Test UpdateBindDisplayId @@ -2335,6 +2336,7 @@ HWTEST_F(PointerDrawingManagerTest, PointerDrawingManagerTest_UpdateBindDisplayI EXPECT_EQ(pointerDrawingManager.lastDisplayId_, 1); EXPECT_EQ(pointerDrawingManager.screenId_, 1); } +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR /** * @tc.name: PointerDrawingManagerTest_DestroyPointerWindow_001 @@ -2540,37 +2542,37 @@ HWTEST_F(PointerDrawingManagerTest, InputWindowsManagerTest_AdjustMouseFocusToSo pointerDrawingManager->RotateDegree(DIRECTION0); pointerDrawingManager->AdjustMouseFocusToSoftRenderOrigin(DIRECTION0, MOUSE_ICON::TEXT_CURSOR, physicalX, physicalY); - if (pointerDrawingManager->GetHardCursorEnabled()) { - EXPECT_EQ(physicalX, 100); - EXPECT_EQ(physicalY, 100); - } else { - EXPECT_EQ(physicalX, 75); - EXPECT_EQ(physicalY, 75); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + EXPECT_EQ(physicalX, 100); + EXPECT_EQ(physicalY, 100); +#else + EXPECT_EQ(physicalX, 75); + EXPECT_EQ(physicalY, 75); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR physicalX = 100; physicalY = 100; pointerDrawingManager->RotateDegree(DIRECTION90); pointerDrawingManager->AdjustMouseFocusToSoftRenderOrigin(DIRECTION90, MOUSE_ICON::TEXT_CURSOR, physicalX, physicalY); - if (pointerDrawingManager->GetHardCursorEnabled()) { - EXPECT_EQ(physicalX, 100); - EXPECT_EQ(physicalY, 100); - } else { - EXPECT_EQ(physicalX, 75); - EXPECT_EQ(physicalY, 125); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + EXPECT_EQ(physicalX, 100); + EXPECT_EQ(physicalY, 100); +#else + EXPECT_EQ(physicalX, 75); + EXPECT_EQ(physicalY, 125); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR physicalX = 100; physicalY = 100; pointerDrawingManager->RotateDegree(DIRECTION270); pointerDrawingManager->AdjustMouseFocusToSoftRenderOrigin(DIRECTION270, MOUSE_ICON::TEXT_CURSOR, physicalX, physicalY); - if (pointerDrawingManager->GetHardCursorEnabled()) { - EXPECT_EQ(physicalX, 100); - EXPECT_EQ(physicalY, 100); - } else { - EXPECT_EQ(physicalX, 125); - EXPECT_EQ(physicalY, 75); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + EXPECT_EQ(physicalX, 100); + EXPECT_EQ(physicalY, 100); +#else + EXPECT_EQ(physicalX, 125); + EXPECT_EQ(physicalY, 75); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR } /** @@ -2591,37 +2593,37 @@ HWTEST_F(PointerDrawingManagerTest, InputWindowsManagerTest_AdjustMouseFocusToSo pointerDrawingManager->RotateDegree(DIRECTION0); pointerDrawingManager->AdjustMouseFocusToSoftRenderOrigin(DIRECTION0, MOUSE_ICON::DEFAULT, physicalX, physicalY); - if (pointerDrawingManager->GetHardCursorEnabled()) { - EXPECT_EQ(physicalX, 100); - EXPECT_EQ(physicalY, 100); - } else { - EXPECT_EQ(physicalX, 75); - EXPECT_EQ(physicalY, 75); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + EXPECT_EQ(physicalX, 100); + EXPECT_EQ(physicalY, 100); +#else + EXPECT_EQ(physicalX, 75); + EXPECT_EQ(physicalY, 75); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR physicalX = 100; physicalY = 100; pointerDrawingManager->RotateDegree(DIRECTION90); pointerDrawingManager->AdjustMouseFocusToSoftRenderOrigin(DIRECTION90, MOUSE_ICON::DEFAULT, physicalX, physicalY); - if (pointerDrawingManager->GetHardCursorEnabled()) { - EXPECT_EQ(physicalX, 100); - EXPECT_EQ(physicalY, 100); - } else { - EXPECT_EQ(physicalX, 75); - EXPECT_EQ(physicalY, 125); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + EXPECT_EQ(physicalX, 100); + EXPECT_EQ(physicalY, 100); +#else + EXPECT_EQ(physicalX, 75); + EXPECT_EQ(physicalY, 125); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR physicalX = 100; physicalY = 100; pointerDrawingManager->RotateDegree(DIRECTION270); pointerDrawingManager->AdjustMouseFocusToSoftRenderOrigin(DIRECTION270, MOUSE_ICON::DEFAULT, physicalX, physicalY); - if (pointerDrawingManager->GetHardCursorEnabled()) { - EXPECT_EQ(physicalX, 100); - EXPECT_EQ(physicalY, 100); - } else { - EXPECT_EQ(physicalX, 125); - EXPECT_EQ(physicalY, 75); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + EXPECT_EQ(physicalX, 100); + EXPECT_EQ(physicalY, 100); +#else + EXPECT_EQ(physicalX, 125); + EXPECT_EQ(physicalY, 75); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR } /** @@ -2642,37 +2644,37 @@ HWTEST_F(PointerDrawingManagerTest, InputWindowsManagerTest_AdjustMouseFocusToSo pointerDrawingManager->RotateDegree(DIRECTION0); pointerDrawingManager->AdjustMouseFocusToSoftRenderOrigin(DIRECTION0, MOUSE_ICON::DEFAULT, physicalX, physicalY); - if (pointerDrawingManager->GetHardCursorEnabled()) { - EXPECT_EQ(physicalX, 100); - EXPECT_EQ(physicalY, 100); - } else { - EXPECT_EQ(physicalX, 75); - EXPECT_EQ(physicalY, 75); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + EXPECT_EQ(physicalX, 100); + EXPECT_EQ(physicalY, 100); +#else + EXPECT_EQ(physicalX, 75); + EXPECT_EQ(physicalY, 75); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR physicalX = 100; physicalY = 100; pointerDrawingManager->RotateDegree(DIRECTION90); pointerDrawingManager->AdjustMouseFocusToSoftRenderOrigin(DIRECTION90, MOUSE_ICON::DEFAULT, physicalX, physicalY); - if (pointerDrawingManager->GetHardCursorEnabled()) { - EXPECT_EQ(physicalX, 100); - EXPECT_EQ(physicalY, 100); - } else { - EXPECT_EQ(physicalX, 75); - EXPECT_EQ(physicalY, 125); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + EXPECT_EQ(physicalX, 100); + EXPECT_EQ(physicalY, 100); +#else + EXPECT_EQ(physicalX, 75); + EXPECT_EQ(physicalY, 125); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR physicalX = 100; physicalY = 100; pointerDrawingManager->RotateDegree(DIRECTION270); pointerDrawingManager->AdjustMouseFocusToSoftRenderOrigin(DIRECTION270, MOUSE_ICON::DEFAULT, physicalX, physicalY); - if (pointerDrawingManager->GetHardCursorEnabled()) { - EXPECT_EQ(physicalX, 100); - EXPECT_EQ(physicalY, 100); - } else { - EXPECT_EQ(physicalX, 125); - EXPECT_EQ(physicalY, 75); - } +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + EXPECT_EQ(physicalX, 100); + EXPECT_EQ(physicalY, 100); +#else + EXPECT_EQ(physicalX, 125); + EXPECT_EQ(physicalY, 75); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR } /** diff --git a/service/window_manager/test/screen_pointer_test.cpp b/service/window_manager/test/screen_pointer_test.cpp index 7c703cf827b0fae37dd95dbd37d4f9eb2c15a59f..631b91e93b62481146bd26708227293e0272dd7c 100644 --- a/service/window_manager/test/screen_pointer_test.cpp +++ b/service/window_manager/test/screen_pointer_test.cpp @@ -179,10 +179,6 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_Move_001, TestSize.Level1) screenpointer->isCurrentOffScreenRendering_ = true; ret = screenpointer->Move(x, y, align); EXPECT_TRUE(ret); - screenpointer->mode_ = mode_t::SCREEN_MAIN; - screenpointer->isWindowRotation_ = true; - ret = screenpointer->Move(x, y, align); - EXPECT_TRUE(ret); screenpointer->mode_ = mode_t::SCREEN_EXTEND; screenpointer->isCurrentOffScreenRendering_ = false; ret = screenpointer->Move(x, y, align); @@ -260,37 +256,6 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_Rotate_002, TestSize.Level1) EXPECT_NO_FATAL_FAILURE(screenpointer->Rotate(rotation, x, y)); } -/** - * @tc.name: ScreenPointerTest_Rotate_003 - * @tc.desc: Test Rotate - * @tc.type: Function - * @tc.require: - */ -HWTEST_F(ScreenPointerTest, ScreenPointerTest_Rotate_003, TestSize.Level1) -{ - CALL_TEST_DEBUG; - hwcmgr_ptr_t hwcmgr = std::make_shared(); - ASSERT_NE(hwcmgr, nullptr); - handler_ptr_t handler = nullptr; - DisplayInfo di; - ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); - ASSERT_NE(screenpointer, nullptr); - int32_t x = 0; - int32_t y = 0; - screenpointer->mode_ = mode_t::SCREEN_MAIN; - screenpointer->rotation_ = rotation_t::ROTATION_0; - screenpointer->isWindowRotation_ = true; - screenpointer->displayDirection_ = DIRECTION90; - rotation_t rotation = rotation_t(DIRECTION90); - EXPECT_NO_FATAL_FAILURE(screenpointer->Rotate(rotation, x, y)); - rotation = rotation_t(DIRECTION180); - EXPECT_NO_FATAL_FAILURE(screenpointer->Rotate(rotation, x, y)); - rotation = rotation_t(DIRECTION270); - EXPECT_NO_FATAL_FAILURE(screenpointer->Rotate(rotation, x, y)); - rotation = rotation_t(DIRECTION0); - EXPECT_NO_FATAL_FAILURE(screenpointer->Rotate(rotation, x, y)); -} - /** * @tc.name: ScreenPointerTest_GetDefaultBuffer_001 * @tc.desc: Test GetDefaultBuffer @@ -468,16 +433,16 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_OnDisplayInfo_001, TestSize.Level1 ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); ASSERT_NE(screenpointer, nullptr); screenpointer->bufferId_ = 5; - EXPECT_NO_FATAL_FAILURE(screenpointer->OnDisplayInfo(di, false)); + EXPECT_NO_FATAL_FAILURE(screenpointer->OnDisplayInfo(di)); screenpointer->bufferId_ = 1; screenpointer->isCurrentOffScreenRendering_ = true; - EXPECT_NO_FATAL_FAILURE(screenpointer->OnDisplayInfo(di, false)); + EXPECT_NO_FATAL_FAILURE(screenpointer->OnDisplayInfo(di)); screenpointer->isCurrentOffScreenRendering_ = false; - EXPECT_NO_FATAL_FAILURE(screenpointer->OnDisplayInfo(di, false)); + EXPECT_NO_FATAL_FAILURE(screenpointer->OnDisplayInfo(di)); di.uniqueId = 2; screenpointer->screenId_ = 1; - EXPECT_NO_FATAL_FAILURE(screenpointer->OnDisplayInfo(di, false)); + EXPECT_NO_FATAL_FAILURE(screenpointer->OnDisplayInfo(di)); } /** diff --git a/test/facility/mock/include/input_windows_manager_mock.h b/test/facility/mock/include/input_windows_manager_mock.h index ca8bde22f7d51b7751feb57bad0915276ca81eff..8167d0855062ef2be98c68de08738ff1c2d5edd5 100644 --- a/test/facility/mock/include/input_windows_manager_mock.h +++ b/test/facility/mock/include/input_windows_manager_mock.h @@ -139,9 +139,10 @@ public: #endif // OHOS_BUILD_ENABLE_ANCO #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) MOCK_METHOD(int32_t, ShiftAppPointerEvent, (const ShiftWindowParam&, bool)); - MOCK_METHOD(Direction, GetDisplayDirection, (const DisplayInfo *)); #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH - MOCK_METHOD(bool, GetHardCursorEnabled, ()); +#ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR + MOCK_METHOD(bool, IsSupported, ()); +#endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR #if defined(OHOS_BUILD_ENABLE_TOUCH) && defined(OHOS_BUILD_ENABLE_MONITOR) MOCK_METHOD(void, AttachTouchGestureMgr, (std::shared_ptr)); MOCK_METHOD(void, CancelAllTouches, (std::shared_ptr, bool));