From b77c023e6092b65fe67d2aa696a98756a8b99b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E6=97=AD?= Date: Sat, 21 Jun 2025 16:42:51 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郭旭 --- .../src/js_input_monitor_module.cpp | 2 +- .../innerkits/event/include/input_event.h | 2 +- .../innerkits/event/include/shift_info.h | 1 - .../src/input_device_manager.cpp | 2 +- .../test/device_event_monitor_test.cpp | 4 +- .../src/event_interceptor_handler.cpp | 2 +- .../libinput_adapter/src/libinput_adapter.cpp | 4 +- .../src/mouse_transform_processor.cpp | 5 +- .../src/input_active_subscriber_handler.cpp | 2 +- .../src/input_windows_manager.cpp | 97 +++++++++---------- .../src/pointer_drawing_manager.cpp | 14 +-- .../src/input_manager_command.cpp | 28 ++---- 12 files changed, 70 insertions(+), 93 deletions(-) diff --git a/frameworks/napi/input_monitor/src/js_input_monitor_module.cpp b/frameworks/napi/input_monitor/src/js_input_monitor_module.cpp index b3a5d29196..4a455257be 100644 --- a/frameworks/napi/input_monitor/src/js_input_monitor_module.cpp +++ b/frameworks/napi/input_monitor/src/js_input_monitor_module.cpp @@ -116,7 +116,7 @@ static void AddPreMonitor(napi_env env, napi_callback_info info, napi_value napi return; } if (!JS_INPUT_MONITOR_MGR.GetKeysArray(env, napiKeys, keysLength, keys)) { - THROWERR_CUSTOM(env, PRE_KEY_NOT_SUPPORTED, "Event listening not supported for the key"); + THROWERR_CUSTOM(env, PRE_KEY_NOT_SUPPORTED, "Event listening not supported for the key"); return; } if (keys.size() != keysLength) { diff --git a/interfaces/native/innerkits/event/include/input_event.h b/interfaces/native/innerkits/event/include/input_event.h index d148f9e3b1..263a80ee84 100644 --- a/interfaces/native/innerkits/event/include/input_event.h +++ b/interfaces/native/innerkits/event/include/input_event.h @@ -129,7 +129,7 @@ public: * * @since 19 */ - static constexpr uint32_t EVENT_FLAG_KEYBOARD_ENTER_FOCUS = 0x00002000; + static constexpr uint32_t EVENT_FLAG_KEYBOARD_ENTER_FOCUS = 0x00002000; /** * The multimodal input event for device exit focus flag. * diff --git a/interfaces/native/innerkits/event/include/shift_info.h b/interfaces/native/innerkits/event/include/shift_info.h index d10ef8609c..d5aab511b7 100644 --- a/interfaces/native/innerkits/event/include/shift_info.h +++ b/interfaces/native/innerkits/event/include/shift_info.h @@ -47,7 +47,6 @@ struct ShiftWindowParam : public Parcelable { return false; } if (!out.WriteInt32(sourceType)) { - } return true; } diff --git a/service/device_manager/src/input_device_manager.cpp b/service/device_manager/src/input_device_manager.cpp index b2fae292ac..9417b48f5b 100644 --- a/service/device_manager/src/input_device_manager.cpp +++ b/service/device_manager/src/input_device_manager.cpp @@ -480,7 +480,7 @@ void InputDeviceManager::OnInputDeviceRemoved(struct libinput_device *inputDevic if (!sysUid.empty()) { #ifdef OHOS_BUILD_ENABLE_KEYBOARD_EXT_FLAG NotifyDevRemoveCallbackExt(deviceId); -#endif // OHOS_BUILD_ENABLE_KEYBOARD_EXT_FLAG +#endif // OHOS_BUILD_ENABLE_KEYBOARD_EXT_FLAG CHKPV(devCallbacks_); devCallbacks_(deviceId, sysUid, "remove"); MMI_HILOGI("Send device info to window manager, device id:%{public}d, system uid:%s, status:remove", diff --git a/service/device_state_manager/test/device_event_monitor_test.cpp b/service/device_state_manager/test/device_event_monitor_test.cpp index b35d95c909..499cedffc1 100644 --- a/service/device_state_manager/test/device_event_monitor_test.cpp +++ b/service/device_state_manager/test/device_event_monitor_test.cpp @@ -48,7 +48,7 @@ public: HWTEST_F(DeviceEventMonitorTest, InitCommonEventSubscriber_001, TestSize.Level1) { CALL_TEST_DEBUG; - DeviceEventMonitor deviceEventMonitor; + DeviceEventMonitor deviceEventMonitor; deviceEventMonitor.hasInit_ = true; EXPECT_NO_FATAL_FAILURE(deviceEventMonitor.InitCommonEventSubscriber()); } @@ -61,7 +61,7 @@ HWTEST_F(DeviceEventMonitorTest, InitCommonEventSubscriber_001, TestSize.Level1) HWTEST_F(DeviceEventMonitorTest, InitCommonEventSubscriber_002, TestSize.Level1) { CALL_TEST_DEBUG; - DeviceEventMonitor deviceEventMonitor; + DeviceEventMonitor deviceEventMonitor; deviceEventMonitor.hasInit_ = false; EXPECT_NO_FATAL_FAILURE(deviceEventMonitor.InitCommonEventSubscriber()); } diff --git a/service/interceptor/src/event_interceptor_handler.cpp b/service/interceptor/src/event_interceptor_handler.cpp index b8fe5a538b..e31923c708 100644 --- a/service/interceptor/src/event_interceptor_handler.cpp +++ b/service/interceptor/src/event_interceptor_handler.cpp @@ -83,7 +83,7 @@ bool EventInterceptorHandler::KeyInterceptByHostOSWhiteList(int32_t keyCode) std::string keyString = std::to_string(keyCode); keyString += ";"; bool isIntercept = keyevent_intercept_whitelist->find(keyString) != std::string::npos; - MMI_HILOGD("Received key event is %{public}d isIntercept is %{public}d", keyCode, isIntercept); + MMI_HILOGD("Received key event is %{public}d isIntercept is %{public}d", keyCode, isIntercept); return isIntercept; } #endif // OHOS_BUILD_ENABLE_KEYBOARD diff --git a/service/libinput_adapter/src/libinput_adapter.cpp b/service/libinput_adapter/src/libinput_adapter.cpp index 79298b0662..455cf59bd3 100644 --- a/service/libinput_adapter/src/libinput_adapter.cpp +++ b/service/libinput_adapter/src/libinput_adapter.cpp @@ -156,8 +156,7 @@ constexpr static libinput_interface LIBINPUT_INTERFACE = { } else { id = std::stoi(match[0]); } - MMI_HILOGWK("Libinput .open_restricted id:%{public}d, fd:%{public}d, errno:%{public}d", - id, fd, errNo); + MMI_HILOGWK("Libinput .open_restricted id:%{public}d, fd:%{public}d, errno:%{public}d", id, fd, errNo); return fd < 0 ? RET_ERR : fd; }, .close_restricted = [](int32_t fd, void *user_data) @@ -873,6 +872,5 @@ void LibinputAdapter::OnDeviceRemoved(std::string path) OnEventHandler(); } } -///add } // namespace MMI } // namespace OHOS diff --git a/service/mouse_event_normalize/src/mouse_transform_processor.cpp b/service/mouse_event_normalize/src/mouse_transform_processor.cpp index 7e88e8b674..0817865b29 100644 --- a/service/mouse_event_normalize/src/mouse_transform_processor.cpp +++ b/service/mouse_event_normalize/src/mouse_transform_processor.cpp @@ -802,7 +802,7 @@ double MouseTransformProcessor::HandleAxisAccelateTouchPad(double axisValue) if (PRODUCT_TYPE == DEVICE_TYPE_M_PC) { deviceType = DeviceType::DEVICE_M_PC; } - if (PRODUCT_TYPE == DEVICE_TYPE_M_TABLET1 || PRODUCT_TYPE == DEVICE_TYPE_M_TABLET2 || + if (PRODUCT_TYPE == DEVICE_TYPE_M_TABLET1 || PRODUCT_TYPE == DEVICE_TYPE_M_TABLET2 || PRODUCT_TYPE == DEVICE_TYPE_M_TABLET3) { deviceType = DeviceType::DEVICE_M_TABLET; } @@ -1201,8 +1201,7 @@ void MouseTransformProcessor::Dump(int32_t fd, const std::vector &a CHKPV(pointerEvent_); pointerEvent_->GetPointerItem(pointerEvent_->GetPointerId(), item); mprintf(fd, "Mouse device state information:\t"); - mprintf(fd, - "PointerId:%d | SourceType:%s | PointerAction:%s | WindowX:%d | WindowY:%d | ButtonId:%d " + mprintf(fd, "PointerId:%d | SourceType:%s | PointerAction:%s | WindowX:%d | WindowY:%d | ButtonId:%d " "| AgentWindowId:%d | TargetWindowId:%d | DownTime:%" PRId64 " | IsPressed:%s \t", pointerEvent_->GetPointerId(), pointerEvent_->DumpSourceType(), pointerEvent_->DumpPointerAction(), item.GetWindowX(), item.GetWindowY(), pointerEvent_->GetButtonId(), pointerEvent_->GetAgentWindowId(), diff --git a/service/subscriber/src/input_active_subscriber_handler.cpp b/service/subscriber/src/input_active_subscriber_handler.cpp index d097fd95e5..58ea65eef0 100644 --- a/service/subscriber/src/input_active_subscriber_handler.cpp +++ b/service/subscriber/src/input_active_subscriber_handler.cpp @@ -243,7 +243,7 @@ void InputActiveSubscriberHandler::OnSessionDelete(SessionPtr sess) auto newEnd = std::remove_if( subscribers_.begin(), subscribers_.end(), [sess](std::shared_ptr subscribe) { if (subscribe && subscribe->sess_ == sess) { - return true; + return true; } return false; }); diff --git a/service/window_manager/src/input_windows_manager.cpp b/service/window_manager/src/input_windows_manager.cpp index d13b3b3901..090fb462db 100644 --- a/service/window_manager/src/input_windows_manager.cpp +++ b/service/window_manager/src/input_windows_manager.cpp @@ -1240,7 +1240,7 @@ void InputWindowsManager::SendBackCenterPointerEevent(const CursorPosition &curs InputHandler->GetFilterHandler()->HandlePointerEvent(pointerBackCenterEvent); } -CursorPosition InputWindowsManager::ResetCursorPos(const DisplayGroupInfo &displayGroupInfo) +CursorPosition InputWindowsManager::ResetCursorPos(const DisplayGroupInfo &displayGroupInfo) { int32_t groupId = displayGroupInfo.groupId; if (!displayGroupInfo.displaysInfo.empty()) { @@ -1590,7 +1590,7 @@ void InputWindowsManager::CancelMouseEvent() lastPointerEventCopy->UpdatePointerItem(pointerId, item); } MMI_HILOGI("Cancel mouse event for valid display change,pointerId:%{public}d action:%{public}d->%{public}d " - "isItemExist=%{public}d", + "isItemExist=%{public}d", pointerId, originAction, action, @@ -1873,8 +1873,8 @@ void InputWindowsManager::AdjustDisplayRotation(int32_t groupId) ((displayInfo->direction - displayInfo->displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); if (cursorPosCur.displayDirection != displayInfo->displayDirection) { MMI_HILOGI("displayId:%{public}d, cursorPosX:%{private}.2f, cursorPosY:%{private}.2f, direction:%{public}d, " - "physicalDisplay id:%{public}d, x:%{private}d, y:%{private}d, width:%{public}d, height:%{public}d, " - "dpi:%{public}d, name:%{public}s, uniq:%{public}s, direction:%{public}d, displayDirection:%{public}d", + "physicalDisplay id:%{public}d, x:%{private}d, y:%{private}d, width:%{public}d, height:%{public}d, " + "dpi:%{public}d, name:%{public}s, uniq:%{public}s, direction:%{public}d, displayDirection:%{public}d", cursorPosCur.displayId, cursorPosCur.cursorPos.x, cursorPosCur.cursorPos.y, cursorPosCur.direction, displayInfo->id, displayInfo->x, displayInfo->y, displayInfo->width, displayInfo->height, @@ -2041,7 +2041,7 @@ void InputWindowsManager::PointerDrawingManagerOnDisplayInfo(const DisplayGroupI for (auto displayInfo : displayGroupInfo.displaysInfo) { if (displayInfo.uniqueId == currentDisplayInfo.uniqueId && displayInfo.dpi != currentDisplayInfo.dpi) { MMI_HILOGD("dpi changed, current displayId: %{public}d, dpi: %{public}d, " - "latest displayId: %{public}d, dpi: %{public}d", + "latest displayId: %{public}d, dpi: %{public}d", currentDisplayInfo.uniqueId, currentDisplayInfo.dpi, displayInfo.uniqueId, displayInfo.dpi); auto drawNewDpiRes = IPointerDrawingManager::GetInstance()->DrawNewDpiPointer(); if (drawNewDpiRes != RET_OK) { @@ -2492,7 +2492,7 @@ void InputWindowsManager::PrintEnterEventInfo(std::shared_ptr poin 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", + 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()); } @@ -2606,10 +2606,10 @@ void InputWindowsManager::PrintWindowInfo(const std::vector &windows std::string window; window += StringPrintf("windowId:["); for (const auto &item : windowsInfo) { - MMI_HILOGD("windowsInfos,id:%{public}d,pid:%{public}d,uid:%{public}d," - "area.x:%d,area.y:%d,area.width:%{public}d,area.height:%{public}d," - "defaultHotAreas.size:%{public}zu,pointerHotAreas.size:%{public}zu," - "agentWindowId:%{public}d,flags:%{public}d,action:%{public}d,displayId:%{public}d," + MMI_HILOGD("windowsInfos, id:%{public}d, pid:%{public}d, uid:%{public}d," + "area.x:%d,area.y:%d,area.width:%{public}d, area.height:%{public}d," + "defaultHotAreas.size:%{public}zu, pointerHotAreas.size:%{public}zu," + "agentWindowId:%{public}d, flags:%{public}d, action:%{public}d, displayId:%{public}d," "zOrder:%{public}f, privacyMode:%{public}d", item.id, item.pid, item.uid, item.area.x, item.area.y, item.area.width, item.area.height, item.defaultHotAreas.size(), item.pointerHotAreas.size(), @@ -2654,7 +2654,7 @@ void InputWindowsManager::PrintWindowGroupInfo(const WindowGroupInfo &windowGrou if (!HiLogIsLoggable(MMI_LOG_DOMAIN, MMI_LOG_TAG, LOG_DEBUG)) { return; } - MMI_HILOGD("windowsGroupInfo,focusWindowId:%{public}d,displayId:%{public}d", + MMI_HILOGD("windowsGroupInfo,focusWindowId:%{public}d, displayId:%{public}d", windowGroupInfo.focusWindowId, windowGroupInfo.displayId); PrintWindowInfo(windowGroupInfo.windowsInfo); } @@ -2664,8 +2664,8 @@ void InputWindowsManager::PrintDisplayGroupInfo(const DisplayGroupInfo displayGr if (!HiLogIsLoggable(MMI_LOG_DOMAIN, MMI_LOG_TAG, LOG_DEBUG)) { return; } - MMI_HILOGD("logicalInfo,width:%{public}d,height:%{public}d,focusWindowId:%{public}d," - "windowsInfosNum:%{public}zu,displayInfosNum:%{public}zu", + MMI_HILOGD("logicalInfo, width:%{public}d, height:%{public}d, focusWindowId:%{public}d," + "windowsInfosNum:%{public}zu, displayInfosNum:%{public}zu", displayGroupInfo.width, displayGroupInfo.height, displayGroupInfo.focusWindowId, @@ -2682,12 +2682,12 @@ void InputWindowsManager::PrintDisplayInfo(const DisplayInfo displayInfo) if (!HiLogIsLoggable(MMI_LOG_DOMAIN, MMI_LOG_TAG, LOG_DEBUG)) { return; } - MMI_HILOGD("displayInfo{id:%{public}d,name:%{public}s,uniq:%{public}s " + MMI_HILOGD("displayInfo{id:%{public}d, name:%{public}s, uniq:%{public}s " "XY:{%{private}d %{private}d} offsetXY:{%{private}d %{private}d} " "WH:{%{private}d %{private}d} validWH:{%{private}d %{private}d} " - "direction:%{public}d,displayDirection:%{public}d,fixedDirection:%{public}d} " + "direction:%{public}d, displayDirection:%{public}d, fixedDirection:%{public}d} " "oneHandXY:{%{private}d %{private}d}," - "pointerActiveWidth:%{private}d,pointerActiveHeight:%{private}d", + "pointerActiveWidth:%{private}d, pointerActiveHeight:%{private}d", displayInfo.id, displayInfo.name.c_str(), displayInfo.uniq.c_str(), @@ -2739,7 +2739,7 @@ const std::shared_ptr InputWindowsManager::FindPhysicalDisplayInfo( } } } - MMI_HILOGD("Failed to search for Physical,uniq:%{public}s", uniq.c_str()); + MMI_HILOGD("Failed to search for Physical, uniq:%{public}s", uniq.c_str()); DisplayGroupInfo displayGroupInfo; auto iter = displayGroupInfoMap_.find(MAIN_GROUPID); if (iter != displayGroupInfoMap_.end()) { @@ -3546,7 +3546,7 @@ bool InputWindowsManager::InWhichHotArea(int32_t x, int32_t y, const std::vector for (const auto &item : rects) { if (item.width == 0 || item.height == 0) { MMI_HILOGD("The width or height of hotArea is 0, width: %{public}d, height: %{public}d, " - "areaNum: %{public}d", item.width, item.height, areaNum); + "areaNum: %{public}d", item.width, item.height, areaNum); areaNum++; continue; } @@ -3851,7 +3851,7 @@ std::optional InputWindowsManager::GetWindowInfo(int32_t logicalX, i for (const auto& item : WindowsInfo) { if ((item.flags & WindowInfo::FLAG_BIT_UNTOUCHABLE) == WindowInfo::FLAG_BIT_UNTOUCHABLE) { MMI_HILOGD("Skip the untouchable window to continue searching, " - "window:%{public}d, flags:%{public}d", item.id, item.flags); + "window:%{public}d, flags:%{public}d", item.id, item.flags); continue; } else if (IsInHotArea(logicalX, logicalY, item.pointerHotAreas, item)) { return std::make_optional(item); @@ -4101,8 +4101,8 @@ void InputWindowsManager::UpdatePointerEvent(int32_t logicalX, int32_t logicalY, if (device != nullptr) { deviceName = device->GetName(); } - MMI_HILOGE("Not mouse event id:%{public}d,PI:%{public}d,AC:%{public}d,wid:%{public}d by:%{public}s," - " SI:%{public}s,PC:%{public}zu, LastEvent id:%{public}d,PI:%{public}d,AC:%{public}d,wid:%{public}d", + MMI_HILOGE("Not mouse event id:%{public}d, PI:%{public}d, AC:%{public}d, wid:%{public}d by:%{public}s," + " SI:%{public}s, PC:%{public}zu, LastEvent id:%{public}d, PI:%{public}d, AC:%{public}d, wid:%{public}d", pointerEvent->GetId(), pointerEvent->GetPointerId(), pointerEvent->GetPointerAction(), pointerEvent->GetTargetWindowId(), deviceName.c_str(), isSimulate.c_str(), pointerIds.size(), lastPointerEvent_->GetId(), lastPointerEvent_->GetPointerId(), lastPointerEvent_->GetPointerAction(), @@ -4539,11 +4539,11 @@ bool InputWindowsManager::IsNeedDrawPointer(PointerEvent::PointerItem &pointerIt } if (inputDevice != nullptr) { MMI_HILOGD("name:%{public}s type:%{public}d bus:%{public}d, " - "version:%{public}d product:%{public}d vendor:%{public}d, " - "phys:%{public}s uniq:%{public}s", - inputDevice->GetName().c_str(), inputDevice->GetType(), inputDevice->GetBus(), - inputDevice->GetVersion(), inputDevice->GetProduct(), inputDevice->GetVendor(), - inputDevice->GetPhys().c_str(), inputDevice->GetUniq().c_str()); + "version:%{public}d product:%{public}d vendor:%{public}d, " + "phys:%{public}s uniq:%{public}s", + inputDevice->GetName().c_str(), inputDevice->GetType(), inputDevice->GetBus(), + inputDevice->GetVersion(), inputDevice->GetProduct(), inputDevice->GetVendor(), + inputDevice->GetPhys().c_str(), inputDevice->GetUniq().c_str()); } if (inputDevice != nullptr && inputDevice->GetBus() == BUS_USB) { return true; @@ -4650,7 +4650,7 @@ void InputWindowsManager::HandleOneHandMode(const DisplayInfo &displayInfo, { pointerEvent->SetFixedMode(PointerEvent::FixedMode::AUTO); MMI_HILOG_DISPATCHD("displayInfo.oneHandX=%{private}d, displayInfo.oneHandY=%{private}d, " - "expandHeight=%{public}d,scalePercent=%{public}d, fixedModeStr=%{public}s", + "expandHeight=%{public}d,scalePercent=%{public}d, fixedModeStr=%{public}s", displayInfo.oneHandX, displayInfo.oneHandY, displayInfo.expandHeight, displayInfo.scalePercent, pointerEvent->GetFixedModeStr().c_str()); double fixedDisplayX = pointerItem.GetDisplayXPos(); @@ -5562,7 +5562,6 @@ int32_t InputWindowsManager::UpdateJoystickTarget(std::shared_ptr pointerEvent->SetTargetWindowId(windowInfo->id); pointerEvent->SetAgentWindowId(windowInfo->agentWindowId); MMI_HILOG_DISPATCHD("focusWindow:%{public}d, pid:%{public}d", focusWindowId, windowInfo->pid); - return RET_OK; } #endif // OHOS_BUILD_ENABLE_JOYSTICK @@ -5738,7 +5737,7 @@ bool InputWindowsManager::IsInsideDisplay(const DisplayInfo& displayInfo, double bool isInside = (physicalX >= 0 && physicalX < physicalRect.x) && (physicalY >= 0 && physicalY < physicalRect.y); PrintDisplayInfo(displayInfo); MMI_HILOGD("isInside:%{public}d physicalXY={%{private}f %{private}f} " - "physicalRect={%{public}d %{public}d} useDirection:%{public}d}", + "physicalRect={%{public}d %{public}d} useDirection:%{public}d}", static_cast(isInside), physicalX, physicalY, @@ -5947,7 +5946,7 @@ void InputWindowsManager::ReverseRotateScreen(const DisplayInfo& info, const dou { const Direction direction = info.direction; MMI_HILOGD("X:%{private}.2f, Y:%{private}.2f, offsetXY={%{private}d %{private}d}," - "info.WH:{%{private}d %{private}d} info.validWH:{%{private}d %{private}d}", + "info.WH:{%{private}d %{private}d} info.validWH:{%{private}d %{private}d}", x, y, info.offsetX, @@ -6118,7 +6117,7 @@ void InputWindowsManager::UpdateAndAdjustMouseLocation(int32_t& displayId, doubl physicalY = posMap->second.cursorPos.y; } MMI_HILOGD("Mouse Data: isRealData=%{public}d, displayId:%{public}d, mousePhysicalXY={%{public}d, %{public}d}, " - "cursorPosXY: {%{public}.2f, %{public}.2f} -> {%{public}.2f %{private}.2f}", + "cursorPosXY: {%{public}.2f, %{public}.2f} -> {%{public}.2f %{private}.2f}", static_cast(isRealData), displayId, mouseLocationTmp.physicalX, mouseLocationTmp.physicalY, oldX, oldY, physicalX, physicalY); } @@ -6146,7 +6145,7 @@ MouseLocation InputWindowsManager::GetMouseInfo() curMouseLocation = iter->second; } MMI_HILOGD("Mouselocation displayinfo: displayId:%{public}d, W:%{public}d, H:%{public}d", - displayInfo.id, displayInfo.validWidth, displayInfo.validHeight); + displayInfo.id, displayInfo.validWidth, displayInfo.validHeight); return curMouseLocation; } MMI_HILOGD("Mouselocation next: displayId:%{public}d, X:%{public}d, Y:%{public}d", @@ -6316,15 +6315,15 @@ void InputWindowsManager::DumpDisplayInfo(int32_t fd, const std::vector &args) mprintf(fd, "windowsInfos,num:%zu", windowsInfo.size()); for (const auto &item : windowsInfo) { mprintf(fd, " windowsInfos: id:%d | pid:%d | uid:%d | area.x:%d | area.y:%d " - "| area.width:%d | area.height:%d | defaultHotAreas.size:%zu " - "| pointerHotAreas.size:%zu | agentWindowId:%d | flags:%u " - "| action:%d | displayId:%d | zOrder:%f \t", - item.id, item.pid, item.uid, item.area.x, item.area.y, item.area.width, - item.area.height, item.defaultHotAreas.size(), item.pointerHotAreas.size(), - item.agentWindowId, item.flags, item.action, item.displayId, item.zOrder); + "| area.width:%d | area.height:%d | defaultHotAreas.size:%zu " + "| pointerHotAreas.size:%zu | agentWindowId:%d | flags:%u " + "| action:%d | displayId:%d | zOrder:%f \t", + item.id, item.pid, item.uid, item.area.x, item.area.y, item.area.width, + item.area.height, item.defaultHotAreas.size(), item.pointerHotAreas.size(), + item.agentWindowId, item.flags, item.action, item.displayId, item.zOrder); for (const auto &win : item.defaultHotAreas) { mprintf(fd, "\t defaultHotAreas: x:%d | y:%d | width:%d | height:%d \t", - win.x, win.y, win.width, win.height); + win.x, win.y, win.width, win.height); } for (const auto &pointer : item.pointerHotAreas) { mprintf(fd, "\t pointerHotAreas: x:%d | y:%d | width:%d | height:%d \t", - pointer.x, pointer.y, pointer.width, pointer.height); + pointer.x, pointer.y, pointer.width, pointer.height); } std::string dump; @@ -6956,7 +6955,7 @@ std::optional InputWindowsManager::GetWindowInfoById(int32_t windowI for (const auto& item : iter->second.windowsInfo) { CHKCC(item.id == windowId && (item.flags & WindowInfo::FLAG_BIT_UNTOUCHABLE) != WindowInfo::FLAG_BIT_UNTOUCHABLE && - transparentWins_.find(item.id) == transparentWins_.end()); + transparentWins_.find(item.id) == transparentWins_.end()); return std::make_optional(item); } } @@ -7099,7 +7098,7 @@ int32_t InputWindowsManager::ShiftAppTouchPointerEvent(const ShiftWindowInfo &sh int32_t InputWindowsManager::ShiftAppPointerEvent(const ShiftWindowParam ¶m, bool autoGenDown) { MMI_HILOGI("Start shift pointer event, sourceWindowId:%{public}d, targetWindowId:%{public}d," - "x:%{private}d, y:%{private}d, autoGenDown:%{public}d", + "x:%{private}d, y:%{private}d, autoGenDown:%{public}d", param.sourceWindowId, param.targetWindowId, param.x, param.y, static_cast(autoGenDown)); std::optional sourceWindowInfo = GetWindowInfoById(param.sourceWindowId); std::optional targetWindowInfo = GetWindowInfoById(param.targetWindowId); diff --git a/service/window_manager/src/pointer_drawing_manager.cpp b/service/window_manager/src/pointer_drawing_manager.cpp index 4b3804e864..f4dd3b1bc6 100644 --- a/service/window_manager/src/pointer_drawing_manager.cpp +++ b/service/window_manager/src/pointer_drawing_manager.cpp @@ -1097,8 +1097,7 @@ void PointerDrawingManager::SoftwareCursorDynamicRender(MOUSE_ICON mouseStyle) CHKPV(it.second); auto sn = it.second->GetSurfaceNode(); cfg.dpi = it.second->GetDPI(); - MMI_HILOGD("SoftwareCursorDynamicRender, screen = %{public}u, dpi = %{public}f", - it.first, cfg.dpi); + MMI_HILOGD("SoftwareCursorDynamicRender, screen = %{public}u, dpi = %{public}f", it.first, cfg.dpi); if (it.second->IsMirror() || it.first == screenId_) { if (mouseStyle == MOUSE_ICON::LOADING) { cfg.rotationFocusX = GetFocusCoordinates(); @@ -1852,9 +1851,7 @@ void PointerDrawingManager::DoDraw(uint8_t *addr, uint32_t width, uint32_t heigh { CALL_DEBUG_ENTER; CHKPV(addr); - const uint32_t addrSize = width * height * CURSOR_STRIDE; - currentFrame_ = 0; OHOS::Rosen::Drawing::Bitmap bitmap; OHOS::Rosen::Drawing::BitmapFormat format { OHOS::Rosen::Drawing::COLORTYPE_RGBA_8888, @@ -2567,16 +2564,14 @@ bool PointerDrawingManager::IsPointerVisible() if (!hapPidInfos_.empty()) { for (auto& item : hapPidInfos_) { if (item.pid == pid_) { - MMI_HILOGI("Visible pid:%{public}d-visible:%{public}s", - item.pid, item.visible ? "true" : "false"); + MMI_HILOGI("Visible pid:%{public}d-visible:%{public}s", item.pid, item.visible ? "true" : "false"); return item.visible; } } if (!(INPUT_DEV_MGR->HasPointerDevice() || WIN_MGR->IsMouseSimulate() || INPUT_DEV_MGR->HasVirtualPointerDevice()) || pid_ == 0) { auto info = hapPidInfos_.back(); - MMI_HILOGI("Only hap visible pid:%{public}d-visible:%{public}s", - info.pid, info.visible ? "true" : "false"); + MMI_HILOGI("Only hap visible pid:%{public}d-visible:%{public}s", info.pid, info.visible ? "true" : "false"); return info.visible; } } @@ -2634,8 +2629,7 @@ bool PointerDrawingManager::GetPointerVisible(int32_t pid) if (count == 0 && !hapPidInfos_.empty()) { for (auto& item : hapPidInfos_) { if (item.pid == pid_) { - MMI_HILOGI("Visible pid:%{public}d-visible:%{public}s", - item.pid, item.visible ? "true" : "false"); + MMI_HILOGI("Visible pid:%{public}d-visible:%{public}s", item.pid, item.visible ? "true" : "false"); count++; ret = item.visible; break; diff --git a/tools/inject_event/src/input_manager_command.cpp b/tools/inject_event/src/input_manager_command.cpp index 06dfcefc5e..5da89251f4 100644 --- a/tools/inject_event/src/input_manager_command.cpp +++ b/tools/inject_event/src/input_manager_command.cpp @@ -260,8 +260,7 @@ int32_t InputManagerCommand::ParseCommand(int32_t argc, char *argv[]) int32_t ppx = 0; int32_t ppy = 0; - auto simulateMouseEvent = [&ppx, &ppy](std::shared_ptr pointerEvent) - { + auto simulateMouseEvent = [&ppx, &ppy](std::shared_ptr pointerEvent) { PointerEvent::PointerItem item; pointerEvent->GetPointerItem(0, item); int32_t x = item.GetDisplayX(); @@ -498,8 +497,7 @@ int32_t InputManagerCommand::ParseCommand(int32_t argc, char *argv[]) pointerEvent->AddPointerItem(item); pointerEvent->SetButtonPressed(buttonId); pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_BEGIN); - pointerEvent->SetAxisValue(PointerEvent::AxisType::AXIS_TYPE_SCROLL_VERTICAL, - scrollValue); + pointerEvent->SetAxisValue(PointerEvent::AxisType::AXIS_TYPE_SCROLL_VERTICAL, scrollValue); pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE); simulateMouseEvent(pointerEvent); @@ -509,8 +507,7 @@ int32_t InputManagerCommand::ParseCommand(int32_t argc, char *argv[]) pointerEvent->AddPointerItem(item); pointerEvent->SetButtonPressed(buttonId); pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_UPDATE); - pointerEvent->SetAxisValue(PointerEvent::AxisType::AXIS_TYPE_SCROLL_VERTICAL, - scrollValue); + pointerEvent->SetAxisValue(PointerEvent::AxisType::AXIS_TYPE_SCROLL_VERTICAL, scrollValue); pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE); simulateMouseEvent(pointerEvent); @@ -520,8 +517,7 @@ int32_t InputManagerCommand::ParseCommand(int32_t argc, char *argv[]) pointerEvent->AddPointerItem(item); pointerEvent->SetButtonPressed(buttonId); pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_AXIS_END); - pointerEvent->SetAxisValue(PointerEvent::AxisType::AXIS_TYPE_SCROLL_VERTICAL, - scrollValue); + pointerEvent->SetAxisValue(PointerEvent::AxisType::AXIS_TYPE_SCROLL_VERTICAL, scrollValue); pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE); simulateMouseEvent(pointerEvent); break; @@ -2286,12 +2282,8 @@ int32_t InputManagerCommand::ProcessTouchPadFingerSwipe(int32_t argc, char *argv return SwipeActionEvent(startX, startY, endX, endY); } -std::shared_ptr InputManagerCommand::CreateEvent( - int32_t id, - int32_t type, - int32_t pointerId, - int32_t sourceType, - int32_t fingerCount) +std::shared_ptr InputManagerCommand::CreateEvent(int32_t id, int32_t type, int32_t pointerId, + int32_t sourceType, int32_t fingerCount) { auto pointerEvent = PointerEvent::Create(); CHKPP(pointerEvent); @@ -2304,12 +2296,8 @@ std::shared_ptr InputManagerCommand::CreateEvent( return pointerEvent; } -void InputManagerCommand::FillPointerItem( - PointerEvent::PointerItem &item, - int32_t pointX, - int32_t pointY, - int32_t id, - bool press) +void InputManagerCommand::FillPointerItem(PointerEvent::PointerItem &item, int32_t pointX, int32_t pointY, + int32_t id, bool press) { item.SetDisplayX(pointX); item.SetDisplayY(pointY); -- Gitee From 9cfbe553be49afe365c79df17401397992a29c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E6=97=AD?= Date: Mon, 23 Jun 2025 01:08:35 +0000 Subject: [PATCH 2/3] update service/window_manager/src/input_windows_manager.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郭旭 --- service/window_manager/src/input_windows_manager.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/service/window_manager/src/input_windows_manager.cpp b/service/window_manager/src/input_windows_manager.cpp index 090fb462db..d47a92f7c2 100644 --- a/service/window_manager/src/input_windows_manager.cpp +++ b/service/window_manager/src/input_windows_manager.cpp @@ -2606,10 +2606,10 @@ void InputWindowsManager::PrintWindowInfo(const std::vector &windows std::string window; window += StringPrintf("windowId:["); for (const auto &item : windowsInfo) { - MMI_HILOGD("windowsInfos, id:%{public}d, pid:%{public}d, uid:%{public}d," - "area.x:%d,area.y:%d,area.width:%{public}d, area.height:%{public}d," - "defaultHotAreas.size:%{public}zu, pointerHotAreas.size:%{public}zu," - "agentWindowId:%{public}d, flags:%{public}d, action:%{public}d, displayId:%{public}d," + MMI_HILOGD("windowsInfos, id:%{public}d, pid:%{public}d, uid:%{public}d, " + "area.x:%d, area.y:%d, area.width:%{public}d, area.height:%{public}d, " + "defaultHotAreas.size:%{public}zu, pointerHotAreas.size:%{public}zu, " + "agentWindowId:%{public}d, flags:%{public}d, action:%{public}d, displayId:%{public}d, " "zOrder:%{public}f, privacyMode:%{public}d", item.id, item.pid, item.uid, item.area.x, item.area.y, item.area.width, item.area.height, item.defaultHotAreas.size(), item.pointerHotAreas.size(), @@ -2664,7 +2664,7 @@ void InputWindowsManager::PrintDisplayGroupInfo(const DisplayGroupInfo displayGr if (!HiLogIsLoggable(MMI_LOG_DOMAIN, MMI_LOG_TAG, LOG_DEBUG)) { return; } - MMI_HILOGD("logicalInfo, width:%{public}d, height:%{public}d, focusWindowId:%{public}d," + MMI_HILOGD("logicalInfo, width:%{public}d, height:%{public}d, focusWindowId:%{public}d, " "windowsInfosNum:%{public}zu, displayInfosNum:%{public}zu", displayGroupInfo.width, displayGroupInfo.height, -- Gitee From 10a6eac12fdcfb3ec8cf950556ff1dec774f7e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E6=97=AD?= Date: Mon, 23 Jun 2025 01:11:42 +0000 Subject: [PATCH 3/3] update service/window_manager/src/input_windows_manager.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郭旭 --- service/window_manager/src/input_windows_manager.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/service/window_manager/src/input_windows_manager.cpp b/service/window_manager/src/input_windows_manager.cpp index d47a92f7c2..a37afd0c59 100644 --- a/service/window_manager/src/input_windows_manager.cpp +++ b/service/window_manager/src/input_windows_manager.cpp @@ -2683,11 +2683,11 @@ void InputWindowsManager::PrintDisplayInfo(const DisplayInfo displayInfo) return; } MMI_HILOGD("displayInfo{id:%{public}d, name:%{public}s, uniq:%{public}s " - "XY:{%{private}d %{private}d} offsetXY:{%{private}d %{private}d} " - "WH:{%{private}d %{private}d} validWH:{%{private}d %{private}d} " - "direction:%{public}d, displayDirection:%{public}d, fixedDirection:%{public}d} " - "oneHandXY:{%{private}d %{private}d}," - "pointerActiveWidth:%{private}d, pointerActiveHeight:%{private}d", + "XY:{%{private}d %{private}d} offsetXY:{%{private}d %{private}d} " + "WH:{%{private}d %{private}d} validWH:{%{private}d %{private}d} " + "direction:%{public}d, displayDirection:%{public}d, fixedDirection:%{public}d} " + "oneHandXY:{%{private}d %{private}d}," + "pointerActiveWidth:%{private}d, pointerActiveHeight:%{private}d", displayInfo.id, displayInfo.name.c_str(), displayInfo.uniq.c_str(), -- Gitee