diff --git a/service/event_dispatch/src/event_dispatch_handler.cpp b/service/event_dispatch/src/event_dispatch_handler.cpp index 0555a452a9b3e2220e8ad9bfe81a3826e09a11a1..f088b646061eca677c5e565e20e9bea8b39bc11b 100644 --- a/service/event_dispatch/src/event_dispatch_handler.cpp +++ b/service/event_dispatch/src/event_dispatch_handler.cpp @@ -403,6 +403,7 @@ void EventDispatchHandler::DispatchPointerEventInner(std::shared_ptrGetProgramName().c_str(), sess->GetPid(), pointerEvent->GetPointerAction()); } + WIN_MGR->PrintEnterEventInfo(pointerEvent); if (!udsServer->SendMsg(fd, pkt)) { MMI_HILOGE("Sending structure of EventTouch failed! errCode:%{public}d", MSG_SEND_FAIL); return; diff --git a/service/mouse_event_normalize/src/mouse_transform_processor.cpp b/service/mouse_event_normalize/src/mouse_transform_processor.cpp index 3b4a79150ccc83cef3b8cb144daec9e2ac8e0bc7..7f994fb180f332df106e3fe57d3e2c8cbf7403d4 100644 --- a/service/mouse_event_normalize/src/mouse_transform_processor.cpp +++ b/service/mouse_event_normalize/src/mouse_transform_processor.cpp @@ -152,14 +152,6 @@ int32_t MouseTransformProcessor::HandleMotionInner(struct libinput_event_pointer pointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE); pointerEvent_->SetButtonId(buttonId_); - if (MouseState->IsLeftBtnPressed()) { - if (!pointerEvent_->IsButtonPressed(PointerEvent::MOUSE_BUTTON_LEFT)) { - pointerEvent_->SetButtonPressed(PointerEvent::MOUSE_BUTTON_LEFT); - } - } else { - pointerEvent_->DeleteReleaseButton(PointerEvent::MOUSE_BUTTON_LEFT); - } - CursorPosition cursorPos = WIN_MGR->GetCursorPos(); if (cursorPos.displayId < 0) { MMI_HILOGE("No display"); @@ -833,8 +825,13 @@ bool MouseTransformProcessor::HandlePostInner(struct libinput_event_pointer* dat pointerItem.SetHeight(0); pointerItem.SetPressure(0); pointerItem.SetDeviceId(deviceId_); - pointerItem.SetRawDx(static_cast(unaccelerated_.dx)); - pointerItem.SetRawDy(static_cast(unaccelerated_.dy)); + if (pointerEvent_->GetPointerAction() == PointerEvent::POINTER_ACTION_BUTTON_UP) { + pointerItem.SetRawDx(0); + pointerItem.SetRawDy(0); + } else { + pointerItem.SetRawDx(static_cast(unaccelerated_.dx)); + pointerItem.SetRawDy(static_cast(unaccelerated_.dy)); + } pointerEvent_->UpdateId(); StartLogTraceId(pointerEvent_->GetId(), pointerEvent_->GetEventType(), pointerEvent_->GetPointerAction()); diff --git a/service/window_manager/include/i_input_windows_manager.h b/service/window_manager/include/i_input_windows_manager.h index 3ac0cc0ce7e958b1c52b6ce6966cdca2586e2847..d5340682b40284d0a0d92b7424366304fd7c815c 100644 --- a/service/window_manager/include/i_input_windows_manager.h +++ b/service/window_manager/include/i_input_windows_manager.h @@ -72,6 +72,7 @@ public: virtual int32_t GetClientFd(std::shared_ptr pointerEvent) = 0; virtual int32_t GetClientFd(std::shared_ptr pointerEvent, int32_t windowId) = 0; virtual bool AdjustFingerFlag(std::shared_ptr pointerEvent) = 0; + virtual void PrintEnterEventInfo(std::shared_ptr pointerEvent) = 0; #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH virtual bool IsFocusedSession(int32_t session) const = 0; virtual void UpdateDisplayInfo(DisplayGroupInfo &displayGroupInfo) = 0; diff --git a/service/window_manager/include/input_windows_manager.h b/service/window_manager/include/input_windows_manager.h index 62269cfb7e2da0bb410a658924805cee398deccc..51bf1361b22ce30cef8583a93ab462ad20cb90e0 100644 --- a/service/window_manager/include/input_windows_manager.h +++ b/service/window_manager/include/input_windows_manager.h @@ -64,6 +64,7 @@ public: int32_t GetClientFd(std::shared_ptr pointerEvent); int32_t GetClientFd(std::shared_ptr pointerEvent, int32_t windowId); bool AdjustFingerFlag(std::shared_ptr pointerEvent); + void PrintEnterEventInfo(std::shared_ptr pointerEvent); #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH bool HandleWindowInputType(const WindowInfo &window, std::shared_ptr pointerEvent); void UpdateCaptureMode(const DisplayGroupInfo &displayGroupInfo); diff --git a/service/window_manager/src/input_windows_manager.cpp b/service/window_manager/src/input_windows_manager.cpp index 72619bc80e21a9dd499d5e56fa4324b531f0cc9a..7892d0d0daff5a82f31bddd1d64f7e3e7777a76a 100644 --- a/service/window_manager/src/input_windows_manager.cpp +++ b/service/window_manager/src/input_windows_manager.cpp @@ -1906,12 +1906,26 @@ void InputWindowsManager::DispatchPointer(int32_t pointerAction, int32_t windowI if (pointerAction == PointerEvent::POINTER_ACTION_LEAVE_WINDOW) { pointerEvent->SetAgentWindowId(lastWindowInfo_.id); } + PrintEnterEventInfo(pointerEvent); EventLogHelper::PrintEventData(pointerEvent, MMI_LOG_FREEZE); #ifdef OHOS_BUILD_ENABLE_POINTER auto filter = InputHandler->GetFilterHandler(); filter->HandlePointerEvent(pointerEvent); #endif // OHOS_BUILD_ENABLE_POINTER } + +void InputWindowsManager::PrintEnterEventInfo(std::shared_ptr pointerEvent) +{ + int32_t pointerAc = pointerEvent->GetPointerAction(); + if (pointerAc == PointerEvent::POINTER_ACTION_LEAVE_WINDOW && + pointerEvent->GetSourceType() != PointerEvent::SOURCE_TYPE_MOUSE) { + auto device = INPUT_DEV_MGR->GetInputDevice(pointerEvent->GetDeviceId()); + CHKPV(device); + MMI_HILOGE("leave-window type:%{public}d,id:%{public}d,pointerid:%{public}d,action:%{public}d by:%{public}s", + pointerEvent->GetSourceType(), pointerEvent->GetId(), pointerEvent->GetPointerId(), + pointerAc, device->GetName().c_str()); + } +} #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH #ifdef OHOS_BUILD_ENABLE_POINTER diff --git a/test/facility/mock/include/input_windows_manager_mock.h b/test/facility/mock/include/input_windows_manager_mock.h index 4c7c29221ecf1f67c3eac6f937718b2fb66793de..9f8d83171ca822c10f98f8bee06ba798cb0b1ff1 100644 --- a/test/facility/mock/include/input_windows_manager_mock.h +++ b/test/facility/mock/include/input_windows_manager_mock.h @@ -37,6 +37,7 @@ public: MOCK_METHOD(int32_t, GetClientFd, (std::shared_ptr)); MOCK_METHOD(int32_t, GetClientFd, (std::shared_ptr, int32_t)); MOCK_METHOD(bool, AdjustFingerFlag, (std::shared_ptr)); + MOCK_METHOD(void, PrintEnterEventInfo, (std::shared_ptr)); MOCK_METHOD(bool, IsFocusedSession, (int32_t), (const)); void UpdateDisplayInfo(DisplayGroupInfo&) override {} void UpdateDisplayInfoExtIfNeed(DisplayGroupInfo&, bool) override {}