diff --git a/frameworks/proxy/events/include/event_log_helper.h b/frameworks/proxy/events/include/event_log_helper.h index 4b8224054769ffdfdf109439b3fd74ce2bd6a850..211904c5c152d31badacdcc9535562790b1faafe 100644 --- a/frameworks/proxy/events/include/event_log_helper.h +++ b/frameworks/proxy/events/include/event_log_helper.h @@ -276,9 +276,9 @@ private: item.GetFixedDisplayXPos(), item.GetFixedDisplayYPos(), item.GetWindowXPos(), item.GetWindowYPos(), item.IsPressed(), item.GetPressure(), item.GetMoveFlag(), item.GetLongAxis(), item.GetShortAxis(), isSimulate.c_str()); - MMI_HILOG_HEADER(LOG_INFO, lh, "%{public}d|%{public}d|%{public}d|%{public}d|%{public}" PRId64, - item.GetPointerId(), item.GetTargetWindowId(), item.GetOriginPointerId(), - item.GetTwist(), item.GetDownTime()); + MMI_HILOG_HEADER(LOG_INFO, lh, "%{public}d|%{public}d|%{public}d|%{public}d|%{public}d" + "|%{public}" PRId64, item.GetPointerId(), item.GetTargetWindowId(), item.GetOriginPointerId(), + event->GetTargetDisplayId(), item.GetTwist(), item.GetDownTime()); } } std::vector pressedKeys = event->GetPressedKeys(); diff --git a/service/message_handle/src/server_msg_handler.cpp b/service/message_handle/src/server_msg_handler.cpp index 945623d4e0578e63f5376960183901061922dfcf..fe9a950e4831bca4a7ea9bca81f73b581e3b2448 100644 --- a/service/message_handle/src/server_msg_handler.cpp +++ b/service/message_handle/src/server_msg_handler.cpp @@ -624,12 +624,6 @@ int32_t ServerMsgHandler::SaveTargetWindowId(std::shared_ptr point if ((pointerEvent->GetSourceType() == PointerEvent::SOURCE_TYPE_TOUCHSCREEN) && (pointerEvent->GetPointerAction() == PointerEvent::POINTER_ACTION_DOWN || pointerEvent->GetPointerAction() == PointerEvent::POINTER_ACTION_HOVER_ENTER)) { - int32_t pointerId = pointerEvent->GetPointerId(); - PointerEvent::PointerItem pointerItem; - if (!pointerEvent->GetPointerItem(pointerId, pointerItem)) { - MMI_HILOGE("Can't find pointer item, pointer:%{public}d", pointerId); - return RET_ERR; - } int32_t targetWindowId = pointerEvent->GetTargetWindowId(); if (isShell) { shellTargetWindowIds_[touch] = targetWindowId; @@ -640,11 +634,12 @@ int32_t ServerMsgHandler::SaveTargetWindowId(std::shared_ptr point } else { nativeTargetWindowIds_[touch] = targetWindowId; } + MMI_HILOGD("Update displayId:%{public}d, pointerId:%{public}d, targetWindowId:%{public}d", + touch.displayId_, touch.pointerId_, targetWindowId); } if ((pointerEvent->GetSourceType() == PointerEvent::SOURCE_TYPE_TOUCHSCREEN) && (pointerEvent->GetPointerAction() == PointerEvent::POINTER_ACTION_UP || pointerEvent->GetPointerAction() == PointerEvent::POINTER_ACTION_HOVER_EXIT)) { - int32_t pointerId = pointerEvent->GetPointerId(); if (isShell) { shellTargetWindowIds_.erase(touch); } else if (IsCastInject(pointerEvent->GetDeviceId()) && (pointerEvent->GetZOrder() > 0)) { @@ -654,6 +649,8 @@ int32_t ServerMsgHandler::SaveTargetWindowId(std::shared_ptr point } else { nativeTargetWindowIds_.erase(touch); } + MMI_HILOGD("Erase displayId:%{public}d, pointerId:%{public}d", + touch.displayId_, touch.pointerId_); } return RET_OK; } @@ -698,8 +695,13 @@ int32_t ServerMsgHandler::FixTargetWindowId(std::shared_ptr pointe pointerEvent->SetPointerId(pointerEvent->GetPointerId() + diffPointerId); } } + auto displayId = pointerEvent->GetTargetDisplayId(); + if (displayId < 0 && !WIN_MGR->UpdateDisplayId(displayId)) { + MMI_HILOG_DISPATCHE("This display is not existent"); + return RET_ERR; + } InjectionTouch touch{ - .displayId_ = pointerEvent->GetTargetDisplayId(), .pointerId_ = pointerEvent->GetPointerId()}; + .displayId_ = displayId, .pointerId_ = pointerEvent->GetPointerId()}; auto iter = targetWindowIdMap.find(touch); if (iter != targetWindowIdMap.end()) { return iter->second; diff --git a/service/window_manager/include/i_input_windows_manager.h b/service/window_manager/include/i_input_windows_manager.h index 84d9f7bad7fe9683fb0b48dc5df2596d5faccb70..db9791b0b731cf47a13135af7ed09eda9c680932 100644 --- a/service/window_manager/include/i_input_windows_manager.h +++ b/service/window_manager/include/i_input_windows_manager.h @@ -151,6 +151,7 @@ public: #endif // OHOS_BUILD_ENABLE_TOUCH #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) + virtual bool UpdateDisplayId(int32_t& displayId) = 0; virtual void DrawTouchGraphic(std::shared_ptr pointerEvent) = 0; virtual int32_t UpdateTargetPointer(std::shared_ptr pointerEvent) = 0; virtual const OLD::DisplayInfo *GetPhysicalDisplay(int32_t id) const = 0; diff --git a/test/facility/mock/include/input_windows_manager_mock.h b/test/facility/mock/include/input_windows_manager_mock.h index c5cc3e01d351a2ecb72a5afa20e50d6995f842dd..db193636f09e77be26af21123947c2757e5fccd9 100644 --- a/test/facility/mock/include/input_windows_manager_mock.h +++ b/test/facility/mock/include/input_windows_manager_mock.h @@ -113,6 +113,7 @@ public: #endif // OHOS_BUILD_ENABLE_TOUCH #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) + MOCK_METHOD(bool, UpdateDisplayId, (int32_t&)); void DrawTouchGraphic(std::shared_ptr) override {} MOCK_METHOD(int32_t, UpdateTargetPointer, (std::shared_ptr)); MOCK_METHOD(const OLD::DisplayInfo *, GetPhysicalDisplay, (int32_t), (const));