From 262dfe378b91ea9f2f1cc013bc6255c2c299197d Mon Sep 17 00:00:00 2001 From: panjie Date: Mon, 23 Jun 2025 16:46:08 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=84=E8=93=9D=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I2bf99b583a1e41472c72ca369d7879804b4af128 Signed-off-by: panjie --- .../src/js_register_module.cpp | 44 +- frameworks/native/input/oh_input_manager.cpp | 96 +++- .../input/test/oh_input_manager_test.cpp | 2 +- .../include/input_manager_impl.h | 25 +- .../include/multimodal_event_handler.h | 2 +- .../event_handler/src/client_msg_handler.cpp | 5 +- .../src/input_handler_manager.cpp | 2 + .../event_handler/src/input_manager_impl.cpp | 297 ++++++------- .../src/multimodal_event_handler.cpp | 5 +- .../test/input_manager_impl_test.cpp | 60 +-- frameworks/proxy/events/src/input_manager.cpp | 18 +- frameworks/proxy/events/src/pointer_event.cpp | 6 + .../proxy/events/test/input_manager_test.cpp | 85 +++- ...input_manager_update_display_info_test.cpp | 91 +++- interfaces/kits/c/input/oh_input_manager.h | 23 + interfaces/kits/c/ohinput.ndk.json | 8 + .../event/include/i_input_event_consumer.h | 6 +- .../innerkits/event/include/pointer_event.h | 20 +- .../innerkits/proxy/include/input_manager.h | 15 +- .../innerkits/proxy/include/window_info.h | 338 ++++++++++---- .../IMultimodalInputConnect.idl | 2 +- .../multimodal_input_connect_manager.h | 3 +- .../src/multimodal_input_connect_manager.cpp | 4 +- .../include/i_input_event_handler.h | 6 +- .../key_command/include/key_command_handler.h | 4 +- .../key_command/src/key_command_handler.cpp | 2 +- .../test/key_command_handler_test.cpp | 44 +- .../long_press_subscriber_handler_test.cpp | 10 +- .../libinput_adapter/src/libinput_adapter.cpp | 4 +- .../include/server_msg_handler.h | 16 +- .../message_handle/src/server_msg_handler.cpp | 293 +++++++++--- .../test/server_msg_handler_test.cpp | 76 ++-- service/module_loader/include/mmi_service.h | 4 +- service/module_loader/src/mmi_service.cpp | 10 +- .../include/mouse_transform_processor.h | 12 +- .../src/mouse_transform_processor.cpp | 12 +- .../src/mouse_transform_processor_test.cpp | 6 +- .../include/touch_transform_processor.h | 2 +- .../src/touch_transform_processor.cpp | 17 +- .../test/src/touch_event_normalize_test.cpp | 4 +- .../src/touch_transform_processor_test.cpp | 4 +- .../include/cursor_drawing_component.h | 6 +- .../include/i_input_windows_manager.h | 19 +- .../include/i_pointer_drawing_manager.h | 14 +- .../include/input_windows_manager.h | 146 +++--- .../include/knuckle_drawing_manager.h | 12 +- .../include/knuckle_dynamic_drawing_manager.h | 6 +- .../window_manager/include/old_display_info.h | 248 +++++++++++ .../include/pointer_drawing_manager.h | 38 +- .../window_manager/include/screen_pointer.h | 6 +- .../include/touch_drawing_manager.h | 6 +- .../src/cursor_drawing_component.cpp | 10 +- .../src/input_windows_manager.cpp | 418 +++++++++++------- .../src/knuckle_drawing_manager.cpp | 17 +- .../src/knuckle_dynamic_drawing_manager.cpp | 15 +- .../src/pointer_drawing_manager.cpp | 171 +++---- service/window_manager/src/screen_pointer.cpp | 8 +- .../src/touch_drawing_manager.cpp | 15 +- .../test/cursor_drawing_component_test.cpp | 9 +- .../test/input_windows_manager_ex_test.cpp | 186 ++++---- .../test/input_windows_manager_one_test.cpp | 72 ++- .../test/input_windows_manager_test.cpp | 308 ++++++------- .../test/knuckle_drawing_manager_test.cpp | 5 +- .../knuckle_dynamic_drawing_manager_test.cpp | 6 +- service/window_manager/test/mock.cpp | 10 +- .../test/pointer_drawing_manager_ex_test.cpp | 4 +- .../test/pointer_drawing_manager_test.cpp | 12 +- .../test/screen_pointer_test.cpp | 41 +- .../test/touch_drawing_manager_test.cpp | 16 +- .../mock/include/input_windows_manager_mock.h | 15 +- .../pointerstyle_fuzzer.cpp | 25 +- .../stubhandleallocsocketfd_fuzzer.cpp | 3 +- .../updatedisplayinfo_fuzzer.cpp | 27 +- util/common/include/struct_multimodal.h | 20 +- 74 files changed, 2291 insertions(+), 1306 deletions(-) create mode 100644 service/window_manager/include/old_display_info.h diff --git a/frameworks/napi/input_event_client/src/js_register_module.cpp b/frameworks/napi/input_event_client/src/js_register_module.cpp index 0434d03415..92028067f6 100644 --- a/frameworks/napi/input_event_client/src/js_register_module.cpp +++ b/frameworks/napi/input_event_client/src/js_register_module.cpp @@ -371,12 +371,24 @@ static void HandleMousePropertyInt32(napi_env env, napi_value mouseHandle, MMI_HILOGE("toolType:%{public}d is less 0, can not process", toolType); THROWERR_CUSTOM(env, COMMON_PARAMETER_ERROR, "toolType must be greater than or equal to 0"); } + int32_t globalX = INT_MAX; + if (GetNamedPropertyInt32(env, mouseHandle, "globalX", globalX) != RET_OK) { + MMI_HILOGD("No globaX"); + } + int32_t globalY = INT_MAX; + if (GetNamedPropertyInt32(env, mouseHandle, "globalY", globalY) != RET_OK) { + MMI_HILOGD("No globaY"); + } pointerEvent->SetSourceType(toolType); item.SetPointerId(0); item.SetDisplayX(screenX); item.SetDisplayY(screenY); item.SetDisplayXPos(screenX); item.SetDisplayYPos(screenY); + if (globalX != INT_MAX && globalY != INT_MAX) { + item.SetGlobalX(globalX); + item.SetGlobalY(globalY); + } pointerEvent->SetPointerId(0); pointerEvent->AddPointerItem(item); } @@ -413,6 +425,8 @@ static napi_value InjectMouseEvent(napi_env env, napi_callback_info info) THROWERR_API9(env, COMMON_PARAMETER_ERROR, "mouseEvent", "object"); return nullptr; } + bool useGlobalCoordinate = false; + GetNamedPropertyBool(env, argv[0], "useGlobalCoordinate", useGlobalCoordinate); auto pointerEvent = PointerEvent::Create(); PointerEvent::PointerItem item; CHKPP(pointerEvent); @@ -420,7 +434,12 @@ static napi_value InjectMouseEvent(napi_env env, napi_callback_info info) HandleMouseAction(env, mouseHandle, pointerEvent, item); HandleMousePropertyInt32(env, mouseHandle, pointerEvent, item); HandleMousePressedButtons(env, mouseHandle, pointerEvent, item); - InputManager::GetInstance()->SimulateInputEvent(pointerEvent); + int32_t useCoordinate = PointerEvent::DISPLAY_COORDINATE; + if (useGlobalCoordinate) { + MMI_HILOGD("useGlobalCoordinate"); + useCoordinate = PointerEvent::GLOBAL_COORDINATE; + } + InputManager::GetInstance()->SimulateInputEvent(pointerEvent, true, useCoordinate); CHKRP(napi_create_int32(env, 0, &result), CREATE_INT32); return result; } @@ -504,6 +523,15 @@ static void HandleTouchAttribute(napi_env env, std::shared_ptr poi if (GetNamedPropertyDouble(env, touchObject, "pressure", pressure) != RET_OK) { MMI_HILOGE("Get pressure failed"); } + int32_t globalX = INT_MAX; + if (GetNamedPropertyInt32(env, touchObject, "globalX", globalX) != RET_OK) { + MMI_HILOGD("No globaX"); + } + int32_t globalY = INT_MAX; + if (GetNamedPropertyInt32(env, touchObject, "globalY", globalY) != RET_OK) { + MMI_HILOGD("No globaY"); + } + pointerItem.SetDisplayX(screenX); pointerItem.SetDisplayY(screenY); pointerItem.SetDisplayXPos(screenX); @@ -511,6 +539,10 @@ static void HandleTouchAttribute(napi_env env, std::shared_ptr poi pointerItem.SetPointerId(pointerId); pointerItem.SetToolType(toolType); pointerItem.SetPressure(pressure); + if (globalX != INT_MAX && globalY != INT_MAX) { + pointerItem.SetGlobalX(globalX); + pointerItem.SetGlobalY(globalY); + } if (isTouch) { pointerEvent->SetPointerId(pointerId); pointerEvent->SetActionTime(pressedTime); @@ -627,6 +659,8 @@ static napi_value InjectTouchEvent(napi_env env, napi_callback_info info) THROWERR_API9(env, COMMON_PARAMETER_ERROR, "touchEvent", "object"); return nullptr; } + bool useGlobalCoordinate = false; + GetNamedPropertyBool(env, argv[0], "useGlobalCoordinate", useGlobalCoordinate); auto pointerEvent = PointerEvent::Create(); PointerEvent::PointerItem item; CHKPP(pointerEvent); @@ -635,7 +669,13 @@ static napi_value InjectTouchEvent(napi_env env, napi_callback_info info) if (!HandleTouchPropertyInt32(env, touchHandle, pointerEvent, item, action)) { return nullptr; } - InputManager::GetInstance()->SimulateInputEvent(pointerEvent, pointerEvent->GetAutoToVirtualScreen()); + int32_t useCoordinate = PointerEvent::DISPLAY_COORDINATE; + if (useGlobalCoordinate) { + MMI_HILOGD("useGlobalCoordinate"); + useCoordinate = PointerEvent::GLOBAL_COORDINATE; + } + InputManager::GetInstance()->SimulateInputEvent(pointerEvent, pointerEvent->GetAutoToVirtualScreen(), + useCoordinate); CHKRP(napi_create_int32(env, 0, &result), CREATE_INT32); return result; } diff --git a/frameworks/native/input/oh_input_manager.cpp b/frameworks/native/input/oh_input_manager.cpp index 07f33f4ba2..43606fb76f 100644 --- a/frameworks/native/input/oh_input_manager.cpp +++ b/frameworks/native/input/oh_input_manager.cpp @@ -49,8 +49,8 @@ struct Input_MouseEvent { int32_t action; int32_t displayX; int32_t displayY; - int32_t globalX; - int32_t globalY; + int32_t globalX { INT_MAX }; + int32_t globalY { INT_MAX }; int32_t button { -1 }; int32_t axisType { -1 }; float axisValue { 0.0f }; @@ -64,8 +64,8 @@ struct Input_TouchEvent { int32_t id; int32_t displayX; int32_t displayY; - int32_t globalX; - int32_t globalY; + int32_t globalX { INT_MAX }; + int32_t globalY { INT_MAX };; int64_t actionTime { -1 }; int32_t windowId { -1 }; int32_t displayId { -1 }; @@ -508,6 +508,12 @@ static int32_t HandleMouseProperty(const struct Input_MouseEvent* mouseEvent, item.SetDisplayY(screenY); item.SetDisplayXPos(screenX); item.SetDisplayYPos(screenY); + int32_t globalX = mouseEvent->globalX; + int32_t globalY = mouseEvent->globalY; + if (globalX != INT_MAX && globalY != INT_MAX) { + item.SetGlobalX(globalX); + item.SetGlobalY(globalY); + } g_mouseEvent->SetPointerId(0); g_mouseEvent->UpdatePointerItem(g_mouseEvent->GetPointerId(), item); return INPUT_SUCCESS; @@ -539,7 +545,46 @@ int32_t OH_Input_InjectMouseEvent(const struct Input_MouseEvent* mouseEvent) return result; } g_mouseEvent->AddFlag(OHOS::MMI::InputEvent::EVENT_FLAG_SIMULATE); - result = OHOS::Singleton::GetInstance().SimulateInputEvent(g_mouseEvent, true); + result = OHOS::Singleton::GetInstance().SimulateInputEvent(g_mouseEvent, + true, PointerEvent::DISPLAY_COORDINATE); + if ((result == INPUT_PERMISSION_DENIED) || (result == INPUT_OCCUPIED_BY_OTHER)) { + MMI_HILOGE("Permission denied or occupied by other"); + return result; + } + return INPUT_SUCCESS; +} + +int32_t OH_Input_InjectMouseEventGlobal(const struct Input_MouseEvent* mouseEvent) +{ + MMI_HILOGD("Input_MouseEvent global"); + CHKPR(mouseEvent, INPUT_PARAMETER_ERROR); + CHKPR(g_mouseEvent, INPUT_PARAMETER_ERROR); + g_mouseEvent->ClearFlag(); + g_mouseEvent->ClearAxisValue(); + g_mouseEvent->SetTargetDisplayId(0); + int64_t time = mouseEvent->actionTime; + if (time < 0) { + time = OHOS::MMI::GetSysClockTime(); + } + g_mouseEvent->SetActionTime(time); + OHOS::MMI::PointerEvent::PointerItem item; + int32_t pointerId = 10000; + g_mouseEvent->GetPointerItem(pointerId, item); + item.SetDownTime(time); + int32_t result = HandleMouseAction(mouseEvent, item); + if (result != 0) { + return result; + } + result = HandleMouseProperty(mouseEvent, item); + if (result != 0) { + return result; + } + if (!item.IsValidGlobalXY()) { + return INPUT_PARAMETER_ERROR; + } + g_mouseEvent->AddFlag(OHOS::MMI::InputEvent::EVENT_FLAG_SIMULATE); + result = OHOS::Singleton::GetInstance().SimulateInputEvent(g_mouseEvent, + true, PointerEvent::GLOBAL_COORDINATE); if ((result == INPUT_PERMISSION_DENIED) || (result == INPUT_OCCUPIED_BY_OTHER)) { MMI_HILOGE("Permission denied or occupied by other"); return result; @@ -795,6 +840,12 @@ static int32_t HandleTouchProperty(const struct Input_TouchEvent* touchEvent, item.SetDisplayY(screenY); item.SetDisplayXPos(screenX); item.SetDisplayYPos(screenY); + int32_t globalX = touchEvent->globalX; + int32_t globalY = touchEvent->globalY; + if (globalX != INT_MAX && globalY != INT_MAX) { + item.SetGlobalX(globalX); + item.SetGlobalY(globalY); + } item.SetPointerId(id); g_touchEvent->SetPointerId(id); g_touchEvent->SetSourceType(OHOS::MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN); @@ -822,7 +873,40 @@ int32_t OH_Input_InjectTouchEvent(const struct Input_TouchEvent* touchEvent) return INPUT_PARAMETER_ERROR; } g_touchEvent->AddFlag(OHOS::MMI::InputEvent::EVENT_FLAG_SIMULATE); - OHOS::Singleton::GetInstance().SimulateInputEvent(g_touchEvent, true); + OHOS::Singleton::GetInstance().SimulateInputEvent(g_touchEvent, true, + PointerEvent::DISPLAY_COORDINATE); + if (touchEvent->action == TOUCH_ACTION_UP) { + g_touchEvent->RemovePointerItem(g_touchEvent->GetPointerId()); + MMI_HILOGD("This touch event is up remove this finger"); + if (g_touchEvent->GetPointerIds().empty()) { + MMI_HILOGD("This touch event is final finger up remove this finger"); + g_touchEvent->Reset(); + } + } + return INPUT_SUCCESS; +} + +int32_t OH_Input_InjectTouchEventGlobal(const struct Input_TouchEvent* touchEvent) +{ + MMI_HILOGD("injectTouchEvent global"); + CHKPR(touchEvent, INPUT_PARAMETER_ERROR); + CHKPR(g_touchEvent, INPUT_PARAMETER_ERROR); + g_touchEvent->ClearFlag(); + OHOS::MMI::PointerEvent::PointerItem item; + int32_t result = HandleTouchAction(touchEvent, item); + if (result != 0) { + return INPUT_PARAMETER_ERROR; + } + result = HandleTouchProperty(touchEvent, item); + if (result != 0) { + return INPUT_PARAMETER_ERROR; + } + if (!item.IsValidGlobalXY()) { + return INPUT_PARAMETER_ERROR; + } + g_touchEvent->AddFlag(OHOS::MMI::InputEvent::EVENT_FLAG_SIMULATE); + OHOS::Singleton::GetInstance().SimulateInputEvent(g_touchEvent, true, + PointerEvent::GLOBAL_COORDINATE); if (touchEvent->action == TOUCH_ACTION_UP) { g_touchEvent->RemovePointerItem(g_touchEvent->GetPointerId()); MMI_HILOGD("This touch event is up remove this finger"); diff --git a/frameworks/native/input/test/oh_input_manager_test.cpp b/frameworks/native/input/test/oh_input_manager_test.cpp index 5719525115..b6b85d7690 100644 --- a/frameworks/native/input/test/oh_input_manager_test.cpp +++ b/frameworks/native/input/test/oh_input_manager_test.cpp @@ -1944,7 +1944,7 @@ HWTEST_F(OHInputManagerTest, OHInputManagerTest_QueryMaxTouchPoints_002, TestSiz * @tc.type: FUNC * @tc.require: */ -HWTEST_F(OHInputManagerTest, OHInputManagerTest_MouseEventGlobalCoordinates, TestSize.Level1) +HWTEST_F(OHInputManagerTest, OHInputManagerTest_TouchMouseGlobalCoordinates, TestSize.Level1) { Input_MouseEvent mouseEvent; OH_Input_SetMouseEventGlobalX(&mouseEvent, DEFAULT_GLOBAL_X); diff --git a/frameworks/proxy/event_handler/include/input_manager_impl.h b/frameworks/proxy/event_handler/include/input_manager_impl.h index 456ae1da03..d1d3733cbc 100644 --- a/frameworks/proxy/event_handler/include/input_manager_impl.h +++ b/frameworks/proxy/event_handler/include/input_manager_impl.h @@ -52,8 +52,7 @@ public: int32_t GetAllMmiSubscribedEvents(std::map, int32_t> &datas); int32_t SetDisplayBind(int32_t deviceId, int32_t displayId, std::string &msg); int32_t GetWindowPid(int32_t windowId); - int32_t UpdateDisplayInfo(const DisplayGroupInfo &displayGroupInfo); - int32_t UpdateDisplayInfo(const std::vector &displayGroupInfo); + int32_t UpdateDisplayInfo(const UserScreenInfo &userScreenInfo); int32_t UpdateWindowInfo(const WindowGroupInfo &windowGroupInfo); #ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT void SetEnhanceConfig(uint8_t *cfg, uint32_t cfgLen); @@ -102,7 +101,7 @@ public: #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) void OnPointerEvent(std::shared_ptr pointerEvent); #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH - int32_t PackDisplayData(NetPacket &pkt, const DisplayGroupInfo &displayGroupInfo); + int32_t PackDisplayData(NetPacket &pkt, const UserScreenInfo &userScreenInfo); int32_t AddMonitor(std::function)> monitor); int32_t AddMonitor(std::function)> monitor); @@ -126,7 +125,8 @@ public: int32_t RemoveInterceptor(int32_t interceptorId); void SimulateInputEvent(std::shared_ptr keyEvent, bool isNativeInject = false); - int32_t SimulateInputEvent(std::shared_ptr pointerEvent, bool isNativeInject = false); + int32_t SimulateInputEvent(std::shared_ptr pointerEvent, bool isNativeInject = false, + int32_t useCoordinate = PointerEvent::DISPLAY_COORDINATE); void HandleSimulateInputEvent(std::shared_ptr pointerEvent); void SimulateTouchPadEvent(std::shared_ptr pointerEvent, bool isNativeInject = false); void SimulateTouchPadInputEvent(std::shared_ptr pointerEvent, @@ -259,15 +259,20 @@ public: int32_t QueryPointerRecord(int32_t count, std::vector> &pointerList); private: - int32_t PackWindowInfo(NetPacket &pkt, const DisplayGroupInfo &displayGroupInfo); + int32_t PackScreensInfo(NetPacket &pkt, const std::vector& screens); + int32_t PackDisplayGroupsInfo(NetPacket &pkt, const std::vector &displayGroups); + int32_t PackDisplaysInfo(NetPacket &pkt, const std::vector& displaysInfo); + int32_t PackWindowInfo(NetPacket &pkt, const std::vector &windowsInfo); int32_t PackWindowGroupInfo(NetPacket &pkt); - int32_t PackDisplayInfo(NetPacket &pkt, DisplayGroupInfo &displayGroupInfo); + int32_t PackUiExtentionWindowInfo(const std::vector& windowsInfo, NetPacket &pkt); void PrintWindowInfo(const std::vector &windowsInfo); - void PrintForemostThreeWindowInfo(const std::vector &windowsInfo); - void PrintDisplayInfo(const DisplayGroupInfo &displayGroupInfo); void PrintWindowGroupInfo(); - int32_t SendDisplayInfo(const DisplayGroupInfo &displayGroupInfo); + void PrintDisplayInfo(const UserScreenInfo &userScreenInfo); + void PrintScreens(const std::vector& screens); + void PrintDisplayGroups(const std::vector& displayGroups); + void PrintDisplaysInfo(const std::vector& displaysInfo); + int32_t SendDisplayInfo(const UserScreenInfo &userScreenInfo); int32_t SendWindowInfo(); void SendWindowAreaInfo(WindowArea area, int32_t pid, int32_t windowId); bool IsValiadWindowAreas(const std::vector &windows); @@ -312,7 +317,7 @@ private: std::shared_ptr lastPointerEvent_ { nullptr }; std::function windowStatecallback_; bool knuckleSwitch_ { true }; - std::vector displayGroupInfoArray_; + UserScreenInfo userScreenInfo_; #ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT uint8_t* enhanceCfg_ = nullptr; uint32_t enhanceCfgLen_ = 0; diff --git a/frameworks/proxy/event_handler/include/multimodal_event_handler.h b/frameworks/proxy/event_handler/include/multimodal_event_handler.h index f51e0cd733..e4dd8d1d02 100644 --- a/frameworks/proxy/event_handler/include/multimodal_event_handler.h +++ b/frameworks/proxy/event_handler/include/multimodal_event_handler.h @@ -61,7 +61,7 @@ public: int32_t SubscribeLongPressEvent(int32_t subscribeId, const LongPressRequest &longPressRequest); int32_t UnsubscribeLongPressEvent(int32_t subscribeId); #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) - int32_t InjectPointerEvent(std::shared_ptr pointerEvent, bool isNativeInject); + int32_t InjectPointerEvent(std::shared_ptr pointerEvent, bool isNativeInject, int32_t useCoordinate); #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) int32_t InjectTouchPadEvent(std::shared_ptr pointerEvent, const TouchpadCDG &touchpadCDG, diff --git a/frameworks/proxy/event_handler/src/client_msg_handler.cpp b/frameworks/proxy/event_handler/src/client_msg_handler.cpp index 7ab487ea7d..3f88245658 100644 --- a/frameworks/proxy/event_handler/src/client_msg_handler.cpp +++ b/frameworks/proxy/event_handler/src/client_msg_handler.cpp @@ -233,11 +233,12 @@ int32_t ClientMsgHandler::OnPointerEvent(const UDSClient& client, NetPacket& pkt PointerEvent::PointerItem pointerItem {}; if (pointerEvent->GetPointerItem(pointerEvent->GetPointerId(), pointerItem)) { MMI_HILOGD("Report pointer event, No:%{public}d,PA:%{public}s,DX:%{private}d,DY:%{private}d" - ",DXP:%{private}f,DYP:%{private}f,WXP:%{private}f,WYP:%{private}f", + ",DXP:%{private}f,DYP:%{private}f,WXP:%{private}f,WYP:%{private}f,GX:%{private}f,GY:%{private}f", pointerEvent->GetId(), pointerEvent->DumpPointerAction(), pointerItem.GetDisplayX(), pointerItem.GetDisplayY(), pointerItem.GetDisplayXPos(), pointerItem.GetDisplayYPos(), - pointerItem.GetWindowXPos(), pointerItem.GetWindowYPos()); + pointerItem.GetWindowXPos(), pointerItem.GetWindowYPos(), + pointerItem.GetGlobalX(), pointerItem.GetGlobalY()); } InputMgrImpl.OnPointerEvent(pointerEvent); if (pointerEvent->GetSourceType() == PointerEvent::SOURCE_TYPE_JOYSTICK) { diff --git a/frameworks/proxy/event_handler/src/input_handler_manager.cpp b/frameworks/proxy/event_handler/src/input_handler_manager.cpp index c4b2ceba87..8fa9119a64 100644 --- a/frameworks/proxy/event_handler/src/input_handler_manager.cpp +++ b/frameworks/proxy/event_handler/src/input_handler_manager.cpp @@ -750,6 +750,8 @@ void InputHandlerManager::OnInputEvent(std::shared_ptr pointerEven GetConsumerInfos(pointerEvent, deviceTags, consumerInfos); for (auto iter = consumerInfos.begin(); iter != consumerInfos.end(); ++iter) { auto tempEvent = std::make_shared(*pointerEvent); + PointerEvent::PointerItem pointerItem; + tempEvent->GetPointerItem(tempEvent->GetPointerId(), pointerItem); if (std::next(iter) == consumerInfos.end()) { tempEvent->SetProcessedCallback(monitorCallbackConsume_); } else { diff --git a/frameworks/proxy/event_handler/src/input_manager_impl.cpp b/frameworks/proxy/event_handler/src/input_manager_impl.cpp index 83817aa67b..0767947cbc 100644 --- a/frameworks/proxy/event_handler/src/input_manager_impl.cpp +++ b/frameworks/proxy/event_handler/src/input_manager_impl.cpp @@ -134,56 +134,42 @@ int32_t InputManagerImpl::GetWindowPid(int32_t windowId) return MULTIMODAL_INPUT_CONNECT_MGR->GetWindowPid(windowId); } -int32_t InputManagerImpl::UpdateDisplayInfo(const DisplayGroupInfo &displayGroupInfo) +int32_t InputManagerImpl::UpdateDisplayInfo(const UserScreenInfo &userScreenInfo) { CALL_DEBUG_ENTER; if (!MMIEventHdl.InitClient()) { MMI_HILOGE("Failed to initialize MMI client"); return RET_ERR; } - { - std::lock_guard guard(mtx_); - if (displayGroupInfo.windowsInfo.size() < MAX_WINDOW_SIZE) { - windowGroupInfo_.windowsInfo.clear(); - } - displayGroupInfoArray_.clear(); - displayGroupInfoArray_.emplace_back(displayGroupInfo); + if (userScreenInfo.displayGroups.size() > MAX_DISPLAY_GROUP_SIZE || + userScreenInfo.screens.size() > MAX_SCREEN_SIZE) { + MMI_HILOGE("display groups size:%{public}zu, screen size:%{public}zu", + userScreenInfo.displayGroups.size(), userScreenInfo.screens.size()); + return RET_ERR; } - int32_t ret = SendDisplayInfo(displayGroupInfo); - if (ret != RET_OK) { - MMI_HILOGE("Failed to send display information to service"); - return ret; + size_t numDisplay = 0; + for (const auto &group : userScreenInfo.displayGroups) { + numDisplay += group.displaysInfo.size(); } - PrintDisplayInfo(displayGroupInfo); - return RET_OK; -} - -int32_t InputManagerImpl::UpdateDisplayInfo(const std::vector &displayGroupInfos) -{ - CALL_DEBUG_ENTER; - if (!MMIEventHdl.InitClient()) { - MMI_HILOGE("Failed to initialize MMI client"); + if (numDisplay > MAX_DISPLAY_SIZE) { + MMI_HILOGE("display size:%{public}zu", numDisplay); return RET_ERR; } { std::lock_guard guard(mtx_); - displayGroupInfoArray_.clear(); + userScreenInfo_ = userScreenInfo; auto cnt = 0; - for (auto &it : displayGroupInfos) { - displayGroupInfoArray_.emplace_back(it); + for (const auto &it : userScreenInfo.displayGroups) { cnt += it.windowsInfo.size(); } if (cnt < static_cast(MAX_WINDOW_SIZE)) { windowGroupInfo_.windowsInfo.clear(); } } - for (const auto &item : displayGroupInfos) { - int32_t ret = SendDisplayInfo(item); - if (ret != RET_OK) { - MMI_HILOGE("Failed to send display information to service"); - return ret; - } - PrintDisplayInfo(item); + int32_t ret = SendDisplayInfo(userScreenInfo); + if (ret != RET_OK) { + MMI_HILOGE("Failed to send user screen info, ret:%{public}d", ret); + return ret; } return RET_OK; } @@ -667,20 +653,23 @@ void InputManagerImpl::OnPointerEvent(std::shared_ptr pointerEvent } #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH -int32_t InputManagerImpl::PackDisplayData(NetPacket &pkt, const DisplayGroupInfo &displayGroupInfo) +int32_t InputManagerImpl::PackDisplayData(NetPacket &pkt, const UserScreenInfo &userScreenInfo) { CALL_DEBUG_ENTER; - pkt << displayGroupInfo.groupId << displayGroupInfo.isMainGroup << displayGroupInfo.width << displayGroupInfo.height - << displayGroupInfo.focusWindowId << displayGroupInfo.currentUserId; - if (pkt.ChkRWError()) { - MMI_HILOGE("Packet write logical data failed"); + pkt << userScreenInfo.userId; + if (PackScreensInfo(pkt, userScreenInfo.screens) != RET_OK) { + MMI_HILOGE("Packet write screens info failed"); return RET_ERR; } - if (PackWindowInfo(pkt, displayGroupInfo) != RET_OK) { - MMI_HILOGE("Packet write windows info failed"); + if (PackDisplayGroupsInfo(pkt, userScreenInfo.displayGroups) != RET_OK) { + MMI_HILOGE("Packet write display group failed"); return RET_ERR; } - return PackDisplayInfo(pkt, const_cast(displayGroupInfo)); + if (pkt.ChkRWError()) { + MMI_HILOGE("Pack display data failed"); + return RET_ERR; + } + return RET_OK; } int32_t InputManagerImpl::PackWindowGroupInfo(NetPacket &pkt) @@ -752,13 +741,71 @@ int32_t InputManagerImpl::PackUiExtentionWindowInfo(const std::vector& screens) __attribute__((no_sanitize("cfi"))) +{ + CALL_DEBUG_ENTER; + uint32_t num = static_cast(screens.size()); + pkt << num; + for (const auto &item : screens) { + pkt << item.id << item.uniqueId << item.screenType << item.width << item.height << item.physicalWidth + << item.physicalHeight << item.tpDirection << item.dpi << item.ppi << item.rotation; + } + if (pkt.ChkRWError()) { + MMI_HILOGE("Packet write screens data failed"); + return RET_ERR; + } + return RET_OK; +} + +int32_t InputManagerImpl::PackDisplayGroupsInfo(NetPacket &pkt, + const std::vector& displayGroups) __attribute__((no_sanitize("cfi"))) +{ + CALL_DEBUG_ENTER; + uint32_t num = static_cast(displayGroups.size()); + pkt << num; + for (const auto &item : displayGroups) { + pkt << item.id << item.name << item.type << item.mainDisplayId << item.focusWindowId; + if (PackDisplaysInfo(pkt, item.displaysInfo) != RET_OK + || PackWindowInfo(pkt, item.windowsInfo) != RET_OK) { + return RET_ERR; + } + } + if (pkt.ChkRWError()) { + MMI_HILOGE("Packet write display groups data failed"); + return RET_ERR; + } + return RET_OK; +} + +int32_t InputManagerImpl::PackDisplaysInfo(NetPacket &pkt, + const std::vector& displaysInfo) __attribute__((no_sanitize("cfi"))) +{ + CALL_DEBUG_ENTER; + uint32_t num = static_cast(displaysInfo.size()); + pkt << num; + for (const auto &item : displaysInfo) { + pkt << item.id << item.x << item.y << item.width << item.height + << item.dpi << item.name << item.direction << item.displayDirection + << item.displayMode << item.transform << item.scalePercent << item.expandHeight + << item.isCurrentOffScreenRendering << item.displaySourceMode << item.oneHandX + << item.oneHandY << item.screenArea << item.rsId << item.offsetX << item.offsetY + << item.pointerActiveWidth << item.pointerActiveHeight; + } + if (pkt.ChkRWError()) { + MMI_HILOGE("Packet write displays data failed"); + return RET_ERR; + } + return RET_OK; +} + int32_t InputManagerImpl::PackWindowInfo(NetPacket &pkt, - const DisplayGroupInfo &displayGroupInfo) __attribute__((no_sanitize("cfi"))) + const std::vector &windowsInfo) __attribute__((no_sanitize("cfi"))) { CALL_DEBUG_ENTER; - uint32_t num = static_cast(displayGroupInfo.windowsInfo.size()); + uint32_t num = static_cast(windowsInfo.size()); pkt << num; - for (const auto &item : displayGroupInfo.windowsInfo) { + for (const auto &item : windowsInfo) { int32_t byteCount = 0; pkt << item.id << item.pid << item.uid << item.area << item.defaultHotAreas << item.pointerHotAreas << item.agentWindowId << item.flags << item.action @@ -842,47 +889,6 @@ bool InputManagerImpl::IsGRLOrHopper() return false; } -int32_t InputManagerImpl::PackDisplayInfo(NetPacket &pkt, DisplayGroupInfo &displayGroupInfo) -{ - CALL_DEBUG_ENTER; - uint32_t num = static_cast(displayGroupInfo.displaysInfo.size()); - pkt << num; - int32_t hprId = 999; - for (auto &item : displayGroupInfo.displaysInfo) { - if (!IsGRLOrHopper() || !(item.id == 0 || item.id == hprId) || item.validWidth == 0 || item.validHeight == 0) { - int32_t validW = item.validWidth; - int32_t validH = item.validHeight; - item.validWidth = item.width; - item.validHeight = item.height; - MMI_HILOGD("id:%{private}d not grl or hopper, " - "change validWH:{%{private}d %{private}d}->{%{private}d %{private}d}", - item.id, - validW, - validH, - item.validWidth, - item.validHeight); - } - pkt << item.id << item.x << item.y << item.width - << item.height << item.dpi << item.name << item.uniq << item.direction - << item.displayDirection << item.displayMode << item.transform << item.ppi << item.offsetX - << item.offsetY << item.isCurrentOffScreenRendering << item.screenRealWidth - << item.screenRealHeight << item.screenRealPPI << item.screenRealDPI << item.screenCombination - << item.validWidth << item.validHeight << item.fixedDirection - << item.physicalWidth << item.physicalHeight << item.scalePercent << item.expandHeight << item.uniqueId; -#ifdef OHOS_BUILD_ENABLE_ONE_HAND_MODE - pkt << item.oneHandX << item.oneHandY; -#endif -#ifdef OHOS_BUILD_ENABLE_VKEYBOARD - pkt << item.pointerActiveWidth << item.pointerActiveHeight; -#endif // OHOS_BUILD_ENABLE_VKEYBOARD - } - if (pkt.ChkRWError()) { - MMI_HILOGE("Packet write display data failed"); - return RET_ERR; - } - return RET_OK; -} - void InputManagerImpl::PrintWindowInfo(const std::vector &windowsInfo) { if (!HiLogIsLoggable(MMI_LOG_DOMAIN, MMI_LOG_TAG, LOG_DEBUG)) { @@ -924,65 +930,61 @@ void InputManagerImpl::PrintWindowInfo(const std::vector &windowsInf } } -void InputManagerImpl::PrintForemostThreeWindowInfo(const std::vector &windowsInfo) +void InputManagerImpl::PrintDisplayInfo(const UserScreenInfo &userScreenInfo) { - uint8_t times = 0; - for (const auto &item : windowsInfo) { - if (times > LOOP_COND) { - return; - } - MMI_HILOGD("WindowInfo[%{public}d,%{public}d,%{public}d,%{public}d,%{public}d,%{public}d,%{public}f]", - item.id, item.pid, item.area.x, item.area.y, item.area.width, item.area.height, item.zOrder); - for (const auto &pointer : item.pointerHotAreas) { - MMI_HILOGD("pointerHotAreas:x:%{public}d,y:%{public}d,width:%{public}d,height:%{public}d", - pointer.x, pointer.y, pointer.width, pointer.height); - } - times++; + if (!HiLogIsLoggable(MMI_LOG_DOMAIN, MMI_LOG_TAG, LOG_DEBUG)) { + return; } + MMI_HILOGD("userId:%{private}d", userScreenInfo.userId); + PrintScreens(userScreenInfo.screens); + PrintDisplayGroups(userScreenInfo.displayGroups); } -void InputManagerImpl::PrintDisplayInfo(const DisplayGroupInfo &displayGroupInfo) +void InputManagerImpl::PrintScreens(const std::vector& screens) { - MMI_HILOGD("displayGroupId:%{public}d,windowsInfos,num:%{public}zu,focusWindowId:%{public}d", - displayGroupInfo.groupId, displayGroupInfo.windowsInfo.size(), - displayGroupInfo.focusWindowId); - PrintForemostThreeWindowInfo(displayGroupInfo.windowsInfo); - if (!HiLogIsLoggable(MMI_LOG_DOMAIN, MMI_LOG_TAG, LOG_DEBUG)) { - return; + MMI_HILOGD("screens size:%{public}zu", screens.size()); + int32_t i = 0; + for (const auto &item : screens) { + MMI_HILOGD("screen %{public}d: id:%{public}d, uniqueId:%{public}s, screenType:%{public}d,width:%{private}d," + "height:%{private}d, physicalWidth:%{private}d, physicalHeight:%{private}d,tpDirection:%{public}d" + "dpi:%{public}d, ppi:%{public}d", + i, item.id, item.uniqueId.c_str(), item.screenType, item.width, item.height, item.physicalWidth, + item.physicalHeight, item.tpDirection, item.dpi, item.ppi); + i++; } - MMI_HILOGD("logicalInfo,width:%{public}d,height:%{public}d,focusWindowId:%{public}d", - displayGroupInfo.width, displayGroupInfo.height, displayGroupInfo.focusWindowId); - PrintWindowInfo(displayGroupInfo.windowsInfo); - - MMI_HILOGD("displayInfos,num:%{public}zu", displayGroupInfo.displaysInfo.size()); - for (const auto &item : displayGroupInfo.displaysInfo) { - MMI_HILOGD("displayInfos,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," - "displayMode:%{public}d,oneHandX:%{private}d,oneHandY:%{private}d,scalePercent:%{public}d," - "expandHeight:%{public}d,validWH:{%{private}d %{private}d},fixedDirection:%{public}d," - "physicalWH:{%{private}d %{private}d},pActiveWH:{%{private}d %{private}d}", - item.id, - item.x, - item.y, - item.width, - item.height, - item.dpi, - item.name.c_str(), - item.uniq.c_str(), - item.direction, - item.displayDirection, - item.displayMode, - item.oneHandX, - item.oneHandY, - item.scalePercent, - item.expandHeight, - item.validWidth, - item.validHeight, - item.fixedDirection, - item.physicalWidth, - item.physicalHeight, - item.pointerActiveWidth, - item.pointerActiveHeight); +} + +void InputManagerImpl::PrintDisplayGroups(const std::vector& displayGroups) +{ + MMI_HILOGD("displayGroups size:%{public}zu", displayGroups.size()); + int32_t i = 0; + for (const auto &item : displayGroups) { + MMI_HILOGD("displayGroups %{public}d: id:%{public}d, name:%{public}s, type:%{public}d," + "mainDisplayId:%{public}d, focusWindowId:%{public}d", + i, item.id, item.name.c_str(), item.type, item.mainDisplayId, item.focusWindowId); + PrintDisplaysInfo(item.displaysInfo); + PrintWindowInfo(item.windowsInfo); + i++; + } +} + +void InputManagerImpl::PrintDisplaysInfo(const std::vector& displaysInfo) +{ + MMI_HILOGD("displaysInfo size:%{public}zu", displaysInfo.size()); + int32_t i = 0; + for (const auto &item : displaysInfo) { + MMI_HILOGD("displayInfos %{public}d,id:%{public}d,x:%{private}d,y:%{private}d,width:%{public}d," + "height:%{public}d,dpi:%{public}d,name:%{public}s,direction:%{public}d,displayDirection:%{public}d," + "displayMode:%{public}d,oneHandX:%{private}d,oneHandY:%{private}d,scalePercent:%{public}d," + "expandHeight:%{public}d,isCurrentOffScreenRendering:%{public}d,displaySourceMode:%{public}d" + "screenArea{id:%{public}d, x:%{private}d, y:%{private}d, width:%{private}d, height:%{private}d}," + "rsId:%{public}d", + i, item.id, item.x, item.y, item.width, item.height, item.dpi, item.name.c_str(), item.direction, + item.displayDirection, item.displayMode, item.oneHandX, item.oneHandY, item.scalePercent, + item.expandHeight, item.isCurrentOffScreenRendering, item.displaySourceMode, item.screenArea.id, + item.screenArea.area.x, item.screenArea.area.y, item.screenArea.area.width, item.screenArea.area.height, + item.rsId); + i++; } } @@ -1235,7 +1237,8 @@ void InputManagerImpl::HandleSimulateInputEvent(std::shared_ptr po } } -int32_t InputManagerImpl::SimulateInputEvent(std::shared_ptr pointerEvent, bool isNativeInject) +int32_t InputManagerImpl::SimulateInputEvent(std::shared_ptr pointerEvent, bool isNativeInject, + int32_t useCoordinate) { CALL_DEBUG_ENTER; #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) @@ -1249,6 +1252,7 @@ int32_t InputManagerImpl::SimulateInputEvent(std::shared_ptr point pointerEvent->GetPointerAction() != PointerEvent::POINTER_ACTION_FINGERPRINT_SLIDE) { MMI_HILOGI("Pointer event action:%{public}d", pointerEvent->GetPointerAction()); } + if (pointerEvent->GetSourceType() == PointerEvent::SOURCE_TYPE_MOUSE || pointerEvent->GetSourceType() == PointerEvent::SOURCE_TYPE_TOUCHPAD) { #ifndef OHOS_BUILD_ENABLE_POINTER @@ -1269,7 +1273,7 @@ int32_t InputManagerImpl::SimulateInputEvent(std::shared_ptr point } #endif // OHOS_BUILD_ENABLE_JOYSTICK HandleSimulateInputEvent(pointerEvent); - if (MMIEventHdl.InjectPointerEvent(pointerEvent, isNativeInject) != RET_OK) { + if (MMIEventHdl.InjectPointerEvent(pointerEvent, isNativeInject, useCoordinate) != RET_OK) { MMI_HILOGE("Failed to inject pointer event"); return INPUT_PERMISSION_DENIED; } @@ -1285,7 +1289,7 @@ void InputManagerImpl::SimulateTouchPadEvent(std::shared_ptr point CHKPV(pointerEvent); if (pointerEvent->GetSourceType() == PointerEvent::SOURCE_TYPE_MOUSE || pointerEvent->GetSourceType() == PointerEvent::SOURCE_TYPE_TOUCHPAD) { - if (MMIEventHdl.InjectPointerEvent(pointerEvent, false) != RET_OK) { + if (MMIEventHdl.InjectPointerEvent(pointerEvent, false, PointerEvent::DISPLAY_COORDINATE) != RET_OK) { MMI_HILOGE("Failed to inject pointer event to touchPad"); } } @@ -1630,14 +1634,7 @@ void InputManagerImpl::OnConnected() ReAddInputEventFilter(); { std::lock_guard guard(mtx_); - for (auto &iter : displayGroupInfoArray_) { - if (!iter.windowsInfo.empty() && !iter.displaysInfo.empty()) { - MMI_HILOGD("displayGroupInfo: windowsInfo size:%{public}zu, displaysInfo size:%{public}zu", - iter.windowsInfo.size(), iter.displaysInfo.size()); - SendDisplayInfo(iter); - PrintDisplayInfo(iter); - } - } + SendDisplayInfo(userScreenInfo_); if (!windowGroupInfo_.windowsInfo.empty()) { MMI_HILOGD("windowGroupInfo_: windowsInfo size:%{public}zu", windowGroupInfo_.windowsInfo.size()); SendWindowInfo(); @@ -1737,13 +1734,13 @@ void InputManagerImpl::OnDisconnected() #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH } -int32_t InputManagerImpl::SendDisplayInfo(const DisplayGroupInfo &displayGroupInfo) +int32_t InputManagerImpl::SendDisplayInfo(const UserScreenInfo &userScreenInfo) { CALL_DEBUG_ENTER; MMIClientPtr client = MMIEventHdl.GetMMIClient(); CHKPR(client, RET_ERR); NetPacket pkt(MmiMessageId::DISPLAY_INFO); - int32_t ret = PackDisplayData(pkt, displayGroupInfo); + int32_t ret = PackDisplayData(pkt, userScreenInfo); if (ret != RET_OK) { MMI_HILOGE("Pack display info failed"); return ret; @@ -2948,4 +2945,4 @@ int32_t InputManagerImpl::QueryPointerRecord(int32_t count, std::vectorQueryPointerRecord(count, pointerList); } } // namespace MMI -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/frameworks/proxy/event_handler/src/multimodal_event_handler.cpp b/frameworks/proxy/event_handler/src/multimodal_event_handler.cpp index b0cb5c1067..1cf32364e3 100644 --- a/frameworks/proxy/event_handler/src/multimodal_event_handler.cpp +++ b/frameworks/proxy/event_handler/src/multimodal_event_handler.cpp @@ -224,11 +224,12 @@ MMIClientPtr MultimodalEventHandler::GetMMIClient() } #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) -int32_t MultimodalEventHandler::InjectPointerEvent(std::shared_ptr pointerEvent, bool isNativeInject) +int32_t MultimodalEventHandler::InjectPointerEvent(std::shared_ptr pointerEvent, bool isNativeInject, + int32_t useCoordinate) { CHKPR(pointerEvent, ERROR_NULL_POINTER); CHKPR(MULTIMODAL_INPUT_CONNECT_MGR, RET_ERR); - int32_t ret = MULTIMODAL_INPUT_CONNECT_MGR->InjectPointerEvent(pointerEvent, isNativeInject); + int32_t ret = MULTIMODAL_INPUT_CONNECT_MGR->InjectPointerEvent(pointerEvent, isNativeInject, useCoordinate); if (ret != 0) { MMI_HILOGE("Send to server failed, ret:%{public}d", ret); return RET_ERR; diff --git a/frameworks/proxy/event_handler/test/input_manager_impl_test.cpp b/frameworks/proxy/event_handler/test/input_manager_impl_test.cpp index 1c79b4acf0..7f46167a1d 100644 --- a/frameworks/proxy/event_handler/test/input_manager_impl_test.cpp +++ b/frameworks/proxy/event_handler/test/input_manager_impl_test.cpp @@ -411,9 +411,9 @@ HWTEST_F(InputManagerImplTest, InputManagerImplTest_OnConnected_01, TestSize.Lev { CALL_TEST_DEBUG; DisplayGroupInfo displayGroupInfo {}; - InputMgrImpl.displayGroupInfoArray_.push_back(displayGroupInfo); - EXPECT_TRUE(InputMgrImpl.displayGroupInfoArray_[DEFAULT_GROUP_ID].windowsInfo.empty()); - EXPECT_TRUE(InputMgrImpl.displayGroupInfoArray_[DEFAULT_GROUP_ID].displaysInfo.empty()); + InputMgrImpl.userScreenInfo_.displayGroups.push_back(displayGroupInfo); + EXPECT_TRUE(InputMgrImpl.userScreenInfo_.displayGroups[DEFAULT_GROUP_ID].windowsInfo.empty()); + EXPECT_TRUE(InputMgrImpl.userScreenInfo_.displayGroups[DEFAULT_GROUP_ID].displaysInfo.empty()); ASSERT_NO_FATAL_FAILURE(InputMgrImpl.OnConnected()); } @@ -427,20 +427,20 @@ HWTEST_F(InputManagerImplTest, InputManagerImplTest_OnConnected_02, TestSize.Lev { CALL_TEST_DEBUG; DisplayGroupInfo displayGroupInfo {}; - InputMgrImpl.displayGroupInfoArray_.push_back(displayGroupInfo); - InputMgrImpl.displayGroupInfoArray_[DEFAULT_GROUP_ID].width = 50; - InputMgrImpl.displayGroupInfoArray_[DEFAULT_GROUP_ID].height = 60; + InputMgrImpl.userScreenInfo_.displayGroups.push_back(displayGroupInfo); + DisplayInfo displayInfo; + displayInfo.width = 50; + displayInfo.height = 60; + InputMgrImpl.userScreenInfo_.displayGroups[DEFAULT_GROUP_ID].displaysInfo.push_back(displayInfo); WindowInfo windowInfo; windowInfo.id = 1; windowInfo.pid = 2; - InputMgrImpl.displayGroupInfoArray_[DEFAULT_GROUP_ID].windowsInfo.push_back(windowInfo); - EXPECT_FALSE(InputMgrImpl.displayGroupInfoArray_[DEFAULT_GROUP_ID].windowsInfo.empty()); - - DisplayInfo displayInfo; + InputMgrImpl.userScreenInfo_.displayGroups[DEFAULT_GROUP_ID].windowsInfo.push_back(windowInfo); + EXPECT_FALSE(InputMgrImpl.userScreenInfo_.displayGroups[DEFAULT_GROUP_ID].windowsInfo.empty()); displayInfo.width = 10; displayInfo.height = 20; - InputMgrImpl.displayGroupInfoArray_[DEFAULT_GROUP_ID].displaysInfo.push_back(displayInfo); - EXPECT_FALSE(InputMgrImpl.displayGroupInfoArray_[DEFAULT_GROUP_ID].displaysInfo.empty()); + InputMgrImpl.userScreenInfo_.displayGroups[DEFAULT_GROUP_ID].displaysInfo.push_back(displayInfo); + EXPECT_FALSE(InputMgrImpl.userScreenInfo_.displayGroups[DEFAULT_GROUP_ID].displaysInfo.empty()); EXPECT_TRUE(InputMgrImpl.anrObservers_.empty()); ASSERT_NO_FATAL_FAILURE(InputMgrImpl.OnConnected()); @@ -459,9 +459,9 @@ HWTEST_F(InputManagerImplTest, InputManagerImplTest_OnConnected_03, TestSize.Lev displayInfo.width = 10; displayInfo.height = 20; DisplayGroupInfo displayGroupInfo {}; - InputMgrImpl.displayGroupInfoArray_.push_back(displayGroupInfo); - InputMgrImpl.displayGroupInfoArray_[DEFAULT_GROUP_ID].displaysInfo.push_back(displayInfo); - EXPECT_FALSE(InputMgrImpl.displayGroupInfoArray_[DEFAULT_GROUP_ID].displaysInfo.empty()); + InputMgrImpl.userScreenInfo_.displayGroups.push_back(displayGroupInfo); + InputMgrImpl.userScreenInfo_.displayGroups[DEFAULT_GROUP_ID].displaysInfo.push_back(displayInfo); + EXPECT_FALSE(InputMgrImpl.userScreenInfo_.displayGroups[DEFAULT_GROUP_ID].displaysInfo.empty()); ASSERT_NO_FATAL_FAILURE(InputMgrImpl.OnConnected()); } @@ -475,14 +475,16 @@ HWTEST_F(InputManagerImplTest, InputManagerImplTest_OnConnected_04, TestSize.Lev { CALL_TEST_DEBUG; DisplayGroupInfo displayGroupInfo {}; - InputMgrImpl.displayGroupInfoArray_.push_back(displayGroupInfo); - InputMgrImpl.displayGroupInfoArray_[DEFAULT_GROUP_ID].width = 50; - InputMgrImpl.displayGroupInfoArray_[DEFAULT_GROUP_ID].height = 60; + InputMgrImpl.userScreenInfo_.displayGroups.push_back(displayGroupInfo); + DisplayInfo displayInfo; + displayInfo.width = 50; + displayInfo.height = 60; + InputMgrImpl.userScreenInfo_.displayGroups[DEFAULT_GROUP_ID].displaysInfo.push_back(displayInfo); WindowInfo windowInfo; windowInfo.id = 1; windowInfo.pid = 2; - InputMgrImpl.displayGroupInfoArray_[DEFAULT_GROUP_ID].windowsInfo.push_back(windowInfo); - EXPECT_FALSE(InputMgrImpl.displayGroupInfoArray_[DEFAULT_GROUP_ID].windowsInfo.empty()); + InputMgrImpl.userScreenInfo_.displayGroups[DEFAULT_GROUP_ID].windowsInfo.push_back(windowInfo); + EXPECT_FALSE(InputMgrImpl.userScreenInfo_.displayGroups[DEFAULT_GROUP_ID].windowsInfo.empty()); ASSERT_NO_FATAL_FAILURE(InputMgrImpl.OnConnected()); } @@ -738,24 +740,6 @@ HWTEST_F(InputManagerImplTest, InputManagerImplTest_UnsubscribeLongPressEvent, T ASSERT_NO_FATAL_FAILURE(InputMgrImpl.UnsubscribeLongPressEvent(subscriberId)); } -/** - * @tc.name : PrintForemostThreeWindowInfo_WhenMoreThanThreeWindowsExist - * @tc.desc : Test PrintForemostThreeWindowInfo method when there are more than three windows - * @tc.type: FUNC - * @tc.require: - */ -HWTEST_F(InputManagerImplTest, PrintForemostThreeWindowInfo_WhenMoreThanThreeWindowsExist, TestSize.Level1) -{ - CALL_TEST_DEBUG; - std::vector windowsInfo; - for (int i = 0; i < 5; i++) { - WindowInfo windowInfo; - windowInfo.action = WINDOW_UPDATE_ACTION::UNKNOWN; - windowsInfo.push_back(windowInfo); - } - InputMgrImpl.PrintForemostThreeWindowInfo(windowsInfo); -} - /** * @tc.name : ConvertToCapiKeyAction_ShouldReturnInvalidValue_WhenKeyActionIsInvalid * @tc.desc : Test ConvertToCapiKeyAction function when keyAction is invalid. diff --git a/frameworks/proxy/events/src/input_manager.cpp b/frameworks/proxy/events/src/input_manager.cpp index 1b27751f67..f63b926520 100644 --- a/frameworks/proxy/events/src/input_manager.cpp +++ b/frameworks/proxy/events/src/input_manager.cpp @@ -65,14 +65,9 @@ int32_t InputManager::GetWindowPid(int32_t windowId) return InputMgrImpl.GetWindowPid(windowId); } -int32_t InputManager::UpdateDisplayInfo(const DisplayGroupInfo &displayGroupInfo) +int32_t InputManager::UpdateDisplayInfo(const UserScreenInfo &userScreenInfo) { - return InputMgrImpl.UpdateDisplayInfo(displayGroupInfo); -} - -int32_t InputManager::UpdateDisplayInfo(const std::vector &displayGroupInfo) -{ - return InputMgrImpl.UpdateDisplayInfo(displayGroupInfo); + return InputMgrImpl.UpdateDisplayInfo(userScreenInfo); } int32_t InputManager::UpdateWindowInfo(const WindowGroupInfo &windowGroupInfo) @@ -271,7 +266,8 @@ void InputManager::SimulateInputEvent(std::shared_ptr keyEvent) InputMgrImpl.SimulateInputEvent(keyEvent); } -void InputManager::SimulateInputEvent(std::shared_ptr pointerEvent, bool isAutoToVirtualScreen) +void InputManager::SimulateInputEvent(std::shared_ptr pointerEvent, bool isAutoToVirtualScreen, + int32_t useCoordinate) { LogTracer lt(pointerEvent->GetId(), pointerEvent->GetEventType(), pointerEvent->GetPointerAction()); pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE); @@ -287,11 +283,11 @@ void InputManager::SimulateInputEvent(std::shared_ptr pointerEvent } else { MMI_HILOGD("isAutoToVirtualScreen=%{public}s", isAutoToVirtualScreen ? "true" : "false"); } - InputMgrImpl.SimulateInputEvent(pointerEvent); + InputMgrImpl.SimulateInputEvent(pointerEvent, useCoordinate); } void InputManager::SimulateInputEvent(std::shared_ptr pointerEvent, float zOrder, - bool isAutoToVirtualScreen) + bool isAutoToVirtualScreen, int32_t useCoordinate) { CHKPV(pointerEvent); LogTracer lt(pointerEvent->GetId(), pointerEvent->GetEventType(), pointerEvent->GetPointerAction()); @@ -310,7 +306,7 @@ void InputManager::SimulateInputEvent(std::shared_ptr pointerEvent MMI_HILOGD("zOrder=%{public}f, isAutoToVirtualScreen=%{public}s", zOrder, isAutoToVirtualScreen ? "true" : "false"); } - InputMgrImpl.SimulateInputEvent(pointerEvent); + InputMgrImpl.SimulateInputEvent(pointerEvent, useCoordinate); } void InputManager::SimulateTouchPadInputEvent(std::shared_ptr pointerEvent, diff --git a/frameworks/proxy/events/src/pointer_event.cpp b/frameworks/proxy/events/src/pointer_event.cpp index 416130147a..3763affe66 100644 --- a/frameworks/proxy/events/src/pointer_event.cpp +++ b/frameworks/proxy/events/src/pointer_event.cpp @@ -274,6 +274,12 @@ double PointerEvent::PointerItem::GetGlobalY() const return globalY_; } +bool PointerEvent::PointerItem::IsValidGlobalXY() const +{ + return globalX_ > DBL_MIN && globalX_ < DBL_MAX && + globalY_ > DBL_MIN && globalY_ < DBL_MAX; +} + int32_t PointerEvent::PointerItem::GetToolWidth() const { return toolWidth_; diff --git a/frameworks/proxy/events/test/input_manager_test.cpp b/frameworks/proxy/events/test/input_manager_test.cpp index 54351086bb..b587d9569f 100644 --- a/frameworks/proxy/events/test/input_manager_test.cpp +++ b/frameworks/proxy/events/test/input_manager_test.cpp @@ -1376,10 +1376,12 @@ HWTEST_F(InputManagerTest, InputManagerTest_UpdateDisplayInfo, TestSize.Level1) CALL_TEST_DEBUG; DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 0; - displayGroupInfo.width = 0; - displayGroupInfo.height = 0; - InputManager::GetInstance()->UpdateDisplayInfo(displayGroupInfo); - ASSERT_TRUE(displayGroupInfo.displaysInfo.empty()); + UserScreenInfo userScreenInfo; + userScreenInfo.displayGroups.push_back(displayGroupInfo); + InputManager::GetInstance()->UpdateDisplayInfo(userScreenInfo); + if (!userScreenInfo.displayGroups.empty()) { + ASSERT_TRUE(userScreenInfo.displayGroups[0].displaysInfo.empty()); + } } /** @@ -1393,8 +1395,8 @@ HWTEST_F(InputManagerTest, InputManagerTest_UpdateDisplayInfo001, TestSize.Level CALL_TEST_DEBUG; DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 1; - displayGroupInfo.width = 1000; - displayGroupInfo.height = 2000; + int32_t dgw = 1000; + int32_t dgh = 2000; DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.x =1; @@ -1403,7 +1405,6 @@ HWTEST_F(InputManagerTest, InputManagerTest_UpdateDisplayInfo001, TestSize.Level displayInfo.height = 2; displayInfo.dpi = 240; displayInfo.name = "pp"; - displayInfo.uniq = "pp"; displayInfo.direction = DIRECTION0; displayGroupInfo.displaysInfo.push_back(displayInfo); WindowInfo info; @@ -1419,7 +1420,26 @@ HWTEST_F(InputManagerTest, InputManagerTest_UpdateDisplayInfo001, TestSize.Level info.flags = 0; info.displayId = 0; displayGroupInfo.windowsInfo.push_back(info); - ASSERT_NO_FATAL_FAILURE(InputManager::GetInstance()->UpdateDisplayInfo(displayGroupInfo)); + + std::vector screenInfos; + ScreenInfo screenInfo; + screenInfo.screenType =(ScreenType)info.windowType; + screenInfo.dpi = displayInfo.dpi; + screenInfo.height = displayInfo.height; + screenInfo.width = displayInfo.width; + screenInfo.physicalWidth = dgw; + screenInfo.physicalHeight = dgh; + screenInfo.id =info.id; + screenInfo.rotation = Rotation::ROTATION_0; + screenInfo.tpDirection = Direction::DIRECTION0; + screenInfo.uniqueId = displayInfo.name; + screenInfos.push_back(screenInfo); + + UserScreenInfo userScreenInfo; + userScreenInfo.displayGroups.push_back(displayGroupInfo); + userScreenInfo.screens = screenInfos; + InputManager::GetInstance()->UpdateDisplayInfo(userScreenInfo); + ASSERT_NO_FATAL_FAILURE(InputManager::GetInstance()->UpdateDisplayInfo(userScreenInfo)); } /** @@ -1433,8 +1453,8 @@ HWTEST_F(InputManagerTest, InputManagerTest_UpdateDisplayInfo002, TestSize.Level CALL_TEST_DEBUG; DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 0; - displayGroupInfo.width = 1000; - displayGroupInfo.height = 2000; + int32_t dgw = 1000; + int32_t dgh = 2000; DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.x =1; @@ -1443,10 +1463,10 @@ HWTEST_F(InputManagerTest, InputManagerTest_UpdateDisplayInfo002, TestSize.Level displayInfo.height = 2; displayInfo.dpi = 240; displayInfo.name = "pp"; - displayInfo.uniq = "pp"; displayInfo.direction = DIRECTION0; displayInfo.displayMode = DisplayMode::FULL; displayGroupInfo.displaysInfo.push_back(displayInfo); + std::vector screenInfos; for (uint32_t i = 0; i < MAX_WINDOW_NUMS; i++) { WindowInfo info; info.id = i + 1; @@ -1462,8 +1482,24 @@ HWTEST_F(InputManagerTest, InputManagerTest_UpdateDisplayInfo002, TestSize.Level info.displayId = 0; info.zOrder = static_cast(MAX_WINDOW_NUMS - i); displayGroupInfo.windowsInfo.push_back(info); + ScreenInfo screenInfo; + screenInfo.screenType =(ScreenType)info.windowType; + screenInfo.dpi = displayInfo.dpi; + screenInfo.height = displayInfo.height; + screenInfo.width = displayInfo.width; + screenInfo.physicalWidth = dgw; + screenInfo.physicalHeight = dgh; + screenInfo.id =info.id; + screenInfo.rotation = Rotation::ROTATION_0; + screenInfo.tpDirection = Direction::DIRECTION0; + screenInfo.uniqueId = displayInfo.name; + screenInfos.push_back(screenInfo); } - ASSERT_NO_FATAL_FAILURE(InputManager::GetInstance()->UpdateDisplayInfo(displayGroupInfo)); + UserScreenInfo userScreenInfo; + userScreenInfo.displayGroups.push_back(displayGroupInfo); + userScreenInfo.screens = screenInfos; + InputManager::GetInstance()->UpdateDisplayInfo(userScreenInfo); + ASSERT_NO_FATAL_FAILURE(InputManager::GetInstance()->UpdateDisplayInfo(userScreenInfo)); } /** @@ -1477,9 +1513,10 @@ HWTEST_F(InputManagerTest, InputManagerTest_UpdateDisplayInfo003, TestSize.Level CALL_TEST_DEBUG; DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 1; - displayGroupInfo.width = 1000; - displayGroupInfo.height = 2000; + int32_t dgw = 1000; + int32_t dgh = 2000; DisplayInfo displayInfo; + std::vector screenInfos; for (uint32_t i = 0; i < 2; i++) { // one is default-display and another is simulate display displayInfo.id = i; displayInfo.x =1; @@ -1488,7 +1525,6 @@ HWTEST_F(InputManagerTest, InputManagerTest_UpdateDisplayInfo003, TestSize.Level displayInfo.height = 2; displayInfo.dpi = 240; displayInfo.name = "pp"; - displayInfo.uniq = "pp"; displayInfo.direction = DIRECTION0; displayGroupInfo.displaysInfo.push_back(displayInfo); } @@ -1502,8 +1538,25 @@ HWTEST_F(InputManagerTest, InputManagerTest_UpdateDisplayInfo003, TestSize.Level info.flags = 0; info.displayId = i; displayGroupInfo.windowsInfo.push_back(info); + + displayInfo = displayGroupInfo.displaysInfo[i]; + ScreenInfo screenInfo; + screenInfo.screenType =(ScreenType)info.windowType; + screenInfo.dpi = displayInfo.dpi; + screenInfo.height = displayInfo.height; + screenInfo.width = displayInfo.width; + screenInfo.physicalWidth = dgw; + screenInfo.physicalHeight = dgh; + screenInfo.id =info.id; + screenInfo.rotation = Rotation::ROTATION_0; + screenInfo.tpDirection = Direction::DIRECTION0; + screenInfo.uniqueId = displayInfo.name; + screenInfos.push_back(screenInfo); } - ASSERT_NO_FATAL_FAILURE(InputManager::GetInstance()->UpdateDisplayInfo(displayGroupInfo)); + UserScreenInfo userScreenInfo; + userScreenInfo.displayGroups.push_back(displayGroupInfo); + userScreenInfo.screens = screenInfos; + ASSERT_NO_FATAL_FAILURE(InputManager::GetInstance()->UpdateDisplayInfo(userScreenInfo)); } /** diff --git a/frameworks/proxy/events/test/input_manager_update_display_info_test.cpp b/frameworks/proxy/events/test/input_manager_update_display_info_test.cpp index 1d49b1fa17..fc94805f46 100644 --- a/frameworks/proxy/events/test/input_manager_update_display_info_test.cpp +++ b/frameworks/proxy/events/test/input_manager_update_display_info_test.cpp @@ -137,7 +137,6 @@ DisplayInfo InputManagerUpdateDisplayInfoTest::CreateDisplayInfo(int32_t id) con displayinfo.height = DISPLAYINFO_HEIGHT; displayinfo.dpi = DISPLAYINFO_DPI; displayinfo.name = "pp"; - displayinfo.uniq = "pp"; displayinfo.direction = DIRECTION0; return displayinfo; } @@ -157,8 +156,8 @@ HWTEST_F(InputManagerUpdateDisplayInfoTest, InputManagerTest_UpdateDisplayInfoSh ASSERT_NE(pixelMap, nullptr); DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 1; - displayGroupInfo.width = 1000; - displayGroupInfo.height = 2000; + int32_t dgw = 1000; + int32_t dgh = 2000; DisplayInfo displayinfo = CreateDisplayInfo(0); displayGroupInfo.displaysInfo.push_back(displayinfo); WindowInfo info; @@ -176,7 +175,22 @@ HWTEST_F(InputManagerUpdateDisplayInfoTest, InputManagerTest_UpdateDisplayInfoSh info.displayId = 0; info.pixelMap = pixelMap.get(); displayGroupInfo.windowsInfo.push_back(info); - ASSERT_NO_FATAL_FAILURE(InputManager::GetInstance()->UpdateDisplayInfo(displayGroupInfo)); + + UserScreenInfo userScreenInfo; + ScreenInfo screenInfo; + screenInfo.screenType =(ScreenType)info.windowType; + screenInfo.dpi = displayinfo.dpi; + screenInfo.height = info.area.height; + screenInfo.width = info.area.width; + screenInfo.physicalWidth = dgw; + screenInfo.physicalHeight = dgh; + screenInfo.id = displayinfo.id; + screenInfo.rotation = Rotation::ROTATION_0; + screenInfo.tpDirection = Direction::DIRECTION0; + screenInfo.uniqueId = displayinfo.name; + userScreenInfo.screens.push_back(screenInfo); + userScreenInfo.displayGroups.push_back(displayGroupInfo); + ASSERT_NO_FATAL_FAILURE(InputManager::GetInstance()->UpdateDisplayInfo(userScreenInfo)); } /** @@ -198,8 +212,8 @@ HWTEST_F(InputManagerUpdateDisplayInfoTest, InputManagerTest_UpdateDisplayInfoSh ASSERT_NE(pixelMap, nullptr); DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 1; - displayGroupInfo.width = 1000; - displayGroupInfo.height = 2000; + int32_t dgw = 1000; + int32_t dgh = 2000; DisplayInfo displayinfo = CreateDisplayInfo(0); displayGroupInfo.displaysInfo.push_back(displayinfo); WindowInfo info; @@ -219,7 +233,23 @@ HWTEST_F(InputManagerUpdateDisplayInfoTest, InputManagerTest_UpdateDisplayInfoSh int32_t displayX = width / 2; int32_t displayY = height / 2; CheckMaskDisplayPoint(pixelMap.get(), displayX, displayY); - ASSERT_NO_FATAL_FAILURE(InputManager::GetInstance()->UpdateDisplayInfo(displayGroupInfo)); + + UserScreenInfo userScreenInfo; + ScreenInfo screenInfo; + screenInfo.screenType =(ScreenType)info.windowType; + screenInfo.dpi = displayinfo.dpi; + screenInfo.height = info.area.height; + screenInfo.width = info.area.width; + screenInfo.physicalWidth = dgw; + screenInfo.physicalHeight = dgh; + screenInfo.id = displayinfo.id; + screenInfo.rotation = Rotation::ROTATION_0; + screenInfo.tpDirection = Direction::DIRECTION0; + screenInfo.uniqueId = displayinfo.name; + userScreenInfo.screens.push_back(screenInfo); + userScreenInfo.displayGroups.push_back(displayGroupInfo); + + ASSERT_NO_FATAL_FAILURE(InputManager::GetInstance()->UpdateDisplayInfo(userScreenInfo)); } /** @@ -233,8 +263,8 @@ HWTEST_F(InputManagerUpdateDisplayInfoTest, InputManagerTest_UpdateDisplayInfoSh CALL_TEST_DEBUG; DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 0; - displayGroupInfo.width = 1000; - displayGroupInfo.height = 2000; + int32_t dgw = 1000; + int32_t dgh = 2000; DisplayInfo displayinfo = CreateDisplayInfo(0); displayinfo.direction = DIRECTION0; displayinfo.displayMode = DisplayMode::FULL; @@ -242,6 +272,7 @@ HWTEST_F(InputManagerUpdateDisplayInfoTest, InputManagerTest_UpdateDisplayInfoSh std::vector> maskSizeMatrix = { { 100, 300 }, { 30, 30 }, { 50, 50 }, { 80, 80 }, { 10, 8 }, { 5, 20 }, { 6, 10 }, { 30, 30 }, { 20, 30 }, { 40, 10 } }; std::vector> vecPixelMap; + std::vector screenInfos; for (uint32_t i = 0; i < maskSizeMatrix.size(); i++) { ASSERT_EQ(maskSizeMatrix[i].size(), 2); ASSERT_GE(maskSizeMatrix[i][0], 2); @@ -276,8 +307,23 @@ HWTEST_F(InputManagerUpdateDisplayInfoTest, InputManagerTest_UpdateDisplayInfoSh int32_t displayX = maskSizeMatrix[i][0] / 2; int32_t displayY = maskSizeMatrix[i][1] / 2; CheckMaskDisplayPoint(pixelMap.get(), displayX, displayY); + ScreenInfo screenInfo; + screenInfo.screenType =(ScreenType)info.windowType; + screenInfo.dpi = displayinfo.dpi; + screenInfo.height = info.area.height; + screenInfo.width = info.area.width; + screenInfo.physicalWidth = dgw; + screenInfo.physicalHeight = dgh; + screenInfo.id = displayinfo.id; + screenInfo.rotation = Rotation::ROTATION_0; + screenInfo.tpDirection = Direction::DIRECTION0; + screenInfo.uniqueId = displayinfo.name; + screenInfos.push_back(screenInfo); } - ASSERT_NO_FATAL_FAILURE(InputManager::GetInstance()->UpdateDisplayInfo(displayGroupInfo)); + UserScreenInfo userScreenInfo; + userScreenInfo.displayGroups.push_back(displayGroupInfo); + userScreenInfo.screens = screenInfos; + ASSERT_NO_FATAL_FAILURE(InputManager::GetInstance()->UpdateDisplayInfo(userScreenInfo)); } /** @@ -291,9 +337,10 @@ HWTEST_F(InputManagerUpdateDisplayInfoTest, InputManagerTest_UpdateDisplayInfoSh CALL_TEST_DEBUG; DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 1; - displayGroupInfo.width = 1000; - displayGroupInfo.height = 2000; + int32_t dgw = 1000; + int32_t dgh = 2000; std::vector> vecPixelMap; + std::vector screenInfos; std::vector> maskSizeMatrix = { { 800, 600 }, { 1024, 1024 } }; for (uint32_t i = 0; i < maskSizeMatrix.size(); i++) { DisplayInfo displayinfo = CreateDisplayInfo(i); @@ -324,8 +371,26 @@ HWTEST_F(InputManagerUpdateDisplayInfoTest, InputManagerTest_UpdateDisplayInfoSh int32_t displayX = maskSizeMatrix[i][1] / 2; int32_t displayY = maskSizeMatrix[i][0] / 2; CheckMaskDisplayPoint(pixelMap.get(), displayX, displayY); + + ScreenInfo screenInfo; + screenInfo.screenType =(ScreenType)info.windowType; + screenInfo.dpi = displayGroupInfo.displaysInfo[i].dpi; + screenInfo.height = displayGroupInfo.displaysInfo[i].height; + screenInfo.width = displayGroupInfo.displaysInfo[i].width; + screenInfo.physicalWidth = dgw; + screenInfo.physicalHeight = dgh; + screenInfo.id = displayGroupInfo.displaysInfo[i].id; + screenInfo.rotation = Rotation::ROTATION_0; + screenInfo.tpDirection = Direction::DIRECTION0; + screenInfo.uniqueId = displayGroupInfo.displaysInfo[i].name; + screenInfos.push_back(screenInfo); } - ASSERT_NO_FATAL_FAILURE(InputManager::GetInstance()->UpdateDisplayInfo(displayGroupInfo)); + + UserScreenInfo userScreenInfo; + userScreenInfo.displayGroups.push_back(displayGroupInfo); + userScreenInfo.screens = screenInfos; + InputManager::GetInstance()->UpdateDisplayInfo(userScreenInfo); + ASSERT_NO_FATAL_FAILURE(InputManager::GetInstance()->UpdateDisplayInfo(userScreenInfo)); } } // namespace MMI } // namespace OHOS diff --git a/interfaces/kits/c/input/oh_input_manager.h b/interfaces/kits/c/input/oh_input_manager.h index 2c150efddd..1e510703a4 100644 --- a/interfaces/kits/c/input/oh_input_manager.h +++ b/interfaces/kits/c/input/oh_input_manager.h @@ -636,6 +636,18 @@ int32_t OH_Input_GetKeyEventDisplayId(const struct Input_KeyEvent* keyEvent); */ int32_t OH_Input_InjectMouseEvent(const struct Input_MouseEvent* mouseEvent); +/** + * @brief Inject mouse event using global coordinate. + * + * @param mouseEvent - the mouse event to be injected, set up effective globalX globalY. + * @return OH_Input_InjectMouseEventGlobal function result code. + * {@link INPUT_SUCCESS} inject mouseEvent success.\n + * {@link INPUT_PERMISSION_DENIED} Permission verification failed.\n + * {@link INPUT_PARAMETER_ERROR} Parameter check failed.\n + * @since 20 + */ +int32_t OH_Input_InjectMouseEventGlobal(const struct Input_MouseEvent* mouseEvent); + /** * @brief Creates a mouse event object. * @@ -888,6 +900,17 @@ int32_t OH_Input_GetMouseEventGlobalY(const struct Input_MouseEvent* mouseEvent) */ int32_t OH_Input_InjectTouchEvent(const struct Input_TouchEvent* touchEvent); +/** + * @brief Inject touch event using global coordinate. + * + * @param touchEvent - the touch event to be injected, set up effective globalX globalY. + * @return OH_Input_InjectTouchEventGlobal function result code. + * {@link INPUT_SUCCESS} inject touchEvent success.\n + * {@link INPUT_PARAMETER_ERROR} Parameter check failed.\n + * @since 20 + */ +int32_t OH_Input_InjectTouchEventGlobal(const struct Input_TouchEvent* touchEvent); + /** * @brief Creates a touch event object. * diff --git a/interfaces/kits/c/ohinput.ndk.json b/interfaces/kits/c/ohinput.ndk.json index 7129ecbb4c..1669bd85b5 100644 --- a/interfaces/kits/c/ohinput.ndk.json +++ b/interfaces/kits/c/ohinput.ndk.json @@ -566,5 +566,13 @@ { "first_introduced": "20", "name": "OH_Input_GetAxisEventGlobalY" + }, + { + "first_introduced": "20", + "name": "OH_Input_InjectMouseEventGlobal" + }, + { + "first_introduced": "20", + "name": "OH_Input_InjectTouchEventGlobal" } ] \ No newline at end of file diff --git a/interfaces/native/innerkits/event/include/i_input_event_consumer.h b/interfaces/native/innerkits/event/include/i_input_event_consumer.h index f2b4c953fa..c647470cec 100644 --- a/interfaces/native/innerkits/event/include/i_input_event_consumer.h +++ b/interfaces/native/innerkits/event/include/i_input_event_consumer.h @@ -28,9 +28,9 @@ public: IInputEventConsumer() = default; virtual ~IInputEventConsumer() = default; - virtual void OnInputEvent(std::shared_ptr keyEvent) const; - virtual void OnInputEvent(std::shared_ptr pointerEvent) const; - virtual void OnInputEvent(std::shared_ptr axisEvent) const; + virtual void OnInputEvent(std::shared_ptr keyEvent) const = 0; + virtual void OnInputEvent(std::shared_ptr pointerEvent) const = 0; + virtual void OnInputEvent(std::shared_ptr axisEvent) const = 0; }; } // namespace MMI } // namespace OHOS diff --git a/interfaces/native/innerkits/event/include/pointer_event.h b/interfaces/native/innerkits/event/include/pointer_event.h index 48ad68c9e7..7735c81f09 100644 --- a/interfaces/native/innerkits/event/include/pointer_event.h +++ b/interfaces/native/innerkits/event/include/pointer_event.h @@ -17,6 +17,7 @@ #define POINTER_EVENT_H #include +#include #include #include #include @@ -222,6 +223,14 @@ public: static constexpr int32_t TOUCH_ACTION_GESTURE_END = 106; + /** + * + * @since 20 + */ + static constexpr int32_t DISPLAY_COORDINATE = 0; + + static constexpr int32_t GLOBAL_COORDINATE = 1; + enum AxisType { /** * Indicates an unknown axis type. It is generally used as the initial value. @@ -891,6 +900,13 @@ public: * @since 20 */ double GetGlobalY() const; + + /** + * @brief Whether the global coordinates are valid. + * @return bool + * @since 20 + */ + bool IsValidGlobalXY() const; /** * @brief Obtains the width of the pressed area. * @return Returns the width. @@ -1318,8 +1334,8 @@ public: bool pressed_ { false }; int32_t displayX_ {}; int32_t displayY_ {}; - double globalX_ { 0.0f }; - double globalY_ { 0.0f }; + double globalX_ { DBL_MAX }; + double globalY_ { DBL_MAX }; int32_t fixedDisplayX_ {}; int32_t fixedDisplayY_ {}; int32_t windowX_ {}; diff --git a/interfaces/native/innerkits/proxy/include/input_manager.h b/interfaces/native/innerkits/proxy/include/input_manager.h index bb501bbe5f..41c45bebbc 100644 --- a/interfaces/native/innerkits/proxy/include/input_manager.h +++ b/interfaces/native/innerkits/proxy/include/input_manager.h @@ -52,11 +52,11 @@ public: int32_t SetDisplayBind(int32_t deviceId, int32_t displayId, std::string &msg); /** - * @brief Updates the screen and window information. - * @param displayGroupInfo Indicates the logical screen information. - * @since 9 + * @brief Updates the screen、display and window information array. + * @param userScreenInfo Indicates the user screen、display and window information. + * @since 20 */ - int32_t UpdateDisplayInfo(const DisplayGroupInfo &displayGroupInfo); + int32_t UpdateDisplayInfo(const UserScreenInfo &userScreenInfo); /** * @brief Updates the screen and window information array. @@ -360,10 +360,12 @@ public: * or mouse device input event to simulate. * @param isAutoToVirtualScreen In one-handed mode, true indicates that the data is automatically injected to * the virtual screen, and false indicates that the data is not automatically injected to the virtual screen. + * @param useCoordinate Which coordinates to use for injecting events. * @return void * @since 9 */ - void SimulateInputEvent(std::shared_ptr pointerEvent, bool isAutoToVirtualScreen = true); + void SimulateInputEvent(std::shared_ptr pointerEvent, bool isAutoToVirtualScreen = true, + int32_t useCoordinate = PointerEvent::DISPLAY_COORDINATE); /** * @brief Simulates a touchpad input event, touchscreen input event, or mouse device input event. @@ -373,11 +375,12 @@ public: * @param zOrder Indicates the point event will inject to the window whose index value is less than the zOrder * @param isAutoToVirtualScreen In one-handed mode, true indicates that the data is automatically injected to * the virtual screen, and false indicates that the data is not automatically injected to the virtual screen. + * @param useCoordinate Which coordinates to use for injecting events. * @return void * @since 9 */ void SimulateInputEvent(std::shared_ptr pointerEvent, float zOrder, - bool isAutoToVirtualScreen = true); + bool isAutoToVirtualScreen = true, int32_t useCoordinate = PointerEvent::DISPLAY_COORDINATE); void SimulateTouchPadInputEvent(std::shared_ptr pointerEvent, const TouchpadCDG &touchpadCDG); /** diff --git a/interfaces/native/innerkits/proxy/include/window_info.h b/interfaces/native/innerkits/proxy/include/window_info.h index f47de066ac..1529182932 100644 --- a/interfaces/native/innerkits/proxy/include/window_info.h +++ b/interfaces/native/innerkits/proxy/include/window_info.h @@ -25,6 +25,9 @@ inline constexpr int32_t GLOBAL_WINDOW_ID = -1; inline constexpr int32_t DEFAULT_DISPLAY_ID = -1; inline constexpr int32_t DEFAULT_GROUP_ID = 0; +constexpr uint32_t MAX_DISPLAY_GROUP_SIZE = 100; +constexpr uint32_t MAX_DISPLAY_SIZE = 1000; +constexpr uint32_t MAX_SCREEN_SIZE = 1000; enum SecureFlag { DEFAULT_MODE = 0, @@ -354,81 +357,123 @@ struct WindowInfo { * * @since 9 */ -enum class ScreenCombination : uint32_t { +enum class DisplaySourceMode : uint32_t { SCREEN_ALONE, SCREEN_EXPAND, + + /** + * mirror screen + * + * @since 20 + */ SCREEN_MIRROR, + + /** + * different source screen + * + * @since 20 + */ SCREEN_UNIQUE, + + /** + * extend screen + * + * @since 20 + */ SCREEN_EXTEND, + + /** + * main screen + * + * @since 20 + */ SCREEN_MAIN }; -struct DisplayInfo { +/** +* The area of ​​the logical screen on the physical screen +* Based on screen 0°, not affected by display rotation angle +* @since 20 +*/ +struct ScreenArea { /** - * Unique ID of the physical display + * The unique ID of the physical screen. * - * @since 9 + * @since 20 */ int32_t id; + /** + * The area of ​​the logical screen on the physical screen + * The upper left corner of the screen is the origin + * Based on screen 0°, not affected by display rotation angle + * @since 20 + */ + Rect area; +}; +struct DisplayInfo { /** - * X coordinate of the upper left corner on the logical screen + * Unique ID of the logical display, this value is greater than or equal to 0 and is unique in user space. * - * @since 9 + * @since 20 + */ + int32_t id; + + /** + * The x offset of the upper left corner of the current rotation angle of the screen relative to the upper + * left corner of the main screen, in px, changes with the rotation + * @since 20 */ int32_t x; /** - * Y coordinate of the upper left corner on the logical screen + * The y offset of the upper left corner of the current rotation angle of the screen relative to the upper + * left corner of the main screen, changes with the rotation. in px. * - * @since 9 + * @since 20 */ int32_t y; /** * Display width, which is the logical width of the original screen when the rotation angle is 0. - * The value remains unchanged even if the display screen is rotated. + * The value changed if the display screen is rotated. in px. * - * @since 9 + * @since 20 */ int32_t width; /** * Display height, which is the logical height of the original screen when the rotation angle is 0. - * The value remains unchanged even if the display screen is rotated. + * The value changed if the display screen is rotated. in px. * * @since 9 */ int32_t height; /** - * Pixel density, which indicates the number of pixels in an inch + * Pixel density, which indicates the number of pixels in an inch,changes with resolution adjustment * * @since 10 */ int32_t dpi; /** - * Name of the physical display, which is used for debugging + * Name of the logical display, which is used for debugging * * @since 9 */ std::string name; - /** - * Unique screen ID, which is used to associate the corresponding touchscreen. The default value is default0. + * The angle increment from the logical screen orientation of 0° clockwise to the current screen orientation. * - * @since 9 + * @since 20 */ - std::string uniq; - + Direction direction; /** - * Orientation of the physical display - * - * @since 9 + * The angle increment from the current rotation angle of the logical screen to the rotation angle of + * its window content display clockwise. + * @since 20 */ - Direction direction; - Direction displayDirection; /** @@ -446,14 +491,6 @@ struct DisplayInfo { */ std::vector transform; - /** - * Orientation of the physical display - * - * @since 12 - */ - int32_t offsetX = 0; - int32_t offsetY = 0; - float ppi; /** * Coordinate of the upper left corner of the virtual screen in one-hand mode. * If oneHandX is 0, the virtual screen is in the lower left corner. @@ -477,47 +514,38 @@ struct DisplayInfo { * @since 12 */ bool isCurrentOffScreenRendering = false; - int32_t screenRealWidth = 0; - int32_t screenRealHeight = 0; - float screenRealPPI = 0.0f; - int32_t screenRealDPI = 0; - ScreenCombination screenCombination = ScreenCombination::SCREEN_MAIN; /** - * Width of the effective area of the screen. When the screen is rotated, the value changes accordingly. + * logical screen mode * - * @since 12 + * @since 12 20 */ - int32_t validWidth = 0; + DisplaySourceMode displaySourceMode = DisplaySourceMode::SCREEN_MAIN; /** - * Height of the effective area of the screen. When the screen is rotated, the value changes accordingly. - * - * @since 12 - */ - int32_t validHeight = 0; - + * The area of the logical screen on the physical screen + * Based on screen 0°, not affected by display rotation angle + * @since 20 + */ + ScreenArea screenArea; /** - * Rotation angle of the TP patch offset correction. + * rs id. * - * @since 12 + * @since 20 */ - Direction fixedDirection; - + int32_t rsId; /** - * The physical width of the screen, in millimeters. + * The x coordinate of the valid area relative to the entire logical screen * - * @since 12 + * @since 20 */ - int32_t physicalWidth { 0 }; - + int32_t offsetX = 0; /** - * The physical height of the screen, in millimeters. + * The y coordinate of the valid area relative to the entire logical screen * * @since 12 */ - int32_t physicalHeight { 0 }; - + int32_t offsetY = 0; /** * The Pointer Active Width * @@ -531,57 +559,179 @@ struct DisplayInfo { * @since 12 */ int32_t pointerActiveHeight { 0 }; +}; +/** +* Screen type. +* +* @since 20 +*/ +enum class ScreenType : uint32_t { + UNDEFINED, - /** Unique ID of the physical display + /** + * real screen. * - * @since 12 + * @since 20 + */ + REAL, + + /** + * virtual screen. + * + * @since 20 */ - int32_t uniqueId { 0 }; + VIRTUAL }; +/** +* The angle of the physical screen relative to the sensor 0 degrees. +* +* @since 20 +*/ +enum class Rotation : uint32_t { + ROTATION_0, + ROTATION_90, + ROTATION_180, + ROTATION_270, +}; +/** + * physical screen information + * + * @since 20 + */ +struct ScreenInfo { + /** + * The unique ID of the physical screen. + * + * @since 20 + */ + int32_t id; + /** + * Unique screen ID, which is used to associate the corresponding touchscreen. + * The default value is default0. + * + * @since 20 + */ + std::string uniqueId; + /** + * Screen type. + * + * @since 20 + */ + ScreenType screenType { ScreenType::REAL }; + /** + * The width of the physical screen, in px. Does not follow rotation. Does not change for + * the same physical screen. + * + * @since 20 + */ + int32_t width; + /** + * The height of the physical screen, in px. Does not follow rotation. Does not change for + * the same physical screen. + * + * @since 20 + */ + int32_t height; + /** + * The width of the physical screen, in mm. Does not follow the rotation. Does not change for + * the same physical screen. + * + * @since 20 + */ + int32_t physicalWidth; + /** + * The width of the physical height, in mm. Does not follow the rotation. Does not change for + * the same physical screen. + * + * @since 20 + */ + int32_t physicalHeight; + /** + * The angle from the screen default origin to the TP origin clockwise. + * + * @since 20 + */ + Direction tpDirection; + /** + * Physical pixel density does not change with resolution. + * + * @since 20 + */ + int32_t dpi; + /** + * The number of pixels per inch is a physical property and does not change. + * + * @since 20 + */ + int32_t ppi; + /** + * The angle of the physical screen relative to the sensor 0 degrees. + * + * @since 20 + */ + Rotation rotation; +}; + +/** + * Logical screen group type + * + * @since 20 + */ +enum GroupType { + /** + * The default group, the group that receives input events. This group can only have one + * + * @since 20 + */ + GROUP_DEFAULT = 0, + /** + * The special group, the group can have multiple. + * + * @since 20 + */ + GROUP_SPECIAL = 1, +}; /** * Logical screen information * - * @since 9 + * @since 20 */ struct DisplayGroupInfo { /** - * index of group. default=-1 + * Logical screen group id, at least the user space level guarantees uniqueness. + * The range is greater than or equal to 0 * - * @since 16 + * @since 20 */ - int32_t groupId { DEFAULT_GROUP_ID }; - + int32_t id; /** - * main group flag. default=true + * Logical screen group name * - * @since 16 + * @since 20 */ - bool isMainGroup { false }; - + std::string name; /** - * Width of the logical display + * Logical screen group type * - * @since 9 + * @since 20 */ - int32_t width; - + GroupType type; /** - * Height of the logical display + * The main logical screen ID. The logical screen with this ID must be in the displaysInfo. * - * @since 9 + * @since 20 */ - int32_t height; + int32_t mainDisplayId; /** - * ID of the focus window + * ID of the focus window, The value -1 indicates that there is no focused window in the current screen group. + * The default screen group must have a focused window. * - * @since 9 + * @since 20 */ int32_t focusWindowId; - int32_t currentUserId { -1 }; - /** * List of window information of the logical display arranged in Z order, with the top window at the top * @@ -590,13 +740,39 @@ struct DisplayGroupInfo { std::vector windowsInfo; /** - * Physical screen information list + * logical screen information list * - * @since 9 + * @since 20 */ std::vector displaysInfo; }; +/** + * user's screen information + * + * @since 20 + */ +struct UserScreenInfo { + /** + * user id. + * + * @since 20 + */ + int32_t userId; + /** + * Physical screen information. + * + * @since 20 + */ + std::vector screens; + /** + * Logical screen information. + * + * @since 20 + */ + std::vector displayGroups; +}; + struct WindowGroupInfo { /** * ID of the focus window diff --git a/service/connect_manager/IMultimodalInputConnect.idl b/service/connect_manager/IMultimodalInputConnect.idl index 85a173173c..b2d37ca785 100644 --- a/service/connect_manager/IMultimodalInputConnect.idl +++ b/service/connect_manager/IMultimodalInputConnect.idl @@ -102,7 +102,7 @@ interface OHOS.MMI.IMultimodalInputConnect { void UnsubscribetabletProximity([in] int subscribeId); void SubscribeLongPressEvent([in] int subscribeId, [in] LongPressRequest longPressRequest); void UnsubscribeLongPressEvent([in] int subscribeId); - void InjectPointerEvent([in] PointerEvent pointerEvent, [in] boolean isNativeInject); + void InjectPointerEvent([in] PointerEvent pointerEvent, [in] boolean isNativeInject, [in] int useCoordinate); void InjectTouchPadEvent([in] PointerEvent pointerEvent, [in] TouchpadCDG touchpadCDG, [in] boolean isNativeInject); void SetAnrObserver(); void GetDisplayBindInfo([out] DisplayBindInfo[] infos); diff --git a/service/connect_manager/include/multimodal_input_connect_manager.h b/service/connect_manager/include/multimodal_input_connect_manager.h index 42d65ebf92..50734fd0a8 100644 --- a/service/connect_manager/include/multimodal_input_connect_manager.h +++ b/service/connect_manager/include/multimodal_input_connect_manager.h @@ -108,7 +108,8 @@ public: int32_t UnsubscribetabletProximity(int32_t subscribeId); int32_t SubscribeLongPressEvent(int32_t subscribeId, const LongPressRequest &longPressRequest); int32_t UnsubscribeLongPressEvent(int32_t subscribeId); - int32_t InjectPointerEvent(const std::shared_ptr pointerEvent, bool isNativeInject); + int32_t InjectPointerEvent(const std::shared_ptr pointerEvent, bool isNativeInject, + int32_t useCoordinate); int32_t InjectTouchPadEvent(std::shared_ptr pointerEvent, const TouchpadCDG &touchpadCDG, bool isNativeInject); int32_t SetAnrObserver(); diff --git a/service/connect_manager/src/multimodal_input_connect_manager.cpp b/service/connect_manager/src/multimodal_input_connect_manager.cpp index 934cab7a4b..4dd29eb2b4 100644 --- a/service/connect_manager/src/multimodal_input_connect_manager.cpp +++ b/service/connect_manager/src/multimodal_input_connect_manager.cpp @@ -562,12 +562,12 @@ int32_t MultimodalInputConnectManager::InjectKeyEvent(const std::shared_ptr pointerEvent, - bool isNativeInject) + bool isNativeInject, int32_t useCoordinate) { std::lock_guard guard(lock_); CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); CHKPR(pointerEvent, ERR_INVALID_VALUE); - return multimodalInputConnectService_->InjectPointerEvent(*pointerEvent, isNativeInject); + return multimodalInputConnectService_->InjectPointerEvent(*pointerEvent, isNativeInject, useCoordinate); } int32_t MultimodalInputConnectManager::InjectTouchPadEvent(std::shared_ptr pointerEvent, diff --git a/service/event_handler/include/i_input_event_handler.h b/service/event_handler/include/i_input_event_handler.h index f8c6cd16f5..efe861c512 100755 --- a/service/event_handler/include/i_input_event_handler.h +++ b/service/event_handler/include/i_input_event_handler.h @@ -33,9 +33,9 @@ public: IInputEventConsumer() = default; virtual ~IInputEventConsumer() = default; - virtual void OnInputEvent(InputHandlerType type, std::shared_ptr event) const; - virtual void OnInputEvent(InputHandlerType type, std::shared_ptr event) const; - virtual void OnInputEvent(InputHandlerType type, std::shared_ptr event) const; + virtual void OnInputEvent(InputHandlerType type, std::shared_ptr event) const = 0; + virtual void OnInputEvent(InputHandlerType type, std::shared_ptr event) const = 0; + virtual void OnInputEvent(InputHandlerType type, std::shared_ptr event) const = 0; }; IInputEventHandler() = default; DISALLOW_COPY_AND_MOVE(IInputEventHandler); diff --git a/service/key_command/include/key_command_handler.h b/service/key_command/include/key_command_handler.h index da9d113a1e..a36303074d 100755 --- a/service/key_command/include/key_command_handler.h +++ b/service/key_command/include/key_command_handler.h @@ -16,7 +16,7 @@ #ifndef KEY_COMMAND_HANDLER_H #define KEY_COMMAND_HANDLER_H -#include "window_info.h" +#include "old_display_info.h" #include "i_input_event_handler.h" #include "input_handler_type.h" @@ -290,7 +290,7 @@ private: void HandleFingerGestureUpEvent(const std::shared_ptr touchEvent); void HandleKnuckleGestureDownEvent(const std::shared_ptr touchEvent); void HandleKnuckleGestureUpEvent(const std::shared_ptr touchEvent); - std::pair CalcDrawCoordinate(const DisplayInfo& displayInfo, + std::pair CalcDrawCoordinate(const OLD::DisplayInfo& displayInfo, PointerEvent::PointerItem pointerItem); void SingleKnuckleGestureProcesser(const std::shared_ptr touchEvent); void DoubleKnuckleGestureProcesser(const std::shared_ptr touchEvent); diff --git a/service/key_command/src/key_command_handler.cpp b/service/key_command/src/key_command_handler.cpp index c702165b04..b2e5fe34d8 100644 --- a/service/key_command/src/key_command_handler.cpp +++ b/service/key_command/src/key_command_handler.cpp @@ -767,7 +767,7 @@ bool KeyCommandHandler::IsValidAction(int32_t action) return false; } -std::pair KeyCommandHandler::CalcDrawCoordinate(const DisplayInfo& displayInfo, +std::pair KeyCommandHandler::CalcDrawCoordinate(const OLD::DisplayInfo& displayInfo, PointerEvent::PointerItem pointerItem) { CALL_DEBUG_ENTER; diff --git a/service/key_command/test/key_command_handler_test.cpp b/service/key_command/test/key_command_handler_test.cpp index 49dc03c041..28ae6bf389 100644 --- a/service/key_command/test/key_command_handler_test.cpp +++ b/service/key_command/test/key_command_handler_test.cpp @@ -1075,7 +1075,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_CheckTwoFingerGestureActio handler.twoFingerGesture_.touches[1].y = 10; handler.twoFingerGesture_.touches[1].downTime = 100000; InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.dpi = 320; displayInfo.width = 150; displayInfo.height = 300; @@ -1122,7 +1122,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_CheckTwoFingerGestureActio handler.twoFingerGesture_.touches[1].y = 170; handler.twoFingerGesture_.touches[1].downTime = 100000; InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.dpi = 320; displayInfo.width = 150; displayInfo.height = 300; @@ -1194,7 +1194,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_CheckTwoFingerGestureActio EXPECT_FALSE(handler.CheckTwoFingerGestureAction()); InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.dpi = 320; displayInfo.width = 10; displayInfo.height = 30; @@ -1296,7 +1296,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_ConvertVPToPX_004, TestSiz KeyCommandHandler handler; int32_t vp = 10; InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.dpi = -10; displayInfo.uniq = "default0"; auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID); @@ -4052,7 +4052,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_ConvertVPToPX_002, TestSiz ASSERT_EQ(ret, 0); vp = 5; InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.x = 2; displayInfo.y = 3; @@ -4079,7 +4079,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_ConvertVPToPX_003, TestSiz KeyCommandHandler handler; int32_t vp = 5; InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.x = 2; displayInfo.y = 3; @@ -4114,7 +4114,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_CheckTwoFingerGestureActio handler.twoFingerGesture_.touches[1].y = -400; handler.twoFingerGesture_.touches[1].downTime = 50000; InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.x = 2; displayInfo.y = 3; @@ -4149,7 +4149,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_CheckTwoFingerGestureActio handler.twoFingerGesture_.touches[1].y = 400; handler.twoFingerGesture_.touches[1].downTime = 50000; InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.x = 2; displayInfo.y = 3; @@ -4184,7 +4184,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_CheckTwoFingerGestureActio handler.twoFingerGesture_.touches[1].y = 20; handler.twoFingerGesture_.touches[1].downTime = 50000; InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.x = 2; displayInfo.y = 3; @@ -5597,7 +5597,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_HandleKnuckleGestureDownEv KeyCommandHandler handler; handler.gameForbidFingerKnuckle_ = false; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; WindowInfo windowInfo; windowInfo.id = 0; @@ -5636,7 +5636,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_CheckTwoFingerGestureActio handler.twoFingerGesture_.touches[0].downTime = 0; handler.twoFingerGesture_.touches[1].downTime = 1; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.dpi = 320; displayInfo.width = 1260; displayInfo.height = 2720; @@ -5649,7 +5649,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_CheckTwoFingerGestureActio IInputWindowsManager::instance_ = inputWindowsManager; handler.twoFingerGesture_.touches[0].x = 600; handler.twoFingerGesture_.touches[0].y = 600; - + handler.twoFingerGesture_.touches[1].x = 800; handler.twoFingerGesture_.touches[1].y = 600; ASSERT_NO_FATAL_FAILURE(handler.CheckTwoFingerGestureAction()); @@ -5697,7 +5697,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_ConvertVPToPX_006, TestSiz { CALL_TEST_DEBUG; int32_t vp = 5; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.x = 2; displayInfo.y = 3; @@ -5738,7 +5738,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_CheckKnuckleCondition_001, handler.gameForbidFingerKnuckle_ = false; handler.singleKnuckleGesture_.state = false; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.direction = DIRECTION0; WindowInfo windowInfo; @@ -5796,7 +5796,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_CheckKnuckleCondition_002, handler.gameForbidFingerKnuckle_ = false; handler.singleKnuckleGesture_.state = false; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.direction = DIRECTION0; WindowInfo windowInfo; @@ -5844,7 +5844,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_HandleKnuckleGestureTouchM touchEvent->SetPointerId(0); touchEvent->SetTargetDisplayId(0); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.direction = DIRECTION0; auto inputWindowsManager = std::make_shared(); @@ -5893,7 +5893,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_HandleKnuckleGestureTouchM touchEvent->SetPointerId(0); touchEvent->SetTargetDisplayId(0); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.direction = DIRECTION0; auto inputWindowsManager = std::make_shared(); @@ -5942,7 +5942,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_HandleKnuckleGestureTouchM touchEvent->SetPointerId(0); touchEvent->SetTargetDisplayId(0); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.direction = DIRECTION0; auto inputWindowsManager = std::make_shared(); @@ -5988,7 +5988,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_HandleKnuckleGestureTouchM touchEvent->SetPointerId(0); touchEvent->SetTargetDisplayId(0); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.direction = DIRECTION0; auto inputWindowsManager = std::make_shared(); @@ -6037,7 +6037,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_HandleKnuckleGestureTouchM touchEvent->SetPointerId(0); touchEvent->SetTargetDisplayId(0); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.direction = DIRECTION0; auto inputWindowsManager = std::make_shared(); @@ -6085,7 +6085,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_HandleKnuckleGestureTouchM touchEvent->SetPointerId(0); touchEvent->SetTargetDisplayId(0); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.direction = DIRECTION0; auto inputWindowsManager = std::make_shared(); @@ -6102,7 +6102,7 @@ HWTEST_F(KeyCommandHandlerTest, KeyCommandHandlerTest_HandleKnuckleGestureTouchM handler.isStartBase_ = true; handler.isGesturing_ = true; handler.isLetterGesturing_ = false; - + ASSERT_NO_FATAL_FAILURE(handler.HandleKnuckleGestureTouchMove(touchEvent)); } diff --git a/service/key_command/test/long_press_subscriber_handler_test.cpp b/service/key_command/test/long_press_subscriber_handler_test.cpp index 9dfc378e44..5a88c280bb 100644 --- a/service/key_command/test/long_press_subscriber_handler_test.cpp +++ b/service/key_command/test/long_press_subscriber_handler_test.cpp @@ -1038,7 +1038,7 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_StartFinge int32_t ret = LONG_PRESS_EVENT_HANDLER->SubscribeLongPressEvent(sess, subscribeId, longPressRequest); EXPECT_TRUE(ret >= 0); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.dpi = 320; displayInfo.width = 1260; displayInfo.height = 2720; @@ -1069,7 +1069,7 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_CheckFinge TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.dpi = 320; displayInfo.width = 1260; displayInfo.height = 2720; @@ -1118,7 +1118,7 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_CheckFinge TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.dpi = 320; displayInfo.width = 1260; displayInfo.height = 2720; @@ -1169,7 +1169,7 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_CheckFinge TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.dpi = 320; displayInfo.width = 1260; displayInfo.height = 2720; @@ -1246,7 +1246,7 @@ HWTEST_F(LongPressSubscribeHandlerTest, LongPressSubscribeHandlerTest_ConvertVPT { CALL_TEST_DEBUG; int32_t vp = 5; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.x = 2; displayInfo.y = 3; diff --git a/service/libinput_adapter/src/libinput_adapter.cpp b/service/libinput_adapter/src/libinput_adapter.cpp index d8eb0aa155..ae8f1f66d4 100644 --- a/service/libinput_adapter/src/libinput_adapter.cpp +++ b/service/libinput_adapter/src/libinput_adapter.cpp @@ -349,7 +349,7 @@ void LibinputAdapter::HandleVFullKeyboardMessages( // delay the event destroy. bool delayDestroy = false; int32_t confirmedDelayMs(0); - + if (getLibinputEventForVKeyboard_ == nullptr || getLibinputEventForVTrackpad_ == nullptr) { return; } @@ -375,7 +375,7 @@ void LibinputAdapter::HandleVFullKeyboardMessages( } HandleVKeyboardMessage(eventType, keyEvents, frameTime); } - + // handle trackpad messages. while (true) { std::vector events; diff --git a/service/message_handle/include/server_msg_handler.h b/service/message_handle/include/server_msg_handler.h index 38809573ed..34a8505ff1 100644 --- a/service/message_handle/include/server_msg_handler.h +++ b/service/message_handle/include/server_msg_handler.h @@ -99,10 +99,11 @@ public: #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) void DealGesturePointers(std::shared_ptr pointerEvent); int32_t OnInjectPointerEvent(const std::shared_ptr pointerEvent, int32_t pid, - bool isNativeInject, bool isShell); + bool isNativeInject, bool isShell, int32_t useCoordinate); int32_t OnInjectTouchPadEvent(const std::shared_ptr pointerEvent, int32_t pid, const TouchpadCDG &touchpadCDG, bool isNativeInject, bool isShell); - int32_t OnInjectPointerEventExt(const std::shared_ptr pointerEvent, bool isShell); + int32_t OnInjectPointerEventExt(const std::shared_ptr pointerEvent, bool isShell, + int32_t useCoordinate); int32_t OnInjectTouchPadEventExt(const std::shared_ptr pointerEvent, const TouchpadCDG &touchpadCDG, bool isShell); int32_t SaveTargetWindowId(std::shared_ptr pointerEvent, bool isShell); @@ -161,8 +162,16 @@ private: bool CloseInjectNotice(int32_t pid); bool IsNavigationWindowInjectEvent(std::shared_ptr pointerEvent); int32_t NativeInjectCheck(int32_t pid); - int32_t ReadDisplayInfo(NetPacket &pkt, DisplayGroupInfo &displayGroupInfo); + int32_t ReadScreensInfo(NetPacket &pkt, UserScreenInfo &userScreenInfo); + int32_t ReadDisplayGroupsInfo(NetPacket &pkt, UserScreenInfo &userScreenInfo); + int32_t ReadDisplaysInfo(NetPacket &pkt, DisplayGroupInfo &displayGroupInfo); + int32_t ReadWindowsInfo(NetPacket &pkt, DisplayGroupInfo &displayGroupInfo, + OLD::DisplayGroupInfo &oldDisplayGroupInfo); bool IsCastInject(int32_t deviceid); + bool ChangeToOld(const UserScreenInfo& userScreenInfo); + void ChangeToOld(size_t num, const std::vector& displaysInfo, + const std::vector& screens); + void Printf(const UserScreenInfo& userScreenInfo); private: UDSServer *udsServer_ { nullptr }; std::map nativeTargetWindowIds_; @@ -179,6 +188,7 @@ private: ClientDeathHandler clientDeathHandler_; std::mutex mutexMapQueryAuthorizeLastTimestamp_; std::map mapQueryAuthorizeLastTimestamp_; + std::vector oldDisplayGroupInfos_; }; } // namespace MMI } // namespace OHOS diff --git a/service/message_handle/src/server_msg_handler.cpp b/service/message_handle/src/server_msg_handler.cpp index 423bad8806..8d94bfe875 100644 --- a/service/message_handle/src/server_msg_handler.cpp +++ b/service/message_handle/src/server_msg_handler.cpp @@ -237,7 +237,7 @@ int32_t ServerMsgHandler::OnSetFunctionKeyState(int32_t pid, int32_t funcKey, bo #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) int32_t ServerMsgHandler::OnInjectPointerEvent(const std::shared_ptr pointerEvent, int32_t pid, - bool isNativeInject, bool isShell) + bool isNativeInject, bool isShell, int32_t useCoordinate) { CALL_DEBUG_ENTER; CHKPR(pointerEvent, ERROR_NULL_POINTER); @@ -248,7 +248,7 @@ int32_t ServerMsgHandler::OnInjectPointerEvent(const std::shared_ptr pointerEvent, int32_t pid, @@ -329,7 +329,8 @@ void ServerMsgHandler::DealGesturePointers(std::shared_ptr pointer } } -int32_t ServerMsgHandler::OnInjectPointerEventExt(const std::shared_ptr pointerEvent, bool isShell) +int32_t ServerMsgHandler::OnInjectPointerEventExt(const std::shared_ptr pointerEvent, bool isShell, + int32_t useCoordinate) { CALL_DEBUG_ENTER; CHKPR(pointerEvent, ERROR_NULL_POINTER); @@ -345,7 +346,7 @@ int32_t ServerMsgHandler::OnInjectPointerEventExt(const std::shared_ptrProcessInjectEventGlobalXY(pointerEvent, useCoordinate); inputEventNormalizeHandler->HandleTouchEvent(pointerEvent); if (!pointerEvent->HasFlag(InputEvent::EVENT_FLAG_ACCESSIBILITY) && !(IsCastInject(pointerEvent->GetDeviceId())) && @@ -369,6 +370,7 @@ int32_t ServerMsgHandler::OnInjectPointerEventExt(const std::shared_ptrProcessInjectEventGlobalXY(pointerEvent, useCoordinate); inputEventNormalizeHandler->HandlePointerEvent(pointerEvent); CHKPR(pointerEvent, ERROR_NULL_POINTER); if (pointerEvent->HasFlag(InputEvent::EVENT_FLAG_ACCESSIBILITY)) { @@ -742,40 +744,6 @@ int32_t ServerMsgHandler::OnUiExtentionWindowInfo(NetPacket &pkt, WindowInfo& in return RET_OK; } -int32_t ServerMsgHandler::ReadDisplayInfo(NetPacket &pkt, DisplayGroupInfo &displayGroupInfo) -{ - uint32_t num = 0; - pkt >> num; - for (uint32_t i = 0; i < num; i++) { - DisplayInfo info; - pkt >> info.id >> info.x >> info.y >> info.width >> info.height >> info.dpi >> info.name - >> info.uniq >> info.direction >> info.displayDirection >> info.displayMode >> info.transform >> info.ppi - >> info.offsetX >> info.offsetY >> info.isCurrentOffScreenRendering >> info.screenRealWidth - >> info.screenRealHeight >> info.screenRealPPI >> info.screenRealDPI >> info.screenCombination - >> info.validWidth >> info.validHeight >> info.fixedDirection - >> info.physicalWidth >> info.physicalHeight >> info.scalePercent >> info.expandHeight >> info.uniqueId; -#ifdef OHOS_BUILD_ENABLE_ONE_HAND_MODE - pkt >> info.oneHandX >> info.oneHandY; -#endif // OHOS_BUILD_ENABLE_ONE_HAND_MODE -#ifdef OHOS_BUILD_ENABLE_VKEYBOARD - pkt >> info.pointerActiveWidth >> info.pointerActiveHeight; -#endif // OHOS_BUILD_ENABLE_VKEYBOARD - if (PRODUCT_TYPE != PRODUCT_TYPE_PC) { - info.uniq = "default" + std::to_string(info.id); - } - displayGroupInfo.displaysInfo.push_back(info); - if (pkt.ChkRWError()) { - MMI_HILOGE("Packet read display info failed"); - return RET_ERR; - } - } - if (pkt.ChkRWError()) { - MMI_HILOGE("Packet read display info failed"); - return RET_ERR; - } - return RET_OK; -} - bool ServerMsgHandler::IsCastInject(int32_t deviceid) { return (deviceid == CAST_INPUT_DEVICEID || deviceid == CAST_SCREEN_DEVICEID); @@ -791,36 +759,90 @@ int32_t ServerMsgHandler::OnDisplayInfo(SessionPtr sess, NetPacket &pkt) MMI_HILOGW("Not native or systemapp skip, pid:%{public}d tokenType:%{public}d", sess->GetPid(), tokenType); return RET_ERR; } - DisplayGroupInfo displayGroupInfo; - pkt >> displayGroupInfo.groupId >> displayGroupInfo.isMainGroup >> displayGroupInfo.width >> - displayGroupInfo.height >> displayGroupInfo.focusWindowId >> displayGroupInfo.currentUserId; + UserScreenInfo userScreenInfo; + oldDisplayGroupInfos_.clear(); + pkt >> userScreenInfo.userId; + if (ReadScreensInfo(pkt, userScreenInfo) != RET_OK) { + return RET_ERR; + } + if (ReadDisplayGroupsInfo(pkt, userScreenInfo) != RET_OK) { + return RET_ERR; + } + if (!ChangeToOld(userScreenInfo)) { + return RET_ERR; + } + for (auto &displayGroupInfo : oldDisplayGroupInfos_) { + WIN_MGR->UpdateDisplayInfoExtIfNeed(displayGroupInfo, true); + } + return RET_OK; +} + +int32_t ServerMsgHandler::ReadScreensInfo(NetPacket &pkt, UserScreenInfo &userScreenInfo) +{ uint32_t num = 0; pkt >> num; + if (num > MAX_SCREEN_SIZE) { + MMI_HILOGE("Too many screens, num:%{public}u", num); + return RET_ERR; + } + for (uint32_t i = 0; i < num; i++) { + ScreenInfo info; + pkt >> info.id >> info.uniqueId >> info.screenType >> info.width >> info.height >> info.physicalWidth + >> info.physicalHeight >> info.tpDirection >> info.dpi >> info.ppi >> info.rotation; + userScreenInfo.screens.push_back(info); + } if (pkt.ChkRWError()) { - MMI_HILOGE("Packet read display info failed"); + MMI_HILOGE("Read screens info error"); + return RET_ERR; + } + return RET_OK; +} + +int32_t ServerMsgHandler::ReadDisplayGroupsInfo(NetPacket &pkt, UserScreenInfo &userScreenInfo) +{ + uint32_t num = 0; + pkt >> num; + if (num > MAX_DISPLAY_GROUP_SIZE) { + MMI_HILOGE("Too many display groups, num:%{public}u", num); return RET_ERR; } for (uint32_t i = 0; i < num; i++) { - WindowInfo info; - int32_t byteCount = 0; - pkt >> info.id >> info.pid >> info.uid >> info.area >> info.defaultHotAreas - >> info.pointerHotAreas >> info.agentWindowId >> info.flags >> info.action - >> info.displayId >> info.groupId >> info.zOrder >> info.pointerChangeAreas >> info.transform - >> info.windowInputType >> info.privacyMode >> info.windowType - >> info.isSkipSelfWhenShowOnVirtualScreen >> info.windowNameType >> byteCount; + DisplayGroupInfo info; + OLD::DisplayGroupInfo oldInfo; + pkt >> info.id >> info.name >> info.type >> info.mainDisplayId >> info.focusWindowId; + if (ReadDisplaysInfo(pkt, info) != RET_OK) { + return RET_ERR; + } + if (ReadWindowsInfo(pkt, info, oldInfo) != RET_OK) { + return RET_ERR; + } + userScreenInfo.displayGroups.push_back(info); + oldDisplayGroupInfos_.push_back(oldInfo); + } + return RET_OK; +} - OnUiExtentionWindowInfo(pkt, info); - pkt >> info.rectChangeBySystem; - displayGroupInfo.windowsInfo.push_back(info); +int32_t ServerMsgHandler::ReadDisplaysInfo(NetPacket &pkt, DisplayGroupInfo &displayGroupInfo) +{ + uint32_t num = 0; + pkt >> num; + if (num > MAX_DISPLAY_SIZE) { + MMI_HILOGE("Too many displays, num:%{public}u", num); + return RET_ERR; + } + for (uint32_t i = 0; i < num; i++) { + DisplayInfo info; + pkt >> info.id >> info.x >> info.y >> info.width >> info.height >> info.dpi >> info.name + >> info.direction >> info.displayDirection >> info.displayMode >> info.transform + >> info.scalePercent >> info.expandHeight >> info.isCurrentOffScreenRendering + >> info.displaySourceMode >> info.oneHandX >> info.oneHandY >> info.screenArea >> info.rsId + >> info.offsetX >> info.offsetY >> info.pointerActiveWidth >> info.pointerActiveHeight; + displayGroupInfo.displaysInfo.push_back(info); if (pkt.ChkRWError()) { MMI_HILOGE("Packet read display info failed"); return RET_ERR; } } - if (ReadDisplayInfo(pkt, displayGroupInfo) != RET_OK) { - return RET_ERR; - } - WIN_MGR->UpdateDisplayInfoExtIfNeed(displayGroupInfo, true); return RET_OK; } @@ -1000,6 +1022,165 @@ int32_t ServerMsgHandler::OnMarkConsumed(SessionPtr sess, int32_t eventId) } #endif // OHOS_BUILD_ENABLE_MONITOR +int32_t ServerMsgHandler::ReadWindowsInfo(NetPacket &pkt, DisplayGroupInfo &displayGroupInfo, + OLD::DisplayGroupInfo &oldDisplayGroupInfo) +{ + uint32_t num = 0; + pkt >> num; + for (uint32_t i = 0; i < num; i++) { + WindowInfo info; + int32_t byteCount = 0; + pkt >> info.id >> info.pid >> info.uid >> info.area >> info.defaultHotAreas + >> info.pointerHotAreas >> info.agentWindowId >> info.flags >> info.action + >> info.displayId >> info.groupId >> info.zOrder >> info.pointerChangeAreas >> info.transform + >> info.windowInputType >> info.privacyMode >> info.windowType + >> info.isSkipSelfWhenShowOnVirtualScreen >> info.windowNameType >> byteCount; + + OnUiExtentionWindowInfo(pkt, info); + pkt >> info.rectChangeBySystem; + displayGroupInfo.windowsInfo.push_back(info); + oldDisplayGroupInfo.windowsInfo.push_back(info); + if (pkt.ChkRWError()) { + MMI_HILOGE("read window info failed"); + return RET_ERR; + } + } + return RET_OK; +} + +bool ServerMsgHandler::ChangeToOld(const UserScreenInfo& userScreenInfo) +{ + if (userScreenInfo.displayGroups.size() != oldDisplayGroupInfos_.size()) { + MMI_HILOGE("ChangeToOld size inconsistent, new size:%{public}zu, old size:%{public}zu", + userScreenInfo.displayGroups.size(), oldDisplayGroupInfos_.size()); + return false; + } + size_t num = 0; + for (auto &displayGroupInfo : userScreenInfo.displayGroups) { + if (num >= oldDisplayGroupInfos_.size()) { + MMI_HILOGE("num:%{public}zu", num); + break; + } + oldDisplayGroupInfos_[num].groupId = displayGroupInfo.id; + oldDisplayGroupInfos_[num].type = displayGroupInfo.type; + oldDisplayGroupInfos_[num].mainDisplayId = displayGroupInfo.mainDisplayId; + oldDisplayGroupInfos_[num].focusWindowId = displayGroupInfo.focusWindowId; + oldDisplayGroupInfos_[num].currentUserId = userScreenInfo.userId; + ChangeToOld(num, displayGroupInfo.displaysInfo, userScreenInfo.screens); + num++; + } + return true; +} + +void ServerMsgHandler::ChangeToOld(size_t num, const std::vector& displaysInfo, + const std::vector& screens) +{ + for (auto &display : displaysInfo) { + OLD::DisplayInfo oldDisplay; + oldDisplay = { + .id = display.id, + .x = display.x, + .y = display.y, + .dpi = display.dpi, + .name = display.name, + .direction = display.direction, + .displayDirection = display.displayDirection, + .displayMode = display.displayMode, + .transform = display.transform, + .offsetX = display.offsetX, + .offsetY = display.offsetY, + .scalePercent = display.scalePercent, + .expandHeight = display.expandHeight, + .isCurrentOffScreenRendering = display.isCurrentOffScreenRendering, + .displaySourceMode = display.displaySourceMode, + .oneHandX = display.oneHandX, + .oneHandY = display.oneHandY, + .validWidth = display.width, + .validHeight = display.height, + .pointerActiveWidth = display.pointerActiveWidth, + .pointerActiveHeight = display.pointerActiveHeight, + .rsId = display.rsId, + }; + for (auto &screen : screens) { + if (screen.id == display.screenArea.id) { + oldDisplay.uniq = screen.uniqueId; + oldDisplay.ppi = screen.ppi; + oldDisplay.screenRealWidth = screen.width; + oldDisplay.screenRealHeight = screen.height; + oldDisplay.screenRealDPI = screen.dpi; + oldDisplay.fixedDirection = screen.tpDirection; + oldDisplay.physicalWidth = screen.physicalWidth; + oldDisplay.physicalHeight = screen.physicalHeight; + if (display.screenArea.area.width > 0 && display.screenArea.area.height > 0) { + if (oldDisplay.direction == Direction::DIRECTION0 + || oldDisplay.direction == Direction::DIRECTION180) { + oldDisplay.width = static_cast(static_cast(display.width) / + static_cast(display.screenArea.area.width) * static_cast(screen.width)); + oldDisplay.height = static_cast(static_cast(display.height) / + static_cast(display.screenArea.area.height) * static_cast(screen.height)); + } + if (oldDisplay.direction == Direction::DIRECTION90 + || oldDisplay.direction == Direction::DIRECTION270) { + oldDisplay.width = static_cast(static_cast(display.width) / + static_cast(display.screenArea.area.height) *static_cast(screen.height)); + oldDisplay.height = static_cast(static_cast(display.height) / + static_cast(display.screenArea.area.width) * static_cast(screen.width)); + } + } + break; + } + } + if (num >= oldDisplayGroupInfos_.size()) { + MMI_HILOGE("num:%{public}zu", num); + break; + } + oldDisplayGroupInfos_[num].displaysInfo.emplace_back(oldDisplay); + } +} + +void ServerMsgHandler::Printf(const UserScreenInfo& userScreenInfo) +{ + MMI_HILOGD("userScreenInfo-----------"); + MMI_HILOGD("userId:%{public}d, ", userScreenInfo.userId); + size_t num = 0; + for (const auto &item : userScreenInfo.screens) { + MMI_HILOGD("screen%{public}zu, id:%{public}d, uniqueId:%{public}s, screenType:%{public}d, width:%{public}d, " + "height:%{public}d, physicalWidth:%{public}d, physicalHeight:%{public}d, tpDirection:%{public}d, " + "dpi%{public}d, ppi%{public}d, rotation%{public}d", num, item.id, item.uniqueId.c_str(), + item.screenType, item.width, item.height, item.physicalWidth, item.physicalHeight, item.tpDirection, + item.dpi, item.ppi, item.rotation); + num++; + } + num = 0; + for (const auto &item : userScreenInfo.displayGroups) { + MMI_HILOGD("displayGroups%{public}zu,id:%{public}d,name:%{public}s,type:%{public}d, mainDisplayId:%{public}d," + "focusWindowId:%{public}d", + num, item.id, item.name.c_str(), item.type, item.mainDisplayId, item.focusWindowId); + size_t numDisplayInfo = 0; + for (const auto &itemDisplay : item.displaysInfo) { + MMI_HILOGD("displays%{public}zu,id:%{public}d,x:%{public}d,y:%{public}d,width:%{public}d," + "height:%{public}d,dpi:%{public}d,name:%{public}s,direction:%{public}d,displayDirection:%{public}d," + "displayMode:%{public}d,scalePercent:%{public}d, expandHeight:%{public}d," + "isCurrentOffScreenRendering:%{public}d,displaySourceMode:%{public}d,oneHandX:%{public}d," + "oneHandY:%{public}d, screenArea:{%{public}d:{%{public}d,%{public}d,%{public}d,%{public}d}," + "rsId:%{public}d},offsetX:%{public}d,offsetY:%{public}d,pointerActiveWidth:%{public}d," + "pointerActiveHeight:%{public}d,transform:", + numDisplayInfo, itemDisplay.id, itemDisplay.x, itemDisplay.y, itemDisplay.width, itemDisplay.height, + itemDisplay.dpi, itemDisplay.name.c_str(), itemDisplay.direction, itemDisplay.displayDirection, + itemDisplay.displayMode, itemDisplay.scalePercent, itemDisplay.expandHeight, + itemDisplay.isCurrentOffScreenRendering, itemDisplay.displaySourceMode, itemDisplay.oneHandX, + itemDisplay.oneHandY, itemDisplay.screenArea.id, itemDisplay.screenArea.area.x, + itemDisplay.screenArea.area.y, itemDisplay.screenArea.area.width, itemDisplay.screenArea.area.height, + itemDisplay.rsId, itemDisplay.offsetX, itemDisplay.offsetY, + itemDisplay.pointerActiveWidth, itemDisplay.pointerActiveHeight); + for (auto& transform : itemDisplay.transform) { + MMI_HILOGD("%{public}f,", transform); + } + numDisplayInfo++; + } + num++; + } +} #if defined(OHOS_BUILD_ENABLE_POINTER) && defined(OHOS_BUILD_ENABLE_POINTER_DRAWING) int32_t ServerMsgHandler::OnMoveMouse(int32_t offsetX, int32_t offsetY) { diff --git a/service/message_handle/test/server_msg_handler_test.cpp b/service/message_handle/test/server_msg_handler_test.cpp index df2bb1c85e..6bdf79f673 100644 --- a/service/message_handle/test/server_msg_handler_test.cpp +++ b/service/message_handle/test/server_msg_handler_test.cpp @@ -196,7 +196,8 @@ HWTEST_F(ServerMsgHandlerTest, ServerMsgHandlerTest_OnInjectPointerEvent, TestSi ASSERT_NE(pointerEvent, nullptr); int32_t pid = 1; bool isNativeInject = true; - int32_t result = servermsghandler.OnInjectPointerEvent(pointerEvent, pid, isNativeInject, false); + int32_t result = servermsghandler.OnInjectPointerEvent(pointerEvent, pid, isNativeInject, false, + PointerEvent::DISPLAY_COORDINATE); EXPECT_EQ(result, COMMON_PERMISSION_CHECK_ERROR); } @@ -542,19 +543,19 @@ HWTEST_F(ServerMsgHandlerTest, ServerMsgHandlerTest_OnInjectPointerEventExt_001, CALL_TEST_DEBUG; ServerMsgHandler handler; std::shared_ptr pointerEvent = nullptr; - int32_t ret = handler.OnInjectPointerEventExt(pointerEvent, false); + int32_t ret = handler.OnInjectPointerEventExt(pointerEvent, false, false); EXPECT_EQ(ret, ERROR_NULL_POINTER); pointerEvent = PointerEvent::Create(); EXPECT_NE(pointerEvent, nullptr); int32_t sourceType = PointerEvent::SOURCE_TYPE_TOUCHSCREEN; - ret = handler.OnInjectPointerEventExt(pointerEvent, false); + ret = handler.OnInjectPointerEventExt(pointerEvent, false, false); EXPECT_EQ(ret, ERROR_NULL_POINTER); sourceType = PointerEvent::SOURCE_TYPE_MOUSE; - EXPECT_NO_FATAL_FAILURE(handler.OnInjectPointerEventExt(pointerEvent, false)); + EXPECT_NO_FATAL_FAILURE(handler.OnInjectPointerEventExt(pointerEvent, false, false)); sourceType = PointerEvent::SOURCE_TYPE_JOYSTICK; - EXPECT_NO_FATAL_FAILURE(handler.OnInjectPointerEventExt(pointerEvent, false)); + EXPECT_NO_FATAL_FAILURE(handler.OnInjectPointerEventExt(pointerEvent, false, false)); sourceType = PointerEvent::SOURCE_TYPE_TOUCHPAD; - EXPECT_NO_FATAL_FAILURE(handler.OnInjectPointerEventExt(pointerEvent, false)); + EXPECT_NO_FATAL_FAILURE(handler.OnInjectPointerEventExt(pointerEvent, false, false)); } /** @@ -1378,22 +1379,22 @@ HWTEST_F(ServerMsgHandlerTest, ServerMsgHandlerTest_OnInjectPointerEventExt, Tes pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_UNKNOWN); pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN); msgHandler.nativeTargetWindowIds_.insert(std::make_pair(pointerEvent->GetPointerId(), 10)); - EXPECT_NE(msgHandler.OnInjectPointerEventExt(pointerEvent, false), RET_ERR); + EXPECT_NE(msgHandler.OnInjectPointerEventExt(pointerEvent, false, false), RET_ERR); pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE); pointerEvent->SetPointerId(1); pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE); pointerEvent->bitwise_ = InputEvent::EVENT_FLAG_RAW_POINTER_MOVEMENT; - EXPECT_NE(msgHandler.OnInjectPointerEventExt(pointerEvent, false), RET_ERR); + EXPECT_NE(msgHandler.OnInjectPointerEventExt(pointerEvent, false, false), RET_ERR); pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_JOYSTICK); pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE); pointerEvent->AddFlag(InputEvent::EVENT_FLAG_NONE); - EXPECT_NE(msgHandler.OnInjectPointerEventExt(pointerEvent, false), RET_OK); + EXPECT_NE(msgHandler.OnInjectPointerEventExt(pointerEvent, false, false), RET_OK); pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHPAD); pointerEvent->bitwise_ = InputEvent::EVENT_FLAG_HIDE_POINTER; - EXPECT_NE(msgHandler.OnInjectPointerEventExt(pointerEvent, false), RET_OK); + EXPECT_NE(msgHandler.OnInjectPointerEventExt(pointerEvent, false, false), RET_OK); } /** @@ -1570,7 +1571,8 @@ HWTEST_F(ServerMsgHandlerTest, ServerMsgHandlerTest_OnInjectPointerEvent_002, Te pointerEvent->eventType_ = 1; pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_UNKNOWN); msgHandler.authorizationCollection_.insert(std::make_pair(pid, AuthorizationStatus::UNAUTHORIZED)); - EXPECT_EQ(msgHandler.OnInjectPointerEvent(pointerEvent, pid, isNativeInject, false), COMMON_PERMISSION_CHECK_ERROR); + EXPECT_EQ(msgHandler.OnInjectPointerEvent(pointerEvent, pid, isNativeInject, false, + PointerEvent::DISPLAY_COORDINATE), COMMON_PERMISSION_CHECK_ERROR); } /** @@ -1593,7 +1595,8 @@ HWTEST_F(ServerMsgHandlerTest, ServerMsgHandlerTest_OnInjectPointerEvent_003, Te pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_UNKNOWN); msgHandler.authorizationCollection_.insert(std::make_pair(pid, AuthorizationStatus::UNKNOWN)); InputHandler->eventNormalizeHandler_ = std::make_shared(); - EXPECT_NE(msgHandler.OnInjectPointerEvent(pointerEvent, pid, isNativeInject, false), RET_OK); + EXPECT_NE(msgHandler.OnInjectPointerEvent(pointerEvent, pid, isNativeInject, false, + PointerEvent::DISPLAY_COORDINATE), RET_OK); } /** @@ -1614,7 +1617,8 @@ HWTEST_F(ServerMsgHandlerTest, ServerMsgHandlerTest_OnInjectPointerEvent_004, Te pointerEvent->eventType_ = 1; pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_UNKNOWN); InputHandler->eventNormalizeHandler_ = std::make_shared(); - EXPECT_NE(msgHandler.OnInjectPointerEvent(pointerEvent, pid, isNativeInject, false), RET_OK); + EXPECT_NE(msgHandler.OnInjectPointerEvent(pointerEvent, pid, isNativeInject, false, + PointerEvent::DISPLAY_COORDINATE), RET_OK); } /** @@ -1830,14 +1834,11 @@ HWTEST_F(ServerMsgHandlerTest, ServerMsgHandlerTest_OnDisplayInfo, TestSize.Leve int32_t num = 1; SessionPtr sess = std::make_shared(PROGRAM_NAME, g_moduleType, g_writeFd, UID_ROOT, g_pid); NetPacket pkt(MmiMessageId::DISPLAY_INFO); - DisplayGroupInfo displayGroupInfo { - .width = 100, - .height = 100, + OLD::DisplayGroupInfo displayGroupInfo { .focusWindowId = 10, .currentUserId = 20, }; - pkt << displayGroupInfo.width << displayGroupInfo.height - << displayGroupInfo.focusWindowId << displayGroupInfo.currentUserId << num; + pkt << displayGroupInfo.focusWindowId << displayGroupInfo.currentUserId << num; pkt.rwErrorStatus_ = CircleStreamBuffer::ErrorStatus::ERROR_STATUS_WRITE; EXPECT_EQ(handler.OnDisplayInfo(sess, pkt), RET_ERR); } @@ -2195,14 +2196,11 @@ HWTEST_F(ServerMsgHandlerTest, ServerMsgHandlerTest_OnDisplayInfo_001, TestSize. SessionPtr sess = std::make_shared(PROGRAM_NAME, g_moduleType, g_writeFd, UID_ROOT, g_pid); sess->SetTokenType(TOKEN_HAP); NetPacket pkt(MmiMessageId::DISPLAY_INFO); - DisplayGroupInfo displayGroupInfo { - .width = 100, - .height = 100, + OLD::DisplayGroupInfo displayGroupInfo { .focusWindowId = 10, .currentUserId = 20, }; - pkt << displayGroupInfo.width << displayGroupInfo.height - << displayGroupInfo.focusWindowId << displayGroupInfo.currentUserId << num; + pkt << displayGroupInfo.focusWindowId << displayGroupInfo.currentUserId << num; pkt.rwErrorStatus_ = CircleStreamBuffer::ErrorStatus::ERROR_STATUS_WRITE; EXPECT_EQ(handler.OnDisplayInfo(sess, pkt), RET_ERR); } @@ -2221,14 +2219,11 @@ HWTEST_F(ServerMsgHandlerTest, ServerMsgHandlerTest_OnDisplayInfo_002, TestSize. SessionPtr sess = std::make_shared(PROGRAM_NAME, g_moduleType, g_writeFd, UID_ROOT, g_pid); sess->SetTokenType(TOKEN_NATIVE); NetPacket pkt(MmiMessageId::DISPLAY_INFO); - DisplayGroupInfo displayGroupInfo { - .width = 100, - .height = 100, + OLD::DisplayGroupInfo displayGroupInfo { .focusWindowId = 10, .currentUserId = 20, }; - pkt << displayGroupInfo.width << displayGroupInfo.height - << displayGroupInfo.focusWindowId << displayGroupInfo.currentUserId << num; + pkt << displayGroupInfo.focusWindowId << displayGroupInfo.currentUserId << num; pkt.rwErrorStatus_ = CircleStreamBuffer::ErrorStatus::ERROR_STATUS_OK; EXPECT_EQ(handler.OnDisplayInfo(sess, pkt), RET_ERR); } @@ -2247,14 +2242,11 @@ HWTEST_F(ServerMsgHandlerTest, ServerMsgHandlerTest_OnDisplayInfo_003, TestSize. SessionPtr sess = std::make_shared(PROGRAM_NAME, g_moduleType, g_writeFd, UID_ROOT, g_pid); sess->SetTokenType(TOKEN_SYSTEM_HAP); NetPacket pkt(MmiMessageId::DISPLAY_INFO); - DisplayGroupInfo displayGroupInfo { - .width = 100, - .height = 100, + OLD::DisplayGroupInfo displayGroupInfo { .focusWindowId = 10, .currentUserId = 20, }; - pkt << displayGroupInfo.width << displayGroupInfo.height - << displayGroupInfo.focusWindowId << displayGroupInfo.currentUserId << num; + pkt << displayGroupInfo.focusWindowId << displayGroupInfo.currentUserId << num; pkt.rwErrorStatus_ = CircleStreamBuffer::ErrorStatus::ERROR_STATUS_READ; EXPECT_EQ(handler.OnDisplayInfo(sess, pkt), RET_ERR); } @@ -2274,14 +2266,11 @@ HWTEST_F(ServerMsgHandlerTest, ServerMsgHandlerTest_OnDisplayInfo_004, TestSize. sess->SetTokenType(TOKEN_SHELL); NetPacket pkt(MmiMessageId::DISPLAY_INFO); pkt.rwErrorStatus_ = CircleStreamBuffer::ErrorStatus::ERROR_STATUS_OK; - DisplayGroupInfo displayGroupInfo { - .width = 100, - .height = 100, + OLD::DisplayGroupInfo displayGroupInfo { .focusWindowId = 10, .currentUserId = 20, }; - pkt << displayGroupInfo.width << displayGroupInfo.height - << displayGroupInfo.focusWindowId << displayGroupInfo.currentUserId << num; + pkt << displayGroupInfo.focusWindowId << displayGroupInfo.currentUserId << num; Rect rec = { 1, 1, 1, 1 }; std::vector recVec = { rec, rec }; std::vector pChangeAreas = { 1, 1, 1 }; @@ -2619,7 +2608,8 @@ HWTEST_F(ServerMsgHandlerTest, ServerMsgHandlerTest_OnInjectPointerEvent_005, Te pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_UNKNOWN); msgHandler.authorizationCollection_.insert(std::make_pair(pid, AuthorizationStatus::UNKNOWN)); InputHandler->eventNormalizeHandler_ = std::make_shared(); - int32_t result = msgHandler.OnInjectPointerEvent(pointerEvent, pid, isNativeInject, false); + int32_t result = msgHandler.OnInjectPointerEvent(pointerEvent, pid, isNativeInject, false, + PointerEvent::DISPLAY_COORDINATE); EXPECT_EQ(result, COMMON_PERMISSION_CHECK_ERROR); } @@ -2984,22 +2974,22 @@ HWTEST_F(ServerMsgHandlerTest, ServerMsgHandlerTest_OnInjectPointerEventExt002, pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_UNKNOWN); pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHSCREEN); msgHandler.nativeTargetWindowIds_.insert(std::make_pair(pointerEvent->GetPointerId(), 10)); - ASSERT_NO_FATAL_FAILURE(msgHandler.OnInjectPointerEventExt(pointerEvent, true)); + ASSERT_NO_FATAL_FAILURE(msgHandler.OnInjectPointerEventExt(pointerEvent, true, false)); pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE); pointerEvent->SetPointerId(1); pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE); pointerEvent->bitwise_ = InputEvent::EVENT_FLAG_RAW_POINTER_MOVEMENT; - ASSERT_NO_FATAL_FAILURE(msgHandler.OnInjectPointerEventExt(pointerEvent, true)); + ASSERT_NO_FATAL_FAILURE(msgHandler.OnInjectPointerEventExt(pointerEvent, true, false)); pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_JOYSTICK); pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE); pointerEvent->AddFlag(InputEvent::EVENT_FLAG_NONE); - ASSERT_NO_FATAL_FAILURE(msgHandler.OnInjectPointerEventExt(pointerEvent, true)); + ASSERT_NO_FATAL_FAILURE(msgHandler.OnInjectPointerEventExt(pointerEvent, true, false)); pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_TOUCHPAD); pointerEvent->bitwise_ = InputEvent::EVENT_FLAG_HIDE_POINTER; - ASSERT_NO_FATAL_FAILURE(msgHandler.OnInjectPointerEventExt(pointerEvent, true)); + ASSERT_NO_FATAL_FAILURE(msgHandler.OnInjectPointerEventExt(pointerEvent, true, false)); } /** diff --git a/service/module_loader/include/mmi_service.h b/service/module_loader/include/mmi_service.h index 05c355fcec..fe09f36c5c 100644 --- a/service/module_loader/include/mmi_service.h +++ b/service/module_loader/include/mmi_service.h @@ -142,7 +142,7 @@ public: ErrCode UnsubscribetabletProximity(int32_t subscribeId) override; ErrCode SubscribeLongPressEvent(int32_t subscribeId, const LongPressRequest &longPressRequest) override; ErrCode UnsubscribeLongPressEvent(int32_t subscribeId) override; - ErrCode InjectPointerEvent(const PointerEvent& pointerEvent, bool isNativeInject) override; + ErrCode InjectPointerEvent(const PointerEvent& pointerEvent, bool isNativeInject, int32_t useCoordinate) override; ErrCode InjectTouchPadEvent(const PointerEvent& pointerEvent, const TouchpadCDG& touchpadCDG, bool isNativeInject) override; ErrCode SetAnrObserver() override; @@ -298,7 +298,7 @@ protected: int32_t OnGetKeyState(std::vector &pressedKeys, std::unordered_map &specialKeysState); #endif // OHOS_BUILD_ENABLE_KEYBOARD int32_t CheckInjectPointerEvent(const std::shared_ptr pointerEvent, - int32_t pid, bool isNativeInject, bool isShell); + int32_t pid, bool isNativeInject, bool isShell, int32_t useCoordinate); int32_t CheckTouchPadEvent(const std::shared_ptr pointerEvent, int32_t pid, const TouchpadCDG &touchpadCDG, bool isNativeInject, bool isShell); bool InitLibinputService(); diff --git a/service/module_loader/src/mmi_service.cpp b/service/module_loader/src/mmi_service.cpp index 3ff4f18603..ba8317354d 100644 --- a/service/module_loader/src/mmi_service.cpp +++ b/service/module_loader/src/mmi_service.cpp @@ -2142,12 +2142,12 @@ int32_t MMIService::OnGetKeyState(std::vector &pressedKeys, #endif // OHOS_BUILD_ENABLE_KEYBOARD int32_t MMIService::CheckInjectPointerEvent(const std::shared_ptr pointerEvent, - int32_t pid, bool isNativeInject, bool isShell) + int32_t pid, bool isNativeInject, bool isShell, int32_t useCoordinate) { #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) CHKPR(pointerEvent, ERROR_NULL_POINTER); LogTracer lt(pointerEvent->GetId(), pointerEvent->GetEventType(), pointerEvent->GetPointerAction()); - return sMsgHandler_.OnInjectPointerEvent(pointerEvent, pid, isNativeInject, isShell); + return sMsgHandler_.OnInjectPointerEvent(pointerEvent, pid, isNativeInject, isShell, useCoordinate); #else return RET_OK; #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH @@ -2165,7 +2165,7 @@ int32_t MMIService::CheckTouchPadEvent(const std::shared_ptr point #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH } -ErrCode MMIService::InjectPointerEvent(const PointerEvent& pointerEvent, bool isNativeInject) +ErrCode MMIService::InjectPointerEvent(const PointerEvent& pointerEvent, bool isNativeInject, int32_t useCoordinate) { CALL_DEBUG_ENTER; if (!IsRunning()) { @@ -2186,8 +2186,8 @@ ErrCode MMIService::InjectPointerEvent(const PointerEvent& pointerEvent, bool is ret = InjectPointerEventExt(pointerEventPtr, pid, isNativeInject, isShell); #else ret = delegateTasks_.PostSyncTask( - [this, pointerEventPtr, pid, isNativeInject, isShell] { - return this->CheckInjectPointerEvent(pointerEventPtr, pid, isNativeInject, isShell); + [this, pointerEventPtr, pid, isNativeInject, isShell, useCoordinate] { + return this->CheckInjectPointerEvent(pointerEventPtr, pid, isNativeInject, isShell, useCoordinate); } ); #endif // OHOS_BUILD_ENABLE_ANCO diff --git a/service/mouse_event_normalize/include/mouse_transform_processor.h b/service/mouse_event_normalize/include/mouse_transform_processor.h index 2412f87ea5..6444032ed4 100644 --- a/service/mouse_event_normalize/include/mouse_transform_processor.h +++ b/service/mouse_event_normalize/include/mouse_transform_processor.h @@ -22,7 +22,7 @@ #include "timer_manager.h" #include "pointer_event.h" #include "touchpad_control_display_gain.h" -#include "window_info.h" +#include "old_display_info.h" #include namespace OHOS { @@ -120,9 +120,9 @@ private: bool HandlePostInner(struct libinput_event_pointer* data, PointerEvent::PointerItem &pointerItem); void HandleTouchPadAxisState(libinput_pointer_axis_source source, int32_t& direction, bool& tpScrollSwitch); void HandleTouchPadButton(enum libinput_button_state state, int32_t type); - int32_t UpdateMouseMoveLocation(const DisplayInfo* displayInfo, Offset &offset, + int32_t UpdateMouseMoveLocation(const OLD::DisplayInfo* displayInfo, Offset &offset, double &abs_x, double &abs_y, int32_t deviceType); - int32_t UpdateTouchpadMoveLocation(const DisplayInfo* displayInfo, struct libinput_event* event, + int32_t UpdateTouchpadMoveLocation(const OLD::DisplayInfo* displayInfo, struct libinput_event* event, Offset &offset, double &abs_x, double &abs_y, int32_t deviceType); #ifndef OHOS_BUILD_ENABLE_WATCH void HandleTouchpadRightButton(struct libinput_event_pointer* data, const int32_t evenType, uint32_t &button); @@ -135,9 +135,9 @@ private: void TransTouchpadRightButton(struct libinput_event_pointer* data, const int32_t type, uint32_t &button); 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 CalculateOffset(const OLD::DisplayInfo* displayInfo, Offset &offset); + bool IsWindowRotation(const OLD::DisplayInfo* displayInfo); + Direction GetDisplayDirection(const OLD::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 a5667daf98..e8d143673e 100644 --- a/service/mouse_event_normalize/src/mouse_transform_processor.cpp +++ b/service/mouse_event_normalize/src/mouse_transform_processor.cpp @@ -113,7 +113,7 @@ std::shared_ptr MouseTransformProcessor::GetPointerEvent() const } #ifdef OHOS_BUILD_EMULATOR -static Coordinate2D CalculateCursorPosFromOffset(Offset offset, const DisplayInfo &displayInfo) +static Coordinate2D CalculateCursorPosFromOffset(Offset offset, const OLD::DisplayInfo &displayInfo) { auto direction = displayInfo.displayDirection; auto width = displayInfo.width; @@ -204,7 +204,7 @@ int32_t MouseTransformProcessor::HandleMotionInner(struct libinput_event_pointer return RET_OK; } -int32_t MouseTransformProcessor::UpdateMouseMoveLocation(const DisplayInfo* displayInfo, Offset &offset, +int32_t MouseTransformProcessor::UpdateMouseMoveLocation(const OLD::DisplayInfo* displayInfo, Offset &offset, double &abs_x, double &abs_y, int32_t deviceType) { CHKPR(displayInfo, ERROR_NULL_POINTER); @@ -261,7 +261,7 @@ int32_t MouseTransformProcessor::UpdateMouseMoveLocation(const DisplayInfo* disp } } -int32_t MouseTransformProcessor::UpdateTouchpadMoveLocation(const DisplayInfo* displayInfo, +int32_t MouseTransformProcessor::UpdateTouchpadMoveLocation(const OLD::DisplayInfo* displayInfo, struct libinput_event* event, Offset &offset, double &abs_x, double &abs_y, int32_t deviceType) { CHKPR(displayInfo, ERROR_NULL_POINTER); @@ -410,7 +410,7 @@ void MouseTransformProcessor::HandleReportMouseResponseTime( MMI_HILOGI("Mouse write end , ret:%{public}d", ret); } -bool MouseTransformProcessor::IsWindowRotation(const DisplayInfo* displayInfo) +bool MouseTransformProcessor::IsWindowRotation(const OLD::DisplayInfo* displayInfo) { MMI_HILOGD("ROTATE_POLICY: %{public}d, FOLDABLE_DEVICE_POLICY:%{public}s", ROTATE_POLICY, FOLDABLE_DEVICE_POLICY.c_str()); @@ -430,7 +430,7 @@ bool MouseTransformProcessor::IsWindowRotation(const DisplayInfo* displayInfo) (displayInfo->displayMode == DisplayMode::FULL && foldableDevicePolicyFull)))); } -Direction MouseTransformProcessor::GetDisplayDirection(const DisplayInfo *displayInfo) +Direction MouseTransformProcessor::GetDisplayDirection(const OLD::DisplayInfo *displayInfo) { Direction displayDirection = DIRECTION0; if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) { @@ -448,7 +448,7 @@ Direction MouseTransformProcessor::GetDisplayDirection(const DisplayInfo *displa return displayDirection; } -void MouseTransformProcessor::CalculateOffset(const DisplayInfo *displayInfo, Offset &offset) +void MouseTransformProcessor::CalculateOffset(const OLD::DisplayInfo* displayInfo, Offset &offset) { #ifndef OHOS_BUILD_EMULATOR if (Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) { diff --git a/service/mouse_event_normalize/test/src/mouse_transform_processor_test.cpp b/service/mouse_event_normalize/test/src/mouse_transform_processor_test.cpp index 02669501f3..7965f82c11 100644 --- a/service/mouse_event_normalize/test/src/mouse_transform_processor_test.cpp +++ b/service/mouse_event_normalize/test/src/mouse_transform_processor_test.cpp @@ -633,7 +633,7 @@ HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_CalculateOffse int32_t deviceId = 0; MouseTransformProcessor processor(deviceId); Offset offset; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.direction = DIRECTION90; displayInfo.displayDirection = DIRECTION0; ASSERT_NO_FATAL_FAILURE(processor.CalculateOffset(&displayInfo, offset)); @@ -650,7 +650,7 @@ HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_CalculateOffse int32_t deviceId = 0; MouseTransformProcessor processor(deviceId); Offset offset; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.direction = DIRECTION180; displayInfo.displayDirection = DIRECTION0; ASSERT_NO_FATAL_FAILURE(processor.CalculateOffset(&displayInfo, offset)); @@ -667,7 +667,7 @@ HWTEST_F(MouseTransformProcessorTest, MouseTransformProcessorTest_CalculateOffse int32_t deviceId = 0; MouseTransformProcessor processor(deviceId); Offset offset; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.direction = DIRECTION270; displayInfo.displayDirection = DIRECTION0; ASSERT_NO_FATAL_FAILURE(processor.CalculateOffset(&displayInfo, offset)); diff --git a/service/touch_event_normalize/include/touch_transform_processor.h b/service/touch_event_normalize/include/touch_transform_processor.h index bce7e6efb4..dbe6837349 100644 --- a/service/touch_event_normalize/include/touch_transform_processor.h +++ b/service/touch_event_normalize/include/touch_transform_processor.h @@ -40,7 +40,7 @@ private: int32_t GetTouchToolType(struct libinput_device *device); void TransformTouchProperties(TouchType &rawTouch, PointerEvent::PointerItem &pointerItem); void NotifyFingersenseProcess(PointerEvent::PointerItem &pointerItem, int32_t &toolType); - void UpdatePointerItemProperties(PointerEvent::PointerItem &item, EventTouch &touchInfo); + void UpdatePointerItemByTouchInfo(PointerEvent::PointerItem &item, EventTouch &touchInfo); void InitToolTypes(); bool DumpInner(); private: diff --git a/service/touch_event_normalize/src/touch_transform_processor.cpp b/service/touch_event_normalize/src/touch_transform_processor.cpp index 6fb3184e64..804ec8bcf3 100644 --- a/service/touch_event_normalize/src/touch_transform_processor.cpp +++ b/service/touch_event_normalize/src/touch_transform_processor.cpp @@ -116,7 +116,7 @@ bool TouchTransformProcessor::OnEventTouchDown(struct libinput_event *event) item.SetPointerId(seatSlot); item.SetDownTime(time); item.SetPressed(true); - UpdatePointerItemProperties(item, touchInfo); + UpdatePointerItemByTouchInfo(item, touchInfo); item.SetDeviceId(deviceId_); int32_t toolType = GetTouchToolType(touch, device); #ifdef OHOS_BUILD_ENABLE_FINGERSENSE_WRAPPER @@ -135,11 +135,13 @@ bool TouchTransformProcessor::OnEventTouchDown(struct libinput_event *event) return true; } -void TouchTransformProcessor::UpdatePointerItemProperties(PointerEvent::PointerItem &item, EventTouch &touchInfo) +void TouchTransformProcessor::UpdatePointerItemByTouchInfo(PointerEvent::PointerItem &item, EventTouch &touchInfo) { CALL_DEBUG_ENTER; item.SetDisplayX(touchInfo.point.x); item.SetDisplayY(touchInfo.point.y); + item.SetGlobalX(touchInfo.globalCoord.x); + item.SetGlobalY(touchInfo.globalCoord.y); item.SetDisplayXPos(touchInfo.coordF.x); item.SetDisplayYPos(touchInfo.coordF.y); item.SetRawDisplayX(touchInfo.point.x); @@ -221,16 +223,7 @@ bool TouchTransformProcessor::OnEventTouchMotion(struct libinput_event *event) item.SetPressure(pressure); item.SetLongAxis(longAxis); item.SetShortAxis(shortAxis); - item.SetDisplayX(touchInfo.point.x); - item.SetDisplayY(touchInfo.point.y); - item.SetDisplayXPos(touchInfo.coordF.x); - item.SetDisplayYPos(touchInfo.coordF.y); - item.SetRawDisplayX(touchInfo.point.x); - item.SetRawDisplayY(touchInfo.point.y); - item.SetToolDisplayX(touchInfo.toolRect.point.x); - item.SetToolDisplayY(touchInfo.toolRect.point.y); - item.SetToolWidth(touchInfo.toolRect.width); - item.SetToolHeight(touchInfo.toolRect.height); + UpdatePointerItemByTouchInfo(item, touchInfo); pointerEvent_->UpdatePointerItem(seatSlot, item); pointerEvent_->SetPointerId(seatSlot); pointerEvent_->ClearFlag(InputEvent::EVENT_FLAG_ACCESSIBILITY); diff --git a/service/touch_event_normalize/test/src/touch_event_normalize_test.cpp b/service/touch_event_normalize/test/src/touch_event_normalize_test.cpp index 0945fbad76..d7155a3a73 100644 --- a/service/touch_event_normalize/test/src/touch_event_normalize_test.cpp +++ b/service/touch_event_normalize/test/src/touch_event_normalize_test.cpp @@ -73,7 +73,7 @@ void TouchEventNormalizeTest::TearDown() /** * @tc.name: TouchTransformProcessorTest_UpdatePointerItemProperties - * @tc.desc: Test UpdatePointerItemProperties + * @tc.desc: Test UpdatePointerItemByTouchInfo * @tc.type: FUNC * @tc.require: */ @@ -90,7 +90,7 @@ HWTEST_F(TouchTransformProcessorTest, TouchTransformProcessorTest_UpdatePointerI touchInfo.toolRect.point.y = 600; touchInfo.toolRect.width = 720; touchInfo.toolRect.height = 1000; - ASSERT_NO_FATAL_FAILURE(touchTransformProcessor.UpdatePointerItemProperties(item, touchInfo)); + ASSERT_NO_FATAL_FAILURE(touchTransformProcessor.UpdatePointerItemByTouchInfo(item, touchInfo)); } /** diff --git a/service/touch_event_normalize/test/src/touch_transform_processor_test.cpp b/service/touch_event_normalize/test/src/touch_transform_processor_test.cpp index f0aed38929..6dc46b8372 100644 --- a/service/touch_event_normalize/test/src/touch_transform_processor_test.cpp +++ b/service/touch_event_normalize/test/src/touch_transform_processor_test.cpp @@ -127,7 +127,7 @@ HWTEST_F(TouchTransformProcessorTest, OnEventTouchDown_001, TestSize.Level1) /** * @tc.name: TouchTransformProcessorTest_UpdatePointerItemProperties_001 - * @tc.desc: Test the funcation UpdatePointerItemProperties + * @tc.desc: Test the funcation UpdatePointerItemByTouchInfo * @tc.type: FUNC * @tc.require: */ @@ -143,7 +143,7 @@ HWTEST_F(TouchTransformProcessorTest, UpdatePointerItemProperties_001, TestSize. touchInfo.toolRect.height = 60; int32_t deviceId = 6; TouchTransformProcessor processor(deviceId); - processor.UpdatePointerItemProperties(item, touchInfo); + processor.UpdatePointerItemByTouchInfo(item, touchInfo); ASSERT_EQ(item.GetDisplayX(), touchInfo.point.x); ASSERT_EQ(item.GetDisplayY(), touchInfo.point.y); ASSERT_EQ(item.GetDisplayXPos(), touchInfo.point.x); diff --git a/service/window_manager/include/cursor_drawing_component.h b/service/window_manager/include/cursor_drawing_component.h index 88b1751e7d..55e06fb6fe 100644 --- a/service/window_manager/include/cursor_drawing_component.h +++ b/service/window_manager/include/cursor_drawing_component.h @@ -34,8 +34,8 @@ public: void DrawPointer(int32_t displayId, int32_t physicalX, int32_t physicalY, const PointerStyle pointerStyle, Direction direction); - void UpdateDisplayInfo(const DisplayInfo &displayInfo); - void OnDisplayInfo(const DisplayGroupInfo &displayGroupInfo); + void UpdateDisplayInfo(const OLD::DisplayInfo &displayInfo); + void OnDisplayInfo(const OLD::DisplayGroupInfo &displayGroupInfo); void OnWindowInfo(const WinInfo &info); bool Init(); void DeletePointerVisible(int32_t pid); @@ -69,7 +69,7 @@ public: void InitScreenInfo(); int32_t EnableHardwareCursorStats(int32_t pid, bool enable); int32_t GetHardwareCursorStats(int32_t pid, uint32_t &frameCount, uint32_t &vsyncCount); - DisplayInfo GetCurrentDisplayInfo(); + OLD::DisplayInfo GetCurrentDisplayInfo(); void ForceClearPointerVisiableStatus(); void InitPointerObserver(); void OnSessionLost(int32_t pid); diff --git a/service/window_manager/include/i_input_windows_manager.h b/service/window_manager/include/i_input_windows_manager.h index 32081a1c2a..97a2da9b1d 100644 --- a/service/window_manager/include/i_input_windows_manager.h +++ b/service/window_manager/include/i_input_windows_manager.h @@ -32,7 +32,7 @@ #include "touch_gesture_manager.h" #endif // defined(OHOS_BUILD_ENABLE_TOUCH) && defined(OHOS_BUILD_ENABLE_MONITOR) #include "uds_server.h" -#include "window_info.h" +#include "old_display_info.h" #include "shift_info.h" namespace OHOS { @@ -75,8 +75,9 @@ public: 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; - virtual void UpdateDisplayInfoExtIfNeed(DisplayGroupInfo &displayGroupInfo, bool needUpdateDisplayExt) = 0; + virtual void UpdateDisplayInfo(OLD::DisplayGroupInfo &displayGroupInfo) = 0; + virtual void UpdateDisplayInfoExtIfNeed(OLD::DisplayGroupInfo &displayGroupInfo, bool needUpdateDisplayExt) = 0; + virtual void ProcessInjectEventGlobalXY(std::shared_ptr pointerEvent, int32_t useCoordinate) = 0; virtual void UpdateWindowInfo(const WindowGroupInfo &windowGroupInfo) = 0; virtual int32_t ClearWindowPointerStyle(int32_t pid, int32_t windowId) = 0; virtual void Dump(int32_t fd, const std::vector &args) = 0; @@ -91,7 +92,7 @@ public: virtual const std::vector GetWindowGroupInfoByDisplayIdCopy(int32_t displayId) const = 0; virtual std::pair TransformWindowXY(const WindowInfo &, double, double) const = 0; virtual void ClearTargetWindowId(int32_t pointerId) = 0; - virtual std::pair TransformDisplayXY(const DisplayInfo &info, + virtual std::pair TransformDisplayXY(const OLD::DisplayInfo &info, double logicX, double logicY) const = 0; virtual int32_t SetPixelMapData(int32_t infoId, void *pixelMap) = 0; virtual int32_t GetCurrentUserId() = 0; @@ -139,7 +140,7 @@ public: EventTouch& touchInfo, int32_t& targetDisplayId, bool isNeedClear = false) = 0; virtual bool CalculateTipPoint(struct libinput_event_tablet_tool* tip, int32_t& targetDisplayId, PhysicalCoordinate& coord) = 0; - virtual const std::shared_ptr GetDefaultDisplayInfo() const = 0; + virtual const std::shared_ptr GetDefaultDisplayInfo() const = 0; virtual void ReverseXY(int32_t &x, int32_t &y) = 0; virtual void FoldScreenRotation(std::shared_ptr pointerEvent) = 0; virtual void SendCancelEventWhenLock() = 0; @@ -148,7 +149,7 @@ public: #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) virtual void DrawTouchGraphic(std::shared_ptr pointerEvent) = 0; virtual int32_t UpdateTargetPointer(std::shared_ptr pointerEvent) = 0; - virtual const std::shared_ptr GetPhysicalDisplay(int32_t id) const = 0; + virtual const std::shared_ptr GetPhysicalDisplay(int32_t id) const = 0; #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) @@ -172,7 +173,7 @@ 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; + virtual Direction GetDisplayDirection(const OLD::DisplayInfo *displayInfo) = 0; #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH #if defined(OHOS_BUILD_ENABLE_TOUCH) && defined(OHOS_BUILD_ENABLE_MONITOR) virtual void AttachTouchGestureMgr(std::shared_ptr touchGestureMgr) = 0; @@ -181,7 +182,7 @@ public: #ifdef OHOS_BUILD_ENABLE_TOUCH virtual std::shared_ptr GetLastPointerEventForGesture() = 0; #endif // OHOS_BUILD_ENABLE_TOUCH - virtual std::pair CalcDrawCoordinate(const DisplayInfo& displayInfo, + virtual std::pair CalcDrawCoordinate(const OLD::DisplayInfo& displayInfo, PointerEvent::PointerItem pointerItem) = 0; virtual void SwitchTouchTracking(bool touchTracking) = 0; @@ -197,4 +198,4 @@ private: #define WIN_MGR ::OHOS::MMI::IInputWindowsManager::GetInstance() } // namespace MMI } // namespace OHOS -#endif // I_INPUT_WINDOWS_MANAGER_H +#endif // I_INPUT_WINDOWS_MANAGER_H \ No newline at end of file diff --git a/service/window_manager/include/i_pointer_drawing_manager.h b/service/window_manager/include/i_pointer_drawing_manager.h index f271234715..17282f2d23 100644 --- a/service/window_manager/include/i_pointer_drawing_manager.h +++ b/service/window_manager/include/i_pointer_drawing_manager.h @@ -17,7 +17,7 @@ #define I_POINTER_DRAWING_MANAGER_H #include "pointer_style.h" -#include "window_info.h" +#include "old_display_info.h" #include "delegate_interface.h" namespace OHOS { @@ -28,10 +28,10 @@ public: virtual ~IPointerDrawingManager() = default; static IPointerDrawingManager* GetInstance(); - virtual void DrawPointer(int32_t displayId, int32_t physicalX, int32_t physicalY, + virtual void DrawPointer(int32_t rsId, int32_t physicalX, int32_t physicalY, const PointerStyle pointerStyle, Direction direction) {} - virtual void UpdateDisplayInfo(const DisplayInfo& displayInfo) {} - virtual void OnDisplayInfo(const DisplayGroupInfo& displayGroupInfo) {} + virtual void UpdateDisplayInfo(const OLD::DisplayInfo& displayInfo) {} + virtual void OnDisplayInfo(const OLD::DisplayGroupInfo& displayGroupInfo) {} virtual void OnWindowInfo(const WinInfo &info) {} virtual bool Init() { @@ -128,7 +128,7 @@ public: { return 0; } - virtual void DrawMovePointer(int32_t displayId, int32_t physicalX, int32_t physicalY) {} + virtual void DrawMovePointer(int32_t rsId, int32_t physicalX, int32_t physicalY) {} virtual void Dump(int32_t fd, const std::vector &args) {} virtual void InitPointerCallback() {} virtual void InitScreenInfo() {} @@ -140,7 +140,7 @@ public: { return 0; } - virtual DisplayInfo GetCurrentDisplayInfo() + virtual OLD::DisplayInfo GetCurrentDisplayInfo() { return {}; } @@ -166,7 +166,7 @@ public: virtual void DrawScreenCenterPointer(const PointerStyle &pointerStyle) {} virtual void SubscribeScreenModeChange() {} virtual int32_t UpdateMouseLayer(const PointerStyle& pointerStyle, - int32_t displayId, int32_t physicalX, int32_t physicalY) + int32_t physicalX, int32_t physicalY) { return 0; } diff --git a/service/window_manager/include/input_windows_manager.h b/service/window_manager/include/input_windows_manager.h index 829d49debb..b1dfca2562 100644 --- a/service/window_manager/include/input_windows_manager.h +++ b/service/window_manager/include/input_windows_manager.h @@ -68,14 +68,15 @@ public: 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); + void UpdateCaptureMode(const OLD::DisplayGroupInfo &displayGroupInfo); bool IsFocusedSession(int32_t session) const; - void UpdateDisplayInfo(DisplayGroupInfo &displayGroupInfo); - void UpdateDisplayInfoExtIfNeed(DisplayGroupInfo &displayGroupInfo, bool needUpdateDisplayExt); + void UpdateDisplayInfo(OLD::DisplayGroupInfo &displayGroupInfo); + void UpdateDisplayInfoExtIfNeed(OLD::DisplayGroupInfo &displayGroupInfo, bool needUpdateDisplayExt); void UpdateWindowInfo(const WindowGroupInfo &windowGroupInfo); + void ProcessInjectEventGlobalXY(std::shared_ptr pointerEvent, int32_t useCoordinate); int32_t ClearWindowPointerStyle(int32_t pid, int32_t windowId); void Dump(int32_t fd, const std::vector &args); - void DumpDisplayInfo(int32_t fd, const std::vector& displaysInfo); + void DumpDisplayInfo(int32_t fd, const std::vector& displaysInfo); int32_t GetWindowPid(int32_t windowId, const std::vector &windowsInfo) const; int32_t GetWindowPid(int32_t windowId) const; int32_t SetMouseCaptureMode(int32_t windowId, bool isCaptureMode); @@ -89,7 +90,7 @@ public: ExtraData GetExtraData() const; const std::vector GetWindowGroupInfoByDisplayIdCopy(int32_t displayId) const; std::pair TransformWindowXY(const WindowInfo &window, double logicX, double logicY) const; - std::pair TransformDisplayXY(const DisplayInfo &info, double logicX, double logicY) const; + std::pair TransformDisplayXY(const OLD::DisplayInfo &info, double logicX, double logicY) const; int32_t GetCurrentUserId(); bool GetCancelEventFlag(std::shared_ptr pointerEvent); void SetFoldState (); @@ -114,7 +115,7 @@ public: void UpdateAndAdjustMouseLocation(int32_t& displayId, double& x, double& y, bool isRealData = true); #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH #ifdef OHOS_BUILD_ENABLE_POINTER - const DisplayGroupInfo GetDisplayGroupInfo(int32_t groupId = DEFAULT_GROUP_ID); + const OLD::DisplayGroupInfo GetDisplayGroupInfo(int32_t groupId = DEFAULT_GROUP_ID); int32_t SetHoverScrollState(bool state); bool GetHoverScrollState() const; bool SelectPointerChangeArea(int32_t windowId, int32_t logicalX, int32_t logicalY); @@ -138,23 +139,24 @@ public: #endif // OHOS_BUILD_ENABLE_POINTER #ifdef OHOS_BUILD_ENABLE_TOUCH - void AdjustDisplayCoordinate(const DisplayInfo& displayInfo, double& physicalX, double& physicalY) const; + void AdjustDisplayCoordinate(const OLD::DisplayInfo& displayInfo, double& physicalX, double& physicalY) const; bool TouchPointToDisplayPoint(int32_t deviceId, struct libinput_event_touch* touch, EventTouch& touchInfo, int32_t& targetDisplayId, bool isNeedClear = false); #endif // OHOS_BUILD_ENABLE_TOUCH #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) - void ReverseRotateScreen(const DisplayInfo& info, const double x, const double y, Coordinate2D& cursorPos) const; - void ReverseRotateDisplayScreen(const DisplayInfo& info, const double x, const double y, + void ReverseRotateScreen(const OLD::DisplayInfo& info, const double x, const double y, Coordinate2D& cursorPos) const; - void ScreenRotateAdjustDisplayXY(const DisplayInfo& info, PhysicalCoordinate& coord) const; - void RotateScreen(const DisplayInfo& info, PhysicalCoordinate& coord) const; - void RotateDisplayScreen(const DisplayInfo& info, PhysicalCoordinate& coord); + void ReverseRotateDisplayScreen(const OLD::DisplayInfo& info, const double x, const double y, + Coordinate2D& cursorPos) const; + void ScreenRotateAdjustDisplayXY(const OLD::DisplayInfo& info, PhysicalCoordinate& coord) const; + void RotateScreen(const OLD::DisplayInfo& info, PhysicalCoordinate& coord) const; + void RotateDisplayScreen(const OLD::DisplayInfo& info, PhysicalCoordinate& coord); #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH #ifdef OHOS_BUILD_ENABLE_TOUCH bool TransformTipPoint(struct libinput_event_tablet_tool* tip, PhysicalCoordinate& coord, int32_t& displayId); bool CalculateTipPoint(struct libinput_event_tablet_tool* tip, int32_t& targetDisplayId, PhysicalCoordinate& coord); - const std::shared_ptr GetDefaultDisplayInfo() const; + const std::shared_ptr GetDefaultDisplayInfo() const; void ReverseXY(int32_t &x, int32_t &y); #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) void FoldScreenRotation(std::shared_ptr pointerEvent); @@ -163,10 +165,10 @@ public: #endif // OHOS_BUILD_ENABLE_TOUCH #ifdef OHOS_BUILD_ENABLE_ANCO - void UpdateWindowInfoExt(const WindowGroupInfo &windowGroupInfo, const DisplayGroupInfo &displayGroupInfo); - void UpdateOneHandDataExt(const DisplayInfo &displayInfo); + void UpdateWindowInfoExt(const WindowGroupInfo &windowGroupInfo, const OLD::DisplayGroupInfo &displayGroupInfo); + void UpdateOneHandDataExt(const OLD::DisplayInfo &displayInfo); void UpdateShellWindow(const WindowInfo &window); - void UpdateDisplayInfoExt(const DisplayGroupInfo &displayGroupInfo); + void UpdateDisplayInfoExt(const OLD::DisplayGroupInfo &displayGroupInfo); bool IsInAncoWindow(const WindowInfo &window, int32_t x, int32_t y) const; bool IsAncoWindow(const WindowInfo &window) const; bool IsAncoWindowFocus(const WindowInfo &window) const; @@ -174,7 +176,7 @@ public: void DumpAncoWindows(std::string& out) const; void CleanShellWindowIds(); bool IsKnuckleOnAncoWindow(std::shared_ptr pointerEvent); - void SendOneHandData(onst DisplayInfo &displayInfo, std::shared_ptr &pointerEvent); + void SendOneHandData(const OLD::DisplayInfo &displayInfo, std::shared_ptr &pointerEvent); bool IsAncoGameActive(); #endif // OHOS_BUILD_ENABLE_ANCO @@ -183,8 +185,9 @@ public: void DrawTouchGraphic(std::shared_ptr pointerEvent); int32_t UpdateTargetPointer(std::shared_ptr pointerEvent); #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH - const std::shared_ptr GetPhysicalDisplay(int32_t id) const; - const std::shared_ptr GetPhysicalDisplay(int32_t id, const DisplayGroupInfo &displayGroupInfo) const; + const std::shared_ptr GetPhysicalDisplay(int32_t id) const; + const std::shared_ptr GetPhysicalDisplay(int32_t id, + const OLD::DisplayGroupInfo &displayGroupInfo) const; #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) void UpdatePointerChangeAreas(); @@ -209,12 +212,12 @@ public: int32_t SetPixelMapData(int32_t infoId, void *pixelMap); void CleanInvalidPiexMap(int32_t groupId = DEFAULT_GROUP_ID); - void HandleWindowPositionChange(const DisplayGroupInfo &displayGroupInfo); + void HandleWindowPositionChange(const OLD::DisplayGroupInfo &displayGroupInfo); void SendCancelEventWhenWindowChange(int32_t pointerId, int32_t groupId = DEFAULT_GROUP_ID); bool GetHardCursorEnabled(); #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) int32_t ShiftAppPointerEvent(const ShiftWindowParam ¶m, bool autoGenDown); - Direction GetDisplayDirection(const DisplayInfo *displayInfo); + Direction GetDisplayDirection(const OLD::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); @@ -222,7 +225,7 @@ public: #endif // defined(OHOS_BUILD_ENABLE_TOUCH) && defined(OHOS_BUILD_ENABLE_MONITOR) #ifdef OHOS_BUILD_ENABLE_TOUCH std::shared_ptr GetLastPointerEventForGesture() { return lastPointerEventforGesture_; }; - std::pair CalcDrawCoordinate(const DisplayInfo& displayInfo, + std::pair CalcDrawCoordinate(const OLD::DisplayInfo& displayInfo, PointerEvent::PointerItem pointerItem); #endif // OHOS_BUILD_ENABLE_TOUCH void SwitchTouchTracking(bool touchTracking); @@ -243,19 +246,19 @@ private: int32_t targetWindowId, int32_t logicalX, int32_t logicalY); void PrintZorderInfo(const WindowInfo &windowInfo, std::string &window); void PrintWindowInfo(const std::vector &windowsInfo); - void PrintDisplayGroupInfo(const DisplayGroupInfo displayGroupInfo); - void PrintDisplayInfo(const DisplayInfo displayInfo); + void PrintDisplayGroupInfo(const OLD::DisplayGroupInfo displayGroupInfo); + void PrintDisplayInfo(const OLD::DisplayInfo displayInfo); void PrintWindowGroupInfo(const WindowGroupInfo &windowGroupInfo); void PrintWindowNavbar(int32_t groupId = DEFAULT_GROUP_ID); - void CheckFocusWindowChange(const DisplayGroupInfo &displayGroupInfo); + void CheckFocusWindowChange(const OLD::DisplayGroupInfo &displayGroupInfo); void CheckZorderWindowChange(const std::vector &oldWindowsInfo, const std::vector &newWindowsInfo); void UpdateDisplayIdAndName(); void UpdateCustomStyle(int32_t windowId, PointerStyle pointerStyle); void UpdatePointerAction(std::shared_ptr pointerEvent); bool IsNeedDrawPointer(PointerEvent::PointerItem &pointerItem) const; - void UpdateDisplayInfoByIncrementalInfo(const WindowInfo &window, DisplayGroupInfo &displayGroupInfo); - void UpdateWindowsInfoPerDisplay(const DisplayGroupInfo &displayGroupInfo); + void UpdateDisplayInfoByIncrementalInfo(const WindowInfo &window, OLD::DisplayGroupInfo &displayGroupInfo); + void UpdateWindowsInfoPerDisplay(const OLD::DisplayGroupInfo &displayGroupInfo); std::pair TransformSampleWindowXY(int32_t logicX, int32_t logicY) const; bool IsValidZorderWindow(const WindowInfo &window, const std::shared_ptr& pointerEvent); bool SkipPrivacyProtectionWindow(const std::shared_ptr& pointerEvent, const bool &isSkip); @@ -267,12 +270,13 @@ 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); - void GetWidthAndHeight(const DisplayInfo* displayInfo, int32_t &width, int32_t &height, bool isRealData = true); + void GetWidthAndHeight(const OLD::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 void SetPrivacyModeFlag(SecureFlag privacyMode, std::shared_ptr event); void PrintChangedWindowByEvent(int32_t eventType, const WindowInfo &newWindowInfo); - void PrintChangedWindowBySync(const DisplayGroupInfo &newDisplayInfo); + void PrintChangedWindowBySync(const OLD::DisplayGroupInfo &newDisplayInfo); bool IsMouseDrawing(int32_t currentAction); bool ParseConfig(); bool ParseJson(const std::string &configFile); @@ -283,7 +287,7 @@ private: std::shared_ptr pointerEvent); #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH #ifdef OHOS_BUILD_ENABLE_POINTER - std::vector HandleHardwareCursor(std::shared_ptr &physicalDisplayInfo, + std::vector HandleHardwareCursor(std::shared_ptr &physicalDisplayInfo, int32_t physicalX, int32_t physicalY); int32_t UpdateMouseTarget(std::shared_ptr pointerEvent); void UpdatePointerEvent(int32_t logicalX, int32_t logicalY, @@ -292,7 +296,7 @@ private: void OnSessionLost(SessionPtr session); void InitPointerStyle(int32_t groupId = DEFAULT_GROUP_ID); const std::vector& GetWindowGroupInfoByDisplayId(int32_t displayId) const; - const std::vector& GetDisplayInfoVector(int32_t groupId = DEFAULT_GROUP_ID) const; + const std::vector& GetDisplayInfoVector(int32_t groupId = DEFAULT_GROUP_ID) const; const std::vector& GetWindowInfoVector(int32_t groupId = DEFAULT_GROUP_ID) const; int32_t GetFocusWindowId(int32_t groupId = DEFAULT_GROUP_ID) const; int32_t GetLogicalPositionX(int32_t id); @@ -314,19 +318,20 @@ private: void CheckUIExtentionWindowPointerHotArea(int32_t logicalX, int32_t logicalY, const std::vector& windowInfos, int32_t& windowId); std::optional GetWindowInfo(int32_t logicalX, int32_t logicalY, int32_t groupId = DEFAULT_GROUP_ID); - bool IsInsideDisplay(const DisplayInfo& displayInfo, double physicalX, double physicalY); - bool CalculateLayout(const DisplayInfo& displayInfo, const Vector2D &physical, Vector2D& layout); - void FindPhysicalDisplay(const DisplayInfo& displayInfo, double& physicalX, + bool IsInsideDisplay(const OLD::DisplayInfo& displayInfo, double physicalX, double physicalY); + bool CalculateLayout(const OLD::DisplayInfo& displayInfo, const Vector2D &physical, + Vector2D& layout); + void FindPhysicalDisplay(const OLD::DisplayInfo& displayInfo, double& physicalX, double& physicalY, int32_t& displayId); - bool AcrossDisplay(const DisplayInfo &displayInfoDes, const DisplayInfo &displayInfoOri, Vector2D &logical, - Vector2D &layout, const AcrossDirection &acrossDirection); - AcrossDirection CalculateAcrossDirection(const DisplayInfo &displayInfo, const Vector2D &layout); + bool AcrossDisplay(const OLD::DisplayInfo &displayInfoDes, const OLD::DisplayInfo &displayInfoOri, + Vector2D &logical, Vector2D &layout, const AcrossDirection &acrossDirection); + AcrossDirection CalculateAcrossDirection(const OLD::DisplayInfo &displayInfo, const Vector2D &layout); #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) void InitMouseDownInfo(); bool SelectPointerChangeArea(const WindowInfo &windowInfo, PointerStyle &pointerStyle, int32_t logicalX, int32_t logicalY); - void UpdatePointerChangeAreas(const DisplayGroupInfo &displayGroupInfo); + void UpdatePointerChangeAreas(const OLD::DisplayGroupInfo &displayGroupInfo); #ifdef OHOS_BUILD_ENABLE_POINTER_DRAWING void AdjustDisplayRotation(int32_t groupId = DEFAULT_GROUP_ID); void SetPointerEvent(int32_t pointerAction, std::shared_ptr pointerEvent); @@ -336,17 +341,18 @@ private: #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH #if defined(OHOS_BUILD_ENABLE_POINTER) && defined(OHOS_BUILD_ENABLE_POINTER_DRAWING) -void PointerDrawingManagerOnDisplayInfo(const DisplayGroupInfo &displayGroupInfo, bool isDisplayRemoved = false); + void PointerDrawingManagerOnDisplayInfo(const OLD::DisplayGroupInfo &displayGroupInfo, + bool isDisplayRemoved = false); void DrawPointer(bool isDisplayRemoved); bool NeedUpdatePointDrawFlag(const std::vector &windows); #endif // OHOS_BUILD_ENABLE_POINTER && OHOS_BUILD_ENABLE_POINTER_DRAWING - void UpdateFixedXY(const DisplayInfo& displayInfo, std::shared_ptr &pointerEvent); + void UpdateFixedXY(const OLD::DisplayInfo& displayInfo, std::shared_ptr &pointerEvent); #ifdef OHOS_BUILD_ENABLE_ONE_HAND_MODE -void UpdatePointerItemInOneHandMode(const DisplayInfo &displayInfo, std::shared_ptr &pointerEvent); -void UpdateDisplayXYInOneHandMode(double& physicalX, double& physicalY, const DisplayInfo &displayInfo, +void UpdatePointerItemInOneHandMode(const OLD::DisplayInfo &displayInfo, std::shared_ptr &pointerEvent); +void UpdateDisplayXYInOneHandMode(double& physicalX, double& physicalY, const OLD::DisplayInfo &displayInfo, float oneHandScale); -void HandleOneHandMode(const DisplayInfo &displayInfo, std::shared_ptr &pointerEvent, +void HandleOneHandMode(const OLD::DisplayInfo &displayInfo, std::shared_ptr &pointerEvent, PointerEvent::PointerItem &pointerItem); #endif // OHOS_BUILD_ENABLE_ONE_HAND_MODE @@ -364,16 +370,16 @@ void HandleOneHandMode(const DisplayInfo &displayInfo, std::shared_ptr pointerEvent); void UpdateTransformDisplayXY(std::shared_ptr pointerEvent, - const std::vector& windowsInfo, const DisplayInfo& displayInfo); + const std::vector& windowsInfo, const OLD::DisplayInfo& displayInfo); void HandlePullEvent(std::shared_ptr pointerEvent); #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH #ifdef OHOS_BUILD_ENABLE_TOUCH void PullEnterLeaveEvent(int32_t logicalX, int32_t logicalY, const std::shared_ptr pointerEvent, const WindowInfo* touchWindow); void DispatchTouch(int32_t pointerAction, int32_t groupId = DEFAULT_GROUP_ID); - const std::shared_ptr FindPhysicalDisplayInfo(const std::string& uniq) const; + const std::shared_ptr FindPhysicalDisplayInfo(const std::string& uniq) const; bool GetPhysicalDisplayCoord(struct libinput_event_touch* touch, - const DisplayInfo& info, EventTouch& touchInfo, bool isNeedClear = false); + const OLD::DisplayInfo& info, EventTouch& touchInfo, bool isNeedClear = false); void TriggerTouchUpOnInvalidAreaEntry(int32_t pointerId); void SetAntiMisTake(bool state); void SetAntiMisTakeStatus(bool state); @@ -407,46 +413,48 @@ void HandleOneHandMode(const DisplayInfo &displayInfo, std::shared_ptr pointerEvent); #endif // OHOS_BUILD_ENABLE_POINTER && OHOS_BUILD_ENABLE_CROWN void UpdateDisplayMode(int32_t groupId = DEFAULT_GROUP_ID); - void HandleValidDisplayChange(const DisplayGroupInfo &displayGroupInfo); - void ResetPointerPositionIfOutValidDisplay(const DisplayGroupInfo &displayGroupInfo); + void HandleValidDisplayChange(const OLD::DisplayGroupInfo &displayGroupInfo); + void ResetPointerPositionIfOutValidDisplay(const OLD::DisplayGroupInfo &displayGroupInfo); void CancelMouseEvent(); bool IsPositionOutValidDisplay( - Coordinate2D &position, const DisplayInfo ¤tDisplay, bool isPhysicalPos = false); - void CancelTouchScreenEventIfValidDisplayChange(const DisplayGroupInfo &displayGroupInfo); - bool IsValidDisplayChange(const DisplayInfo &displayInfo); + Coordinate2D &position, const OLD::DisplayInfo ¤tDisplay, bool isPhysicalPos = false); + void CancelTouchScreenEventIfValidDisplayChange(const OLD::DisplayGroupInfo &displayGroupInfo); + bool IsValidDisplayChange(const OLD::DisplayInfo &displayInfo); void UpdateKeyEventDisplayId(std::shared_ptr keyEvent, int32_t focusWindowId, int32_t groupId = DEFAULT_GROUP_ID); - bool OnDisplayRemovedOrCombinationChanged(const DisplayGroupInfo &displayGroupInfo); + bool OnDisplayRemovedOrCombinationChanged(const OLD::DisplayGroupInfo &displayGroupInfo); void ChangeWindowArea(int32_t x, int32_t y, WindowInfo &windowInfo); - void ResetPointerPosition(const DisplayGroupInfo &displayGroupInfo); - int32_t GetMainScreenDisplayInfo(const std::vector &displaysInfo, - DisplayInfo &mainScreenDisplayInfo) const; - bool IsPointerOnCenter(const CursorPosition ¤tPos, const DisplayInfo ¤tDisplay); + void ResetPointerPosition(const OLD::DisplayGroupInfo &displayGroupInfo); + int32_t GetMainScreenDisplayInfo(const std::vector &displaysInfo, + OLD::DisplayInfo &mainScreenDisplayInfo) const; + bool IsPointerOnCenter(const CursorPosition ¤tPos, const OLD::DisplayInfo ¤tDisplay); void SendBackCenterPointerEevent(const CursorPosition &cursorPos); - WINDOW_UPDATE_ACTION UpdateWindowInfo(DisplayGroupInfo &displayGroupInfo); + WINDOW_UPDATE_ACTION UpdateWindowInfo(OLD::DisplayGroupInfo &displayGroupInfo); #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) std::optional GetWindowInfoById(int32_t windowId) const; int32_t ShiftAppMousePointerEvent(const ShiftWindowInfo &shiftWindowInfo, bool autoGenDown); int32_t ShiftAppTouchPointerEvent(const ShiftWindowInfo &shiftWindowInfo); int32_t ShiftAppSimulateTouchPointerEvent(const ShiftWindowInfo &shiftWindowInfo); - CursorPosition GetCursorPos(const DisplayGroupInfo &displayGroupInfo); - CursorPosition ResetCursorPos(const DisplayGroupInfo &displayGroupInfo); + CursorPosition GetCursorPos(const OLD::DisplayGroupInfo &displayGroupInfo); + CursorPosition ResetCursorPos(const OLD::DisplayGroupInfo &displayGroupInfo); + GlobalCoords DisplayCoords2GlobalCoords(const Coordinate2D &displayCoords, int32_t displayId); #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH #if defined(OHOS_BUILD_ENABLE_TOUCH) && defined(OHOS_BUILD_ENABLE_MONITOR) bool CancelTouch(int32_t touch); #endif // defined(OHOS_BUILD_ENABLE_TOUCH) && defined(OHOS_BUILD_ENABLE_MONITOR) #ifdef OHOS_BUILD_ENABLE_VKEYBOARD - bool IsPointerActiveRectValid(const DisplayInfo ¤tDisplay); + bool IsPointerActiveRectValid(const OLD::DisplayInfo ¤tDisplay); #endif // OHOS_BUILD_ENABLE_VKEYBOARD bool IsAccessibilityFocusEvent(std::shared_ptr pointerEvent); bool IsAccessibilityEventWithZorderInjected(std::shared_ptr pointerEvent); private: - DisplayGroupInfo& FindTargetDisplayGroupInfo(int32_t displayId); + OLD::DisplayGroupInfo& FindTargetDisplayGroupInfo(int32_t displayId); int32_t FindDisplayGroupId(int32_t displayId) const; - DisplayGroupInfo& GetMainDisplayGroupInfo(); - const DisplayGroupInfo& GetConstMainDisplayGroupInfo() const; - const DisplayGroupInfo& FindDisplayGroupInfo(int32_t displayId) const; - void RotateScreen90(const DisplayInfo& info, PhysicalCoordinate& coord) const; - void InitDisplayGroupInfo(DisplayGroupInfo &displayGroupInfo); + const OLD::DisplayGroupInfo& FindDisplayGroupInfo(int32_t displayId) const; + OLD::DisplayGroupInfo& GetDefaultDisplayGroupInfo(); + const OLD::DisplayGroupInfo& GetConstMainDisplayGroupInfo() const; + void RotateScreen90(const OLD::DisplayInfo& info, PhysicalCoordinate& coord) const; + void RotateScreen0(const OLD::DisplayInfo& info, PhysicalCoordinate& coord) const; + void InitDisplayGroupInfo(OLD::DisplayGroupInfo &displayGroupInfo); private: UDSServer* udsServer_ { nullptr }; #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) @@ -474,12 +482,12 @@ private: #if defined(OHOS_BUILD_ENABLE_TOUCH) && defined(OHOS_BUILD_ENABLE_MONITOR) std::weak_ptr touchGestureMgr_; #endif // defined(OHOS_BUILD_ENABLE_TOUCH) && defined(OHOS_BUILD_ENABLE_MONITOR) - std::map displayGroupInfoMap_; - std::map displayGroupInfoMapTmp_; + std::map displayGroupInfoMap_; + std::map displayGroupInfoMapTmp_; bool mainGroupExisted_; DisplayGroupInfo displayGroupInfoTmp_; std::mutex tmpInfoMutex_; - DisplayGroupInfo displayGroupInfo_; + OLD::DisplayGroupInfo displayGroupInfo_; DisplayGroupInfo displayGroupInfoCurr_; std::map windowsPerDisplay_; std::map> windowsPerDisplayMap_; diff --git a/service/window_manager/include/knuckle_drawing_manager.h b/service/window_manager/include/knuckle_drawing_manager.h index 64ca9b06ea..4b2ccfb928 100644 --- a/service/window_manager/include/knuckle_drawing_manager.h +++ b/service/window_manager/include/knuckle_drawing_manager.h @@ -21,7 +21,7 @@ #include "ui/rs_surface_node.h" #include "pointer_event.h" -#include "window_info.h" +#include "old_display_info.h" namespace OHOS { namespace MMI { @@ -37,16 +37,16 @@ struct ScreenReadState { class KnuckleDrawingManager { public: - void KnuckleDrawHandler(std::shared_ptr touchEvent, int32_t displayId = -1); - void UpdateDisplayInfo(const DisplayInfo& displayInfo); + void KnuckleDrawHandler(std::shared_ptr touchEvent, int32_t rsId = -1); + void UpdateDisplayInfo(const OLD::DisplayInfo& displayInfo); KnuckleDrawingManager(); ~KnuckleDrawingManager() = default; - void RotationCanvasNode(std::shared_ptr canvasNode, const DisplayInfo& displayInfo); + void RotationCanvasNode(std::shared_ptr canvasNode, const OLD::DisplayInfo& displayInfo); std::string GetScreenReadState(); void SetMultiWindowScreenId(uint64_t screenId, uint64_t displayNodeScreenId); private: bool IsValidAction(int32_t action); - void CreateTouchWindow(int32_t displayId); + void CreateTouchWindow(int32_t rsId); void StartTouchDraw(std::shared_ptr touchEvent); int32_t DrawGraphic(std::shared_ptr touchEvent); int32_t GetPointerPos(std::shared_ptr touchEvent); @@ -87,7 +87,7 @@ private: std::vector pointerInfos_; Rosen::Drawing::Paint paint_; Rosen::Drawing::Path path_; - DisplayInfo displayInfo_ {}; + OLD::DisplayInfo displayInfo_ {}; uint64_t screenId_ { 0 }; bool isActionUp_ { false }; bool isNeedInitParticleEmitter_ { true }; diff --git a/service/window_manager/include/knuckle_dynamic_drawing_manager.h b/service/window_manager/include/knuckle_dynamic_drawing_manager.h index 1e7c12425c..d99974b3a3 100644 --- a/service/window_manager/include/knuckle_dynamic_drawing_manager.h +++ b/service/window_manager/include/knuckle_dynamic_drawing_manager.h @@ -28,12 +28,12 @@ public: KnuckleDynamicDrawingManager(); ~KnuckleDynamicDrawingManager() = default; void KnuckleDynamicDrawHandler(std::shared_ptr pointerEvent, int32_t displayId = -1); - void UpdateDisplayInfo(const DisplayInfo& displayInfo); + void UpdateDisplayInfo(const OLD::DisplayInfo& displayInfo); void SetKnuckleDrawingManager(std::shared_ptr knuckleDrawMgr); private: void StartTouchDraw(std::shared_ptr pointerEvent); - void CreateTouchWindow(const int32_t displayId); + void CreateTouchWindow(const int32_t rsId); void CreateCanvasNode(); int32_t DrawGraphic(std::shared_ptr pointerEvent); @@ -50,7 +50,7 @@ private: private: std::shared_ptr surfaceNode_ { nullptr }; std::shared_ptr canvasNode_ { nullptr }; - DisplayInfo displayInfo_ {}; + OLD::DisplayInfo displayInfo_ {}; uint64_t screenId_ { 0 }; Rosen::Drawing::Brush brush_; Rosen::Drawing::Pen pen_; diff --git a/service/window_manager/include/old_display_info.h b/service/window_manager/include/old_display_info.h new file mode 100644 index 0000000000..379762bd22 --- /dev/null +++ b/service/window_manager/include/old_display_info.h @@ -0,0 +1,248 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef OLD_DISPLAY_INFO_H +#define OLD_DISPLAY_INFO_H +#include "window_info.h" +namespace OHOS { +namespace MMI { +namespace OLD { +struct DisplayInfo { + /** + * Unique ID of the physical display + * + * @since 9 + */ + int32_t id; + + /** + * X coordinate of the upper left corner on the logical screen + * + * @since 9 + */ + int32_t x; + + /** + * Y coordinate of the upper left corner on the logical screen + * + * @since 9 + */ + int32_t y; + + /** + * Display width, which is the logical width of the original screen when the rotation angle is 0. + * The value remains unchanged even if the display screen is rotated. + * + * @since 9 + */ + int32_t width; + + /** + * Display height, which is the logical height of the original screen when the rotation angle is 0. + * The value remains unchanged even if the display screen is rotated. + * + * @since 9 + */ + int32_t height; + + /** + * Pixel density, which indicates the number of pixels in an inch + * + * @since 10 + */ + int32_t dpi; + + /** + * Name of the physical display, which is used for debugging + * + * @since 9 + */ + std::string name; + + /** + * Unique screen ID, which is used to associate the corresponding touchscreen. The default value is default0. + * + * @since 9 + */ + std::string uniq; + + /** + * Orientation of the physical display + * + * @since 9 + */ + OHOS::MMI::Direction direction; + + OHOS::MMI::Direction displayDirection; + + /** + * DisplayMode of the display + * + * @since 9 + */ + OHOS::MMI::DisplayMode displayMode { OHOS::MMI::DisplayMode::UNKNOWN }; + + /** + * Number of transform in the screen which is used to calculate the display x and display y by logic x and logic y. + * The value must be POINTER_CHANGEAREA_COUNT. + * + * @since 12 + */ + std::vector transform; + + /** + * Orientation of the physical display + * + * @since 12 + */ + int32_t offsetX = 0; + int32_t offsetY = 0; + float ppi; + + /** + * Scale percent of oneHand rect to display rect. + * If 'scalePercent < 100', it means one hand mode. + * If 'scalePercent == 100', it means not in one hand mode. + */ + int32_t scalePercent = 100; + /** + * Expand height from bottom. + */ + int32_t expandHeight = 0; + /** + * Use for off screen policy + * + * @since 12 + */ + bool isCurrentOffScreenRendering = false; + int32_t screenRealWidth = 0; + int32_t screenRealHeight = 0; + int32_t screenRealDPI = 0; + /** + * logical screen mode + * + * @since 12 20 + */ + OHOS::MMI::DisplaySourceMode displaySourceMode = OHOS::MMI::DisplaySourceMode::SCREEN_MAIN; + /** + * Coordinate of the upper left corner of the virtual screen in one-hand mode. + * If oneHandX is 0, the virtual screen is in the lower left corner. + * If oneHandX is greater than 0, the virtual screen is in the lower right corner. + */ + int32_t oneHandX = 0; + int32_t oneHandY = 0; + + /** + * Width of the effective area of the screen. When the screen is rotated, the value changes accordingly. + * + * @since 12 + */ + int32_t validWidth = 0; + + /** + * Height of the effective area of the screen. When the screen is rotated, the value changes accordingly. + * + * @since 12 + */ + int32_t validHeight = 0; + + /** + * Rotation angle of the TP patch offset correction. + * + * @since 12 + */ + OHOS::MMI::Direction fixedDirection; + + /** + * The physical width of the screen, in millimeters. + * + * @since 12 + */ + int32_t physicalWidth { 0 }; + + /** + * The physical height of the screen, in millimeters. + * + * @since 12 + */ + int32_t physicalHeight { 0 }; + + /** + * The Pointer Active Width + * + * @since 18 + */ + int32_t pointerActiveWidth { 0 }; + + /** + * The Pointer Active Height + * + * @since 18 + */ + int32_t pointerActiveHeight { 0 }; + + /** Unique ID of the physical display + * + * @since 18 + */ + int32_t rsId { 0 }; +}; + +struct DisplayGroupInfo { + /** + * index of group. default=-1 + * + * @since 19 + */ + int32_t groupId { DEFAULT_GROUP_ID }; + /** + * Logical screen group type + * + * @since 20 + */ + OHOS::MMI::GroupType type; + /** + * The main logical screen ID. The logical screen with this ID must be in the displaysInfo. + * + * @since 20 + */ + int32_t mainDisplayId; + + /** + * ID of the focus window + * + * @since 9 + */ + int32_t focusWindowId; + + int32_t currentUserId { -1 }; + + /** + * List of window information of the logical display arranged in Z order, with the top window at the top + * + * @since 9 + */ + std::vector windowsInfo; + + /** + * Physical screen information list + * + * @since 9 + */ + std::vector displaysInfo; +}; +} // namespace OLD +} // namespace MMI +} // namespace OHOS +#endif // DISPLAY_INFO_H \ No newline at end of file diff --git a/service/window_manager/include/pointer_drawing_manager.h b/service/window_manager/include/pointer_drawing_manager.h index a42178dd0c..847c139317 100644 --- a/service/window_manager/include/pointer_drawing_manager.h +++ b/service/window_manager/include/pointer_drawing_manager.h @@ -73,10 +73,10 @@ public: PointerDrawingManager(); DISALLOW_COPY_AND_MOVE(PointerDrawingManager); ~PointerDrawingManager(); - void DrawPointer(int32_t displayId, int32_t physicalX, int32_t physicalY, + void DrawPointer(int32_t rsId, int32_t physicalX, int32_t physicalY, const PointerStyle pointerStyle, Direction direction) override; - void UpdateDisplayInfo(const DisplayInfo& displayInfo) override; - void OnDisplayInfo(const DisplayGroupInfo& displayGroupInfo) override; + void UpdateDisplayInfo(const OLD::DisplayInfo& displayInfo) override; + void OnDisplayInfo(const OLD::DisplayGroupInfo& displayGroupInfo) override; void OnWindowInfo(const WinInfo &info) override; void UpdatePointerDevice(bool hasPointerDevice, bool isPointerVisible, bool isHotPlug) override; bool Init() override; @@ -111,14 +111,14 @@ public: bool HasMagicCursor(); int32_t DrawCursor(const MOUSE_ICON mouseStyle); int32_t SwitchPointerStyle() override; - void DrawMovePointer(int32_t displayId, int32_t physicalX, int32_t physicalY) override; - std::vector> GetDisplayInfo(DisplayInfo &di); + void DrawMovePointer(int32_t rsId, int32_t physicalX, int32_t physicalY) override; + std::vector> GetDisplayInfo(OLD::DisplayInfo &di); void Dump(int32_t fd, const std::vector &args) override; void AttachToDisplay(); int32_t EnableHardwareCursorStats(int32_t pid, bool enable) override; int32_t GetHardwareCursorStats(int32_t pid, uint32_t &frameCount, uint32_t &vsyncCount) override; void SubscribeScreenModeChange() override; - DisplayInfo GetCurrentDisplayInfo() override; + OLD::DisplayInfo GetCurrentDisplayInfo() override; #ifdef OHOS_BUILD_ENABLE_MAGICCURSOR int32_t GetPointerSnapshot(void *pixelMapPtr) override; #endif // OHOS_BUILD_ENABLE_MAGICCURSOR @@ -138,7 +138,7 @@ public: void DrawScreenCenterPointer(const PointerStyle& pointerStyle) override; void OnScreenModeChange(const std::vector> &screens); int32_t UpdateMouseLayer(const PointerStyle& pointerStyle, - int32_t displayId, int32_t physicalX, int32_t physicalY) override; + int32_t physicalX, int32_t physicalY) override; private: struct PixelMapInfo { @@ -151,9 +151,9 @@ private: void GetPreferenceKey(std::string &name); void DrawLoadingPointerStyle(const MOUSE_ICON mouseStyle); void DrawRunningPointerAnimate(const MOUSE_ICON mouseStyle); - void CreatePointerWindow(int32_t displayId, int32_t physicalX, int32_t physicalY, Direction direction); - int32_t CreatePointerWindowForScreenPointer(int32_t displayId, int32_t physicalX, int32_t physicalY); - int32_t CreatePointerWindowForNoScreenPointer(int32_t displayId, int32_t physicalX, int32_t physicalY); + void CreatePointerWindow(int32_t rsId, int32_t physicalX, int32_t physicalY, Direction direction); + int32_t CreatePointerWindowForScreenPointer(int32_t rsId, int32_t physicalX, int32_t physicalY); + int32_t CreatePointerWindowForNoScreenPointer(int32_t physicalX, int32_t physicalY); sptr GetLayer(); sptr GetSurfaceBuffer(sptr layer); sptr RetryGetSurfaceBuffer(sptr layer); @@ -183,8 +183,8 @@ private: int32_t CreatePointerSwitchObserver(isMagicCursor& item); void UpdateStyleOptions(); int32_t GetIndependentPixels(); - bool IsWindowRotation(const DisplayInfo *displayInfo); - Direction GetDisplayDirection(const DisplayInfo *displayInfo); + bool IsWindowRotation(const OLD::DisplayInfo *displayInfo); + Direction GetDisplayDirection(const OLD::DisplayInfo *displayInfo); bool CheckPointerStyleParam(int32_t windowId, PointerStyle pointerStyle); std::map& GetMouseIcons(); void UpdateIconPath(const MOUSE_ICON mouseStyle, std::string iconPath); @@ -201,8 +201,8 @@ private: void ForceClearPointerVisiableStatus() override; int32_t UpdateSurfaceNodeBounds(int32_t physicalX, int32_t physicalY); void CreateCanvasNode(); - bool SetCursorLocation(int32_t displayId, int32_t physicalX, int32_t physicalY, ICON_TYPE iconType); - void SetHardwareCursorPosition(int32_t displayId, int32_t physicalX, int32_t physicalY, + bool SetCursorLocation(int32_t physicalX, int32_t physicalY, ICON_TYPE iconType); + void SetHardwareCursorPosition(int32_t physicalX, int32_t physicalY, PointerStyle pointerStyle); std::shared_ptr GetUserIconCopy(); ICON_TYPE MouseIcon2IconType(MOUSE_ICON m); @@ -219,7 +219,7 @@ private: void PostMoveRetryTask(std::function task); int32_t FlushBuffer(); int32_t GetSurfaceInformation(); - void UpdateBindDisplayId(int32_t displayId); + void UpdateBindDisplayId(int32_t rsId); void PostTaskRSLocation(int32_t physicalX, int32_t physicalY, std::shared_ptr surfaceNode); int32_t InitVsync(MOUSE_ICON mouseStyle); void DumpScreenInfo(std::ostringstream& oss); @@ -236,13 +236,13 @@ private: void ResetMoveRetryTimer(); int32_t HardwareCursorMove(int32_t x, int32_t y, ICON_TYPE align); void HideHardwareCursors(); - int32_t GetMainScreenDisplayInfo(const DisplayGroupInfo &displayGroupInfo, - DisplayInfo &mainScreenDisplayInfo) const; + int32_t GetMainScreenDisplayInfo(const OLD::DisplayGroupInfo &displayGroupInfo, + OLD::DisplayInfo &mainScreenDisplayInfo) const; int32_t DrawDynamicHardwareCursor(std::shared_ptr sp, const RenderConfig &cfg); int32_t DrawDynamicSoftCursor(std::shared_ptr sn, const RenderConfig &cfg); void HardwareCursorDynamicRender(MOUSE_ICON mouseStyle); void SoftwareCursorDynamicRender(MOUSE_ICON mouseStyle); - void UpdateMirrorScreens(std::shared_ptr sp, DisplayInfo displayInfo); + void UpdateMirrorScreens(std::shared_ptr sp, OLD::DisplayInfo displayInfo); void AttachAllSurfaceNode() override; void DetachAllSurfaceNode() override; int32_t CheckHwcReady() override; @@ -257,7 +257,7 @@ private: bool visible { false }; }; bool hasDisplay_ { false }; - DisplayInfo displayInfo_ {}; + OLD::DisplayInfo displayInfo_ {}; bool hasPointerDevice_ { false }; int32_t lastPhysicalX_ { -1 }; int32_t lastPhysicalY_ { -1 }; diff --git a/service/window_manager/include/screen_pointer.h b/service/window_manager/include/screen_pointer.h index 948b2cb18c..27ea372f66 100644 --- a/service/window_manager/include/screen_pointer.h +++ b/service/window_manager/include/screen_pointer.h @@ -20,7 +20,7 @@ #include "hardware_cursor_pointer_manager.h" #include "pointer_renderer.h" -#include "window_info.h" +#include "old_display_info.h" namespace OHOS::MMI { using hwcmgr_ptr_t = std::shared_ptr; @@ -36,7 +36,7 @@ uint32_t GetScreenInfoHeight(const screen_info_ptr_t); class ScreenPointer final { public: DISALLOW_COPY_AND_MOVE(ScreenPointer); - ScreenPointer(hwcmgr_ptr_t hwcmgr, handler_ptr_t handler, const DisplayInfo &di); + ScreenPointer(hwcmgr_ptr_t hwcmgr, handler_ptr_t handler, const OLD::DisplayInfo &di); ScreenPointer(hwcmgr_ptr_t hwcmgr, handler_ptr_t handler, screen_info_ptr_t si); ~ScreenPointer() = default; @@ -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 OLD::DisplayInfo &di, bool isWindowRotation); buffer_ptr_t GetDefaultBuffer(); buffer_ptr_t GetTransparentBuffer(); diff --git a/service/window_manager/include/touch_drawing_manager.h b/service/window_manager/include/touch_drawing_manager.h index 0729a9f7a9..556131a325 100644 --- a/service/window_manager/include/touch_drawing_manager.h +++ b/service/window_manager/include/touch_drawing_manager.h @@ -32,7 +32,7 @@ #endif // USE_ROSEN_DRAWING #include "pointer_event.h" -#include "window_info.h" +#include "old_display_info.h" namespace OHOS { namespace MMI { @@ -61,7 +61,7 @@ public: void SetupSettingObserver(int32_t nRetries); void TouchDrawHandler(std::shared_ptr pointerEvent); int32_t UpdateLabels(); - void UpdateDisplayInfo(const DisplayInfo& displayInfo); + void UpdateDisplayInfo(const OLD::DisplayInfo& displayInfo); void GetOriginalTouchScreenCoordinates(Direction direction, int32_t width, int32_t height, int32_t &physicalX, int32_t &physicalY); int32_t UpdateBubbleData(); @@ -116,7 +116,7 @@ private: std::shared_ptr trackerCanvasNode_ { nullptr }; std::shared_ptr crosshairCanvasNode_ { nullptr }; std::shared_ptr labelsCanvasNode_ { nullptr }; - DisplayInfo displayInfo_ {}; + OLD::DisplayInfo displayInfo_ {}; Bubble bubble_; Rosen::Drawing::Point firstPt_; Rosen::Drawing::Point currentPt_; diff --git a/service/window_manager/src/cursor_drawing_component.cpp b/service/window_manager/src/cursor_drawing_component.cpp index c4fe720fab..86813c5e40 100644 --- a/service/window_manager/src/cursor_drawing_component.cpp +++ b/service/window_manager/src/cursor_drawing_component.cpp @@ -124,13 +124,13 @@ void CursorDrawingComponent::DrawPointer(int32_t displayId, int32_t physicalX, i pointerInstance_->DrawPointer(displayId, physicalX, physicalY, pointerStyle, direction); } -void CursorDrawingComponent::UpdateDisplayInfo(const DisplayInfo &displayInfo) +void CursorDrawingComponent::UpdateDisplayInfo(const OLD::DisplayInfo &displayInfo) { CHK_IS_LOADV(isLoaded_, pointerInstance_) pointerInstance_->UpdateDisplayInfo(displayInfo); } -void CursorDrawingComponent::OnDisplayInfo(const DisplayGroupInfo &displayGroupInfo) +void CursorDrawingComponent::OnDisplayInfo(const OLD::DisplayGroupInfo &displayGroupInfo) { CHK_IS_LOADV(isLoaded_, pointerInstance_) pointerInstance_->OnDisplayInfo(displayGroupInfo); @@ -348,11 +348,11 @@ int32_t CursorDrawingComponent::GetHardwareCursorStats(int32_t pid, uint32_t &fr return pointerInstance_->GetHardwareCursorStats(pid, frameCount, vsyncCount); } -DisplayInfo CursorDrawingComponent::GetCurrentDisplayInfo() +OLD::DisplayInfo CursorDrawingComponent::GetCurrentDisplayInfo() { if (!isLoaded_ || (pointerInstance_ == nullptr)) { MMI_HILOGE("%{public}s is closed", MULTIMODAL_PATH_NAME); - return DisplayInfo(); + return OLD::DisplayInfo(); } return pointerInstance_->GetCurrentDisplayInfo(); } @@ -418,7 +418,7 @@ int32_t CursorDrawingComponent::UpdateMouseLayer( const PointerStyle &pointerStyle, int32_t displayId, int32_t physicalX, int32_t physicalY) { CHK_IS_LOADR(isLoaded_, pointerInstance_) - return pointerInstance_->UpdateMouseLayer(pointerStyle, displayId, physicalX, physicalY); + return pointerInstance_->UpdateMouseLayer(pointerStyle, physicalX, physicalY); } int32_t CursorDrawingComponent::DrawNewDpiPointer() diff --git a/service/window_manager/src/input_windows_manager.cpp b/service/window_manager/src/input_windows_manager.cpp index 5a91d22ca9..92a8bad263 100644 --- a/service/window_manager/src/input_windows_manager.cpp +++ b/service/window_manager/src/input_windows_manager.cpp @@ -165,10 +165,8 @@ InputWindowsManager::InputWindowsManager() : bindInfo_(BIND_CFG_FILE_NAME) lastTouchWindowInfo_.windowNameType = 0; #endif // OHOS_BUILD_ENABLE_TOUCH displayGroupInfo_.groupId = MAIN_GROUPID; - displayGroupInfo_.isMainGroup = true; + displayGroupInfo_.type = GroupType::GROUP_DEFAULT; displayGroupInfo_.focusWindowId = -1; - displayGroupInfo_.width = 0; - displayGroupInfo_.height = 0; displayGroupInfoMap_[MAIN_GROUPID] = displayGroupInfo_; displayGroupInfoMapTmp_[MAIN_GROUPID] = displayGroupInfo_; captureModeInfoMap_[MAIN_GROUPID] = captureModeInfo_; @@ -568,7 +566,7 @@ void InputWindowsManager::FoldScreenRotation(std::shared_ptr point } #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH -DisplayGroupInfo& InputWindowsManager::FindTargetDisplayGroupInfo(int32_t displayId) +OLD::DisplayGroupInfo& InputWindowsManager::FindTargetDisplayGroupInfo(int32_t displayId) { for (auto& it : displayGroupInfoMap_) { for (const auto& item : it.second.displaysInfo) { @@ -577,7 +575,7 @@ DisplayGroupInfo& InputWindowsManager::FindTargetDisplayGroupInfo(int32_t displa } } } - return GetMainDisplayGroupInfo(); + return GetDefaultDisplayGroupInfo(); } int32_t InputWindowsManager::FindDisplayGroupId(int32_t displayId) const @@ -592,25 +590,26 @@ int32_t InputWindowsManager::FindDisplayGroupId(int32_t displayId) const return DEFAULT_GROUP_ID; } -DisplayGroupInfo& InputWindowsManager::GetMainDisplayGroupInfo() +OLD::DisplayGroupInfo& InputWindowsManager::GetDefaultDisplayGroupInfo() { - const auto& iter = displayGroupInfoMap_.find(MAIN_GROUPID); - if (iter != displayGroupInfoMap_.end()) { - return iter->second; + for (auto &item : displayGroupInfoMap_) { + if (item.second.type == GroupType::GROUP_DEFAULT) { + return item.second; + } } return displayGroupInfo_; } -const DisplayGroupInfo& InputWindowsManager::GetConstMainDisplayGroupInfo() const +const OLD::DisplayGroupInfo& InputWindowsManager::GetConstMainDisplayGroupInfo() const { for (auto &it : displayGroupInfoMap_) - if (it.second.isMainGroup) { + if (it.second.type == GroupType::GROUP_DEFAULT) { return it.second; } return displayGroupInfo_; } -const DisplayGroupInfo& InputWindowsManager::FindDisplayGroupInfo(int32_t displayId) const { +const OLD::DisplayGroupInfo& InputWindowsManager::FindDisplayGroupInfo(int32_t displayId) const { for (auto& it : displayGroupInfoMap_) { for (auto& item : it.second.displaysInfo) { if (item.id == displayId) { @@ -855,7 +854,7 @@ int32_t InputWindowsManager::GetWindowPid(int32_t windowId, const std::vectorsecond : GetMainDisplayGroupInfo(); + displayGroupInfo = (iter != displayGroupInfoMapTmp_.end()) ? iter->second : GetDefaultDisplayGroupInfo(); if (it.first != MAIN_GROUPID) { displayGroupInfo.focusWindowId = focusWid; } @@ -1014,7 +1013,7 @@ void InputWindowsManager::UpdateWindowInfo(const WindowGroupInfo &windowGroupInf } } -void InputWindowsManager::UpdateDisplayInfoExtIfNeed(DisplayGroupInfo &displayGroupInfo, bool needUpdateDisplayExt) +void InputWindowsManager::UpdateDisplayInfoExtIfNeed(OLD::DisplayGroupInfo &displayGroupInfo, bool needUpdateDisplayExt) { UpdateDisplayInfo(displayGroupInfo); #ifdef OHOS_BUILD_ENABLE_ANCO @@ -1039,7 +1038,7 @@ void InputWindowsManager::UpdateDisplayInfoExtIfNeed(DisplayGroupInfo &displayGr } void InputWindowsManager::UpdateDisplayInfoByIncrementalInfo(const WindowInfo &window, - DisplayGroupInfo &displayGroupInfo) + OLD::DisplayGroupInfo &displayGroupInfo) { CALL_DEBUG_ENTER; switch (window.action) { @@ -1082,7 +1081,7 @@ void InputWindowsManager::UpdateDisplayInfoByIncrementalInfo(const WindowInfo &w } } -void InputWindowsManager::UpdateWindowsInfoPerDisplay(const DisplayGroupInfo &displayGroupInfo) +void InputWindowsManager::UpdateWindowsInfoPerDisplay(const OLD::DisplayGroupInfo &displayGroupInfo) { CALL_DEBUG_ENTER; std::map windowsPerDisplay; @@ -1130,7 +1129,7 @@ void InputWindowsManager::UpdateWindowsInfoPerDisplay(const DisplayGroupInfo &di #endif // defined(OHOS_BUILD_ENABLE_TOUCH) && defined(OHOS_BUILD_ENABLE_MONITOR) } -WINDOW_UPDATE_ACTION InputWindowsManager::UpdateWindowInfo(DisplayGroupInfo &displayGroupInfo) +WINDOW_UPDATE_ACTION InputWindowsManager::UpdateWindowInfo(OLD::DisplayGroupInfo &displayGroupInfo) { auto action = WINDOW_UPDATE_ACTION::ADD_END; if (!displayGroupInfo.windowsInfo.empty()) { @@ -1182,16 +1181,16 @@ void InputWindowsManager::ChangeWindowArea(int32_t x, int32_t y, WindowInfo &win } } -int32_t InputWindowsManager::GetMainScreenDisplayInfo(const std::vector &displaysInfo, - DisplayInfo &mainScreenDisplayInfo) const +int32_t InputWindowsManager::GetMainScreenDisplayInfo(const std::vector &displaysInfo, + OLD::DisplayInfo &mainScreenDisplayInfo) const { CALL_DEBUG_ENTER; if (displaysInfo.empty()) { MMI_HILOGE("displaysInfo doesn't contain displayInfo"); return RET_ERR; } - for (const DisplayInfo& display : displaysInfo) { - if (display.screenCombination == OHOS::MMI::ScreenCombination::SCREEN_MAIN) { + for (const OLD::DisplayInfo& display : displaysInfo) { + if (display.displaySourceMode == OHOS::MMI::DisplaySourceMode::SCREEN_MAIN) { mainScreenDisplayInfo = display; return RET_OK; } @@ -1223,6 +1222,10 @@ void InputWindowsManager::SendBackCenterPointerEevent(const CursorPosition &curs pointerBackCenterEvent->GetPointerItem(pointerId, item); item.SetDisplayX(cursorPos.cursorPos.x); item.SetDisplayY(cursorPos.cursorPos.y); + GlobalCoords globalCoords = DisplayCoords2GlobalCoords({cursorPos.cursorPos.x, cursorPos.cursorPos.y}, + cursorPos.displayId); + item.SetGlobalX(globalCoords.x); + item.SetGlobalY(globalCoords.y); item.SetDisplayXPos(cursorPos.cursorPos.x); item.SetDisplayYPos(cursorPos.cursorPos.y); item.SetCanceled(true); @@ -1239,11 +1242,11 @@ void InputWindowsManager::SendBackCenterPointerEevent(const CursorPosition &curs InputHandler->GetFilterHandler()->HandlePointerEvent(pointerBackCenterEvent); } -CursorPosition InputWindowsManager::ResetCursorPos(const DisplayGroupInfo &displayGroupInfo) +CursorPosition InputWindowsManager::ResetCursorPos(const OLD::DisplayGroupInfo &displayGroupInfo) { int32_t groupId = displayGroupInfo.groupId; if (!displayGroupInfo.displaysInfo.empty()) { - DisplayInfo displayInfo = displayGroupInfo.displaysInfo[0]; + OLD::DisplayInfo displayInfo = displayGroupInfo.displaysInfo[0]; int32_t x = displayInfo.validWidth * HALF_RATIO; int32_t y = displayInfo.validHeight * HALF_RATIO; if (GetHardCursorEnabled()) { @@ -1267,7 +1270,21 @@ CursorPosition InputWindowsManager::ResetCursorPos(const DisplayGroupInfo &displ return cursorPosMap_[groupId]; } -void InputWindowsManager::ResetPointerPosition(const DisplayGroupInfo &displayGroupInfo) +GlobalCoords InputWindowsManager::DisplayCoords2GlobalCoords(const Coordinate2D &displayCoords, int32_t displayId) +{ + auto displayInfo = GetPhysicalDisplay(displayId); + if (displayInfo == nullptr) { + MMI_HILOGI("GetPhysicalDisplay failed"); + return { DBL_MAX, DBL_MAX }; + } + GlobalCoords globalCoords { + .x = displayInfo->x + displayCoords.x, + .y = displayInfo->y + displayCoords.y + }; + return globalCoords; +} + +void InputWindowsManager::ResetPointerPosition(const OLD::DisplayGroupInfo &displayGroupInfo) { CALL_DEBUG_ENTER; if (displayGroupInfo.displaysInfo.empty()) { @@ -1276,12 +1293,12 @@ void InputWindowsManager::ResetPointerPosition(const DisplayGroupInfo &displayGr CursorPosition oldPtrPos = GetCursorPos(); CursorPosition cursorPos; for (auto ¤tDisplay : displayGroupInfo.displaysInfo) { - if ((currentDisplay.screenCombination == OHOS::MMI::ScreenCombination::SCREEN_MAIN)) { + if ((currentDisplay.displaySourceMode == OHOS::MMI::DisplaySourceMode::SCREEN_MAIN)) { auto displayInfo = GetPhysicalDisplay(oldPtrPos.displayId); CHKPV(displayInfo); MMI_HILOGI("CurDisplayId:%{public}d, oldDisplayId:%{public}d", - currentDisplay.uniqueId, displayInfo->uniqueId); - if ((displayInfo->uniqueId != currentDisplay.uniqueId) || (!IsPointerOnCenter(oldPtrPos, currentDisplay))) { + currentDisplay.rsId, displayInfo->rsId); + if ((displayInfo->rsId != currentDisplay.rsId) || (!IsPointerOnCenter(oldPtrPos, currentDisplay))) { cursorPos = ResetCursorPos(displayGroupInfo); UpdateAndAdjustMouseLocation(cursorPos.displayId, cursorPos.cursorPos.x, cursorPos.cursorPos.y); } @@ -1298,7 +1315,7 @@ void InputWindowsManager::ResetPointerPosition(const DisplayGroupInfo &displayGr (void)SendBackCenterPointerEevent(cursorPos); } -bool InputWindowsManager::IsPointerOnCenter(const CursorPosition ¤tPos, const DisplayInfo ¤tDisplay) +bool InputWindowsManager::IsPointerOnCenter(const CursorPosition ¤tPos, const OLD::DisplayInfo ¤tDisplay) { auto displayCenterX = currentDisplay.validWidth * HALF_RATIO; auto displayCenterY = currentDisplay.validHeight * HALF_RATIO; @@ -1309,17 +1326,17 @@ bool InputWindowsManager::IsPointerOnCenter(const CursorPosition ¤tPos, co return false; } -void InputWindowsManager::HandleValidDisplayChange(const DisplayGroupInfo &displayGroupInfo) +void InputWindowsManager::HandleValidDisplayChange(const OLD::DisplayGroupInfo &displayGroupInfo) { ResetPointerPositionIfOutValidDisplay(displayGroupInfo); CancelTouchScreenEventIfValidDisplayChange(displayGroupInfo); } -CursorPosition InputWindowsManager::GetCursorPos(const DisplayGroupInfo &displayGroupInfo) +CursorPosition InputWindowsManager::GetCursorPos(const OLD::DisplayGroupInfo &displayGroupInfo) { int32_t groupId = displayGroupInfo.groupId; if ((cursorPosMap_[groupId].displayId < 0) && !displayGroupInfoMap_[groupId].displaysInfo.empty()) { - DisplayInfo displayInfo = displayGroupInfo.displaysInfo[0]; + OLD::DisplayInfo displayInfo = displayGroupInfo.displaysInfo[0]; if (GetHardCursorEnabled()) { (void)GetMainScreenDisplayInfo(displayGroupInfo.displaysInfo, displayInfo); } @@ -1330,7 +1347,7 @@ CursorPosition InputWindowsManager::GetCursorPos(const DisplayGroupInfo &display return cursorPosMap_[groupId]; } -void InputWindowsManager::ResetPointerPositionIfOutValidDisplay(const DisplayGroupInfo &displayGroupInfo) +void InputWindowsManager::ResetPointerPositionIfOutValidDisplay(const OLD::DisplayGroupInfo &displayGroupInfo) { if (displayGroupInfo.displaysInfo.empty()) { MMI_HILOGD("DisplayInfo empty"); @@ -1380,7 +1397,7 @@ void InputWindowsManager::ResetPointerPositionIfOutValidDisplay(const DisplayGro CHKPV(displayInfo); CursorDrawingComponent::GetInstance().SetPointerLocation( static_cast(cursorPosx), - static_cast(cursorPosy), displayInfo->uniqueId); + static_cast(cursorPosy), displayInfo->rsId); } if (isChange) { CancelMouseEvent(); @@ -1392,7 +1409,7 @@ void InputWindowsManager::ResetPointerPositionIfOutValidDisplay(const DisplayGro } bool InputWindowsManager::IsPositionOutValidDisplay( - Coordinate2D &position, const DisplayInfo ¤tDisplay, bool isPhysicalPos) + Coordinate2D &position, const OLD::DisplayInfo ¤tDisplay, bool isPhysicalPos) { double posX = position.x; double posY = position.y; @@ -1487,7 +1504,7 @@ bool InputWindowsManager::IsPositionOutValidDisplay( } #ifdef OHOS_BUILD_ENABLE_VKEYBOARD -bool InputWindowsManager::IsPointerActiveRectValid(const DisplayInfo ¤tDisplay) +bool InputWindowsManager::IsPointerActiveRectValid(const OLD::DisplayInfo ¤tDisplay) { return currentDisplay.pointerActiveWidth > 0 && currentDisplay.pointerActiveHeight > 0; } @@ -1550,7 +1567,7 @@ bool InputWindowsManager::IsCaptureMode() } #endif // OHOS_BUILD_ENABLE_VKEYBOARD -void InputWindowsManager::CancelTouchScreenEventIfValidDisplayChange(const DisplayGroupInfo &displayGroupInfo) +void InputWindowsManager::CancelTouchScreenEventIfValidDisplayChange(const OLD::DisplayGroupInfo &displayGroupInfo) { if (lastPointerEventforGesture_ == nullptr) { MMI_HILOGD("lastPointerEventforGesture_ is null"); @@ -1604,7 +1621,7 @@ void InputWindowsManager::CancelMouseEvent() } } -bool InputWindowsManager::IsValidDisplayChange(const DisplayInfo &displayInfo) +bool InputWindowsManager::IsValidDisplayChange(const OLD::DisplayInfo &displayInfo) { int32_t touchDisplayId = displayInfo.id; int32_t groupId = FindDisplayGroupId(touchDisplayId); @@ -1653,7 +1670,7 @@ bool InputWindowsManager::IsValidDisplayChange(const DisplayInfo &displayInfo) return false; } -void InputWindowsManager::HandleWindowPositionChange(const DisplayGroupInfo &displayGroupInfo) +void InputWindowsManager::HandleWindowPositionChange(const OLD::DisplayGroupInfo &displayGroupInfo) { CALL_DEBUG_ENTER; int32_t groupId = displayGroupInfo.groupId; @@ -1752,10 +1769,10 @@ bool InputWindowsManager::JudgeCaramaInFore() return programName.find(".camera") != std::string::npos; } -void InputWindowsManager::InitDisplayGroupInfo(DisplayGroupInfo &displayGroupInfo) +void InputWindowsManager::InitDisplayGroupInfo(OLD::DisplayGroupInfo &displayGroupInfo) { int32_t groupId = displayGroupInfo.groupId; - if (displayGroupInfo.isMainGroup) { + if (displayGroupInfo.type == GroupType::GROUP_DEFAULT) { if (groupId != MAIN_GROUPID) { MMI_HILOGE("The groupId is incorrect, groupId:%{public}d", groupId); return; @@ -1764,16 +1781,16 @@ void InputWindowsManager::InitDisplayGroupInfo(DisplayGroupInfo &displayGroupInf displayGroupInfoMap_[groupId] = displayGroupInfo; } -void InputWindowsManager::UpdateDisplayInfo(DisplayGroupInfo &displayGroupInfo) +void InputWindowsManager::UpdateDisplayInfo(OLD::DisplayGroupInfo &displayGroupInfo) { InitDisplayGroupInfo(displayGroupInfo); - if (!mainGroupExisted_ && displayGroupInfo.isMainGroup) { + if (!mainGroupExisted_ && displayGroupInfo.type == GroupType::GROUP_DEFAULT) { mainGroupExisted_ = true; } int32_t groupId = displayGroupInfo.groupId; bool bFlag = false; #ifdef OHOS_BUILD_ENABLE_ANCO - bFlag = mainGroupExisted_ && !displayGroupInfo.displaysInfo.empty(); + bFlag = displayGroupInfo.type == GroupType::GROUP_DEFAULT && !displayGroupInfo.displaysInfo.empty(); if (bFlag) { const auto &displayInfo = displayGroupInfo.displaysInfo.front(); std::lock_guard lock(oneHandMtx_); @@ -1793,7 +1810,7 @@ void InputWindowsManager::UpdateDisplayInfo(DisplayGroupInfo &displayGroupInfo) if (GetHardCursorEnabled()) { isDisplayChanged = OnDisplayRemovedOrCombinationChanged(displayGroupInfo); } - DisplayGroupInfo displayGroupInfoTemp; + OLD::DisplayGroupInfo displayGroupInfoTemp; displayGroupInfoMapTmp_[displayGroupInfo.groupId] = displayGroupInfo; bFlag = (!Rosen::SceneBoardJudgement::IsSceneBoardEnabled() || action == WINDOW_UPDATE_ACTION::ADD_END) && ((currentUserId_ < 0) || (currentUserId_ == displayGroupInfo.currentUserId)); @@ -1902,7 +1919,7 @@ void InputWindowsManager::AdjustDisplayRotation(int32_t groupId) auto displayInfoTmp = GetPhysicalDisplay(displayId); CHKPV(displayInfoTmp); CursorDrawingComponent::GetInstance().SetPointerLocation( - static_cast(coord.x), static_cast(coord.y), displayInfoTmp->uniqueId); + static_cast(coord.x), static_cast(coord.y), displayInfoTmp->rsId); } } @@ -1932,6 +1949,9 @@ void InputWindowsManager::AdjustDragPosition(int32_t groupId) pointerEvent->GetPointerItem(pointerId, item); item.SetDisplayX(physicalX); item.SetDisplayY(physicalY); + GlobalCoords globalCoords = DisplayCoords2GlobalCoords({physicalX, physicalY}, displayId); + item.SetGlobalX(globalCoords.x); + item.SetGlobalY(globalCoords.y); item.SetDisplayXPos(physicalX); item.SetDisplayYPos(physicalY); pointerEvent->UpdatePointerItem(pointerId, item); @@ -2011,7 +2031,7 @@ void InputWindowsManager::DrawPointer(bool isDisplayRemoved) } } -void InputWindowsManager::PointerDrawingManagerOnDisplayInfo(const DisplayGroupInfo &displayGroupInfo, +void InputWindowsManager::PointerDrawingManagerOnDisplayInfo(const OLD::DisplayGroupInfo &displayGroupInfo, bool isDisplayRemoved) { auto currentDisplayInfo = CursorDrawingComponent::GetInstance().GetCurrentDisplayInfo(); @@ -2038,10 +2058,10 @@ void InputWindowsManager::PointerDrawingManagerOnDisplayInfo(const DisplayGroupI lastDpiMap_[groupId] = lastDpiTmp; } for (auto displayInfo : displayGroupInfo.displaysInfo) { - if (displayInfo.uniqueId == currentDisplayInfo.uniqueId && displayInfo.dpi != currentDisplayInfo.dpi) { + if (displayInfo.rsId == currentDisplayInfo.rsId && displayInfo.dpi != currentDisplayInfo.dpi) { MMI_HILOGD("dpi changed, current displayId: %{public}d, dpi: %{public}d, " - "latest displayId: %{public}d, dpi: %{public}d", - currentDisplayInfo.uniqueId, currentDisplayInfo.dpi, displayInfo.uniqueId, displayInfo.dpi); + "latest displayId: %{public}d, dpi: %{public}d", + currentDisplayInfo.rsId, currentDisplayInfo.dpi, displayInfo.rsId, displayInfo.dpi); auto drawNewDpiRes = CursorDrawingComponent::GetInstance().DrawNewDpiPointer(); if (drawNewDpiRes != RET_OK) { MMI_HILOGE("Draw New Dpi pointer failed."); @@ -2057,13 +2077,13 @@ void InputWindowsManager::PointerDrawingManagerOnDisplayInfo(const DisplayGroupI displayId = displayId < 0 ? newId : displayId; auto displayInfo = GetPhysicalDisplay(displayId); CHKPV(displayInfo); - int32_t DisplayInfoX = GetLogicalPositionX(displayId); - int32_t DisplayInfoY = GetLogicalPositionY(displayId); + int32_t displayInfoX = GetLogicalPositionX(displayId); + int32_t displayInfoY = GetLogicalPositionY(displayId); Direction DirectionCopy = GetLogicalPositionDirection(displayId); Direction DisplayDirection = GetPositionDisplayDirection(displayId); DispatchPointerCancel(displayId); - int32_t logicX = mouseLocation.physicalX + DisplayInfoX; - int32_t logicY = mouseLocation.physicalY + DisplayInfoY; + int32_t logicX = mouseLocation.physicalX + displayInfoX; + int32_t logicY = mouseLocation.physicalY + displayInfoY; lastLogicX_ = logicX; lastLogicY_ = logicY; std::optional windowInfo; @@ -2202,13 +2222,13 @@ void InputWindowsManager::UpdatePointerDrawingManagerWindowInfo() displayId = displayId < 0 ? newId : displayId; auto displayInfo = GetPhysicalDisplay(displayId); CHKPV(displayInfo); - int32_t DisplayInfoX = GetLogicalPositionX(displayId); - int32_t DisplayInfoY = GetLogicalPositionY(displayId); + int32_t displayInfoX = GetLogicalPositionX(displayId); + int32_t displayInfoY = GetLogicalPositionY(displayId); Direction DirectionCopy = GetLogicalPositionDirection(displayId); Direction DisplayDirection = GetPositionDisplayDirection(displayId); DispatchPointerCancel(displayId); - int32_t logicX = mouseLocation.physicalX + DisplayInfoX; - int32_t logicY = mouseLocation.physicalY + DisplayInfoY; + int32_t logicX = mouseLocation.physicalX + displayInfoX; + int32_t logicY = mouseLocation.physicalY + displayInfoY; lastLogicX_ = logicX; lastLogicY_ = logicY; std::optional windowInfo; @@ -2269,6 +2289,10 @@ void InputWindowsManager::SetPointerEvent(int32_t pointerAction, std::shared_ptr currentPointerItem.SetWindowYPos(lastLogicY_- lastWindowInfo_.area.y); currentPointerItem.SetDisplayX(lastPointerItem.GetDisplayX()); currentPointerItem.SetDisplayY(lastPointerItem.GetDisplayY()); + GlobalCoords globalCoords = DisplayCoords2GlobalCoords({currentPointerItem.GetDisplayX(), + currentPointerItem.GetDisplayY()}, lastPointerEventCopy->GetTargetDisplayId()); + currentPointerItem.SetGlobalX(globalCoords.x); + currentPointerItem.SetGlobalY(globalCoords.y); currentPointerItem.SetDisplayXPos(lastPointerItem.GetDisplayXPos()); currentPointerItem.SetDisplayYPos(lastPointerItem.GetDisplayYPos()); currentPointerItem.SetPointerId(0); @@ -2306,10 +2330,10 @@ void InputWindowsManager::SendPointerEvent(int32_t pointerAction) pointerEvent->UpdateId(); LogTracer lt(pointerEvent->GetId(), pointerEvent->GetEventType(), pointerAction); MouseLocation mouseLocation = GetMouseInfo(); - int32_t DisplayInfoX = GetLogicalPositionX(mouseLocation.displayId); - int32_t DisplayInfoY = GetLogicalPositionY(mouseLocation.displayId); - lastLogicX_ = mouseLocation.physicalX + DisplayInfoX; - lastLogicY_ = mouseLocation.physicalY + DisplayInfoY; + int32_t displayInfoX = GetLogicalPositionX(mouseLocation.displayId); + int32_t displayInfoY = GetLogicalPositionY(mouseLocation.displayId); + lastLogicX_ = mouseLocation.physicalX + displayInfoX; + lastLogicY_ = mouseLocation.physicalY + displayInfoY; if (pointerAction == PointerEvent::POINTER_ACTION_ENTER_WINDOW || Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) { auto touchWindow = GetWindowInfo(lastLogicX_, lastLogicY_, MAIN_GROUPID); @@ -2326,6 +2350,10 @@ void InputWindowsManager::SendPointerEvent(int32_t pointerAction) pointerItem.SetWindowYPos(lastLogicY_ - lastWindowInfo_.area.y); pointerItem.SetDisplayX(mouseLocation.physicalX); pointerItem.SetDisplayY(mouseLocation.physicalY); + GlobalCoords globalCoords = DisplayCoords2GlobalCoords({mouseLocation.physicalX, mouseLocation.physicalY}, + mouseLocation.displayId); + pointerItem.SetGlobalX(globalCoords.x); + pointerItem.SetGlobalY(globalCoords.y); pointerItem.SetDisplayXPos(mouseLocation.physicalX); pointerItem.SetDisplayYPos(mouseLocation.physicalY); pointerItem.SetPointerId(0); @@ -2412,7 +2440,7 @@ void InputWindowsManager::DispatchPointer(int32_t pointerAction, int32_t windowI currentPointerItem.SetWindowXPos(lastLogicX_ - lastWindowInfo_.area.x); currentPointerItem.SetWindowYPos(lastLogicY_ - lastWindowInfo_.area.y); if (pointerAction == PointerEvent::POINTER_ACTION_ENTER_WINDOW && windowId > 0) { - auto displayGroupInfo = GetMainDisplayGroupInfo(); + auto displayGroupInfo = GetDefaultDisplayGroupInfo(); int32_t displayId = 0; double cursorPosx = 0.0; double cursorPosy = 0.0; @@ -2425,6 +2453,11 @@ void InputWindowsManager::DispatchPointer(int32_t pointerAction, int32_t windowI } currentPointerItem.SetDisplayX(cursorPosx); currentPointerItem.SetDisplayY(cursorPosy); + auto mouseLocationTmp = iter->second; + GlobalCoords globalCoords = DisplayCoords2GlobalCoords({mouseLocationTmp.physicalX, mouseLocationTmp.physicalY}, + mouseLocationTmp.displayId); + currentPointerItem.SetGlobalX(globalCoords.x); + currentPointerItem.SetGlobalY(globalCoords.y); currentPointerItem.SetDisplayXPos(cursorPosx); currentPointerItem.SetDisplayYPos(cursorPosy); pointerEvent->SetTargetDisplayId(displayId); @@ -2435,6 +2468,10 @@ void InputWindowsManager::DispatchPointer(int32_t pointerAction, int32_t windowI currentPointerItem.SetWindowYPos(lastPointerItem.GetWindowYPos()); currentPointerItem.SetDisplayX(lastPointerItem.GetDisplayX()); currentPointerItem.SetDisplayY(lastPointerItem.GetDisplayY()); + GlobalCoords globalCoords = DisplayCoords2GlobalCoords({lastPointerItem.GetDisplayX(), + lastPointerItem.GetDisplayY()}, lastPointerEventCopy->GetTargetDisplayId()); + currentPointerItem.SetGlobalX(globalCoords.x); + currentPointerItem.SetGlobalY(globalCoords.y); currentPointerItem.SetDisplayXPos(lastPointerItem.GetDisplayXPos()); currentPointerItem.SetDisplayYPos(lastPointerItem.GetDisplayYPos()); pointerEvent->SetTargetDisplayId(lastPointerEventCopy->GetTargetDisplayId()); @@ -2448,6 +2485,10 @@ void InputWindowsManager::DispatchPointer(int32_t pointerAction, int32_t windowI } currentPointerItem.SetDisplayX(lastPointerItem.GetDisplayX()); currentPointerItem.SetDisplayY(lastPointerItem.GetDisplayY()); + GlobalCoords globalCoords = DisplayCoords2GlobalCoords({lastPointerItem.GetDisplayX(), + lastPointerItem.GetDisplayY()}, lastPointerEventCopy->GetTargetDisplayId()); + currentPointerItem.SetGlobalX(globalCoords.x); + currentPointerItem.SetGlobalY(globalCoords.y); currentPointerItem.SetDisplayXPos(lastPointerItem.GetDisplayXPos()); currentPointerItem.SetDisplayYPos(lastPointerItem.GetDisplayYPos()); pointerEvent->SetTargetDisplayId(lastPointerEventCopy->GetTargetDisplayId()); @@ -2658,15 +2699,13 @@ void InputWindowsManager::PrintWindowGroupInfo(const WindowGroupInfo &windowGrou PrintWindowInfo(windowGroupInfo.windowsInfo); } -void InputWindowsManager::PrintDisplayGroupInfo(const DisplayGroupInfo displayGroupInfo) +void InputWindowsManager::PrintDisplayGroupInfo(const OLD::DisplayGroupInfo displayGroupInfo) { 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", - displayGroupInfo.width, - displayGroupInfo.height, + MMI_HILOGD("logicalInfo,focusWindowId:%{public}d," + "windowsInfosNum:%{public}zu,displayInfosNum:%{public}zu", displayGroupInfo.focusWindowId, displayGroupInfo.windowsInfo.size(), displayGroupInfo.displaysInfo.size()); @@ -2676,7 +2715,7 @@ void InputWindowsManager::PrintDisplayGroupInfo(const DisplayGroupInfo displayGr } } -void InputWindowsManager::PrintDisplayInfo(const DisplayInfo displayInfo) +void InputWindowsManager::PrintDisplayInfo(const OLD::DisplayInfo displayInfo) { if (!HiLogIsLoggable(MMI_LOG_DOMAIN, MMI_LOG_TAG, LOG_DEBUG)) { return; @@ -2707,20 +2746,20 @@ void InputWindowsManager::PrintDisplayInfo(const DisplayInfo displayInfo) displayInfo.pointerActiveHeight); } -const std::shared_ptr InputWindowsManager::GetPhysicalDisplay(int32_t id) const +const std::shared_ptr InputWindowsManager::GetPhysicalDisplay(int32_t id) const { int32_t groupId = FindDisplayGroupId(id); const auto iter = displayGroupInfoMap_.find(groupId); if (iter != displayGroupInfoMap_.end()) { for (auto &it : iter->second.displaysInfo) { if (it.id == id) { - return std::make_shared(it); + return std::make_shared(it); } } } else { for (auto &it : displayGroupInfo_.displaysInfo) { if (it.id == id) { - return std::make_shared(it); + return std::make_shared(it); } } } @@ -2729,34 +2768,34 @@ const std::shared_ptr InputWindowsManager::GetPhysicalDisplay(int32 } #ifdef OHOS_BUILD_ENABLE_TOUCH -const std::shared_ptr InputWindowsManager::FindPhysicalDisplayInfo(const std::string& uniq) const +const std::shared_ptr InputWindowsManager::FindPhysicalDisplayInfo(const std::string& uniq) const { for (const auto &item : displayGroupInfoMap_) { for (const auto &it : item.second.displaysInfo) { if (it.uniq == uniq) { - return std::make_shared(it); + return std::make_shared(it); } } } - MMI_HILOGD("Failed to search for Physical, uniq:%{public}s", uniq.c_str()); - DisplayGroupInfo displayGroupInfo; + MMI_HILOGD("Failed to search for Physical,uniq:%{public}s", uniq.c_str()); + OLD::DisplayGroupInfo displayGroupInfo; auto iter = displayGroupInfoMap_.find(MAIN_GROUPID); if (iter != displayGroupInfoMap_.end()) { if (iter->second.displaysInfo.size() > 0) { - return std::make_shared(iter->second.displaysInfo[0]); + return std::make_shared(iter->second.displaysInfo[0]); } } return nullptr; } -const std::shared_ptr InputWindowsManager::GetDefaultDisplayInfo() const +const std::shared_ptr InputWindowsManager::GetDefaultDisplayInfo() const { return FindPhysicalDisplayInfo("default0"); } #endif // OHOS_BUILD_ENABLE_TOUCH #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) -void InputWindowsManager::ScreenRotateAdjustDisplayXY(const DisplayInfo& info, PhysicalCoordinate& coord) const +void InputWindowsManager::ScreenRotateAdjustDisplayXY(const OLD::DisplayInfo& info, PhysicalCoordinate& coord) const { int32_t groupId = FindDisplayGroupId(info.id); Direction rotation = info.direction; @@ -2783,7 +2822,7 @@ void InputWindowsManager::ScreenRotateAdjustDisplayXY(const DisplayInfo& info, P } } -void InputWindowsManager::RotateScreen90(const DisplayInfo& info, PhysicalCoordinate& coord) const +void InputWindowsManager::RotateScreen90(const OLD::DisplayInfo& info, PhysicalCoordinate& coord) const { double oldX = coord.x; double oldY = coord.y; @@ -2798,7 +2837,7 @@ void InputWindowsManager::RotateScreen90(const DisplayInfo& info, PhysicalCoordi return; } -void InputWindowsManager::RotateScreen(const DisplayInfo& info, PhysicalCoordinate& coord) const +void InputWindowsManager::RotateScreen(const OLD::DisplayInfo& info, PhysicalCoordinate& coord) const { double oldX = coord.x; double oldY = coord.y; @@ -2850,7 +2889,7 @@ void InputWindowsManager::RotateScreen(const DisplayInfo& info, PhysicalCoordina } } -void InputWindowsManager::RotateDisplayScreen(const DisplayInfo& info, PhysicalCoordinate& coord) +void InputWindowsManager::RotateDisplayScreen(const OLD::DisplayInfo& info, PhysicalCoordinate& coord) { Direction displayDirection = GetDisplayDirection(&info); bool isEnable = Rosen::SceneBoardJudgement::IsSceneBoardEnabled(); @@ -2895,7 +2934,7 @@ void InputWindowsManager::RotateDisplayScreen(const DisplayInfo& info, PhysicalC #ifdef OHOS_BUILD_ENABLE_TOUCH bool InputWindowsManager::GetPhysicalDisplayCoord(struct libinput_event_touch* touch, - const DisplayInfo& info, EventTouch& touchInfo, bool isNeedClear) + const OLD::DisplayInfo& info, EventTouch& touchInfo, bool isNeedClear) { PrintDisplayInfo(info); auto width = info.width; @@ -2906,6 +2945,7 @@ bool InputWindowsManager::GetPhysicalDisplayCoord(struct libinput_event_touch* t height = info.width; } } + PhysicalCoordinate coord { .x = libinput_event_touch_get_x_transformed(touch, width), .y = libinput_event_touch_get_y_transformed(touch, height - info.expandHeight), @@ -2930,6 +2970,10 @@ bool InputWindowsManager::GetPhysicalDisplayCoord(struct libinput_event_touch* t touchInfo.coordF = coord; touchInfo.point.x = static_cast(coord.x); touchInfo.point.y = static_cast(coord.y); + + touchInfo.globalCoord.x = info.x + touchInfo.point.x; + touchInfo.globalCoord.y = info.y + touchInfo.point.y; + touchInfo.toolRect.point.x = static_cast(libinput_event_touch_get_tool_x_transformed(touch, width)); touchInfo.toolRect.point.y = static_cast(libinput_event_touch_get_tool_y_transformed(touch, height - info.expandHeight)); @@ -3006,7 +3050,7 @@ bool InputWindowsManager::TouchPointToDisplayPoint(int32_t deviceId, struct libi CHKPF(info); physicalDisplayId = info->id; if ((info->width <= 0) || (info->height <= 0)) { - MMI_HILOGE("Get DisplayInfo is error"); + MMI_HILOGE("Get OLD::DisplayInfo is error"); return false; } return GetPhysicalDisplayCoord(touch, *info, touchInfo, isNeedClear); @@ -3060,7 +3104,7 @@ bool InputWindowsManager::CalculateTipPoint(struct libinput_event_tablet_tool* t #endif // OHOS_BUILD_ENABLE_TOUCH #ifdef OHOS_BUILD_ENABLE_POINTER -const DisplayGroupInfo InputWindowsManager::GetDisplayGroupInfo(int32_t groupId) +const OLD::DisplayGroupInfo InputWindowsManager::GetDisplayGroupInfo(int32_t groupId) { auto iter = displayGroupInfoMap_.find(groupId); if (iter != displayGroupInfoMap_.end()) { @@ -3069,7 +3113,7 @@ const DisplayGroupInfo InputWindowsManager::GetDisplayGroupInfo(int32_t groupId) return displayGroupInfo_; } -const std::vector& InputWindowsManager::GetDisplayInfoVector(int32_t groupId) const +const std::vector& InputWindowsManager::GetDisplayInfoVector(int32_t groupId) const { const auto &groupInfo = displayGroupInfoMap_.find(groupId); if (groupInfo != displayGroupInfoMap_.end()) { @@ -3224,10 +3268,10 @@ bool InputWindowsManager::IsNeedRefreshLayer(int32_t windowId) if (displayId < 0) { displayId = newId; } - int32_t DisplayInfoX = GetLogicalPositionX(displayId); - int32_t DisplayInfoY = GetLogicalPositionY(displayId); - int32_t logicX = mouseLocation.physicalX + DisplayInfoX; - int32_t logicY = mouseLocation.physicalY + DisplayInfoY; + int32_t displayInfoX = GetLogicalPositionX(displayId); + int32_t displayInfoY = GetLogicalPositionY(displayId); + int32_t logicX = mouseLocation.physicalX + displayInfoX; + int32_t logicY = mouseLocation.physicalY + displayInfoY; std::optional touchWindow = GetWindowInfo(logicX, logicY, groupId); if (!touchWindow) { MMI_HILOGE("TouchWindow is nullptr"); @@ -3623,7 +3667,7 @@ bool InputWindowsManager::InWhichHotArea(int32_t x, int32_t y, const std::vector #ifdef OHOS_BUILD_ENABLE_TOUCH void InputWindowsManager::AdjustDisplayCoordinate( - const DisplayInfo& displayInfo, double& physicalX, double& physicalY) const + const OLD::DisplayInfo& displayInfo, double& physicalX, double& physicalY) const { int32_t width = displayInfo.validWidth; int32_t height = displayInfo.validHeight; @@ -3889,7 +3933,7 @@ bool InputWindowsManager::SelectPointerChangeArea(int32_t windowId, int32_t logi return findFlag; } -void InputWindowsManager::UpdatePointerChangeAreas(const DisplayGroupInfo &displayGroupInfo) +void InputWindowsManager::UpdatePointerChangeAreas(const OLD::DisplayGroupInfo &displayGroupInfo) { CALL_DEBUG_ENTER; std::map> &winHotAreasTmp = windowsHotAreasMap_[displayGroupInfo.groupId]; @@ -4129,7 +4173,7 @@ bool InputWindowsManager::GetHoverScrollState() const return state; } -std::vector InputWindowsManager::HandleHardwareCursor(std::shared_ptr &physicalDisplayInfo, +std::vector InputWindowsManager::HandleHardwareCursor(std::shared_ptr &physicalDisplayInfo, int32_t physicalX, int32_t physicalY) { std::vector cursorPos = {DEFAULT_POSITION, DEFAULT_POSITION}; @@ -4157,8 +4201,8 @@ int32_t InputWindowsManager::UpdateMouseTarget(std::shared_ptr poi int32_t groupId = FindDisplayGroupId(displayId); auto physicalDisplayInfo = GetPhysicalDisplay(displayId); CHKPR(physicalDisplayInfo, ERROR_NULL_POINTER); - int32_t DisplayInfoX = GetLogicalPositionX(displayId); - int32_t DisplayInfoY = GetLogicalPositionY(displayId); + int32_t displayInfoX = GetLogicalPositionX(displayId); + int32_t displayInfoY = GetLogicalPositionY(displayId); int32_t pointerId = pointerEvent->GetPointerId(); PointerEvent::PointerItem pointerItem; if (!pointerEvent->GetPointerItem(pointerId, pointerItem)) { @@ -4167,27 +4211,27 @@ int32_t InputWindowsManager::UpdateMouseTarget(std::shared_ptr poi } int32_t logicalX = 0; int32_t logicalY = 0; - if (!AddInt32(pointerItem.GetDisplayX(), DisplayInfoX, logicalX)) { + int32_t physicalX = pointerItem.GetDisplayX(); + int32_t physicalY = pointerItem.GetDisplayY(); + if (!AddInt32(physicalX, displayInfoX, logicalX)) { MMI_HILOGE("The addition of logicalX overflows"); return RET_ERR; } - if (!AddInt32(pointerItem.GetDisplayY(), DisplayInfoY, logicalY)) { + if (!AddInt32(physicalY, displayInfoY, logicalY)) { MMI_HILOGE("The addition of logicalY overflows"); return RET_ERR; } if (pointerEvent->GetPointerAction() == PointerEvent::POINTER_ACTION_DOWN) { ClearTargetWindowId(pointerId); } - int32_t physicalX = pointerItem.GetDisplayX(); - int32_t physicalY = pointerItem.GetDisplayY(); auto touchWindow = SelectWindowInfo(logicalX, logicalY, pointerEvent); if (pointerEvent->GetPointerAction() == PointerEvent::POINTER_ACTION_AXIS_BEGIN) { axisBeginWindowInfo_ = touchWindow; } if (!touchWindow) { 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()); + "displayX:%{public}d, displayY:%{public}d", physicalDisplayInfo->rsId, logicalX, logicalY, + physicalX, physicalY); if (pointerEvent->GetPointerAction() == PointerEvent::POINTER_ACTION_BUTTON_DOWN || (mouseDownInfo_.id == -1 && axisBeginWindowInfo_ == std::nullopt)) { MMI_HILOGE("touchWindow is nullptr, targetWindow:%{public}d", pointerEvent->GetTargetWindowId()); @@ -4211,15 +4255,15 @@ int32_t InputWindowsManager::UpdateMouseTarget(std::shared_ptr poi MMI_HILOGW("cursorPos is invalid"); return RET_ERR; } - CursorDrawingComponent::GetInstance().DrawMovePointer(physicalDisplayInfo->uniqueId, + CursorDrawingComponent::GetInstance().DrawMovePointer(physicalDisplayInfo->rsId, cursorPos[0], cursorPos[1]); } else { - CursorDrawingComponent::GetInstance().DrawMovePointer(physicalDisplayInfo->uniqueId, + CursorDrawingComponent::GetInstance().DrawMovePointer(physicalDisplayInfo->rsId, physicalX, physicalY); } 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()); + "displayX:%{public}d, displayY:%{public}d", physicalDisplayInfo->rsId, logicalX, logicalY, + physicalX, physicalY); #endif // OHOS_BUILD_ENABLE_POINTER_DRAWING int64_t endTime = GetSysClockTime(); if ((endTime - beginTime) > RS_PROCESS_TIMEOUT) { @@ -4348,7 +4392,7 @@ int32_t InputWindowsManager::UpdateMouseTarget(std::shared_ptr poi dragPointerStyle_.id, globalStyle_.id); dragPointerStyle_ = globalStyle_; } - CursorDrawingComponent::GetInstance().DrawPointer(physicalDisplayInfo->uniqueId, physicalX, physicalY, + CursorDrawingComponent::GetInstance().DrawPointer(physicalDisplayInfo->rsId, physicalX, physicalY, dragPointerStyle_, direction); } #endif // OHOS_BUILD_ENABLE_POINTER_DRAWING @@ -4383,6 +4427,17 @@ int32_t InputWindowsManager::UpdateMouseTarget(std::shared_ptr poi pointerItem.SetWindowY(static_cast(windowY)); pointerItem.SetWindowXPos(windowX); pointerItem.SetWindowYPos(windowY); + pointerItem.SetGlobalX(logicalX); + pointerItem.SetGlobalY(logicalY); + MMI_HILOGD("(displayX:%{private}d, displayY:%{private}d)" + "(displayInfoX:%{private}d, displayInfoY:%{private}d)" + "(globalX:%{private}f, globalY:%{private}f)", + pointerItem.GetDisplayX(), + pointerItem.GetDisplayY(), + displayInfoX, + displayInfoY, + pointerItem.GetGlobalX(), + pointerItem.GetGlobalY()); pointerEvent->UpdatePointerItem(pointerId, pointerItem); if ((extraData_.appended && (extraData_.sourceType == PointerEvent::SOURCE_TYPE_MOUSE)) || (pointerEvent->GetPointerAction() == PointerEvent::POINTER_ACTION_PULL_UP)) { @@ -4631,7 +4686,7 @@ bool InputWindowsManager::IsNavigationWindowInjectEvent(std::shared_ptr &pointerEvent, PointerEvent::PointerItem &pointerItem) { pointerEvent->SetFixedMode(PointerEvent::FixedMode::AUTO); @@ -4668,7 +4723,7 @@ void InputWindowsManager::HandleOneHandMode(const DisplayInfo &displayInfo, pointerItem.SetFixedDisplayY(static_cast(fixedDisplayY)); } -void InputWindowsManager::UpdatePointerItemInOneHandMode(const DisplayInfo &displayInfo, +void InputWindowsManager::UpdatePointerItemInOneHandMode(const OLD::DisplayInfo &displayInfo, std::shared_ptr &pointerEvent) { int32_t pointerId = pointerEvent->GetPointerId(); @@ -4705,7 +4760,8 @@ void InputWindowsManager::UpdatePointerItemInOneHandMode(const DisplayInfo &disp } #endif // OHOS_BUILD_ENABLE_ONE_HAND_MODE -void InputWindowsManager::UpdateFixedXY(const DisplayInfo& displayInfo, std::shared_ptr &pointerEvent) +void InputWindowsManager::UpdateFixedXY(const OLD::DisplayInfo& displayInfo, + std::shared_ptr &pointerEvent) { #ifdef OHOS_BUILD_ENABLE_ONE_HAND_MODE UpdatePointerItemInOneHandMode(displayInfo, pointerEvent); @@ -4723,7 +4779,7 @@ void InputWindowsManager::UpdateFixedXY(const DisplayInfo& displayInfo, std::sha } void InputWindowsManager::UpdateTransformDisplayXY(std::shared_ptr pointerEvent, - const std::vector& windowsInfo, const DisplayInfo& displayInfo) + const std::vector& windowsInfo, const OLD::DisplayInfo& displayInfo) { CHKPV(pointerEvent); bool isNavigationWindow = false; @@ -4767,6 +4823,9 @@ void InputWindowsManager::UpdateTransformDisplayXY(std::shared_ptr pointerItem.SetDisplayX(static_cast(physicalX)); pointerItem.SetDisplayY(static_cast(physicalY)); + GlobalCoords globalCoords = DisplayCoords2GlobalCoords({physicalX, physicalY}, pointerEvent->GetTargetDisplayId()); + pointerItem.SetGlobalX(globalCoords.x); + pointerItem.SetGlobalY(globalCoords.y); pointerItem.SetDisplayXPos(physicalX); pointerItem.SetDisplayYPos(physicalY); pointerEvent->UpdatePointerItem(pointerId, pointerItem); @@ -4793,12 +4852,15 @@ void InputWindowsManager::SendUIExtentionPointerEvent(double logicalX, double lo windowX = windowXY.first; windowY = windowXY.second; } - int32_t DisplayInfoX = GetLogicalPositionX(pointerEvent->GetTargetDisplayId()); - int32_t DisplayInfoY = GetLogicalPositionY(pointerEvent->GetTargetDisplayId()); - double physicalX = logicalX - DisplayInfoX; - double physicalY = logicalY - DisplayInfoY; + int32_t displayInfoX = GetLogicalPositionX(pointerEvent->GetTargetDisplayId()); + int32_t displayInfoY = GetLogicalPositionY(pointerEvent->GetTargetDisplayId()); + double physicalX = logicalX - displayInfoX; + double physicalY = logicalY - displayInfoY; pointerItem.SetDisplayX(static_cast(physicalX)); pointerItem.SetDisplayY(static_cast(physicalY)); + GlobalCoords globalCoords = DisplayCoords2GlobalCoords({physicalX, physicalY}, pointerEvent->GetTargetDisplayId()); + pointerItem.SetGlobalX(globalCoords.x); + pointerItem.SetGlobalY(globalCoords.y); pointerItem.SetDisplayXPos(physicalX); pointerItem.SetDisplayYPos(physicalY); pointerItem.SetWindowX(static_cast(windowX)); @@ -4852,6 +4914,39 @@ void InputWindowsManager::HandleGestureInjection(bool gestureInject) { } } +void InputWindowsManager::ProcessInjectEventGlobalXY(std::shared_ptr pointerEvent, int32_t useCoordinate) +{ + if (!pointerEvent->HasFlag(InputEvent::EVENT_FLAG_SIMULATE)) { + return; + } + if (useCoordinate != PointerEvent::GLOBAL_COORDINATE) { + return; + } + int32_t pointerId = pointerEvent->GetPointerId(); + PointerEvent::PointerItem pointerItem; + + if (!pointerEvent->GetPointerItem(pointerId, pointerItem)) { + MMI_HILOG_DISPATCHE("Can't find pointer item, pointer:%{public}d", pointerId); + return; + } + double globalX = pointerItem.GetGlobalX(); + double globalY = pointerItem.GetGlobalY(); + if (globalX == DBL_MAX || globalY == DBL_MAX) { + return; + } + const auto& mainGroup = GetDefaultDisplayGroupInfo(); + for (const auto& display : mainGroup.displaysInfo) { + if (globalX >= display.x && globalX <= display.x + display.width && + globalY >= display.y && globalY <= display.y + display.height) { + pointerEvent->SetTargetDisplayId(display.id); + pointerItem.SetDisplayX(static_cast(globalX - display.x)); + pointerItem.SetDisplayY(static_cast(globalY - display.y)); + pointerEvent->UpdatePointerItem(pointerId, pointerItem); + return; + } + } +} + int32_t InputWindowsManager::UpdateTouchScreenTarget(std::shared_ptr pointerEvent) { CHKPR(pointerEvent, ERROR_NULL_POINTER); @@ -4867,7 +4962,6 @@ int32_t InputWindowsManager::UpdateTouchScreenTarget(std::shared_ptrSetTargetDisplayId(displayId); - int32_t groupId = FindDisplayGroupId(displayId); auto physicDisplayInfo = GetPhysicalDisplay(displayId); CHKPR(physicDisplayInfo, ERROR_NULL_POINTER); @@ -4894,18 +4988,18 @@ int32_t InputWindowsManager::UpdateTouchScreenTarget(std::shared_ptr(physicalX), DisplayInfoX, logicalX1)) { + int32_t displayInfoX = GetLogicalPositionX(displayId); + int32_t displayInfoY = GetLogicalPositionY(displayId); + if (!AddInt32(static_cast(physicalX), displayInfoX, logicalX1)) { MMI_HILOG_DISPATCHE("The addition of logicalX overflows"); return RET_ERR; } - if (!AddInt32(static_cast(physicalY), DisplayInfoY, logicalY1)) { + if (!AddInt32(static_cast(physicalY), displayInfoY, logicalY1)) { MMI_HILOG_DISPATCHE("The addition of logicalY overflows"); return RET_ERR; } - double logicalX = physicalX + DisplayInfoX; - double logicalY = physicalY + DisplayInfoY; + double logicalX = physicalX + displayInfoX; + double logicalY = physicalY + displayInfoY; const WindowInfo *touchWindow = nullptr; auto targetWindowId = (NeedTouchTracking(*pointerEvent)? GLOBAL_WINDOW_ID : pointerItem.GetTargetWindowId()); bool isHotArea = false; @@ -5188,6 +5282,8 @@ int32_t InputWindowsManager::UpdateTouchScreenTarget(std::shared_ptr(physicalX)); pointerItem.SetDisplayY(static_cast(physicalY)); + pointerItem.SetGlobalX(physicalX + physicDisplayInfo->x); + pointerItem.SetGlobalY(physicalY + physicDisplayInfo->y); pointerItem.SetWindowX(static_cast(windowX)); pointerItem.SetWindowY(static_cast(windowY)); pointerItem.SetDisplayXPos(physicalX); @@ -5294,7 +5390,7 @@ int32_t InputWindowsManager::UpdateTouchScreenTarget(std::shared_ptrpid, .windowId = touchWindow->id }; CursorDrawingComponent::GetInstance().OnWindowInfo(info); - CursorDrawingComponent::GetInstance().DrawPointer(physicDisplayInfo->uniqueId, + CursorDrawingComponent::GetInstance().DrawPointer(physicDisplayInfo->rsId, pointerItem.GetDisplayX(), pointerItem.GetDisplayY(), pointerStyle, physicDisplayInfo->direction); } else if (CursorDrawingComponent::GetInstance().GetMouseDisplayState()) { if ((!checkExtraData) && (!(extraData_.appended && @@ -5475,6 +5571,8 @@ void InputWindowsManager::DispatchTouch(int32_t pointerAction, int32_t groupId) currentPointerItem.SetWindowYPos(windowY); currentPointerItem.SetDisplayX(lastPointerItem.GetDisplayX()); currentPointerItem.SetDisplayY(lastPointerItem.GetDisplayY()); + currentPointerItem.SetGlobalX(lastPointerItem.GetGlobalX()); + currentPointerItem.SetGlobalY(lastPointerItem.GetGlobalY()); currentPointerItem.SetDisplayXPos(lastPointerItem.GetDisplayXPos()); currentPointerItem.SetDisplayYPos(lastPointerItem.GetDisplayYPos()); currentPointerItem.SetPressed(lastPointerItem.IsPressed()); @@ -5618,10 +5716,10 @@ void InputWindowsManager::DrawTouchGraphic(std::shared_ptr pointer } if (!isInMethodWindow) { knuckleDrawMgr_->UpdateDisplayInfo(*physicDisplayInfo); - knuckleDrawMgr_->KnuckleDrawHandler(pointerEvent, physicDisplayInfo->uniqueId); + knuckleDrawMgr_->KnuckleDrawHandler(pointerEvent, physicDisplayInfo->rsId); #ifndef OHOS_BUILD_ENABLE_NEW_KNUCKLE_DYNAMIC knuckleDynamicDrawingManager_->UpdateDisplayInfo(*physicDisplayInfo); - knuckleDynamicDrawingManager_->KnuckleDynamicDrawHandler(pointerEvent, physicDisplayInfo->uniqueId); + knuckleDynamicDrawingManager_->KnuckleDynamicDrawHandler(pointerEvent, physicDisplayInfo->rsId); #endif // OHOS_BUILD_ENABLE_NEW_KNUCKLE_DYNAMIC } #endif // OHOS_BUILD_ENABLE_KEYBOARD && OHOS_BUILD_ENABLE_COMBINATION_KEY && OHOS_BUILD_ENABLE_GESTURESENSE_WRAPPER @@ -5729,7 +5827,7 @@ int32_t InputWindowsManager::UpdateTargetPointer(std::shared_ptr p return ret; } -bool InputWindowsManager::IsInsideDisplay(const DisplayInfo& displayInfo, double physicalX, double physicalY) +bool InputWindowsManager::IsInsideDisplay(const OLD::DisplayInfo& displayInfo, double physicalX, double physicalY) { auto displayDirection = GetDisplayDirection(&displayInfo); auto physicalRect = RotateRect(displayDirection, { displayInfo.validWidth, displayInfo.validHeight }); @@ -5746,7 +5844,7 @@ bool InputWindowsManager::IsInsideDisplay(const DisplayInfo& displayInfo, double return isInside; } -bool InputWindowsManager::CalculateLayout(const DisplayInfo &displayInfo, const Vector2D &physical, +bool InputWindowsManager::CalculateLayout(const OLD::DisplayInfo &displayInfo, const Vector2D &physical, Vector2D &layout) { Direction direction = GetDisplayDirection(&displayInfo); @@ -5768,7 +5866,7 @@ bool InputWindowsManager::CalculateLayout(const DisplayInfo &displayInfo, const return true; } -AcrossDirection InputWindowsManager::CalculateAcrossDirection(const DisplayInfo &displayInfo, +AcrossDirection InputWindowsManager::CalculateAcrossDirection(const OLD::DisplayInfo &displayInfo, const Vector2D &layout) { Vector2D layoutMax; @@ -5796,7 +5894,7 @@ AcrossDirection InputWindowsManager::CalculateAcrossDirection(const DisplayInfo return AcrossDirection::ACROSS_ERROR; } -bool InputWindowsManager::AcrossDisplay(const DisplayInfo &displayInfoDes, const DisplayInfo &displayInfoOri, +bool InputWindowsManager::AcrossDisplay(const OLD::DisplayInfo &displayInfoDes, const OLD::DisplayInfo &displayInfoOri, Vector2D &logical, Vector2D &layout, const AcrossDirection &acrossDirection) { Vector2D layoutMax; @@ -5838,7 +5936,7 @@ bool InputWindowsManager::AcrossDisplay(const DisplayInfo &displayInfoDes, const return re; } -void InputWindowsManager::FindPhysicalDisplay(const DisplayInfo& displayInfo, double& physicalX, +void InputWindowsManager::FindPhysicalDisplay(const OLD::DisplayInfo& displayInfo, double& physicalX, double& physicalY, int32_t& displayId) { CALL_DEBUG_ENTER; @@ -5902,7 +6000,7 @@ void InputWindowsManager::CoordinateCorrection(int32_t width, int32_t height, in } } -Direction InputWindowsManager::GetDisplayDirection(const DisplayInfo *displayInfo) +Direction InputWindowsManager::GetDisplayDirection(const OLD::DisplayInfo *displayInfo) { Direction displayDirection = static_cast(( ((displayInfo->direction - displayInfo->displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); @@ -5920,7 +6018,7 @@ Direction InputWindowsManager::GetDisplayDirection(const DisplayInfo *displayInf return displayDirection; } -void InputWindowsManager::GetWidthAndHeight(const DisplayInfo* displayInfo, int32_t &width, int32_t &height, +void InputWindowsManager::GetWidthAndHeight(const OLD::DisplayInfo* displayInfo, int32_t &width, int32_t &height, bool isRealData) { auto displayDirection = GetDisplayDirection(displayInfo); @@ -5940,7 +6038,7 @@ void InputWindowsManager::GetWidthAndHeight(const DisplayInfo* displayInfo, int3 #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) -void InputWindowsManager::ReverseRotateScreen(const DisplayInfo& info, const double x, const double y, +void InputWindowsManager::ReverseRotateScreen(const OLD::DisplayInfo& info, const double x, const double y, Coordinate2D& cursorPos) const { const Direction direction = info.direction; @@ -5986,7 +6084,7 @@ void InputWindowsManager::ReverseRotateScreen(const DisplayInfo& info, const dou } } -void InputWindowsManager::ReverseRotateDisplayScreen(const DisplayInfo& info, const double x, const double y, +void InputWindowsManager::ReverseRotateDisplayScreen(const OLD::DisplayInfo& info, const double x, const double y, Coordinate2D& cursorPos) const { Direction displayDirection = WIN_MGR->GetDisplayDirection(&info); @@ -6132,7 +6230,7 @@ MouseLocation InputWindowsManager::GetMouseInfo() MMI_HILOGD("Mouselocation start: displayId:%{public}d, X:%{public}d, Y:%{public}d", curMouseLocation.displayId, curMouseLocation.physicalX, curMouseLocation.physicalY); if ((curMouseLocation.displayId < 0) && !displaysInfoVector.empty()) { - DisplayInfo displayInfo = displaysInfoVector[0]; + OLD::DisplayInfo displayInfo = displaysInfoVector[0]; if (GetHardCursorEnabled()) { (void)GetMainScreenDisplayInfo(displaysInfoVector, displayInfo); } @@ -6162,7 +6260,7 @@ CursorPosition InputWindowsManager::GetCursorPos() cursorPos = iter->second; } if ((cursorPos.displayId < 0) && !displaysInfoVector.empty()) { - DisplayInfo displayInfo = displaysInfoVector[0]; + OLD::DisplayInfo displayInfo = displaysInfoVector[0]; if (GetHardCursorEnabled()) { (void)GetMainScreenDisplayInfo(displaysInfoVector, displayInfo); } @@ -6181,7 +6279,7 @@ CursorPosition InputWindowsManager::ResetCursorPos() CALL_DEBUG_ENTER; auto &displaysInfoVector = GetDisplayInfoVector(MAIN_GROUPID); if (!displaysInfoVector.empty()) { - DisplayInfo displayInfo = displaysInfoVector[0]; + OLD::DisplayInfo displayInfo = displaysInfoVector[0]; int32_t x = displayInfo.validWidth * HALF_RATIO; int32_t y = displayInfo.validHeight * HALF_RATIO; if (GetHardCursorEnabled()) { @@ -6308,17 +6406,19 @@ void InputWindowsManager::UpdatePointerAction(std::shared_ptr poin MMI_HILOG_DISPATCHD("pointerAction:%{public}s", pointerEvent->DumpPointerAction()); } -void InputWindowsManager::DumpDisplayInfo(int32_t fd, const std::vector& displaysInfo) +void InputWindowsManager::DumpDisplayInfo(int32_t fd, const std::vector& displaysInfo) { mprintf(fd, "Displays information:\t"); mprintf(fd, "displayInfos,num:%zu", displaysInfo.size()); for (const auto &item : displaysInfo) { - mprintf(fd, "\t displayInfos: uniqueId:%d | screenCombination:%d id:%d | x:%d" - "| y:%d | width:%d | height:%d | name:%s | uniq:%s | direction:%d" - "| displayDirection:%d | displayMode:%u \t", - item.uniqueId, item.screenCombination, item.id, item.x, item.y, item.width, - item.height, item.name.c_str(), item.uniq.c_str(), item.direction, - item.displayDirection, item.displayMode); + mprintf(fd, "\t displayInfos: rsId:%d | displaySourceMode:%d id:%d | x:%d" + "| y:%d | width:%d | height:%d | name:%s | uniq:%s | direction:%d" + "| displayDirection:%d | displayMode:%u | offsetX:%d | offsetY:%d" + "| validWidth:%d | validHeight:%d | pointerActiveWidth:%d | pointerActiveHeight:%d\t", + item.rsId, item.displaySourceMode, item.id, item.x, item.y, item.width, + item.height, item.name.c_str(), item.uniq.c_str(), item.direction, + item.displayDirection, item.displayMode, item.offsetX, item.offsetY, + item.validWidth, item.validHeight, item.pointerActiveWidth, item.pointerActiveHeight); if (item.transform.size() == MATRIX3_SIZE) { mprintf(fd, "\t transform: scaleX:%f | scaleY:%f | anchorPointX:%f | anchorPointY:%f \t", item.transform[SCALE_X], item.transform[SCALE_Y], item.transform[ANCHOR_POINT_X], @@ -6333,7 +6433,7 @@ void InputWindowsManager::Dump(int32_t fd, const std::vector &args) std::shared_ptr delegateProxy = CursorDrawingComponent::GetInstance().GetDelegateProxy(); CHKPV(delegateProxy); - std::vector displaysInfo; + std::vector displaysInfo; std::vector windowsInfo; delegateProxy->OnPostSyncTask([this, &displaysInfo, &windowsInfo] { const auto& iter = displayGroupInfoMap_.find(MAIN_GROUPID); @@ -6404,7 +6504,7 @@ std::pair InputWindowsManager::TransformWindowXY(const WindowInf return { windowXY[0], windowXY[1] }; } -std::pair InputWindowsManager::TransformDisplayXY(const DisplayInfo &info, +std::pair InputWindowsManager::TransformDisplayXY(const OLD::DisplayInfo &info, double logicX, double logicY) const { Matrix3f transform(info.transform); @@ -6641,7 +6741,7 @@ void InputWindowsManager::PrintChangedWindowByEvent(int32_t eventType, const Win lastMatchedWindow_[eventType] = newWindowInfo; } -void InputWindowsManager::PrintChangedWindowBySync(const DisplayGroupInfo &newDisplayInfo) +void InputWindowsManager::PrintChangedWindowBySync(const OLD::DisplayGroupInfo &newDisplayInfo) { auto &WindowsInfo = GetWindowInfoVector(newDisplayInfo.groupId); auto &oldWindows = WindowsInfo; @@ -6882,7 +6982,7 @@ void InputWindowsManager::UpdateKeyEventDisplayId(std::shared_ptr keyE } } -bool InputWindowsManager::OnDisplayRemovedOrCombinationChanged(const DisplayGroupInfo &displayGroupInfo) +bool InputWindowsManager::OnDisplayRemovedOrCombinationChanged(const OLD::DisplayGroupInfo &displayGroupInfo) { auto &displaysInfoVector = GetDisplayInfoVector(displayGroupInfo.groupId); if (displayGroupInfo.displaysInfo.empty() || displaysInfoVector.empty()) { @@ -6892,14 +6992,14 @@ bool InputWindowsManager::OnDisplayRemovedOrCombinationChanged(const DisplayGrou MMI_HILOGD("display has been removed"); return true; } - DisplayInfo newMainDisplayInfo; - DisplayInfo oldMainDisplayInfo; + OLD::DisplayInfo newMainDisplayInfo; + OLD::DisplayInfo oldMainDisplayInfo; (void)GetMainScreenDisplayInfo(displayGroupInfo.displaysInfo, newMainDisplayInfo); (void)GetMainScreenDisplayInfo(displaysInfoVector, oldMainDisplayInfo); MMI_HILOGI("newMainDisplayInfo:%{public}d, oldMainDisplayInfo:%{public}d", - newMainDisplayInfo.uniqueId, oldMainDisplayInfo.uniqueId); + newMainDisplayInfo.rsId, oldMainDisplayInfo.rsId); if (displayGroupInfo.displaysInfo.size() == displaysInfoVector.size() && - newMainDisplayInfo.uniqueId != oldMainDisplayInfo.uniqueId) { + newMainDisplayInfo.rsId != oldMainDisplayInfo.rsId) { MMI_HILOGD("current mainScreenDisplayId changed"); return true; } @@ -6929,12 +7029,12 @@ void InputWindowsManager::SetFoldState() BytraceAdapter::StopFoldState(); } -const std::shared_ptr InputWindowsManager::GetPhysicalDisplay(int32_t id, - const DisplayGroupInfo &displayGroupInfo) const +const std::shared_ptr InputWindowsManager::GetPhysicalDisplay(int32_t id, + const OLD::DisplayGroupInfo &displayGroupInfo) const { for (const auto &it : displayGroupInfo.displaysInfo) { if (it.id == id) { - return std::make_shared(it); + return std::make_shared(it); } } MMI_HILOGW("Failed to obtain physical(%{public}d) display", id); @@ -7191,7 +7291,7 @@ std::shared_ptr InputWindowsManager::GetlastPointerEvent() return lastPointerEvent_; } -std::pair InputWindowsManager::CalcDrawCoordinate(const DisplayInfo& displayInfo, +std::pair InputWindowsManager::CalcDrawCoordinate(const OLD::DisplayInfo& displayInfo, PointerEvent::PointerItem pointerItem) { CALL_DEBUG_ENTER; diff --git a/service/window_manager/src/knuckle_drawing_manager.cpp b/service/window_manager/src/knuckle_drawing_manager.cpp index 5db1b17be1..56892f064c 100644 --- a/service/window_manager/src/knuckle_drawing_manager.cpp +++ b/service/window_manager/src/knuckle_drawing_manager.cpp @@ -155,7 +155,7 @@ KnuckleDrawingManager::KnuckleDrawingManager() displayInfo_.displayDirection = Direction::DIRECTION0; } -void KnuckleDrawingManager::KnuckleDrawHandler(std::shared_ptr touchEvent, int32_t displayId) +void KnuckleDrawingManager::KnuckleDrawHandler(std::shared_ptr touchEvent, int32_t rsId) { CALL_DEBUG_ENTER; CHKPV(touchEvent); @@ -165,10 +165,10 @@ void KnuckleDrawingManager::KnuckleDrawHandler(std::shared_ptr tou CreateObserver(); int32_t touchAction = touchEvent->GetPointerAction(); if (IsValidAction(touchAction) && IsSingleKnuckleDoubleClick(touchEvent)) { - if (displayId == DEFAULT_VALUE) { - displayId = touchEvent->GetTargetDisplayId(); + if (rsId == DEFAULT_VALUE) { + rsId = touchEvent->GetTargetDisplayId(); } - CreateTouchWindow(displayId); + CreateTouchWindow(rsId); StartTouchDraw(touchEvent); } } @@ -242,7 +242,7 @@ bool KnuckleDrawingManager::IsValidAction(const int32_t action) return false; } -void KnuckleDrawingManager::UpdateDisplayInfo(const DisplayInfo& displayInfo) +void KnuckleDrawingManager::UpdateDisplayInfo(const OLD::DisplayInfo& displayInfo) { CALL_DEBUG_ENTER; if (displayInfo_.direction != displayInfo.direction) { @@ -267,7 +267,7 @@ void KnuckleDrawingManager::StartTouchDraw(std::shared_ptr touchEv } void KnuckleDrawingManager::RotationCanvasNode( - std::shared_ptr canvasNode, const DisplayInfo& displayInfo) + std::shared_ptr canvasNode, const OLD::DisplayInfo& displayInfo) { CALL_DEBUG_ENTER; CHKPV(canvasNode); @@ -340,7 +340,7 @@ void KnuckleDrawingManager::InitParticleEmitter() isNeedInitParticleEmitter_ = false; } -void KnuckleDrawingManager::CreateTouchWindow(const int32_t displayId) +void KnuckleDrawingManager::CreateTouchWindow(const int32_t rsId) { CALL_DEBUG_ENTER; if (surfaceNode_ != nullptr) { @@ -365,7 +365,7 @@ void KnuckleDrawingManager::CreateTouchWindow(const int32_t displayId) surfaceNode_->SetBackgroundColor(Rosen::Drawing::Color::COLOR_TRANSPARENT); #endif // USE_ROSEN_DRAWING - screenId_ = static_cast(displayId); + screenId_ = static_cast(rsId); surfaceNode_->SetRotation(0); CreateBrushWorkCanvasNode(); CreateTrackCanvasNode(); @@ -377,6 +377,7 @@ void KnuckleDrawingManager::CreateTouchWindow(const int32_t displayId) MMI_HILOGI("g_WindowScreenId:%{public}" PRIu64 ", g_DisplayNodeScreenId:%{public}" PRIu64 ", screenId_:%{public}" PRIu64, g_WindowScreenId, g_DisplayNodeScreenId, screenId_); surfaceNode_->AttachToDisplay(screenId_); + MMI_HILOGI("KnuckleDrawingManager screenId_:%{public}" PRIu64, screenId_); RotationCanvasNode(brushCanvasNode_, displayInfo_); RotationCanvasNode(trackCanvasNode_, displayInfo_); brushCanvasNode_->ResetSurface(scaleW_, scaleH_); diff --git a/service/window_manager/src/knuckle_dynamic_drawing_manager.cpp b/service/window_manager/src/knuckle_dynamic_drawing_manager.cpp index 920a95da91..cbf0fcf276 100644 --- a/service/window_manager/src/knuckle_dynamic_drawing_manager.cpp +++ b/service/window_manager/src/knuckle_dynamic_drawing_manager.cpp @@ -110,17 +110,17 @@ void KnuckleDynamicDrawingManager::UpdateTrackColors() } void KnuckleDynamicDrawingManager::KnuckleDynamicDrawHandler(std::shared_ptr pointerEvent, - int32_t displayId) + int32_t rsId) { CALL_DEBUG_ENTER; CHKPV(pointerEvent); if (!IsSingleKnuckle(pointerEvent)) { return; } - if (displayId == DEFAULT_VALUE) { - displayId = pointerEvent->GetTargetDisplayId(); + if (rsId == DEFAULT_VALUE) { + rsId = pointerEvent->GetTargetDisplayId(); } - CreateTouchWindow(displayId); + CreateTouchWindow(rsId); if (CheckPointerAction(pointerEvent)) { StartTouchDraw(pointerEvent); } @@ -300,7 +300,7 @@ void KnuckleDynamicDrawingManager::ProcessMoveEvent(std::shared_ptr return RET_OK; } -void KnuckleDynamicDrawingManager::CreateTouchWindow(const int32_t displayId) +void KnuckleDynamicDrawingManager::CreateTouchWindow(const int32_t rsId) { CALL_DEBUG_ENTER; if (surfaceNode_ != nullptr) { @@ -372,7 +372,7 @@ void KnuckleDynamicDrawingManager::CreateTouchWindow(const int32_t displayId) surfaceNode_->SetBackgroundColor(Rosen::Drawing::Color::COLOR_TRANSPARENT); #endif // USE_ROSEN_DRAWING - screenId_ = static_cast(displayId); + screenId_ = static_cast(rsId); surfaceNode_->SetRotation(0); CreateCanvasNode(); @@ -382,6 +382,7 @@ void KnuckleDynamicDrawingManager::CreateTouchWindow(const int32_t displayId) } MMI_HILOGI("The screenId_:%{public}" PRIu64, screenId_); surfaceNode_->AttachToDisplay(screenId_); + MMI_HILOGD("KnuckleDynamicDrawingManager screenId_:%{private}" PRIu64, screenId_); CHKPV(knuckleDrawMgr_); knuckleDrawMgr_->RotationCanvasNode(canvasNode_, displayInfo_); canvasNode_->ResetSurface(scaleW_, scaleH_); diff --git a/service/window_manager/src/pointer_drawing_manager.cpp b/service/window_manager/src/pointer_drawing_manager.cpp index 362373dd7d..34eb31a7fe 100644 --- a/service/window_manager/src/pointer_drawing_manager.cpp +++ b/service/window_manager/src/pointer_drawing_manager.cpp @@ -334,8 +334,7 @@ ICON_TYPE PointerDrawingManager::MouseIcon2IconType(MOUSE_ICON m) return ICON_TYPE(mouseIcons_[m].alignmentWay); } -bool PointerDrawingManager::SetCursorLocation(int32_t displayId, int32_t physicalX, - int32_t physicalY, ICON_TYPE iconType) +bool PointerDrawingManager::SetCursorLocation(int32_t physicalX, int32_t physicalY, ICON_TYPE iconType) { bool magicCursorSetBounds = false; if (UpdateSurfaceNodeBounds(physicalX, physicalY) == RET_OK) { @@ -376,25 +375,25 @@ void PointerDrawingManager::ForceClearPointerVisiableStatus() } int32_t PointerDrawingManager::UpdateMouseLayer(const PointerStyle& pointerStyle, - int32_t displayId, int32_t physicalX, int32_t physicalY) + int32_t physicalX, int32_t physicalY) { if (InitLayer(MOUSE_ICON(lastMouseStyle_.id)) != RET_OK) { mouseIconUpdate_ = false; MMI_HILOGE("Init layer failed"); return RET_ERR; } - if (!SetCursorLocation(displayId, physicalX, physicalY, MouseIcon2IconType(MOUSE_ICON(lastMouseStyle_.id)))) { + if (!SetCursorLocation(physicalX, physicalY, MouseIcon2IconType(MOUSE_ICON(lastMouseStyle_.id)))) { return RET_ERR; } return RET_OK; } -int32_t PointerDrawingManager::DrawMovePointer(int32_t displayId, int32_t physicalX, int32_t physicalY, +int32_t PointerDrawingManager::DrawMovePointer(int32_t rsId, int32_t physicalX, int32_t physicalY, PointerStyle pointerStyle, Direction direction) { CHKPR(GetSurfaceNode(), RET_ERR); MMI_HILOGD("Pointer window move success, pointerStyle id:%{public}d", pointerStyle.id); - displayId_ = displayId; + displayId_ = rsId; #ifdef OHOS_BUILD_ENABLE_MAGICCURSOR bool cursorEnlarged = MAGIC_POINTER_VELOCITY_TRACKER->GetCursorEnlargedStatus(); if (cursorEnlarged) { @@ -406,10 +405,10 @@ int32_t PointerDrawingManager::DrawMovePointer(int32_t displayId, int32_t physic } #endif // OHOS_BUILD_ENABLE_MAGICCURSOR if (GetHardCursorEnabled()) { - UpdateBindDisplayId(displayId); + UpdateBindDisplayId(rsId); } if (lastMouseStyle_ == pointerStyle && !mouseIconUpdate_ && lastDirection_ == direction) { - if (!SetCursorLocation(displayId, physicalX, physicalY, MouseIcon2IconType(MOUSE_ICON(lastMouseStyle_.id)))) { + if (!SetCursorLocation(physicalX, physicalY, MouseIcon2IconType(MOUSE_ICON(lastMouseStyle_.id)))) { return RET_ERR; } MMI_HILOGD("The lastpointerStyle is equal with pointerStyle, id:%{public}d, size:%{public}d", @@ -424,15 +423,15 @@ int32_t PointerDrawingManager::DrawMovePointer(int32_t displayId, int32_t physic if (GetHardCursorEnabled()) { UpdatePointerVisible(); } else { - int32_t UpdateLayerRes = UpdateMouseLayer(pointerStyle, displayId, physicalX, physicalY); + int32_t UpdateLayerRes = UpdateMouseLayer(pointerStyle, physicalX, physicalY); if (UpdateLayerRes != RET_OK) { MMI_HILOGE("Update Mouse Layer failed."); } UpdatePointerVisible(); } mouseIconUpdate_ = false; - MMI_HILOGD("Leave, display:%{public}d, physicalX:%{public}d, physicalY:%{public}d", - displayId, physicalX, physicalY); + MMI_HILOGD("Leave, rsId:%{public}d, physicalX:%{private}d, physicalY:%{private}d", + rsId, physicalX, physicalY); return RET_OK; } @@ -461,7 +460,7 @@ void PointerDrawingManager::DrawMovePointer(int32_t displayId, int32_t physicalX UpdateBindDisplayId(displayId); } if (GetSurfaceNode() != nullptr) { - if (!SetCursorLocation(displayId, physicalX, physicalY, MouseIcon2IconType(MOUSE_ICON(lastMouseStyle_.id)))) { + if (!SetCursorLocation(physicalX, physicalY, MouseIcon2IconType(MOUSE_ICON(lastMouseStyle_.id)))) { MMI_HILOGE("SetCursorLocation failed"); return; } @@ -469,7 +468,7 @@ void PointerDrawingManager::DrawMovePointer(int32_t displayId, int32_t physicalX } } -void PointerDrawingManager::SetHardwareCursorPosition(int32_t displayId, int32_t physicalX, int32_t physicalY, +void PointerDrawingManager::SetHardwareCursorPosition(int32_t physicalX, int32_t physicalY, PointerStyle pointerStyle) { if (GetHardCursorEnabled() && lastMouseStyle_.id != MOUSE_ICON::LOADING && @@ -482,12 +481,12 @@ void PointerDrawingManager::SetHardwareCursorPosition(int32_t displayId, int32_t } } -void PointerDrawingManager::DrawPointer(int32_t displayId, int32_t physicalX, int32_t physicalY, +void PointerDrawingManager::DrawPointer(int32_t rsId, int32_t physicalX, int32_t physicalY, const PointerStyle pointerStyle, Direction direction) { CALL_DEBUG_ENTER; - MMI_HILOGD("Display:%{public}d, physicalX:%{public}d, physicalY:%{public}d, pointerStyle:%{public}d", - displayId, physicalX, physicalY, pointerStyle.id); + MMI_HILOGD("rsId:%{public}d, physicalX:%{private}d, physicalY:%{private}d, pointerStyle:%{public}d", + rsId, physicalX, physicalY, pointerStyle.id); FixCursorPosition(physicalX, physicalY); lastPhysicalX_ = physicalX; lastPhysicalY_ = physicalY; @@ -499,18 +498,18 @@ void PointerDrawingManager::DrawPointer(int32_t displayId, int32_t physicalX, in MMI_HILOGD("MagicCursor AdjustMouseFocus:%{public}d", ICON_TYPE(mouseIcons_[MOUSE_ICON(pointerStyle.id)].alignmentWay)); } - if (DrawMovePointer(displayId, physicalX, physicalY, pointerStyle, direction) == RET_OK) { + if (DrawMovePointer(rsId, physicalX, physicalY, pointerStyle, direction) == RET_OK) { return; } #ifdef OHOS_BUILD_ENABLE_MAGICCURSOR if (HasMagicCursor() && currentMouseStyle_.id != DEVELOPER_DEFINED_ICON) { MMI_HILOGD("magicCursor DrawPointer enter CreatePointerWindow"); - MAGIC_CURSOR->CreatePointerWindow(displayId, physicalX, physicalY, direction, surfaceNode_); + MAGIC_CURSOR->CreatePointerWindow(rsId, physicalX, physicalY, direction, surfaceNode_); } else { - CreatePointerWindow(displayId, physicalX, physicalY, direction); + CreatePointerWindow(rsId, physicalX, physicalY, direction); } #else - CreatePointerWindow(displayId, physicalX, physicalY, direction); + CreatePointerWindow(rsId, physicalX, physicalY, direction); #endif // OHOS_BUILD_ENABLE_MAGICCURSOR CHKPV(GetSurfaceNode()); UpdateMouseStyle(); @@ -519,8 +518,9 @@ void PointerDrawingManager::DrawPointer(int32_t displayId, int32_t physicalX, in return; } UpdatePointerVisible(); - SetHardwareCursorPosition(displayId, physicalX, physicalY, lastMouseStyle_); - MMI_HILOGI("Leave, display:%{public}d, physicalX:%d, physicalY:%d", displayId, physicalX, physicalY); + SetHardwareCursorPosition(physicalX, physicalY, lastMouseStyle_); + MMI_HILOGI("Leave, rsId:%{private}d, physicalX:%{private}d, physicalY:%{private}d", + rsId, physicalX, physicalY); } void PointerDrawingManager::UpdateMouseStyle() @@ -560,10 +560,10 @@ int32_t PointerDrawingManager::SwitchPointerStyle() #ifdef OHOS_BUILD_ENABLE_MAGICCURSOR if (HasMagicCursor()) { MAGIC_CURSOR->EnableCursorInversion(); - MAGIC_CURSOR->CreatePointerWindow(displayInfo_.uniqueId, physicalX, physicalY, direction, surfaceNode_); + MAGIC_CURSOR->CreatePointerWindow(displayInfo_.rsId, physicalX, physicalY, direction, surfaceNode_); } else { MAGIC_CURSOR->DisableCursorInversion(); - CreatePointerWindow(displayInfo_.uniqueId, physicalX, physicalY, direction); + CreatePointerWindow(displayInfo_.rsId, physicalX, physicalY, direction); } #endif // OHOS_BUILD_ENABLE_MAGICCURSOR int32_t ret = InitLayer(MOUSE_ICON(lastMouseStyle_.id)); @@ -572,7 +572,7 @@ int32_t PointerDrawingManager::SwitchPointerStyle() return ret; } UpdatePointerVisible(); - SetHardwareCursorPosition(displayInfo_.uniqueId, physicalX, physicalY, lastMouseStyle_); + SetHardwareCursorPosition(physicalX, physicalY, lastMouseStyle_); return RET_OK; } @@ -725,15 +725,15 @@ sptr PointerDrawingManager::RetryGetSurfaceBuffer(sptrdisplayMode == DisplayMode::FULL && foldableDevicePolicyFull)))); } -Direction PointerDrawingManager::GetDisplayDirection(const DisplayInfo *displayInfo) +Direction PointerDrawingManager::GetDisplayDirection(const OLD::DisplayInfo *displayInfo) { Direction direction = static_cast(( ((displayInfo->direction - displayInfo->displayDirection) * ANGLE_90 + ANGLE_360) % ANGLE_360) / ANGLE_90); @@ -1615,6 +1615,7 @@ void PointerDrawingManager::AttachToDisplay() } auto surfaceNodePtr = GetSurfaceNode(); CHKPV(surfaceNodePtr); + MMI_HILOGI("AttachToDisplay screenId_:%{public}" PRIu64"", screenId_); surfaceNodePtr->AttachToDisplay(screenId_); } @@ -1640,21 +1641,21 @@ void PointerDrawingManager::CreateCanvasNode() surfaceNodePtr->AddChild(canvasNode_, DEFAULT_VALUE); } -int32_t PointerDrawingManager::CreatePointerWindowForScreenPointer(int32_t displayId, +int32_t PointerDrawingManager::CreatePointerWindowForScreenPointer(int32_t rsId, int32_t physicalX, int32_t physicalY) { CALL_DEBUG_ENTER; // suface node init std::shared_ptr sp = nullptr; { - if (screenPointers_.count(static_cast(displayId))) { - sp = screenPointers_[displayId]; + if (screenPointers_.count(static_cast(rsId))) { + sp = screenPointers_[rsId]; if (!g_isRsRestart) { for (auto it : screenPointers_) { CHKPR(it.second, RET_ERR); it.second->Init(pointerRenderer_); } - if (displayId == displayInfo_.uniqueId) { + if (rsId == displayInfo_.rsId) { CHKPR(sp, RET_ERR); SetSurfaceNode(sp->GetSurfaceNode()); } @@ -1665,16 +1666,16 @@ int32_t PointerDrawingManager::CreatePointerWindowForScreenPointer(int32_t displ g_isRsRestart = true; sp = std::make_shared(hardwareCursorPointerManager_, handler_, displayInfo_); CHKPR(sp, RET_ERR); - screenPointers_[displayInfo_.uniqueId] = sp; + screenPointers_[displayInfo_.rsId] = sp; if (!sp->Init(pointerRenderer_)) { - MMI_HILOGE("ScreenPointer %{public}d init failed", displayInfo_.uniqueId); + MMI_HILOGE("ScreenPointer %{public}d init failed", displayInfo_.rsId); return RET_ERR; } - if (displayId == displayInfo_.uniqueId) { + if (rsId == displayInfo_.rsId) { SetSurfaceNode(sp->GetSurfaceNode()); } - MMI_HILOGI("ScreenPointer displayId %{public}d displayInfo_.uniqueId %{public}d", - displayId, displayInfo_.uniqueId); + MMI_HILOGI("ScreenPointer rsId %{public}d displayInfo_.rsId %{public}d", + rsId, displayInfo_.rsId); Rosen::RSTransaction::FlushImplicitTransaction(); } } @@ -1685,8 +1686,7 @@ int32_t PointerDrawingManager::CreatePointerWindowForScreenPointer(int32_t displ return RET_OK; } -int32_t PointerDrawingManager::CreatePointerWindowForNoScreenPointer(int32_t displayId, - int32_t physicalX, int32_t physicalY) +int32_t PointerDrawingManager::CreatePointerWindowForNoScreenPointer(int32_t physicalX, int32_t physicalY) { CALL_DEBUG_ENTER; Rosen::RSSurfaceNodeConfig surfaceNodeConfig; @@ -1706,27 +1706,28 @@ int32_t PointerDrawingManager::CreatePointerWindowForNoScreenPointer(int32_t dis return RET_OK; } -void PointerDrawingManager::CreatePointerWindow(int32_t displayId, int32_t physicalX, int32_t physicalY, +void PointerDrawingManager::CreatePointerWindow(int32_t rsId, int32_t physicalX, int32_t physicalY, Direction direction) { CALL_DEBUG_ENTER; CALL_INFO_TRACE; - BytraceAdapter::StartRsSurfaceNode(displayId); + BytraceAdapter::StartRsSurfaceNode(rsId); if (GetHardCursorEnabled()) { g_isHdiRemoteDied = false; - if (CreatePointerWindowForScreenPointer(displayId, physicalX, physicalY) != RET_OK) { + if (CreatePointerWindowForScreenPointer(rsId, physicalX, physicalY) != RET_OK) { return; } } else { - if (CreatePointerWindowForNoScreenPointer(displayId, physicalX, physicalY) != RET_OK) { + if (CreatePointerWindowForNoScreenPointer(physicalX, physicalY) != RET_OK) { return; } } MMI_HILOGI("CreatePointerWindow The screenId_:%{public}" PRIu64, screenId_); - screenId_ = static_cast(displayId); + screenId_ = static_cast(rsId); AttachToDisplay(); - lastDisplayId_ = displayId; + lastDisplayId_ = rsId; + MMI_HILOGI("CreatePointerWindow The screenId_:%{public}" PRIu64, screenId_); RotateDegree(direction); lastDirection_ = direction; CreateCanvasNode(); @@ -2192,7 +2193,7 @@ int32_t PointerDrawingManager::SetPointerColor(int32_t color) } } UpdatePointerVisible(); - SetHardwareCursorPosition(displayInfo_.uniqueId, lastPhysicalX_, lastPhysicalY_, lastMouseStyle_); + SetHardwareCursorPosition(lastPhysicalX_, lastPhysicalY_, lastMouseStyle_); return RET_OK; } @@ -2210,12 +2211,12 @@ int32_t PointerDrawingManager::GetPointerColor() return pointerColor; } -void PointerDrawingManager::UpdateDisplayInfo(const DisplayInfo &displayInfo) +void PointerDrawingManager::UpdateDisplayInfo(const OLD::DisplayInfo &displayInfo) { CALL_DEBUG_ENTER; if (GetHardCursorEnabled()) { - if (screenPointers_.count(static_cast(displayInfo.uniqueId))) { - auto sp = screenPointers_[displayInfo.uniqueId]; + if (screenPointers_.count(static_cast(displayInfo.rsId))) { + auto sp = screenPointers_[displayInfo.rsId]; CHKPV(sp); sp->OnDisplayInfo(displayInfo, IsWindowRotation(&displayInfo)); if (sp->IsMain()) { @@ -2280,12 +2281,12 @@ int32_t PointerDrawingManager::SetPointerSize(int32_t size) AdjustMouseFocusToSoftRenderOrigin(direction, MOUSE_ICON(lastMouseStyle_.id), physicalX, physicalY); #ifdef OHOS_BUILD_ENABLE_MAGICCURSOR if (HasMagicCursor()) { - MAGIC_CURSOR->CreatePointerWindow(displayInfo_.uniqueId, physicalX, physicalY, direction, surfaceNode_); + MAGIC_CURSOR->CreatePointerWindow(displayInfo_.rsId, physicalX, physicalY, direction, surfaceNode_); } else { - CreatePointerWindow(displayInfo_.uniqueId, physicalX, physicalY, direction); + CreatePointerWindow(displayInfo_.rsId, physicalX, physicalY, direction); } #else - CreatePointerWindow(displayInfo_.uniqueId, physicalX, physicalY, direction); + CreatePointerWindow(displayInfo_.rsId, physicalX, physicalY, direction); #endif // OHOS_BUILD_ENABLE_MAGICCURSOR if (lastMouseStyle_.id == MOUSE_ICON::CURSOR_CIRCLE) { MMI_HILOGE("Cursor circle does not need to draw size"); @@ -2295,7 +2296,7 @@ int32_t PointerDrawingManager::SetPointerSize(int32_t size) return RET_ERR; } UpdatePointerVisible(); - SetHardwareCursorPosition(displayInfo_.uniqueId, physicalX, physicalY, lastMouseStyle_); + SetHardwareCursorPosition(physicalX, physicalY, lastMouseStyle_); return RET_OK; } @@ -2323,7 +2324,7 @@ int32_t PointerDrawingManager::GetCursorSurfaceId(uint64_t &surfaceId) return RET_OK; } -void PointerDrawingManager::OnDisplayInfo(const DisplayGroupInfo &displayGroupInfo) +void PointerDrawingManager::OnDisplayInfo(const OLD::DisplayGroupInfo &displayGroupInfo) { CALL_DEBUG_ENTER; if (displayGroupInfo.groupId != DEFAULT_GROUP_ID) { @@ -2331,21 +2332,21 @@ void PointerDrawingManager::OnDisplayInfo(const DisplayGroupInfo &displayGroupIn return; } for (const auto& item : displayGroupInfo.displaysInfo) { - if (item.uniqueId == displayInfo_.uniqueId && - item.screenCombination == displayInfo_.screenCombination) { + if (item.rsId == displayInfo_.rsId && + item.displaySourceMode == displayInfo_.displaySourceMode) { UpdateDisplayInfo(item); DrawManager(); return; } } - DisplayInfo displayInfo = displayGroupInfo.displaysInfo[0]; + OLD::DisplayInfo displayInfo = displayGroupInfo.displaysInfo[0]; if (GetHardCursorEnabled()) { (void)GetMainScreenDisplayInfo(displayGroupInfo, displayInfo); } UpdateDisplayInfo(displayInfo); lastPhysicalX_ = displayInfo.validWidth / CALCULATE_MIDDLE; lastPhysicalY_ = displayInfo.validHeight / CALCULATE_MIDDLE; - MouseEventHdr->OnDisplayLost(displayInfo_.uniqueId); + MouseEventHdr->OnDisplayLost(displayInfo_.rsId); auto surfaceNodePtr = GetSurfaceNode(); if (surfaceNodePtr != nullptr) { if (!GetHardCursorEnabled()) { @@ -2356,8 +2357,8 @@ void PointerDrawingManager::OnDisplayInfo(const DisplayGroupInfo &displayGroupIn Rosen::RSTransaction::FlushImplicitTransaction(); MMI_HILOGD("Pointer window destroy success"); } - MMI_HILOGD("displayId_:%{public}d, displayWidth_:%{public}d, displayHeight_:%{public}d", - displayInfo_.uniqueId, displayInfo_.validWidth, displayInfo_.validHeight); + MMI_HILOGD("rsId:%{public}d, displayWidth_:%{public}d, displayHeight_:%{public}d", + displayInfo_.rsId, displayInfo_.validWidth, displayInfo_.validHeight); } void PointerDrawingManager::OnWindowInfo(const WinInfo &info) @@ -2383,7 +2384,7 @@ void PointerDrawingManager::UpdatePointerDevice(bool hasPointerDevice, bool isPo pointerVisible = (pointerVisible && IsPointerVisible()); } SetPointerVisible(getpid(), pointerVisible, 0, false); - } else { +} else { DeletePointerVisible(getpid()); } DrawManager(); @@ -2477,12 +2478,12 @@ void PointerDrawingManager::DrawManager() Direction direction = GetDisplayDirection(&displayInfo_); lastDrawPointerStyle_ = pointerStyle; if (lastPhysicalX_ == -1 || lastPhysicalY_ == -1) { - DrawPointer(displayInfo_.uniqueId, displayInfo_.validWidth / CALCULATE_MIDDLE, + DrawPointer(displayInfo_.rsId, displayInfo_.validWidth / CALCULATE_MIDDLE, displayInfo_.validHeight / CALCULATE_MIDDLE, pointerStyle, direction); MMI_HILOGI("Draw manager, mouseStyle:%{public}d, last physical is initial value", pointerStyle.id); return; } - DrawPointer(displayInfo_.uniqueId, lastPhysicalX_, lastPhysicalY_, pointerStyle, direction); + DrawPointer(displayInfo_.rsId, lastPhysicalX_, lastPhysicalY_, pointerStyle, direction); MMI_HILOGI("Draw manager, mouseStyle:%{public}d", pointerStyle.id); return; } @@ -2533,7 +2534,7 @@ void PointerDrawingManager::UpdatePointerVisible() return; } auto align = MouseIcon2IconType(MOUSE_ICON(lastMouseStyle_.id)); - if (!SetCursorLocation(displayId_, lastPhysicalX_, lastPhysicalY_, align)) { + if (!SetCursorLocation(lastPhysicalX_, lastPhysicalY_, align)) { MMI_HILOGE("SetCursorLocation fail"); } } @@ -2703,7 +2704,7 @@ void PointerDrawingManager::SetPointerLocation(int32_t x, int32_t y, int32_t dis CHKPV(surfaceNodePtr); displayId_ = displayId; if (GetHardCursorEnabled()) { - if (!SetCursorLocation(displayId_, x, y, MouseIcon2IconType(MOUSE_ICON(lastMouseStyle_.id)))) { + if (!SetCursorLocation(x, y, MouseIcon2IconType(MOUSE_ICON(lastMouseStyle_.id)))) { MMI_HILOGE("SetCursorLocation fail"); return; } @@ -2931,13 +2932,13 @@ void PointerDrawingManager::DrawPointerStyle(const PointerStyle& pointerStyle) } Direction direction = GetDisplayDirection(&displayInfo_); if (lastPhysicalX_ == -1 || lastPhysicalY_ == -1) { - DrawPointer(displayInfo_.uniqueId, displayInfo_.validWidth / CALCULATE_MIDDLE, + DrawPointer(displayInfo_.rsId, displayInfo_.validWidth / CALCULATE_MIDDLE, displayInfo_.validHeight / CALCULATE_MIDDLE, pointerStyle, direction); MMI_HILOGD("Draw pointer style, mouseStyle:%{public}d", pointerStyle.id); return; } - DrawPointer(displayInfo_.uniqueId, lastPhysicalX_, lastPhysicalY_, pointerStyle, direction); + DrawPointer(displayInfo_.rsId, lastPhysicalX_, lastPhysicalY_, pointerStyle, direction); MMI_HILOGD("Draw pointer style, mouseStyle:%{public}d", pointerStyle.id); } } @@ -3099,15 +3100,15 @@ int32_t PointerDrawingManager::SkipPointerLayer(bool isSkip) return RET_OK; } -std::vector> PointerDrawingManager::GetDisplayInfo(DisplayInfo &di) +std::vector> PointerDrawingManager::GetDisplayInfo(OLD::DisplayInfo &di) { std::vector> displayInfo = { {std::to_string(di.id), std::to_string(di.x), std::to_string(di.y), std::to_string(di.width), std::to_string(di.height), std::to_string(di.dpi), di.name, di.uniq, std::to_string(static_cast(di.direction)), std::to_string(static_cast(di.displayDirection)), std::to_string(static_cast(di.displayMode)), std::to_string(di.isCurrentOffScreenRendering), - std::to_string(di.screenRealWidth), std::to_string(di.screenRealHeight), std::to_string(di.screenRealPPI), - std::to_string(di.screenRealDPI), std::to_string(static_cast(di.screenCombination))}}; + std::to_string(di.screenRealWidth), std::to_string(di.screenRealHeight), + std::to_string(di.screenRealDPI), std::to_string(static_cast(di.displaySourceMode))}}; return displayInfo; } @@ -3176,13 +3177,13 @@ void PointerDrawingManager::Dump(int32_t fd, const std::vector &arg dprintf(fd, dumpInfo.c_str()); } -void PointerDrawingManager::UpdateBindDisplayId(int32_t displayId) +void PointerDrawingManager::UpdateBindDisplayId(int32_t rsId) { - if (lastDisplayId_ == displayId) { + if (lastDisplayId_ == rsId) { return; } - MMI_HILOGI("Mouse traversal occurs, lastDisplayId_:%{public}d, displayId:%{public}d", - lastDisplayId_, displayId); + MMI_HILOGI("Mouse traversal occurs, lastDisplayId_:%{public}d, rsId:%{public}d", + lastDisplayId_, rsId); if (GetHardCursorEnabled()) { // 隐藏上一个屏幕的软、硬光标 @@ -3193,7 +3194,7 @@ void PointerDrawingManager::UpdateBindDisplayId(int32_t displayId) Rosen::RSTransaction::FlushImplicitTransaction(); // 绑定新屏幕 SurfaceNode 到全局 surfaceNode_ - screenId_ = static_cast(displayId); + screenId_ = static_cast(rsId); MMI_HILOGI("The screenId_:%{public}" PRIu64, screenId_); AttachToDisplay(); @@ -3203,17 +3204,17 @@ void PointerDrawingManager::UpdateBindDisplayId(int32_t displayId) // 绑定新屏幕 SurfaceNode 到全局 surfaceNode_ MMI_HILOGI("UpdateBindDisplayId The screenId_:%{public}" PRIu64, screenId_); - screenId_ = static_cast(displayId); + screenId_ = static_cast(rsId); MMI_HILOGI("The screenId_:%{public}" PRIu64, screenId_); AttachToDisplay(); // 新屏幕上软硬光标位置更新 auto align = MouseIcon2IconType(MOUSE_ICON(lastMouseStyle_.id)); - if (!SetCursorLocation(displayId, lastPhysicalX_, lastPhysicalY_, align)) { + if (!SetCursorLocation(lastPhysicalX_, lastPhysicalY_, align)) { MMI_HILOGE("SetCursorLocation fail"); } - lastDisplayId_ = displayId; + lastDisplayId_ = rsId; } void PointerDrawingManager::OnScreenModeChange(const std::vector> &screens) @@ -3227,7 +3228,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, RsId:%{public}llu, 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) { @@ -3421,7 +3422,7 @@ int32_t PointerDrawingManager::DrawHardCursor(std::shared_ptr sp, return RET_OK; } -void PointerDrawingManager::UpdateMirrorScreens(std::shared_ptr sp, DisplayInfo displayInfo) +void PointerDrawingManager::UpdateMirrorScreens(std::shared_ptr sp, OLD::DisplayInfo displayInfo) { uint32_t mainWidth = sp->GetScreenWidth(); uint32_t mainHeight = sp->GetScreenHeight(); @@ -3609,7 +3610,7 @@ void PointerDrawingManager::DrawScreenCenterPointer(const PointerStyle& pointerS std::swap(x, y); } MMI_HILOGD("DrawScreenCenterPointer, x=%{public}d, y=%{public}d", x, y); - DrawPointer(displayInfo_.uniqueId, x, y, pointerStyle, direction); + DrawPointer(displayInfo_.rsId, x, y, pointerStyle, direction); } else { DrawPointer(displayInfo_.id, displayInfo_.validWidth / CALCULATE_MIDDLE, displayInfo_.validHeight / CALCULATE_MIDDLE, pointerStyle, direction); @@ -3750,7 +3751,7 @@ void PointerDrawingManager::SetSurfaceNode(std::shared_ptr surfaceNode_ = ptr; } -DisplayInfo PointerDrawingManager::GetCurrentDisplayInfo() +OLD::DisplayInfo PointerDrawingManager::GetCurrentDisplayInfo() { return displayInfo_; } diff --git a/service/window_manager/src/screen_pointer.cpp b/service/window_manager/src/screen_pointer.cpp index e4fd4dbb50..fd0ca3f7e7 100644 --- a/service/window_manager/src/screen_pointer.cpp +++ b/service/window_manager/src/screen_pointer.cpp @@ -67,10 +67,10 @@ uint32_t GetScreenInfoHeight(screen_info_ptr_t si) return modes[modeId]->height_; } -ScreenPointer::ScreenPointer(hwcmgr_ptr_t hwcMgr, handler_ptr_t handler, const DisplayInfo &di) +ScreenPointer::ScreenPointer(hwcmgr_ptr_t hwcMgr, handler_ptr_t handler, const OLD::DisplayInfo &di) : hwcMgr_(hwcMgr), handler_(handler) { - screenId_ = di.uniqueId; + screenId_ = di.rsId; width_ = di.width; height_ = di.height; rotation_ = static_cast(di.direction); @@ -311,9 +311,9 @@ 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 OLD::DisplayInfo &di, bool isWindowRotation) { - if (screenId_ != uint32_t(di.uniqueId)) { + if (screenId_ != uint32_t(di.rsId)) { return; } diff --git a/service/window_manager/src/touch_drawing_manager.cpp b/service/window_manager/src/touch_drawing_manager.cpp index 23c3e98cde..0f7e3816e8 100644 --- a/service/window_manager/src/touch_drawing_manager.cpp +++ b/service/window_manager/src/touch_drawing_manager.cpp @@ -182,15 +182,15 @@ void TouchDrawingManager::TouchDrawHandler(std::shared_ptr pointer } } -void TouchDrawingManager::UpdateDisplayInfo(const DisplayInfo& displayInfo) +void TouchDrawingManager::UpdateDisplayInfo(const OLD::DisplayInfo& displayInfo) { CALL_DEBUG_ENTER; isChangedRotation_ = displayInfo.direction == displayInfo_.direction ? false : true; isChangedMode_ = displayInfo.displayMode == displayInfo_.displayMode ? false : true; scaleW_ = displayInfo.validWidth > displayInfo.validHeight ? displayInfo.validWidth : displayInfo.validHeight; scaleH_ = displayInfo.validWidth > displayInfo.validHeight ? displayInfo.validWidth : displayInfo.validHeight; - if (displayInfo.screenCombination != displayInfo_.screenCombination || - displayInfo.uniqueId != displayInfo_.uniqueId) { + if (displayInfo.displaySourceMode != displayInfo_.displaySourceMode || + displayInfo.rsId != displayInfo_.rsId) { if (surfaceNode_ != nullptr) { surfaceNode_->ClearChildren(); surfaceNode_.reset(); @@ -400,11 +400,11 @@ void TouchDrawingManager::AddCanvasNode(std::shared_ptr& ca CALL_DEBUG_ENTER; std::lock_guard lock(mutex_); CHKPV(surfaceNode_); - if (canvasNode != nullptr && screenId_ == static_cast(displayInfo_.uniqueId)) { + if (canvasNode != nullptr && screenId_ == static_cast(displayInfo_.rsId)) { return; } - MMI_HILOGI("Screen from:%{public}" PRIu64 " to :%{public}d", screenId_, displayInfo_.uniqueId); - screenId_ = static_cast(displayInfo_.uniqueId); + MMI_HILOGI("Screen from:%{public}" PRIu64 " to :%{public}d", screenId_, displayInfo_.rsId); + screenId_ = static_cast(displayInfo_.rsId); canvasNode = isTrackerNode ? Rosen::RSCanvasDrawingNode::Create() : Rosen::RSCanvasNode::Create(); canvasNode->SetBounds(0, 0, scaleW_, scaleH_); canvasNode->SetFrame(0, 0, scaleW_, scaleH_); @@ -490,11 +490,12 @@ void TouchDrawingManager::CreateTouchWindow() surfaceNode_->SetBackgroundColor(Rosen::Drawing::Color::COLOR_TRANSPARENT); #endif surfaceNode_->SetRotation(0); - screenId_ = static_cast(displayInfo_.uniqueId); + screenId_ = static_cast(displayInfo_.rsId); if (windowScreenId_ == screenId_) { screenId_ = displayNodeScreenId_; } surfaceNode_->AttachToDisplay(screenId_); + MMI_HILOGI("TouchDrawingManager::CreateTouchWindow:%" PRIu64, screenId_); MMI_HILOGI("Setting screen:%{public}" PRIu64 ", displayNode:%{public}" PRIu64, screenId_, surfaceNode_->GetId()); } diff --git a/service/window_manager/test/cursor_drawing_component_test.cpp b/service/window_manager/test/cursor_drawing_component_test.cpp index 0f3a78f0aa..be0c5c0d3e 100644 --- a/service/window_manager/test/cursor_drawing_component_test.cpp +++ b/service/window_manager/test/cursor_drawing_component_test.cpp @@ -120,7 +120,7 @@ HWTEST_F(CursorDrawingComponentTest, CursorDrawingComponentTest_DrawPointer_001, */ HWTEST_F(CursorDrawingComponentTest, CursorDrawingComponentTest_UpdateDisplayInfo_001, TestSize.Level1) { - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.x =1; displayInfo.y = 1; @@ -128,7 +128,6 @@ HWTEST_F(CursorDrawingComponentTest, CursorDrawingComponentTest_UpdateDisplayInf displayInfo.height = 2; displayInfo.dpi = 240; displayInfo.name = "pp"; - displayInfo.uniq = "pp"; displayInfo.direction = DIRECTION0; displayInfo.displayMode = DisplayMode::FULL; EXPECT_NO_FATAL_FAILURE(instance_->UpdateDisplayInfo(displayInfo)); @@ -156,12 +155,10 @@ HWTEST_F(CursorDrawingComponentTest, CursorDrawingComponentTest_OnWindowInfo_001 */ HWTEST_F(CursorDrawingComponentTest, CursorDrawingComponentTest_OnDisplayInfo_001, TestSize.Level1) { - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 0; - displayGroupInfo.width = 1000; - displayGroupInfo.height = 2000; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.x =1; displayInfo.y = 1; diff --git a/service/window_manager/test/input_windows_manager_ex_test.cpp b/service/window_manager/test/input_windows_manager_ex_test.cpp index b3a7a0efbb..cd873e6627 100644 --- a/service/window_manager/test/input_windows_manager_ex_test.cpp +++ b/service/window_manager/test/input_windows_manager_ex_test.cpp @@ -154,7 +154,7 @@ HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_001, TestSi std::shared_ptr inputWindowsManager = std::static_pointer_cast(WIN_MGR); ASSERT_NE(inputWindowsManager, nullptr); - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo)); } @@ -171,7 +171,7 @@ HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_002, TestSi std::shared_ptr inputWindowsManager = std::static_pointer_cast(WIN_MGR); ASSERT_NE(inputWindowsManager, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager->displayGroupInfoMap_.end()) { @@ -180,7 +180,7 @@ HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_002, TestSi inputWindowsManager->lastPointerEvent_ = PointerEvent::Create(); ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr); inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE); - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo)); it->second.displaysInfo.clear(); inputWindowsManager->lastPointerEvent_.reset(); @@ -200,7 +200,7 @@ HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_003, TestSi std::shared_ptr inputWindowsManager = std::static_pointer_cast(WIN_MGR); ASSERT_NE(inputWindowsManager, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager->displayGroupInfoMap_.end()) { @@ -210,7 +210,7 @@ HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_003, TestSi ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr); inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE); inputWindowsManager->lastPointerEvent_->SetButtonPressed(1); - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo)); it->second.displaysInfo.clear(); inputWindowsManager->lastPointerEvent_.reset(); @@ -230,7 +230,7 @@ HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_004, TestSi std::shared_ptr inputWindowsManager = std::static_pointer_cast(WIN_MGR); ASSERT_NE(inputWindowsManager, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager->displayGroupInfoMap_.end()) { @@ -239,7 +239,7 @@ HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_004, TestSi inputWindowsManager->lastPointerEvent_ = PointerEvent::Create(); ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr); inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN); - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo)); it->second.displaysInfo.clear(); inputWindowsManager->lastPointerEvent_.reset(); @@ -260,7 +260,7 @@ HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_005, TestSi std::shared_ptr inputWindowsManager = std::static_pointer_cast(WIN_MGR); ASSERT_NE(inputWindowsManager, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.x = 8; displayInfo.y = 8; @@ -282,7 +282,7 @@ HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_005, TestSi inputWindowsManager->lastPointerEvent_ = PointerEvent::Create(); ASSERT_NE(inputWindowsManager->lastPointerEvent_, nullptr); inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE); - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo)); it->second.windowsInfo.clear(); it->second.displaysInfo.clear(); @@ -303,7 +303,7 @@ HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_006, TestSi std::shared_ptr inputWindowsManager = std::static_pointer_cast(WIN_MGR); ASSERT_NE(inputWindowsManager, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.x = 8; displayInfo.y = 8; @@ -327,7 +327,7 @@ HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_006, TestSi inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN); inputWindowsManager->isDragBorder_ = true; inputWindowsManager->dragFlag_ = true; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo)); it->second.displaysInfo.clear(); it->second.windowsInfo.clear(); @@ -350,7 +350,7 @@ HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_007, TestSi std::shared_ptr inputWindowsManager = std::static_pointer_cast(WIN_MGR); ASSERT_NE(inputWindowsManager, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.x = 8; displayInfo.y = 8; @@ -374,7 +374,7 @@ HWTEST_F(InputWindowsManagerTest, PointerDrawingManagerOnDisplayInfo_007, TestSi inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_UP); inputWindowsManager->isDragBorder_ = true; inputWindowsManager->dragFlag_ = true; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; EXPECT_NO_FATAL_FAILURE(inputWindowsManager->PointerDrawingManagerOnDisplayInfo(displayGroupInfo)); it->second.displaysInfo.clear(); it->second.windowsInfo.clear(); @@ -407,7 +407,7 @@ HWTEST_F(InputWindowsManagerTest, SendPointerEvent_001, TestSize.Level1) UDSServer udsServer; inputWindowsManager->udsServer_ = &udsServer; int32_t pointerAction = PointerEvent::POINTER_ACTION_UNKNOWN; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 10; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager->displayGroupInfoMap_.end()) { @@ -444,7 +444,7 @@ HWTEST_F(InputWindowsManagerTest, SendPointerEvent_002, TestSize.Level1) UDSServer udsServer; inputWindowsManager->udsServer_ = &udsServer; int32_t pointerAction = PointerEvent::POINTER_ACTION_ENTER_WINDOW ; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 10; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager->displayGroupInfoMap_.end()) { @@ -480,7 +480,7 @@ HWTEST_F(InputWindowsManagerTest, SendPointerEvent_003, TestSize.Level1) UDSServer udsServer; inputWindowsManager->udsServer_ = &udsServer; int32_t pointerAction = PointerEvent::POINTER_ACTION_UNKNOWN; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 10; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager->displayGroupInfoMap_.end()) { @@ -540,7 +540,7 @@ HWTEST_F(InputWindowsManagerTest, SendPointerEvent_005, TestSize.Level1) UDSServer udsServer; inputWindowsManager->udsServer_ = &udsServer; int32_t pointerAction = PointerEvent::POINTER_ACTION_UNKNOWN; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 10; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager->displayGroupInfoMap_.end()) { @@ -595,7 +595,7 @@ HWTEST_F(InputWindowsManagerTest, TransformTipPoint_001, TestSize.Level1) std::shared_ptr inputWindowsManager = std::static_pointer_cast(WIN_MGR); ASSERT_NE(inputWindowsManager, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.uniq = "default0"; displayInfo.direction = DIRECTION90; @@ -623,7 +623,7 @@ HWTEST_F(InputWindowsManagerTest, TransformTipPoint_002, TestSize.Level1) std::shared_ptr inputWindowsManager = std::static_pointer_cast(WIN_MGR); ASSERT_NE(inputWindowsManager, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.uniq = "default0"; displayInfo.direction = DIRECTION270; @@ -650,7 +650,7 @@ HWTEST_F(InputWindowsManagerTest, TransformTipPoint_003, TestSize.Level1) std::shared_ptr inputWindowsManager = std::static_pointer_cast(WIN_MGR); ASSERT_NE(inputWindowsManager, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.uniq = "default0"; displayInfo.direction = DIRECTION0; @@ -893,7 +893,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPhysicalDisplayCoor libinput_event_touch *touch = nullptr; EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true)); - DisplayInfo info; + OLD::DisplayInfo info; info.direction = DIRECTION90; info.direction = DIRECTION270; @@ -962,7 +962,7 @@ HWTEST_F(InputWindowsManagerTest, CalculateTipPoint_002, TestSize.Level1) std::shared_ptr inputWindowsManager = std::static_pointer_cast(WIN_MGR); ASSERT_NE(inputWindowsManager, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.uniq = "default0"; displayInfo.direction = DIRECTION0; @@ -1013,7 +1013,7 @@ HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_001, TestSize.Level1) std::shared_ptr inputWindowsManager = std::static_pointer_cast(WIN_MGR); ASSERT_NE(inputWindowsManager, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.displayDirection = DIRECTION0; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); @@ -1040,7 +1040,7 @@ HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_002, TestSize.Level1) std::shared_ptr inputWindowsManager = std::static_pointer_cast(WIN_MGR); ASSERT_NE(inputWindowsManager, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.displayDirection = DIRECTION0; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); @@ -1069,7 +1069,7 @@ HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_003, TestSize.Level1) std::static_pointer_cast(WIN_MGR); ASSERT_NE(inputWindowsManager, nullptr); inputWindowsManager->mouseDownInfo_.id = 1; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.displayDirection = DIRECTION0; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); @@ -1103,7 +1103,7 @@ HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_004, TestSize.Level1) UDSServer udsServer; inputWindowsManager->udsServer_ = &udsServer; inputWindowsManager->mouseDownInfo_.id = 1; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.displayDirection = DIRECTION0; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); @@ -1145,7 +1145,7 @@ HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_005, TestSize.Level1) inputWindowsManager->udsServer_ = &udsServer; inputWindowsManager->mouseDownInfo_.id = 1; it->second.focusWindowId = 1; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.displayDirection = DIRECTION0; it->second.displaysInfo.push_back(displayInfo); @@ -1188,7 +1188,7 @@ HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_006, TestSize.Level1) inputWindowsManager->udsServer_ = &udsServer; inputWindowsManager->mouseDownInfo_.id = 1; it->second.focusWindowId = -1; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.displayDirection = DIRECTION0; it->second.displaysInfo.push_back(displayInfo); @@ -1229,7 +1229,7 @@ HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_007, TestSize.Level1) UDSServer udsServer; inputWindowsManager->udsServer_ = &udsServer; inputWindowsManager->mouseDownInfo_.id = 1; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.displayDirection = DIRECTION0; it->second.displaysInfo.push_back(displayInfo); @@ -1270,7 +1270,7 @@ HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_008, TestSize.Level1) UDSServer udsServer; inputWindowsManager->udsServer_ = &udsServer; inputWindowsManager->mouseDownInfo_.id = 1; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.displayDirection = DIRECTION0; it->second.displaysInfo.push_back(displayInfo); @@ -1313,7 +1313,7 @@ HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_009, TestSize.Level1) inputWindowsManager->mouseDownInfo_.id = 1; inputWindowsManager->isUiExtension_ = true; it->second.focusWindowId = -1; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.displayDirection = DIRECTION0; it->second.displaysInfo.push_back(displayInfo); @@ -1358,7 +1358,7 @@ HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_010, TestSize.Level1) inputWindowsManager->isDragBorder_ = true; inputWindowsManager->isUiExtension_ = true; it->second.focusWindowId = -1; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.displayDirection = DIRECTION0; it->second.displaysInfo.push_back(displayInfo); @@ -1405,7 +1405,7 @@ HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_011, TestSize.Level1) inputWindowsManager->isDragBorder_ = true; inputWindowsManager->isUiExtension_ = false; it->second.focusWindowId = -1; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.displayDirection = DIRECTION90; it->second.displaysInfo.push_back(displayInfo); @@ -1457,7 +1457,7 @@ HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_012, TestSize.Level1) inputWindowsManager->captureModeInfo_.windowId = 1; inputWindowsManager->extraData_.appended = true; inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.displayDirection = DIRECTION90; it->second.displaysInfo.push_back(displayInfo); @@ -1513,7 +1513,7 @@ HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_013, TestSize.Level1) inputWindowsManager->captureModeInfo_.windowId = -1; inputWindowsManager->extraData_.appended = true; inputWindowsManager->extraData_.sourceType = PointerEvent::SOURCE_TYPE_MOUSE; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.displayDirection = DIRECTION90; it->second.displaysInfo.push_back(displayInfo); @@ -1568,7 +1568,7 @@ HWTEST_F(InputWindowsManagerTest, UpdateMouseTarget_014, TestSize.Level1) inputWindowsManager->captureModeInfo_.windowId = -1; inputWindowsManager->extraData_.appended = false; inputWindowsManager->extraData_.sourceType = -1; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; displayInfo.displayDirection = DIRECTION90; it->second.displaysInfo.push_back(displayInfo); @@ -2556,7 +2556,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPhysicalDisplayCoor std::static_pointer_cast(WIN_MGR); ASSERT_NE(inputWindowsManager, nullptr); libinput_event_touch touch {}; - DisplayInfo info; + OLD::DisplayInfo info; EventTouch touchInfo; info.direction = DIRECTION90; EXPECT_NO_FATAL_FAILURE(inputWindowsManager->GetPhysicalDisplayCoord(&touch, info, touchInfo)); @@ -2586,7 +2586,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_006 bool ret = inputWindowsManager->IsNeedRefreshLayer(windowId); EXPECT_FALSE(ret); inputEvent->targetDisplayId_ = 2; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 2; displayInfo.x = 2; displayInfo.y = 3; @@ -2616,7 +2616,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTransformDisplay std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); std::vector windowsInfo; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; pointerEvent->pointerId_ = 1; PointerEvent::PointerItem item; item.pointerId_ = 1; @@ -2820,7 +2820,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TouchPointToDisplayPoi EXPECT_NO_FATAL_FAILURE(inputWindowsManager->TouchPointToDisplayPoint (deviceId, &touch, touchInfo, physicalDisplayId)); deviceId = 2; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.width = -1; displayInfo.height = 3; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); @@ -2884,7 +2884,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_001 std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); WindowInfoEX winInfoEx; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 10; pointerEvent->bitwise_ = 0x00000000; pointerEvent->SetPointerId(1); @@ -2914,7 +2914,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_002 std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); WindowInfoEX winInfoEx; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 10; pointerEvent->SetPointerId(1); pointerEvent->SetTargetDisplayId(10); @@ -2942,7 +2942,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_003 std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); PointerEvent::PointerItem item; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 10; displayInfo.direction = DIRECTION90; item.SetPointerId(2); @@ -2972,7 +2972,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_004 std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); PointerEvent::PointerItem item; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 10; displayInfo.direction = DIRECTION90; item.SetPointerId(1); @@ -3003,7 +3003,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_005 std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); PointerEvent::PointerItem item; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 10; displayInfo.direction = DIRECTION90; item.SetPointerId(1); @@ -3036,7 +3036,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_006 ASSERT_NE(pointerEvent, nullptr); PointerEvent::PointerItem item; WindowInfoEX winInfoEx; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 10; displayInfo.direction = DIRECTION90; item.SetPointerId(1); @@ -3071,7 +3071,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_007 ASSERT_NE(pointerEvent, nullptr); PointerEvent::PointerItem item; WindowInfoEX winInfoEx; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 10; displayInfo.direction = DIRECTION90; item.SetPointerId(1); @@ -3106,7 +3106,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_008 ASSERT_NE(pointerEvent, nullptr); PointerEvent::PointerItem item; WindowInfoEX winInfoEx; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 10; displayInfo.direction = DIRECTION90; item.SetPointerId(1); @@ -3140,7 +3140,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FoldScreenRotation_009 std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); PointerEvent::PointerItem item; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 10; displayInfo.direction = DIRECTION90; item.SetPointerId(1); @@ -3167,7 +3167,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen, TestSize CALL_TEST_DEBUG; EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false)); InputWindowsManager inputWindowsManager; - DisplayInfo info; + OLD::DisplayInfo info; PhysicalCoordinate coord; info.height = 500; coord.x = 200; @@ -3190,7 +3190,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_001, Test CALL_TEST_DEBUG; EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false)); InputWindowsManager inputWindowsManager; - DisplayInfo info; + OLD::DisplayInfo info; PhysicalCoordinate coord; info.width = 500; coord.y = 200; @@ -3212,7 +3212,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_002, Test { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayInfo info; + OLD::DisplayInfo info; PhysicalCoordinate coord; info.direction = static_cast(10); EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord)); @@ -3228,7 +3228,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_003, Test { CALL_TEST_DEBUG; PhysicalCoordinate coord; - DisplayInfo info; + OLD::DisplayInfo info; InputWindowsManager inputWindowsManager; info.direction = DIRECTION0; @@ -3261,7 +3261,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_004, Test { CALL_TEST_DEBUG; PhysicalCoordinate coord; - DisplayInfo info; + OLD::DisplayInfo info; InputWindowsManager inputWindowsManager; info.displayDirection = DIRECTION0; @@ -3285,7 +3285,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_005, Test { CALL_TEST_DEBUG; PhysicalCoordinate coord; - DisplayInfo info; + OLD::DisplayInfo info; InputWindowsManager inputWindowsManager; info.displayDirection = DIRECTION0; @@ -3309,7 +3309,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_006, Test { CALL_TEST_DEBUG; PhysicalCoordinate coord; - DisplayInfo info; + OLD::DisplayInfo info; InputWindowsManager inputWindowsManager; info.displayDirection = DIRECTION0; @@ -3334,7 +3334,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_007, Test CALL_TEST_DEBUG; EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false)); PhysicalCoordinate coord; - DisplayInfo info; + OLD::DisplayInfo info; InputWindowsManager inputWindowsManager; info.direction = DIRECTION90; EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord)); @@ -3351,7 +3351,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_008, Test CALL_TEST_DEBUG; EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true)); PhysicalCoordinate coord; - DisplayInfo info; + OLD::DisplayInfo info; InputWindowsManager inputWindowsManager; info.direction = DIRECTION90; EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord)); @@ -3367,7 +3367,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_009, Test { CALL_TEST_DEBUG; PhysicalCoordinate coord; - DisplayInfo info; + OLD::DisplayInfo info; InputWindowsManager inputWindowsManager; info.direction = DIRECTION180; EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord)); @@ -3384,7 +3384,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_010, Test CALL_TEST_DEBUG; EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true)); PhysicalCoordinate coord; - DisplayInfo info; + OLD::DisplayInfo info; InputWindowsManager inputWindowsManager; info.direction = DIRECTION270; EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord)); @@ -3401,7 +3401,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_011, Test CALL_TEST_DEBUG; EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false)); PhysicalCoordinate coord; - DisplayInfo info; + OLD::DisplayInfo info; InputWindowsManager inputWindowsManager; info.direction = DIRECTION270; EXPECT_NO_FATAL_FAILURE(inputWindowsManager.RotateScreen(info, coord)); @@ -3418,7 +3418,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_00 CALL_TEST_DEBUG; EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false)); PhysicalCoordinate coord; - DisplayInfo info; + OLD::DisplayInfo info; InputWindowsManager inputWindowsManager; info.direction = DIRECTION0; @@ -3437,7 +3437,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_00 CALL_TEST_DEBUG; EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false)); PhysicalCoordinate coord; - DisplayInfo info; + OLD::DisplayInfo info; InputWindowsManager inputWindowsManager; info.direction = DIRECTION90; @@ -3456,7 +3456,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_00 CALL_TEST_DEBUG; EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true)); PhysicalCoordinate coord; - DisplayInfo info; + OLD::DisplayInfo info; InputWindowsManager inputWindowsManager; info.direction = DIRECTION90; @@ -3475,7 +3475,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_00 CALL_TEST_DEBUG; EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false)); PhysicalCoordinate coord; - DisplayInfo info; + OLD::DisplayInfo info; InputWindowsManager inputWindowsManager; info.direction = DIRECTION180; @@ -3494,7 +3494,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_00 CALL_TEST_DEBUG; EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true)); PhysicalCoordinate coord; - DisplayInfo info; + OLD::DisplayInfo info; InputWindowsManager inputWindowsManager; info.direction = DIRECTION180; @@ -3513,7 +3513,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_00 CALL_TEST_DEBUG; EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false)); PhysicalCoordinate coord; - DisplayInfo info; + OLD::DisplayInfo info; InputWindowsManager inputWindowsManager; info.direction = DIRECTION270; @@ -3532,7 +3532,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateDisplayScreen_00 CALL_TEST_DEBUG; EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true)); PhysicalCoordinate coord; - DisplayInfo info; + OLD::DisplayInfo info; InputWindowsManager inputWindowsManager; info.direction = DIRECTION270; @@ -3554,7 +3554,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer, Te EXPECT_CALL(*messageParcelMock_, GetDisplayId()).WillRepeatedly(Return(displayId)); InputWindowsManager inputWindowsManager; int32_t windowId = 10; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; WindowInfo winInfo; displayInfo.id = 100; displayInfo.x = 200; @@ -3587,7 +3587,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_007 EXPECT_CALL(*messageParcelMock_, GetDisplayId()).WillRepeatedly(Return(displayId)); InputWindowsManager inputWindowsManager; int32_t windowId = -1; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; WindowInfo winInfo; displayInfo.id = 100; displayInfo.x = 200; @@ -3620,7 +3620,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_008 EXPECT_CALL(*messageParcelMock_, GetDisplayId()).WillRepeatedly(Return(displayId)); InputWindowsManager inputWindowsManager; int32_t windowId = 50; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; WindowInfo winInfo; displayInfo.id = 100; displayInfo.x = 200; @@ -3653,7 +3653,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsNeedRefreshLayer_009 EXPECT_CALL(*messageParcelMock_, GetDisplayId()).WillRepeatedly(Return(displayId)); InputWindowsManager inputWindowsManager; int32_t windowId = 50; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; WindowInfo winInfo; displayInfo.id = 100; displayInfo.x = 200; @@ -3683,7 +3683,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustDisplayRotation, EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false)); std::shared_ptr inputWindowsManager = std::static_pointer_cast(WIN_MGR); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 100; displayInfo.direction = DIRECTION90; auto it = inputWindowsManager->cursorPosMap_.find(DEFAULT_GROUP_ID); @@ -3710,7 +3710,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustDisplayRotation_ EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(false)); std::shared_ptr inputWindowsManager = std::static_pointer_cast(WIN_MGR); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 100; displayInfo.direction = DIRECTION90; auto it = inputWindowsManager->cursorPosMap_.find(DEFAULT_GROUP_ID); @@ -3751,7 +3751,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TouchPointToDisplayPoi std::string uniq = "uniq"; EXPECT_CALL(*messageParcelMock_, GetBindDisplayNameByInputDevice(_)).WillRepeatedly(Return(uniq)); InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; int32_t deviceId = 100; libinput_event_touch touch {}; EventTouch touchInfo; @@ -3778,7 +3778,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TouchPointToDisplayPoi std::string uniq = "uniq"; EXPECT_CALL(*messageParcelMock_, GetBindDisplayNameByInputDevice(_)).WillRepeatedly(Return(uniq)); InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; int32_t deviceId = 100; libinput_event_touch touch {}; EventTouch touchInfo; @@ -3806,7 +3806,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TouchPointToDisplayPoi std::string uniq = "uniq"; EXPECT_CALL(*messageParcelMock_, GetBindDisplayNameByInputDevice(_)).WillRepeatedly(Return(uniq)); InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; int32_t deviceId = 100; libinput_event_touch touch {}; EventTouch touchInfo; @@ -3836,8 +3836,8 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo, Tes EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillRepeatedly(Return(true)); EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true)); InputWindowsManager inputWindowsManager; - DisplayGroupInfo displayGroupInfo; - DisplayInfo displayInfo; + OLD::DisplayGroupInfo displayGroupInfo; + OLD::DisplayInfo displayInfo; WindowInfo winInfo; winInfo.action = WINDOW_UPDATE_ACTION::UNKNOWN; displayGroupInfo.windowsInfo.push_back(winInfo); @@ -3860,8 +3860,8 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_001, EXPECT_CALL(*messageParcelMock_, HasPointerDevice()).WillRepeatedly(Return(false)); EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(true)); InputWindowsManager inputWindowsManager; - DisplayGroupInfo displayGroupInfo; - DisplayInfo displayInfo; + OLD::DisplayGroupInfo displayGroupInfo; + OLD::DisplayInfo displayInfo; WindowInfo winInfo; winInfo.action = WINDOW_UPDATE_ACTION::UNKNOWN; displayGroupInfo.windowsInfo.push_back(winInfo); @@ -4036,7 +4036,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerChangeAre { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; WindowInfo winInfo; winInfo.id = 100; winInfo.area; @@ -4070,7 +4070,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetWidthAndHeight, Tes EXPECT_CALL(*messageParcelMock_, IsWindowRotation()).WillRepeatedly(Return(true)); EXPECT_CALL(*messageParcelMock_, IsSceneBoardEnabled()).WillRepeatedly(Return(false)); InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; int32_t width = 300; int32_t height = 300; displayInfo.direction = DIRECTION90; @@ -4158,7 +4158,7 @@ HWTEST_F(InputWindowsManagerTest, DrawTouchGraphic_004, TestSize.Level1) int32_t displayId = 10; pointerEvent->SetTargetDisplayId(displayId); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 10; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager->displayGroupInfoMap_.end()) { @@ -4210,7 +4210,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendUIExtentionPointer ASSERT_NE(inputWindowsManager, nullptr); int32_t logicalX = 100; int32_t logicalY = 200; - + std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); pointerEvent->pointerId_ = 1; @@ -4225,7 +4225,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendUIExtentionPointer windowInfo.pid = 11; windowInfo.transform.push_back(1.1); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 10; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager->displayGroupInfoMap_.end()) { @@ -4254,7 +4254,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendUIExtentionPointer ASSERT_NE(inputWindowsManager, nullptr); int32_t logicalX = 100; int32_t logicalY = 200; - + std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); pointerEvent->pointerId_ = 1; @@ -4269,7 +4269,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SendUIExtentionPointer windowInfo.pid = 11; windowInfo.transform.push_back(1.1); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 10; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager->displayGroupInfoMap_.end()) { @@ -4354,7 +4354,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_HandleHardWareCursorTe std::shared_ptr inputWindowsManager = std::static_pointer_cast(WIN_MGR); ASSERT_NE(inputWindowsManager, nullptr); - std::shared_ptr physicalDisplayInfo = std::make_shared(); + std::shared_ptr physicalDisplayInfo = std::make_shared(); ASSERT_NE(physicalDisplayInfo, nullptr); physicalDisplayInfo->direction = Direction::DIRECTION0; physicalDisplayInfo->displayDirection = Direction::DIRECTION0; @@ -4379,7 +4379,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_HandleHardWareCursorTe std::shared_ptr inputWindowsManager = std::static_pointer_cast(WIN_MGR); ASSERT_NE(inputWindowsManager, nullptr); - std::shared_ptr physicalDisplayInfo = std::make_shared(); + std::shared_ptr physicalDisplayInfo = std::make_shared(); ASSERT_NE(physicalDisplayInfo, nullptr); physicalDisplayInfo->direction = Direction::DIRECTION90; physicalDisplayInfo->displayDirection = Direction::DIRECTION0; @@ -4407,7 +4407,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateMouseTargetTest0 ASSERT_NE(pointerEvent, nullptr); pointerEvent->SetTargetDisplayId(1); pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.x = 300; displayInfo.y = 500; @@ -4448,7 +4448,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateMouseTargetTest0 ASSERT_NE(pointerEvent, nullptr); pointerEvent->SetTargetDisplayId(1); pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.x = 300; displayInfo.y = 500; @@ -4489,7 +4489,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateMouseTargetTest0 ASSERT_NE(pointerEvent, nullptr); pointerEvent->SetTargetDisplayId(1); pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.x = 300; displayInfo.y = 500; diff --git a/service/window_manager/test/input_windows_manager_one_test.cpp b/service/window_manager/test/input_windows_manager_one_test.cpp index 6fb1d22259..f6d494216d 100644 --- a/service/window_manager/test/input_windows_manager_one_test.cpp +++ b/service/window_manager/test/input_windows_manager_one_test.cpp @@ -69,7 +69,7 @@ std::optional InputWindowsManager::GetWindowAndDisplayInfo(int32_t w return std::nullopt; } -void InputWindowsManager::PrintDisplayInfo(const DisplayInfo displayInfo) {} +void InputWindowsManager::PrintDisplayInfo(const OLD::DisplayInfo displayInfo) {} bool Rosen::SceneBoardJudgement::IsSceneBoardEnabled() { @@ -111,7 +111,7 @@ public: HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_ScreenRotateAdjustDisplayXY_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo info; + OLD::DisplayInfo info; info.direction = DIRECTION90; info.validWidth = 0; info.validHeight = 0; @@ -154,7 +154,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_ScreenRotateAdju HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_RotateScreen_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo info; + OLD::DisplayInfo info; info.direction = DIRECTION0; info.displayDirection = Direction::DIRECTION0; info.validWidth = 0; @@ -197,7 +197,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_RotateScreen_001 HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_RotateScreen_002, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo info; + OLD::DisplayInfo info; info.direction = DIRECTION0; info.displayDirection = Direction::DIRECTION0; info.validWidth = 0; @@ -833,7 +833,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_SkipPrivacyProte HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_HandleOneHandMode_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); PointerEvent::PointerItem pointerItem; @@ -857,7 +857,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_HandleOneHandMod HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_UpdatePointerItemInOneHandMode_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); std::shared_ptr inputWindowsManager = std::make_shared(); @@ -882,7 +882,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_UpdatePointerIte HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_UpdatePointerItemInOneHandMode_002, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); std::shared_ptr inputWindowsManager = std::make_shared(); @@ -914,7 +914,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_UpdateTransformD std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); std::vector windowsInfo; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; std::shared_ptr inputWindowsManager = std::make_shared(); int32_t pointerId = 0; @@ -942,7 +942,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_UpdateTransformD std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); std::vector windowsInfo; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; std::shared_ptr inputWindowsManager = std::make_shared(); int32_t pointerId = 0; @@ -972,7 +972,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_UpdateTransformD std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); std::vector windowsInfo; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; std::shared_ptr inputWindowsManager = std::make_shared(); int32_t pointerId = 0; @@ -1002,7 +1002,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_UpdateTransformD std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); std::vector windowsInfo; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; std::shared_ptr inputWindowsManager = std::make_shared(); int32_t pointerId = 0; @@ -1032,7 +1032,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_UpdateTransformD std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); std::vector windowsInfo; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; std::shared_ptr inputWindowsManager = std::make_shared(); int32_t pointerId = 0; @@ -1072,7 +1072,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_UpdateTransformD std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); std::vector windowsInfo; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; std::shared_ptr inputWindowsManager = std::make_shared(); int32_t pointerId = 0; @@ -1138,7 +1138,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_CalculateAcrossD { CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; Vector2D layout; displayInfo.x = 1; displayInfo.y = 1; @@ -1159,8 +1159,8 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_AcrossDisplay_00 { CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayInfo displayInfoDes; - DisplayInfo displayInfoOri; + OLD::DisplayInfo displayInfoDes; + OLD::DisplayInfo displayInfoOri; Vector2D logical; Vector2D layout; AcrossDirection acrossDirection = AcrossDirection::RIGHTWARDS; @@ -1196,12 +1196,12 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_FindPhysicalDisp CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; double physicalX = 0.0f; double physicalY = 0.0f; int32_t displayId = 0; - DisplayInfo displayInfo1; + OLD::DisplayInfo displayInfo1; displayInfo1.id = 0; displayInfo1.dpi = -10; displayInfo1.uniq = "default0"; @@ -1230,7 +1230,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_ReverseRotateDis { CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayInfo info; + OLD::DisplayInfo info; double x = 0.0f; double y = 0.0f; Coordinate2D cursorPos = { 0.0, 0.0 }; @@ -1253,7 +1253,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_ReverseRotateDis { CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayInfo info; + OLD::DisplayInfo info; double x = 0.0f; double y = 0.0f; Coordinate2D cursorPos = { 0.0, 0.0 }; @@ -1495,7 +1495,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_CalcDrawCoordina { CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; PointerEvent::PointerItem pointerItem; pointerItem.rawDisplayX_ = 0; pointerItem.rawDisplayY_ = 0; @@ -1537,7 +1537,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_FindTargetDispla InputWindowsManager inputWindowsManager; WindowGroupInfo windowGroupInfo; int32_t displayId = 1; - DisplayInfo displayInfo1; + OLD::DisplayInfo displayInfo1; displayInfo1.id = 0; displayInfo1.dpi = -10; displayInfo1.uniq = "default0"; @@ -1654,7 +1654,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_FindTargetDispla { CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; int32_t displayId = 0; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); @@ -1676,7 +1676,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_IsPointerOnCente { CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.validWidth = 1; displayInfo.validHeight = 1; @@ -1830,8 +1830,8 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_UpdateDisplayInf { CALL_TEST_DEBUG; InputWindowsManager inputWindowsMgr; - DisplayGroupInfo displayGroupInfo; - DisplayInfo displayInfo; + OLD::DisplayGroupInfo displayGroupInfo; + OLD::DisplayInfo displayInfo; displayGroupInfo.displaysInfo.push_back(displayInfo); displayGroupInfo.groupId = -1; bool needUpdateDisplayExt = true; @@ -1848,12 +1848,10 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_GetMainScreenDis { CALL_TEST_DEBUG; InputWindowsManager inputWindowsMgr; - std::vector displaysInfo; - DisplayInfo mainScreenDisplayInfo; + std::vector displaysInfo; + OLD::DisplayInfo mainScreenDisplayInfo; EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.GetMainScreenDisplayInfo(displaysInfo, mainScreenDisplayInfo)); - mainScreenDisplayInfo.screenCombination = OHOS::MMI::ScreenCombination::SCREEN_ALONE; displaysInfo.push_back(mainScreenDisplayInfo); - mainScreenDisplayInfo.screenCombination = OHOS::MMI::ScreenCombination::SCREEN_MAIN; displaysInfo.push_back(mainScreenDisplayInfo); EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.GetMainScreenDisplayInfo(displaysInfo, mainScreenDisplayInfo)); } @@ -1868,12 +1866,10 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_ResetPointerPosi { CALL_TEST_DEBUG; InputWindowsManager inputWindowsMgr; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.ResetPointerPosition(displayGroupInfo)); - DisplayInfo currentDisplay; - currentDisplay.screenCombination = OHOS::MMI::ScreenCombination::SCREEN_ALONE; + OLD::DisplayInfo currentDisplay; displayGroupInfo.displaysInfo.push_back(currentDisplay); - currentDisplay.screenCombination = OHOS::MMI::ScreenCombination::SCREEN_MAIN; displayGroupInfo.displaysInfo.push_back(currentDisplay); EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.ResetPointerPosition(displayGroupInfo)); } @@ -1888,7 +1884,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_IsPointerOnCente { CALL_TEST_DEBUG; InputWindowsManager inputWindowsMgr; - DisplayInfo currentDisplay; + OLD::DisplayInfo currentDisplay; currentDisplay.validHeight = 2; currentDisplay.validWidth = 2; CursorPosition currentPos; @@ -1911,9 +1907,9 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_ResetCursorPos, { CALL_TEST_DEBUG; InputWindowsManager inputWindowsMgr; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.ResetCursorPos(displayGroupInfo)); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayGroupInfo.displaysInfo.push_back(displayInfo); EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.ResetCursorPos(displayGroupInfo)); } @@ -1928,7 +1924,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_IsPositionOutVal { CALL_TEST_DEBUG; InputWindowsManager inputWindowsMgr; - DisplayInfo currentDisplay; + OLD::DisplayInfo currentDisplay; currentDisplay.validHeight = 2; currentDisplay.validWidth = 2; currentDisplay.height = 2; diff --git a/service/window_manager/test/input_windows_manager_test.cpp b/service/window_manager/test/input_windows_manager_test.cpp index 61f76c6a87..0d72f2cbc8 100644 --- a/service/window_manager/test/input_windows_manager_test.cpp +++ b/service/window_manager/test/input_windows_manager_test.cpp @@ -46,6 +46,7 @@ constexpr uint32_t DEFAULT_ICON_COLOR { 0xFF }; constexpr int32_t MAX_PIXEL_MAP_WIDTH { 600 }; constexpr int32_t MAX_PIXEL_MAP_HEIGHT { 600 }; constexpr int32_t INT32_BYTE { 4 }; +constexpr int32_t NUMBER_TWO { 2 }; #ifdef OHOS_BUILD_ENABLE_VKEYBOARD constexpr uint32_t WINDOW_NAME_TYPE_SCHREENSHOT { 1 }; constexpr float SCREEN_CAPTURE_WINDOW_ZORDER { 8000.0 }; @@ -72,9 +73,7 @@ public: void SetUp(void) { // 创建displayGroupInfo_ - DisplayGroupInfo displayGroupInfo; - displayGroupInfo.width = 20; - displayGroupInfo.height = 20; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 1; uint32_t num = 1; for (uint32_t i = 0; i < num; i++) { @@ -92,12 +91,12 @@ public: displayGroupInfo.windowsInfo.push_back(info); } for (uint32_t i = 0; i < num; i++) { - DisplayInfo info; + OLD::DisplayInfo info; info.id = 1; info.x =1; info.y = 1; - info.width = 2; - info.height = 2; + info.width = NUMBER_TWO; + info.height = NUMBER_TWO; info.dpi = 240; info.name = "pp"; info.uniq = "pp"; @@ -178,9 +177,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetClientFd_001, TestS auto pointerEvent = PointerEvent::Create(); UDSServer udsServer; WIN_MGR->Init(udsServer); - DisplayGroupInfo displayGroupInfo; - displayGroupInfo.width = 20; - displayGroupInfo.height = 20; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 1; displayGroupInfo = WIN_MGR->GetDisplayGroupInfo(); int32_t idNames = -1; @@ -471,7 +468,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetWindowPid_001, Test HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CheckFocusWindowChange_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 123; ASSERT_NO_FATAL_FAILURE(WIN_MGR->CheckFocusWindowChange(displayGroupInfo)); } @@ -485,8 +482,8 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CheckFocusWindowChange HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CheckFocusWindowChange_002, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayGroupInfo displayGroupInfo; - DisplayGroupInfo displayGroupInfo_; + OLD::DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo_; displayGroupInfo.focusWindowId = 123; displayGroupInfo_.focusWindowId = 456; ASSERT_NO_FATAL_FAILURE(WIN_MGR->CheckFocusWindowChange(displayGroupInfo)); @@ -555,7 +552,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetDisplayBindInfo_001 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateCaptureMode_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 123; WIN_MGR->UpdateCaptureMode(displayGroupInfo); EXPECT_FALSE(WIN_MGR->captureModeInfo_.isCaptureMode); @@ -570,7 +567,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateCaptureMode_001, HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfoByIncrementalInfo_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 1; WindowInfo window; WIN_MGR->UpdateDisplayInfoByIncrementalInfo(window, displayGroupInfo); @@ -586,7 +583,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfoByInc HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateWindowsInfoPerDisplay_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 2; WIN_MGR->UpdateWindowsInfoPerDisplay(displayGroupInfo); WindowInfo window1{1}; @@ -608,7 +605,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateWindowsInfoPerDi HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; WindowInfo windowInfo1; windowInfo1.zOrder = 1; windowInfo1.action = WINDOW_UPDATE_ACTION::ADD_END; @@ -739,11 +736,9 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_PrintDisplayInfo_001, InputWindowsManager manager; auto it = manager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != manager.displayGroupInfoMap_.end()) { - it->second.width = 1920; - it->second.height = 1080; it->second.focusWindowId = 1; it->second.windowsInfo.push_back(WindowInfo()); - it->second.displaysInfo.push_back(DisplayInfo()); + it->second.displaysInfo.push_back(OLD::DisplayInfo()); } ASSERT_NO_FATAL_FAILURE(WIN_MGR->PrintDisplayGroupInfo(it->second)); } @@ -758,7 +753,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPhysicalDisplay_001 { CALL_TEST_DEBUG; int32_t id = 1; - const std::shared_ptr displayInfo = WIN_MGR->GetPhysicalDisplay(id); + const std::shared_ptr displayInfo = WIN_MGR->GetPhysicalDisplay(id); EXPECT_NE(displayInfo, nullptr); EXPECT_EQ(displayInfo->id, id); } @@ -773,7 +768,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPhysicalDisplay_002 { CALL_TEST_DEBUG; int32_t id = -1; - const std::shared_ptr displayInfo = WIN_MGR->GetPhysicalDisplay(id); + const std::shared_ptr displayInfo = WIN_MGR->GetPhysicalDisplay(id); EXPECT_EQ(displayInfo, nullptr); } @@ -788,14 +783,14 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FindPhysicalDisplayInf CALL_TEST_DEBUG; InputWindowsManager manager; ASSERT_EQ(manager.FindPhysicalDisplayInfo("test"), nullptr); - DisplayInfo info1; + OLD::DisplayInfo info1; info1.id = 123; auto it = manager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != manager.displayGroupInfoMap_.end()) { it->second.displaysInfo.push_back(info1); } ASSERT_NE(manager.FindPhysicalDisplayInfo("test"), nullptr); - DisplayInfo info2; + OLD::DisplayInfo info2; info2.id = 456; it->second.displaysInfo.push_back(info2); ASSERT_NE(manager.FindPhysicalDisplayInfo("test"), nullptr); @@ -812,7 +807,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FindPhysicalDisplayInf HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo info; + OLD::DisplayInfo info; PhysicalCoordinate coord; info.direction = DIRECTION0; coord.x = 10; @@ -831,7 +826,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_001, Test HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_002, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo info; + OLD::DisplayInfo info; PhysicalCoordinate coord; info.direction = DIRECTION90; info.width = 800; @@ -854,7 +849,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_002, Test HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_003, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo info; + OLD::DisplayInfo info; PhysicalCoordinate coord; info.direction = DIRECTION180; info.width = 800; @@ -877,7 +872,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_003, Test HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_RotateScreen_004, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo info; + OLD::DisplayInfo info; PhysicalCoordinate coord; info.direction = DIRECTION270; info.width = 800; @@ -918,9 +913,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_OnSessionLost_001, Tes CALL_TEST_DEBUG; SessionPtr session = std::shared_ptr(); WIN_MGR->OnSessionLost(session); - DisplayGroupInfo displayGroupInfo; - displayGroupInfo.width = 20; - displayGroupInfo.height = 20; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 1; ASSERT_NO_FATAL_FAILURE(WIN_MGR->GetDisplayGroupInfo()); } @@ -1088,7 +1081,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_InWhichHotArea_001, Te HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_AdjustDisplayCoordinate_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.width = 10; displayInfo.height = 20; displayInfo.validWidth = displayInfo.width; @@ -1421,7 +1414,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SelectPointerChangeAre HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerChangeAreas_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; WIN_MGR->UpdatePointerChangeAreas(displayGroupInfo); EXPECT_TRUE(WIN_MGR->windowsHotAreas_.empty()); } @@ -1435,7 +1428,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerChangeAre HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerChangeAreas_002, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; WIN_MGR->UpdatePointerChangeAreas(); WIN_MGR->UpdatePointerChangeAreas(displayGroupInfo); EXPECT_EQ(WIN_MGR->windowsHotAreas_.size(), 1); @@ -1971,7 +1964,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTargetPointer_00 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsInsideDisplay_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.width = 1920; displayInfo.height = 1080; displayInfo.validWidth = displayInfo.width; @@ -2003,7 +1996,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsInsideDisplay_001, T HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FindPhysicalDisplay_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo displayInfo = {10, 20}; + OLD::DisplayInfo displayInfo = {10, 20}; double physicalX, physicalY; int32_t displayId; WIN_MGR->FindPhysicalDisplay(displayInfo, physicalX, physicalY, displayId); @@ -2033,7 +2026,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FindPhysicalDisplay_00 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetWidthAndHeight_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.displayDirection = DIRECTION0; displayInfo.direction = DIRECTION0; int32_t width = 1920; @@ -2061,7 +2054,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetWidthAndHeight_001, HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ReverseRotateScreen_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo info; + OLD::DisplayInfo info; Coordinate2D cursorPos; info.direction = DIRECTION0; info.width = 1920; @@ -2636,8 +2629,8 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_Init_001, TestSize.Lev */ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateCaptureMode_002, TestSize.Level1) { - DisplayGroupInfo displayGroupInfo; - DisplayInfo info; + OLD::DisplayGroupInfo displayGroupInfo; + OLD::DisplayInfo info; info.id = 1; info.x =1; info.y = 1; @@ -2801,7 +2794,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CheckFocusWindowChange { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 1; auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager.displayGroupInfoMap_.end()) { @@ -2835,7 +2828,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateCaptureMode, Tes { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; WindowInfo windowInfo; inputWindowsManager.captureModeInfo_.isCaptureMode = true; auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID); @@ -2861,7 +2854,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfoByInc CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; WindowInfo window; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; WindowInfo windowInfo; window.action = WINDOW_UPDATE_ACTION::ADD_END; window.id = 5; @@ -2890,7 +2883,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayMode, Tes { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.displayMode = DisplayMode::FULL; inputWindowsManager.displayMode_ = DisplayMode::FULL; auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID); @@ -2917,7 +2910,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPhysicalDisplay, Te CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; int32_t id = 1; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager.displayGroupInfoMap_.end()) { displayInfo.id = 0; @@ -2938,7 +2931,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FindPhysicalDisplayInf { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; std::string uniq = "uniq_test"; displayInfo.uniq = "uniq_test"; auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID); @@ -3146,7 +3139,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayId, TestS CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; int32_t displayId = -1; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 10; auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager.displayGroupInfoMap_.end()) { @@ -3284,7 +3277,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateMouseTarget, Tes pointerEvent->SetTargetDisplayId(-1); EXPECT_EQ(inputWindowsManager.UpdateMouseTarget(pointerEvent), RET_ERR); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager.displayGroupInfoMap_.end()) { @@ -3358,7 +3351,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateAndAdjustMouseLo double x = 200; double y = 200; bool isRealData = true; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.width = 500; displayInfo.height = 500; @@ -3383,7 +3376,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetMouseInfo, TestSize CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; inputWindowsManager.mouseLocation_.displayId = -1; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.width = 600; displayInfo.height = 600; @@ -3405,7 +3398,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetCursorPos, TestSize CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; inputWindowsManager.cursorPos_.displayId = -1; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.width = 300; displayInfo.height = 300; @@ -3426,7 +3419,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ResetCursorPos, TestSi { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.width = 300; displayInfo.height = 300; @@ -3486,8 +3479,8 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FindPhysicalDisplay_00 { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; - DisplayInfo displaysInfo; + OLD::DisplayInfo displayInfo; + OLD::DisplayInfo displaysInfo; double logicalX = 300; double logicalY = 400; double physicalX = 100; @@ -3522,8 +3515,8 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_FindPhysicalDisplay_00 { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayInfo displayInfo; - DisplayInfo displaysInfo; + OLD::DisplayInfo displayInfo; + OLD::DisplayInfo displaysInfo; double logicalX = 300; double logicalY = 400; double physicalX = 100; @@ -3759,7 +3752,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetMouseInfo_002, Test CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; inputWindowsManager.mouseLocation_.displayId = -1; - DisplayInfo displaysInfo; + OLD::DisplayInfo displaysInfo; EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetMouseInfo()); displaysInfo.id = 2; displaysInfo.width = 20; @@ -3789,7 +3782,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetCursorPos_002, Test CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; inputWindowsManager.cursorPos_.displayId = -1; - DisplayInfo displaysInfo; + OLD::DisplayInfo displaysInfo; EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetCursorPos()); displaysInfo.id = 2; displaysInfo.width = 30; @@ -3818,7 +3811,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ResetCursorPos_002, Te { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayInfo displaysInfo; + OLD::DisplayInfo displaysInfo; CursorPosition result = inputWindowsManager.ResetCursorPos(); EXPECT_EQ(result.displayId, -1); displaysInfo.id = 3; @@ -3848,7 +3841,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayIdAndName { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayInfo displaysInfo; + OLD::DisplayInfo displaysInfo; displaysInfo.id = 1; displaysInfo.uniq = "abc"; auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID); @@ -3869,7 +3862,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayIdAndName { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayInfo displaysInfo; + OLD::DisplayInfo displaysInfo; displaysInfo.id = 1; displaysInfo.uniq = "abc"; auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID); @@ -3931,7 +3924,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateMouseTarget001, ASSERT_NE(pointerEvent, nullptr); pointerEvent->SetTargetDisplayId(1); pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.x = 300; displayInfo.y = 500; @@ -3986,7 +3979,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateMouseTarget_002, ASSERT_NE(pointerEvent, nullptr); pointerEvent->SetTargetDisplayId(1); pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_DOWN); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.x = 300; displayInfo.y = 500; @@ -4046,7 +4039,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateMouseTarget_003, ASSERT_NE(pointerEvent, nullptr); pointerEvent->SetTargetDisplayId(1); pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_UP); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.x = 300; displayInfo.y = 500; @@ -4104,7 +4097,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarge ASSERT_NE(pointerEvent, nullptr); pointerEvent->SetTargetDisplayId(1); pointerEvent->SetPointerId(0); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.width = 300; displayInfo.height = 300; @@ -4178,7 +4171,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateAndAdjustMouseLo double x = 350; double y = 350; bool isRealData = true; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.x = 600; displayInfo.y = 600; @@ -4212,7 +4205,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateAndAdjustMouseLo double x = 200; double y = 200; bool isRealData = false; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.x = 600; displayInfo.y = 600; @@ -4332,7 +4325,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ReverseXY, TestSize.Le int32_t y = 100; EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.ReverseXY(x, y)); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.direction = DIRECTION0; displayInfo.width = 200; displayInfo.height = 300; @@ -4381,7 +4374,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_PrintChangedWindowBySy { CALL_TEST_DEBUG; InputWindowsManager inputWindowsMgr; - DisplayGroupInfo newDisplayInfo; + OLD::DisplayGroupInfo newDisplayInfo; EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.PrintChangedWindowBySync(newDisplayInfo)); WindowInfo windowInfo; windowInfo.id = 1; @@ -4605,7 +4598,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_PrintChangedWindowByEv HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformDisplayXY_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo info; + OLD::DisplayInfo info; double logicX = 10.0; double logicY = 20.0; std::pair result =WIN_MGR->TransformDisplayXY(info, logicX, logicY); @@ -4624,7 +4617,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformDisplayXY_001 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformDisplayXY_002, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo info; + OLD::DisplayInfo info; std::vector transform = { 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}; info.transform = transform; double logicX = 10.0; @@ -4645,7 +4638,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformDisplayXY_002 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_TransformDisplayXY_003, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo info; + OLD::DisplayInfo info; std::vector transform = { 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 315.0, 690.0, 1.0}; info.transform = transform; double logicX = 10.0; @@ -4764,7 +4757,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTransformDisplay item.SetDisplayYPos(20); pointerEvent->UpdatePointerItem(0, item); std::vector windowsInfo; - DisplayInfo info; + OLD::DisplayInfo info; WIN_MGR->UpdateTransformDisplayXY(pointerEvent, windowsInfo, info); int32_t pointerId = pointerEvent->GetPointerId(); PointerEvent::PointerItem pointerItem; @@ -4797,7 +4790,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTransformDisplay pointerEvent->UpdatePointerItem(0, item); std::vector windowsInfo; WindowInfo windowInfo; - DisplayInfo info; + OLD::DisplayInfo info; std::vector transform = { 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 315.0, 690.0, 1.0}; info.transform = transform; windowInfo.windowInputType = WindowInputType::MIX_BUTTOM_ANTI_AXIS_MOVE; @@ -4836,7 +4829,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTransformDisplay pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN); std::vector windowsInfo; WindowInfo windowInfo; - DisplayInfo info; + OLD::DisplayInfo info; std::vector transform = { 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 315.0, 690.0, 1.0}; info.transform = transform; windowInfo.windowInputType = WindowInputType::TRANSMIT_ALL; @@ -5208,7 +5201,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarge InputWindowsManager inputWindowsMgr; std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; WindowGroupInfo winGroupInfo; WindowInfo winInfo; Rect rect; @@ -5279,7 +5272,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarge InputWindowsManager inputWindowsMgr; std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; WindowGroupInfo winGroupInfo; WindowInfo winInfo; Rect rect; @@ -5380,7 +5373,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarge InputWindowsManager inputWindowsMgr; std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; WindowGroupInfo winGroupInfo; WindowInfo winInfo; PointerEvent::PointerItem item; @@ -5427,7 +5420,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarge InputWindowsManager inputWindowsMgr; std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; WindowGroupInfo winGroupInfo; WindowInfo winInfo; PointerEvent::PointerItem item; @@ -5477,7 +5470,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarge InputWindowsManager inputWindowsMgr; std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; WindowGroupInfo winGroupInfo; WindowInfo winInfo; PointerEvent::PointerItem item; @@ -5535,7 +5528,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarge InputWindowsManager inputWindowsMgr; std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; WindowGroupInfo winGroupInfo; WindowInfo winInfo; PointerEvent::PointerItem item; @@ -5595,7 +5588,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarge InputWindowsManager inputWindowsMgr; std::shared_ptr pointerEvent = PointerEvent::Create(); ASSERT_NE(pointerEvent, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; WindowGroupInfo winGroupInfo; WindowInfo winInfo; PointerEvent::PointerItem item; @@ -5655,7 +5648,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarge ASSERT_NE(pointerEvent, nullptr); inputWindowsMgr.lastTouchEventOnBackGesture_ = PointerEvent::Create(); ASSERT_NE(inputWindowsMgr.lastTouchEventOnBackGesture_, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; WindowGroupInfo winGroupInfo; WindowInfo winInfo; PointerEvent::PointerItem item; @@ -5716,7 +5709,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarge ASSERT_NE(pointerEvent, nullptr); inputWindowsMgr.lastTouchEventOnBackGesture_ = PointerEvent::Create(); ASSERT_NE(inputWindowsMgr.lastTouchEventOnBackGesture_, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; WindowGroupInfo winGroupInfo; WindowInfo winInfo; PointerEvent::PointerItem item; @@ -5777,7 +5770,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarge ASSERT_NE(pointerEvent, nullptr); inputWindowsMgr.lastTouchEventOnBackGesture_ = PointerEvent::Create(); ASSERT_NE(inputWindowsMgr.lastTouchEventOnBackGesture_, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; WindowGroupInfo winGroupInfo; WindowInfo winInfo; PointerEvent::PointerItem item; @@ -5838,7 +5831,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateTouchScreenTarge ASSERT_NE(pointerEvent, nullptr); inputWindowsMgr.lastTouchEventOnBackGesture_ = PointerEvent::Create(); ASSERT_NE(inputWindowsMgr.lastTouchEventOnBackGesture_, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; WindowGroupInfo winGroupInfo; WindowInfo winInfo; PointerEvent::PointerItem item; @@ -6048,7 +6041,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetDisplayId, TestSize InputWindowsManager inputWindowsMgr; std::shared_ptr inputEvent = InputEvent::Create(); ASSERT_NE(inputEvent, nullptr); - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 100; inputEvent->SetTargetDisplayId(-1); auto it = inputWindowsMgr.displayGroupInfoMap_.find(DEFAULT_GROUP_ID); @@ -6131,7 +6124,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfoExtIf { CALL_TEST_DEBUG; InputWindowsManager inputWindowsMgr; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; bool needUpdateDisplayExt = true; EXPECT_NO_FATAL_FAILURE(inputWindowsMgr.UpdateDisplayInfoExtIfNeed(displayGroupInfo, needUpdateDisplayExt)); } @@ -6298,7 +6291,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ReverseRotateScreen, T { CALL_TEST_DEBUG; InputWindowsManager inputWindowsMgr; - DisplayInfo info; + OLD::DisplayInfo info; double x = 100.5; double y = 100.5; Coordinate2D cursorPos; @@ -6355,7 +6348,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ReverseXY_001, TestSiz InputWindowsManager inputWindowsMgr; int32_t x = 100; int32_t y = 100; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.direction = static_cast(-1); auto it = inputWindowsMgr.displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsMgr.displayGroupInfoMap_.end()) { @@ -6473,9 +6466,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SetPixelMapData, TestS HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_002, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayGroupInfo displayGroupInfo; - displayGroupInfo.width = 20; - displayGroupInfo.height = 20; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 1; WindowInfo windowInfo; @@ -6491,7 +6482,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_002, windowInfo.pointerChangeAreas = { 1, 2, 1, 2, 1, 2, 1, 2, 1 }; displayGroupInfo.windowsInfo.push_back(windowInfo); - DisplayInfo displayInfo1; + OLD::DisplayInfo displayInfo1; displayInfo1.id = 1; displayInfo1.x =1; displayInfo1.y = 1; @@ -6503,7 +6494,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_002, displayInfo1.direction = DIRECTION0; displayGroupInfo.displaysInfo.push_back(displayInfo1); - DisplayInfo displayInfo2; + OLD::DisplayInfo displayInfo2; displayInfo2.id = 2; displayInfo2.x =1; displayInfo2.y = 1; @@ -6530,12 +6521,10 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_002, HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_003, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayGroupInfo displayGroupInfo; - displayGroupInfo.width = 20; - displayGroupInfo.height = 20; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 1; - DisplayInfo displayInfo1; + OLD::DisplayInfo displayInfo1; displayInfo1.id = 1; displayInfo1.x =1; displayInfo1.y = 1; @@ -6547,7 +6536,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_003, displayInfo1.direction = DIRECTION0; displayGroupInfo.displaysInfo.push_back(displayInfo1); - DisplayInfo displayInfo2; + OLD::DisplayInfo displayInfo2; displayInfo2.id = 2; displayInfo2.x =1; displayInfo2.y = 1; @@ -6571,9 +6560,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_003, HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_004, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayGroupInfo displayGroupInfo; - displayGroupInfo.width = 20; - displayGroupInfo.height = 20; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 1; WindowInfo windowInfo; @@ -6589,7 +6576,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_004, windowInfo.pointerChangeAreas = { 1, 2, 1, 2, 1, 2, 1, 2, 1 }; displayGroupInfo.windowsInfo.push_back(windowInfo); - DisplayInfo displayInfo1; + OLD::DisplayInfo displayInfo1; displayInfo1.id = 1; displayInfo1.x =1; displayInfo1.y = 1; @@ -6601,7 +6588,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_004, displayInfo1.direction = DIRECTION0; displayGroupInfo.displaysInfo.push_back(displayInfo1); - DisplayInfo displayInfo2; + OLD::DisplayInfo displayInfo2; displayInfo2.id = 2; displayInfo2.x =1; displayInfo2.y = 1; @@ -6628,9 +6615,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_004, HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_005, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayGroupInfo displayGroupInfo; - displayGroupInfo.width = 20; - displayGroupInfo.height = 20; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 1; ASSERT_NO_FATAL_FAILURE(WIN_MGR->UpdateDisplayInfo(displayGroupInfo)); @@ -6662,7 +6647,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateKeyEventDisplayI inputWindowsManager.UpdateKeyEventDisplayId(keyEvent, focusWindowId); EXPECT_EQ(keyEvent->GetTargetDisplayId(), -1); - DisplayInfo info1 = {.id = 0, .x = 0, .y = 0, .width = 100, .height = 200}; + OLD::DisplayInfo info1 = {.id = 0, .x = 0, .y = 0, .width = 100, .height = 200}; auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager.displayGroupInfoMap_.end()) { it->second.displaysInfo.emplace_back(info1); @@ -6681,12 +6666,12 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_OnDisplayRemovedOrComb { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayGroupInfo displayGroupInfo {}; + OLD::DisplayGroupInfo displayGroupInfo {}; bool ret = inputWindowsManager.OnDisplayRemovedOrCombinationChanged(displayGroupInfo); EXPECT_FALSE(ret); - DisplayInfo info1 = {.id = 0, .x = 0, .y = 0, .width = 100, .height = 200}; - DisplayInfo info2 = {.id = 1, .x = 100, .y = 0, .width = 100, .height = 200}; + OLD::DisplayInfo info1 = {.id = 0, .x = 0, .y = 0, .width = 100, .height = 200}; + OLD::DisplayInfo info2 = {.id = 1, .x = 100, .y = 0, .width = 100, .height = 200}; auto it = inputWindowsManager.displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager.displayGroupInfoMap_.end()) { it->second.displaysInfo = {info1, info2}; @@ -6705,9 +6690,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_OnDisplayRemovedOrComb HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateWindowInfo_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayGroupInfo displayGroupInfo; - displayGroupInfo.width = 20; - displayGroupInfo.height = 20; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 1; WindowInfo windowInfo; @@ -6737,12 +6720,10 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateWindowInfo_001, HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_PointerBackCenter_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayGroupInfo displayGroupInfo; - displayGroupInfo.width = 20; - displayGroupInfo.height = 20; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 1; - DisplayInfo displayInfo1; + OLD::DisplayInfo displayInfo1; displayInfo1.id = 1; displayInfo1.x =1; displayInfo1.y = 1; @@ -6750,11 +6731,10 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_Poin displayInfo1.height = 2; displayInfo1.dpi = 240; displayInfo1.name = "pp"; - displayInfo1.uniq = "pp"; displayInfo1.direction = DIRECTION0; - displayInfo1.screenCombination = OHOS::MMI::ScreenCombination::SCREEN_MAIN; + displayInfo1.displaySourceMode = OHOS::MMI::DisplaySourceMode::SCREEN_MAIN; - DisplayInfo displayInfo2; + OLD::DisplayInfo displayInfo2; displayInfo2.id = 2; displayInfo2.x =1; displayInfo2.y = 1; @@ -6764,7 +6744,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_Poin displayInfo2.name = "pp"; displayInfo2.uniq = "pp"; displayInfo2.direction = DIRECTION0; - displayInfo2.screenCombination = OHOS::MMI::ScreenCombination::SCREEN_EXPAND; + displayInfo2.displaySourceMode = OHOS::MMI::DisplaySourceMode::SCREEN_EXPAND; displayGroupInfo.displaysInfo.push_back(displayInfo2); displayGroupInfo.displaysInfo.push_back(displayInfo1); @@ -7071,7 +7051,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateWindowsInfoPerDi { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; WindowGroupInfo winGroupInfo; WindowInfo winInfo; int32_t displayId = 100; @@ -7429,9 +7409,9 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetPhysicalDisplay_003 CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; int32_t id = 1; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 0; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.displaysInfo.push_back(displayInfo); EXPECT_NO_FATAL_FAILURE(inputWindowsManager.GetPhysicalDisplay(id, displayGroupInfo)); @@ -8071,8 +8051,8 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ShiftAppPointerEvent_0 HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ResetPointerPositionIfOutValidDisplay_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayGroupInfo displayGroupInfo; - DisplayInfo displayInfo; + OLD::DisplayGroupInfo displayGroupInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.width = 1920; displayInfo.height = 1080; @@ -8122,7 +8102,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ResetPointerPositionIf HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_IsPositionOutValidDisplay_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; displayInfo.width = 1; displayInfo.height = 1; @@ -8167,9 +8147,9 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CancelTouchScreenEvent TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.displaysInfo.push_back(displayInfo); InputWindowsManager inputWindowsManager; @@ -8193,9 +8173,9 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CancelTouchScreenEvent TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 1; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.displaysInfo.push_back(displayInfo); InputWindowsManager inputWindowsManager; @@ -8728,7 +8708,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerItemInOne { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayInfo disPlayInfo = { + OLD::DisplayInfo disPlayInfo = { .id = 2, .oneHandX = 100, .oneHandY = 150, @@ -8760,7 +8740,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerItemInOne { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayInfo disPlayInfo = { + OLD::DisplayInfo disPlayInfo = { .id = 2, .oneHandX = 100, .oneHandY = 150, @@ -8794,7 +8774,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerItemInOne { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayInfo disPlayInfo = { + OLD::DisplayInfo disPlayInfo = { .id = 2, .oneHandX = 100, .oneHandY = 150, @@ -8828,7 +8808,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerItemInOne { CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; - DisplayInfo disPlayInfo = { + OLD::DisplayInfo disPlayInfo = { .id = 2, .oneHandX = 100, .oneHandY = 150, @@ -8970,7 +8950,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayXYInOneHa double physicalX = 6; double physicalY = 6; float oneHandScale = 1.0; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.oneHandY = 5; displayInfo.oneHandX = 5; displayInfo.width = 5; @@ -9014,7 +8994,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_HandleOneHandMode_001, pointerItem.pointerId_ = 2; pointerItem.canceled_ = true; pointerItem.pressed_ = true; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.oneHandY = 5; displayInfo.oneHandX = 5; displayInfo.width = 5; @@ -9048,7 +9028,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateCaptureMode_003, { CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; WindowInfo windowInfo; inputWindowsManager->captureModeInfo_.isCaptureMode = true; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); @@ -9108,8 +9088,8 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_PointerDrawingManagerO { CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayGroupInfo displayGroupInfo; - DisplayInfo displayInfo; + OLD::DisplayGroupInfo displayGroupInfo; + OLD::DisplayInfo displayInfo; displayInfo.id = 521; displayInfo.uniq = "uniq_test"; displayInfo.dpi = 1000; @@ -9140,7 +9120,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerDrawingMa EXPECT_NE(inputWindowsManager->lastPointerEvent_, nullptr); EXPECT_NO_FATAL_FAILURE(inputWindowsManager->UpdatePointerDrawingManagerWindowInfo()); - DisplayInfo displaysInfo; + OLD::DisplayInfo displaysInfo; inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_UNKNOWN); inputWindowsManager->lastPointerEvent_->SetButtonPressed(1); auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); @@ -9162,7 +9142,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerDrawingMa std::shared_ptr inputWindowsManager = std::make_shared(); inputWindowsManager->lastPointerEvent_ = PointerEvent::Create(); EXPECT_NE(inputWindowsManager->lastPointerEvent_, nullptr); - DisplayInfo displaysInfo; + OLD::DisplayInfo displaysInfo; inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_UNKNOWN); auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager->displayGroupInfoMap_.end()) { @@ -9183,7 +9163,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerDrawingMa std::shared_ptr inputWindowsManager = std::make_shared(); inputWindowsManager->lastPointerEvent_ = PointerEvent::Create(); EXPECT_NE(inputWindowsManager->lastPointerEvent_, nullptr); - DisplayInfo displaysInfo; + OLD::DisplayInfo displaysInfo; inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_PULL_UP); auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager->displayGroupInfoMap_.end()) { @@ -9204,7 +9184,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerDrawingMa std::shared_ptr inputWindowsManager = std::make_shared(); inputWindowsManager->lastPointerEvent_ = PointerEvent::Create(); EXPECT_NE(inputWindowsManager->lastPointerEvent_, nullptr); - DisplayInfo displaysInfo; + OLD::DisplayInfo displaysInfo; inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_BUTTON_UP); auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager->displayGroupInfoMap_.end()) { @@ -9225,7 +9205,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdatePointerDrawingMa std::shared_ptr inputWindowsManager = std::make_shared(); inputWindowsManager->lastPointerEvent_ = PointerEvent::Create(); EXPECT_NE(inputWindowsManager->lastPointerEvent_, nullptr); - DisplayInfo displaysInfo; + OLD::DisplayInfo displaysInfo; inputWindowsManager->lastPointerEvent_->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN); auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager->displayGroupInfoMap_.end()) { @@ -9244,15 +9224,13 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayIdAndName { CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayInfo displaysInfo; + OLD::DisplayInfo displaysInfo; displaysInfo.id = 1; - displaysInfo.uniqueId = 1; displaysInfo.uniq = "abc"; auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); if (it != inputWindowsManager->displayGroupInfoMap_.end()) { it->second.displaysInfo.push_back(displaysInfo); } - displaysInfo.uniqueId = 1000; it->second.displaysInfo.push_back(displaysInfo); inputWindowsManager->bindInfo_.AddDisplay(1, "abc"); @@ -9278,7 +9256,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_GetCursorPos_003, Test cursorPosRef = it->second; } cursorPosRef.displayId = -1; - DisplayInfo displaysInfo; + OLD::DisplayInfo displaysInfo; displaysInfo.id = 2; displaysInfo.width = 30; displaysInfo.height = 40; @@ -9324,8 +9302,8 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_ResetPointerPositionIf { CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayInfo displaysInfo; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayInfo displaysInfo; + OLD::DisplayGroupInfo displayGroupInfo; displaysInfo.id = 2; displaysInfo.width = 30; displaysInfo.height = 40; @@ -9357,14 +9335,14 @@ HWTEST_F( { CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; std::shared_ptr pointerEvent = PointerEvent::Create(); pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_UNKNOWN); EXPECT_NE(pointerEvent, nullptr); inputWindowsManager->lastPointerEventforGesture_ = pointerEvent; EXPECT_NO_FATAL_FAILURE(inputWindowsManager->CancelTouchScreenEventIfValidDisplayChange(displayGroupInfo)); - DisplayInfo displaysInfo; + OLD::DisplayInfo displaysInfo; displaysInfo.id = 100; pointerEvent->SetTargetDisplayId(displaysInfo.id); auto it = inputWindowsManager->displayGroupInfoMap_.find(DEFAULT_GROUP_ID); @@ -9386,11 +9364,11 @@ HWTEST_F( { CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayGroupInfo displayGroupInfo; + OLD::DisplayGroupInfo displayGroupInfo; std::shared_ptr pointerEvent = PointerEvent::Create(); pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_UNKNOWN); EXPECT_NE(pointerEvent, nullptr); - DisplayInfo displaysInfo; + OLD::DisplayInfo displaysInfo; displaysInfo.id = 100; pointerEvent->SetTargetDisplayId(displaysInfo.id + 1); displayGroupInfo.displaysInfo.push_back(displaysInfo); @@ -9410,8 +9388,8 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CancelTouchScreenEvent { CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayInfo displaysInfo; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayInfo displaysInfo; + OLD::DisplayGroupInfo displayGroupInfo; displaysInfo.id = 2; displaysInfo.width = 30; displaysInfo.height = 40; @@ -9445,8 +9423,8 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CancelTouchScreenEvent { CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayInfo displaysInfo; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayInfo displaysInfo; + OLD::DisplayGroupInfo displayGroupInfo; displaysInfo.id = 2; displaysInfo.width = 30; displaysInfo.height = 40; @@ -9473,8 +9451,8 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateDisplayInfo_006, { CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayGroupInfo displayGroupInfo; - DisplayInfo info; + OLD::DisplayGroupInfo displayGroupInfo; + OLD::DisplayInfo info; info.scalePercent = inputWindowsManager->scalePercent_ + 1; displayGroupInfo.displaysInfo.emplace_back(info); ASSERT_NO_FATAL_FAILURE(inputWindowsManager->UpdateDisplayInfo(displayGroupInfo)); @@ -9490,9 +9468,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_UpdateWindowInfo_002, { CALL_TEST_DEBUG; std::shared_ptr inputWindowsManager = std::make_shared(); - DisplayGroupInfo displayGroupInfo; - displayGroupInfo.width = 20; - displayGroupInfo.height = 20; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.focusWindowId = 1; WindowInfo windowInfo; @@ -9753,7 +9729,7 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_CalculateAcrossDirecti CALL_TEST_DEBUG; InputWindowsManager inputWindowsManager; Vector2D layout; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.x = 100; displayInfo.validWidth = 2147483600; auto ret = inputWindowsManager.CalculateAcrossDirection(displayInfo, layout); diff --git a/service/window_manager/test/knuckle_drawing_manager_test.cpp b/service/window_manager/test/knuckle_drawing_manager_test.cpp index 6c019f33c8..c795bfa604 100644 --- a/service/window_manager/test/knuckle_drawing_manager_test.cpp +++ b/service/window_manager/test/knuckle_drawing_manager_test.cpp @@ -46,7 +46,7 @@ public: static void TearDownTestCase(void) {}; void SetUp(void) { - DisplayInfo info; + OLD::DisplayInfo info; info.id = 1; info.x =1; info.y = 1; @@ -55,7 +55,6 @@ public: int32_t displayDpi = 240; info.dpi = displayDpi; info.name = "display"; - info.uniq = "xx"; if (knuckleDrawMgr_ == nullptr) { knuckleDrawMgr_ = std::make_shared(); } @@ -706,7 +705,7 @@ HWTEST_F(KnuckleDrawingManagerTest, KnuckleDrawingManagerTest_RotationCanvasNode { CALL_TEST_DEBUG; KnuckleDrawingManager kceDrawMgr; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.direction = Direction::DIRECTION90; displayInfo.displayDirection = Direction::DIRECTION0; auto canvasNode = Rosen::RSCanvasNode::Create(); diff --git a/service/window_manager/test/knuckle_dynamic_drawing_manager_test.cpp b/service/window_manager/test/knuckle_dynamic_drawing_manager_test.cpp index 88ab1a9a78..474793623a 100644 --- a/service/window_manager/test/knuckle_dynamic_drawing_manager_test.cpp +++ b/service/window_manager/test/knuckle_dynamic_drawing_manager_test.cpp @@ -42,7 +42,7 @@ public: static void TearDownTestCase(void) {}; void SetUp(void) { - DisplayInfo displayInfo = { .id = 1, .x = 1, .y = 1, .width = 1, .height = 1, + OLD::DisplayInfo displayInfo = { .id = 1, .x = 1, .y = 1, .width = 1, .height = 1, .dpi = 240, .name = "display", .uniq = "xx" }; if (knuckleDynamicDrawingMgr == nullptr) { knuckleDynamicDrawingMgr = std::make_shared(); @@ -451,7 +451,7 @@ HWTEST_F(KnuckleDynamicDrawingManagerTest, KnuckleDynamicDrawingManagerTest_Knuc HWTEST_F(KnuckleDynamicDrawingManagerTest, KnuckleDynamicDrawingManagerTest_UpdateDisplayInfo_001, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo displayInfo = { .id = 1, .x = 1, .y = 1, .width = 1, .height = 1, + OLD::DisplayInfo displayInfo = { .id = 1, .x = 1, .y = 1, .width = 1, .height = 1, .dpi = 240, .name = "display", .uniq = "xx" }; knuckleDynamicDrawingMgr->UpdateDisplayInfo(displayInfo); EXPECT_EQ(knuckleDynamicDrawingMgr->displayInfo_.width, 1); @@ -466,7 +466,7 @@ HWTEST_F(KnuckleDynamicDrawingManagerTest, KnuckleDynamicDrawingManagerTest_Upda HWTEST_F(KnuckleDynamicDrawingManagerTest, KnuckleDynamicDrawingManagerTest_UpdateDisplayInfo_002, TestSize.Level1) { CALL_TEST_DEBUG; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; knuckleDynamicDrawingMgr->UpdateDisplayInfo(displayInfo); EXPECT_EQ(knuckleDynamicDrawingMgr->displayInfo_.width, 0); } diff --git a/service/window_manager/test/mock.cpp b/service/window_manager/test/mock.cpp index c55ce9a2c5..c911a8cc58 100644 --- a/service/window_manager/test/mock.cpp +++ b/service/window_manager/test/mock.cpp @@ -187,7 +187,7 @@ TouchDrawingManager::TouchDrawingManager() {} TouchDrawingManager::~TouchDrawingManager() {} -void TouchDrawingManager::UpdateDisplayInfo(const DisplayInfo& displayInfo) +void TouchDrawingManager::UpdateDisplayInfo(const OLD::DisplayInfo& displayInfo) {} void TouchDrawingManager::RotationScreen() @@ -223,8 +223,8 @@ void PointerDrawingManager::UpdatePointerDevice(bool hasPointerDevice, bool isPo {} void PointerDrawingManager::DrawPointer(int32_t displayId, int32_t physicalX, int32_t physicalY, const PointerStyle pointerStyle, Direction direction) {} -void PointerDrawingManager::UpdateDisplayInfo(const DisplayInfo& displayInfo) {} -void PointerDrawingManager::OnDisplayInfo(const DisplayGroupInfo& displayGroupInfo) {} +void PointerDrawingManager::UpdateDisplayInfo(const OLD::DisplayInfo& displayInfo) {} +void PointerDrawingManager::OnDisplayInfo(const OLD::DisplayGroupInfo& displayGroupInfo) {} void PointerDrawingManager::OnWindowInfo(const WinInfo &info) {} bool PointerDrawingManager::Init() { @@ -440,7 +440,7 @@ int32_t MouseEventNormalize::GetDisplayId() const KnuckleDrawingManager::KnuckleDrawingManager() {} -void KnuckleDrawingManager::UpdateDisplayInfo(const DisplayInfo& displayInfo) +void KnuckleDrawingManager::UpdateDisplayInfo(const OLD::DisplayInfo& displayInfo) {} void KnuckleDrawingManager::KnuckleDrawHandler(std::shared_ptr touchEvent, int32_t displayId) @@ -449,7 +449,7 @@ void KnuckleDrawingManager::KnuckleDrawHandler(std::shared_ptr tou KnuckleDynamicDrawingManager::KnuckleDynamicDrawingManager() {} -void KnuckleDynamicDrawingManager::UpdateDisplayInfo(const DisplayInfo& displayInfo) +void KnuckleDynamicDrawingManager::UpdateDisplayInfo(const OLD::DisplayInfo& displayInfo) {} void KnuckleDynamicDrawingManager::KnuckleDynamicDrawHandler(std::shared_ptr pointerEvent, diff --git a/service/window_manager/test/pointer_drawing_manager_ex_test.cpp b/service/window_manager/test/pointer_drawing_manager_ex_test.cpp index ee211806a5..88e9234d2a 100644 --- a/service/window_manager/test/pointer_drawing_manager_ex_test.cpp +++ b/service/window_manager/test/pointer_drawing_manager_ex_test.cpp @@ -1342,8 +1342,8 @@ HWTEST_F(PointerDrawingManagerExTest, PointerDrawingManagerExTest_OnDisplayInfo, { CALL_TEST_DEBUG; PointerDrawingManager pointerDrawMgr; - DisplayInfo displayInfo; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayInfo displayInfo; + OLD::DisplayGroupInfo displayGroupInfo; displayInfo.id = 10; displayInfo.width = 600; displayInfo.height = 600; diff --git a/service/window_manager/test/pointer_drawing_manager_test.cpp b/service/window_manager/test/pointer_drawing_manager_test.cpp index 6fe1d536e3..b1e571033d 100644 --- a/service/window_manager/test/pointer_drawing_manager_test.cpp +++ b/service/window_manager/test/pointer_drawing_manager_test.cpp @@ -1717,12 +1717,10 @@ HWTEST_F(PointerDrawingManagerTest, InputWindowsManagerTest_OnDisplayInfo_001, T { CALL_TEST_DEBUG; PointerDrawingManager pointerDrawingManager; - DisplayInfo displaysInfo; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayInfo displaysInfo; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.displaysInfo.push_back(displaysInfo); displayGroupInfo.focusWindowId = 0; - displayGroupInfo.width = 0; - displayGroupInfo.height = 0; Rosen::RSSurfaceNodeConfig surfaceNodeConfig; surfaceNodeConfig.SurfaceNodeName = "pointer window"; Rosen::RSSurfaceNodeType surfaceNodeType = Rosen::RSSurfaceNodeType::SELF_DRAWING_WINDOW_NODE; @@ -1742,12 +1740,10 @@ HWTEST_F(PointerDrawingManagerTest, InputWindowsManagerTest_OnDisplayInfo_002, T { CALL_TEST_DEBUG; PointerDrawingManager pointerDrawingManager; - DisplayInfo displaysInfo; - DisplayGroupInfo displayGroupInfo; + OLD::DisplayInfo displaysInfo; + OLD::DisplayGroupInfo displayGroupInfo; displayGroupInfo.displaysInfo.push_back(displaysInfo); displayGroupInfo.focusWindowId = 0; - displayGroupInfo.width = 0; - displayGroupInfo.height = 0; pointerDrawingManager.surfaceNode_ = nullptr; ASSERT_NO_FATAL_FAILURE(pointerDrawingManager.OnDisplayInfo(displayGroupInfo)); } diff --git a/service/window_manager/test/screen_pointer_test.cpp b/service/window_manager/test/screen_pointer_test.cpp index 7768633806..01dffc3e8d 100644 --- a/service/window_manager/test/screen_pointer_test.cpp +++ b/service/window_manager/test/screen_pointer_test.cpp @@ -45,7 +45,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_GetRenderDPI_001, TestSize.Level1) CALL_TEST_DEBUG; hwcmgr_ptr_t hwcmgr = nullptr; handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); ASSERT_NE(screenpointer, nullptr); screenpointer->isCurrentOffScreenRendering_ = true; @@ -74,7 +74,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_SetInvisible_001, TestSize.Level1) hwcmgr_ptr_t hwcmgr = std::make_shared(); ASSERT_NE(hwcmgr, nullptr); handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); ASSERT_NE(screenpointer, nullptr); PointerRenderer renderer; @@ -95,7 +95,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_MoveSoft_001, TestSize.Level1) hwcmgr_ptr_t hwcmgr = std::make_shared(); ASSERT_NE(hwcmgr, nullptr); handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); ASSERT_NE(screenpointer, nullptr); Rosen::RSSurfaceNodeConfig surfaceNodeConfig; @@ -129,7 +129,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_MoveSoft_002, TestSize.Level1) hwcmgr_ptr_t hwcmgr = std::make_shared(); ASSERT_NE(hwcmgr, nullptr); handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; di.id = 1; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); Rosen::RSSurfaceNodeConfig surfaceNodeConfig; @@ -158,7 +158,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_Move_001, TestSize.Level1) hwcmgr_ptr_t hwcmgr = std::make_shared(); ASSERT_NE(hwcmgr, nullptr); handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); ASSERT_NE(screenpointer, nullptr); PointerRenderer renderer; @@ -205,7 +205,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_Rotate_001, TestSize.Level1) hwcmgr_ptr_t hwcmgr = std::make_shared(); ASSERT_NE(hwcmgr, nullptr); handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); ASSERT_NE(screenpointer, nullptr); int32_t x = 0; @@ -243,7 +243,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_Rotate_002, TestSize.Level1) hwcmgr_ptr_t hwcmgr = std::make_shared(); ASSERT_NE(hwcmgr, nullptr); handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); ASSERT_NE(screenpointer, nullptr); int32_t x = 0; @@ -272,7 +272,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_Rotate_003, TestSize.Level1) hwcmgr_ptr_t hwcmgr = std::make_shared(); ASSERT_NE(hwcmgr, nullptr); handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); ASSERT_NE(screenpointer, nullptr); int32_t x = 0; @@ -303,7 +303,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_GetDefaultBufferr_001, TestSize.Le hwcmgr_ptr_t hwcmgr = std::make_shared(); ASSERT_NE(hwcmgr, nullptr); handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); ASSERT_NE(screenpointer, nullptr); PointerRenderer renderer; @@ -324,7 +324,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_GetTransparentBuffer_001, TestSize hwcmgr_ptr_t hwcmgr = std::make_shared(); ASSERT_NE(hwcmgr, nullptr); handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); ASSERT_NE(screenpointer, nullptr); PointerRenderer renderer; @@ -345,7 +345,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_GetCommonBuffer_001, TestSize.Leve hwcmgr_ptr_t hwcmgr = std::make_shared(); ASSERT_NE(hwcmgr, nullptr); handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); ASSERT_NE(screenpointer, nullptr); PointerRenderer renderer; @@ -366,7 +366,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_GetCurrentBuffer_001, TestSize.Lev hwcmgr_ptr_t hwcmgr = std::make_shared(); ASSERT_NE(hwcmgr, nullptr); handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); ASSERT_NE(screenpointer, nullptr); PointerRenderer renderer; @@ -389,7 +389,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_RequestBuffer_001, TestSize.Level1 hwcmgr_ptr_t hwcmgr = std::make_shared(); ASSERT_NE(hwcmgr, nullptr); handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); ASSERT_NE(screenpointer, nullptr); PointerRenderer renderer; @@ -417,7 +417,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_UpdatePadding_001, TestSize.Level1 hwcmgr_ptr_t hwcmgr = std::make_shared(); ASSERT_NE(hwcmgr, nullptr); handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); ASSERT_NE(screenpointer, nullptr); screenpointer->mode_ = mode_t::SCREEN_MAIN; @@ -463,7 +463,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_OnDisplayInfo_001, TestSize.Level1 hwcmgr_ptr_t hwcmgr = std::make_shared(); ASSERT_NE(hwcmgr, nullptr); handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; di.id = 1; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); ASSERT_NE(screenpointer, nullptr); @@ -475,7 +475,6 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_OnDisplayInfo_001, TestSize.Level1 screenpointer->isCurrentOffScreenRendering_ = false; EXPECT_NO_FATAL_FAILURE(screenpointer->OnDisplayInfo(di, false)); - di.uniqueId = 2; screenpointer->screenId_ = 1; EXPECT_NO_FATAL_FAILURE(screenpointer->OnDisplayInfo(di, false)); } @@ -492,7 +491,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_ScreenPointer_001, TestSize.Level1 hwcmgr_ptr_t hwcmgr = std::make_shared(); ASSERT_NE(hwcmgr, nullptr); handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; di.id = 1; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); screenpointer->rotation_ = rotation_t::ROTATION_90; @@ -514,7 +513,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_ScreenPointer_002, TestSize.Level1 CALL_TEST_DEBUG; hwcmgr_ptr_t hwcmgr = nullptr; handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; di.width = 5; di.height = 6; di.direction = Direction::DIRECTION90; @@ -536,7 +535,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_ScreenPointer_003, TestSize.Level1 CALL_TEST_DEBUG; hwcmgr_ptr_t hwcmgr = nullptr; handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; di.width = 5; di.height = 6; di.direction = Direction::DIRECTION270; @@ -563,7 +562,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_IsPositionOutScreen_001, TestSize. hwcmgr_ptr_t hwcmgr = std::make_shared(); ASSERT_NE(hwcmgr, nullptr); handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; di.id = 1; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); screenpointer->isCurrentOffScreenRendering_ = false; @@ -604,7 +603,7 @@ HWTEST_F(ScreenPointerTest, ScreenPointerTest_IsPositionOutScreen_002, TestSize. hwcmgr_ptr_t hwcmgr = std::make_shared(); ASSERT_NE(hwcmgr, nullptr); handler_ptr_t handler = nullptr; - DisplayInfo di; + OLD::DisplayInfo di; di.id = 1; ScreenPointer* screenpointer = new ScreenPointer(hwcmgr, handler, di); screenpointer->isCurrentOffScreenRendering_ = true; diff --git a/service/window_manager/test/touch_drawing_manager_test.cpp b/service/window_manager/test/touch_drawing_manager_test.cpp index d94a345cdb..e6e43f51ce 100644 --- a/service/window_manager/test/touch_drawing_manager_test.cpp +++ b/service/window_manager/test/touch_drawing_manager_test.cpp @@ -39,7 +39,7 @@ public: static void TearDownTestCase(void) {}; void SetUp(void) { - DisplayInfo info; + OLD::DisplayInfo info; info.id = 1; info.x =1; info.y = 1; @@ -1166,7 +1166,7 @@ HWTEST_F(TouchDrawingManagerTest, TouchDrawingManagerTest_UpdateDisplayInfo, Tes { CALL_TEST_DEBUG; TouchDrawingManager touchDrawingMgr; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.direction = Direction::DIRECTION0; touchDrawingMgr.displayInfo_.direction = Direction::DIRECTION0; displayInfo.width = 700; @@ -1321,7 +1321,7 @@ HWTEST_F(TouchDrawingManagerTest, TouchDrawingManagerTest_UpdateDisplayInfo001, { CALL_TEST_DEBUG; TouchDrawingManager touchDrawingMgr; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.direction = Direction::DIRECTION0; touchDrawingMgr.displayInfo_.direction = Direction::DIRECTION0; displayInfo.width = 700; @@ -1333,11 +1333,7 @@ HWTEST_F(TouchDrawingManagerTest, TouchDrawingManagerTest_UpdateDisplayInfo001, displayInfo.direction = Direction::DIRECTION270; touchDrawingMgr.displayInfo_.direction = Direction::DIRECTION270; EXPECT_NO_FATAL_FAILURE(touchDrawingMgr.UpdateDisplayInfo(displayInfo)); - displayInfo.screenCombination = ScreenCombination::SCREEN_MAIN; - touchDrawingMgr.displayInfo_.screenCombination = ScreenCombination::SCREEN_MAIN; EXPECT_NO_FATAL_FAILURE(touchDrawingMgr.UpdateDisplayInfo(displayInfo)); - displayInfo.uniqueId = 1; - touchDrawingMgr.displayInfo_.uniqueId = 2; EXPECT_NO_FATAL_FAILURE(touchDrawingMgr.UpdateDisplayInfo(displayInfo)); Rosen::RSSurfaceNodeConfig surfaceNodeConfig; surfaceNodeConfig.SurfaceNodeName = "touch window"; @@ -1356,7 +1352,7 @@ HWTEST_F(TouchDrawingManagerTest, TouchDrawingManagerTest_UpdateDisplayInfo002, { CALL_TEST_DEBUG; TouchDrawingManager touchDrawingMgr; - DisplayInfo displayInfo; + OLD::DisplayInfo displayInfo; displayInfo.direction = Direction::DIRECTION0; touchDrawingMgr.displayInfo_.direction = Direction::DIRECTION0; displayInfo.width = 700; @@ -1368,11 +1364,7 @@ HWTEST_F(TouchDrawingManagerTest, TouchDrawingManagerTest_UpdateDisplayInfo002, displayInfo.direction = Direction::DIRECTION270; touchDrawingMgr.displayInfo_.direction = Direction::DIRECTION270; EXPECT_NO_FATAL_FAILURE(touchDrawingMgr.UpdateDisplayInfo(displayInfo)); - displayInfo.screenCombination = ScreenCombination::SCREEN_MAIN; - touchDrawingMgr.displayInfo_.screenCombination = ScreenCombination::SCREEN_MAIN; EXPECT_NO_FATAL_FAILURE(touchDrawingMgr.UpdateDisplayInfo(displayInfo)); - displayInfo.uniqueId = 1; - touchDrawingMgr.displayInfo_.uniqueId = 2; EXPECT_NO_FATAL_FAILURE(touchDrawingMgr.UpdateDisplayInfo(displayInfo)); Rosen::RSSurfaceNodeConfig surfaceNodeConfig; surfaceNodeConfig.SurfaceNodeName = "touch window"; diff --git a/test/facility/mock/include/input_windows_manager_mock.h b/test/facility/mock/include/input_windows_manager_mock.h index ca8bde22f7..5feb587cc9 100644 --- a/test/facility/mock/include/input_windows_manager_mock.h +++ b/test/facility/mock/include/input_windows_manager_mock.h @@ -39,8 +39,9 @@ public: 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 {} + void UpdateDisplayInfo(OLD::DisplayGroupInfo&) override {} + void UpdateDisplayInfoExtIfNeed(OLD::DisplayGroupInfo&, bool) override {} + void ProcessInjectEventGlobalXY(std::shared_ptr, int32_t) override {}; void UpdateWindowInfo(const WindowGroupInfo&) override {} MOCK_METHOD(int32_t, ClearWindowPointerStyle, (int32_t, int32_t)); void Dump(int32_t, const std::vector&) override {} @@ -54,7 +55,7 @@ public: MOCK_METHOD(ExtraData, GetExtraData, (), (const)); MOCK_METHOD(const std::vector, GetWindowGroupInfoByDisplayIdCopy, (int32_t), (const)); MOCK_METHOD((std::pair), TransformWindowXY, (const WindowInfo&, double, double), (const)); - MOCK_METHOD((std::pair), TransformDisplayXY, (const DisplayInfo&, double, double), (const)); + MOCK_METHOD((std::pair), TransformDisplayXY, (const OLD::DisplayInfo&, double, double), (const)); void ClearTargetWindowId(int32_t pointerId) override {} #ifdef OHOS_BUILD_ENABLE_KEYBOARD @@ -101,7 +102,7 @@ public: #ifdef OHOS_BUILD_ENABLE_TOUCH MOCK_METHOD(bool, TouchPointToDisplayPoint, (int32_t, struct libinput_event_touch*, EventTouch&, int32_t&, bool)); MOCK_METHOD(bool, CalculateTipPoint, (struct libinput_event_tablet_tool*, int32_t&, PhysicalCoordinate&)); - MOCK_METHOD(const std::shared_ptr, GetDefaultDisplayInfo, (), (const)); + MOCK_METHOD(const std::shared_ptr, GetDefaultDisplayInfo, (), (const)); MOCK_METHOD(void, ReverseXY, (int32_t&, int32_t&)); MOCK_METHOD(void, SendCancelEventWhenLock, ()); MOCK_METHOD(void, FoldScreenRotation, (std::shared_ptr)); @@ -110,7 +111,7 @@ public: #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) void DrawTouchGraphic(std::shared_ptr) override {} MOCK_METHOD(int32_t, UpdateTargetPointer, (std::shared_ptr)); - MOCK_METHOD(const std::shared_ptr, GetPhysicalDisplay, (int32_t), (const)); + MOCK_METHOD(const std::shared_ptr, GetPhysicalDisplay, (int32_t), (const)); #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH #if defined(OHOS_BUILD_ENABLE_POINTER) || defined(OHOS_BUILD_ENABLE_TOUCH) @@ -121,7 +122,7 @@ public: void SetWindowStateNotifyPid(int32_t pid) override {} int32_t GetWindowStateNotifyPid() override { return 0; } int32_t GetPidByWindowId(int32_t pid) override { return 0; } - std::pair CalcDrawCoordinate(const DisplayInfo& displayInfo, + std::pair CalcDrawCoordinate(const OLD::DisplayInfo& displayInfo, PointerEvent::PointerItem pointerItem) override { return { 0, 0 }; } bool GetCancelEventFlag(std::shared_ptr pointerEvent) { return false; } MOCK_METHOD(int32_t, SetPixelMapData, (int32_t infoId, void *pixelMap), (override)); @@ -139,7 +140,7 @@ 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 *)); + MOCK_METHOD(Direction, GetDisplayDirection, (const OLD::DisplayInfo *)); #endif // OHOS_BUILD_ENABLE_POINTER || OHOS_BUILD_ENABLE_TOUCH MOCK_METHOD(bool, GetHardCursorEnabled, ()); #if defined(OHOS_BUILD_ENABLE_TOUCH) && defined(OHOS_BUILD_ENABLE_MONITOR) diff --git a/test/fuzztest/pointerstyle_fuzzer/pointerstyle_fuzzer.cpp b/test/fuzztest/pointerstyle_fuzzer/pointerstyle_fuzzer.cpp index 6562494261..e5f22c8052 100644 --- a/test/fuzztest/pointerstyle_fuzzer/pointerstyle_fuzzer.cpp +++ b/test/fuzztest/pointerstyle_fuzzer/pointerstyle_fuzzer.cpp @@ -75,8 +75,10 @@ void UpdateDisplayInfo(const uint8_t *data, size_t size, int32_t windowId) DisplayGroupInfo displayGroupInfo; size_t startPos = 0; size_t stringSize = 4; - startPos += GetObject(data + startPos, size - startPos, displayGroupInfo.width); - startPos += GetObject(data + startPos, size - startPos, displayGroupInfo.height); + int32_t displayWidth = 0; + int32_t displayHeight = 0; + startPos += GetObject(data + startPos, size - startPos, displayWidth); + startPos += GetObject(data + startPos, size - startPos, displayHeight); startPos += GetObject(data + startPos, size - startPos, displayGroupInfo.focusWindowId); std::vector windowsInfo; std::vector displaysInfo; @@ -103,11 +105,26 @@ void UpdateDisplayInfo(const uint8_t *data, size_t size, int32_t windowId) displayInfo.name = name; char uniq[] = "uniq"; GetString(data + startPos, size - startPos, uniq, stringSize); - displayInfo.uniq = uniq; displaysInfo.push_back(displayInfo); displayGroupInfo.windowsInfo = windowsInfo; displayGroupInfo.displaysInfo = displaysInfo; - InputManager::GetInstance()->UpdateDisplayInfo(displayGroupInfo); + + UserScreenInfo userScreenInfo; + ScreenInfo screenInfo; + screenInfo.screenType =(ScreenType)windowInfo.windowType; + screenInfo.dpi = displayInfo.dpi; + screenInfo.height = windowInfo.area.height; + screenInfo.width = windowInfo.area.width; + screenInfo.physicalWidth = displayWidth; + screenInfo.physicalHeight = displayHeight; + screenInfo.id = displayInfo.id; + screenInfo.rotation = Rotation::ROTATION_0; + screenInfo.tpDirection = Direction::DIRECTION0; + screenInfo.uniqueId = uniq; + userScreenInfo.screens.push_back(screenInfo); + + userScreenInfo.displayGroups.push_back(displayGroupInfo); + InputManager::GetInstance()->UpdateDisplayInfo(userScreenInfo); } void PointerStyleFuzzTest(const uint8_t *data, size_t size) diff --git a/test/fuzztest/stubhandleallocsocketfd_fuzzer/stubhandleallocsocketfd_fuzzer.cpp b/test/fuzztest/stubhandleallocsocketfd_fuzzer/stubhandleallocsocketfd_fuzzer.cpp index dec00e106c..50fdf0083e 100644 --- a/test/fuzztest/stubhandleallocsocketfd_fuzzer/stubhandleallocsocketfd_fuzzer.cpp +++ b/test/fuzztest/stubhandleallocsocketfd_fuzzer/stubhandleallocsocketfd_fuzzer.cpp @@ -54,6 +54,7 @@ int32_t g_tmpDate = 1; void* g_pixelMapPtr = &g_tmpDate; bool g_isAuthorize = true; bool g_isNativeInject = true; +bool g_useCoordinate = PointerEvent::DISPLAY_COORDINATE; bool g_switchFlag = true; bool g_enableFlag = true; bool g_rotateSwitchFlag = true; @@ -110,7 +111,7 @@ bool StubHandleAllocSocketFdFuzzTest(const uint8_t *data, size_t size) MMIService::GetInstance()->InjectKeyEvent(*keyEvent.get(), g_isNativeInject); MMIService::GetInstance()->CheckInjectKeyEvent(keyEvent, tmpfd, g_isNativeInject); MMIService::GetInstance()->OnGetKeyState(vecInt, mpInt); - MMIService::GetInstance()->InjectPointerEvent(*pointerEvent.get(), g_isNativeInject); + MMIService::GetInstance()->InjectPointerEvent(*pointerEvent.get(), g_isNativeInject, g_useCoordinate); MMIService::GetInstance()->OnAddSystemAbility(tmpfd, "deviceId"); MMIService::GetInstance()->SubscribeKeyEvent(tmpfd, *p_option.get()); MMIService::GetInstance()->UnsubscribeKeyEvent(tmpfd); diff --git a/test/fuzztest/updatedisplayinfo_fuzzer/updatedisplayinfo_fuzzer.cpp b/test/fuzztest/updatedisplayinfo_fuzzer/updatedisplayinfo_fuzzer.cpp index a47b94a518..97bfac2a20 100644 --- a/test/fuzztest/updatedisplayinfo_fuzzer/updatedisplayinfo_fuzzer.cpp +++ b/test/fuzztest/updatedisplayinfo_fuzzer/updatedisplayinfo_fuzzer.cpp @@ -96,11 +96,14 @@ void UpdateDisplayInfoFuzzTest(const uint8_t* data, size_t size) DisplayGroupInfo displayGroupInfo; size_t startPos = 0; size_t stringSize = 4; - startPos += GetObject(data + startPos, size - startPos, displayGroupInfo.width); - startPos += GetObject(data + startPos, size - startPos, displayGroupInfo.height); + int32_t displayWidth = 0; + int32_t displayHeight = 0; + startPos += GetObject(data + startPos, size - startPos, displayWidth); + startPos += GetObject(data + startPos, size - startPos, displayHeight); startPos += GetObject(data + startPos, size - startPos, displayGroupInfo.focusWindowId); std::vector windowsInfo; std::vector displaysInfo; + std::vector screenInfos; for (size_t i = 0; i < WindowInfo::MAX_HOTAREA_COUNT + 1; ++i) { WindowInfo windowInfo; startPos += GetObject(data + startPos, size - startPos, windowInfo.area.x); @@ -125,12 +128,28 @@ void UpdateDisplayInfoFuzzTest(const uint8_t* data, size_t size) displayInfo.name = name; char uniq[] = "uniq"; startPos += GetString(data + startPos, size - startPos, uniq, stringSize); - displayInfo.uniq = uniq; displaysInfo.push_back(displayInfo); + + ScreenInfo screenInfo; + screenInfo.screenType =(ScreenType)windowInfo.windowType; + screenInfo.dpi = displayInfo.dpi; + screenInfo.height = windowInfo.area.height; + screenInfo.width = windowInfo.area.width; + screenInfo.physicalWidth = displayWidth; + screenInfo.physicalHeight = displayHeight; + screenInfo.id = displayInfo.id; + screenInfo.rotation = Rotation::ROTATION_0; + screenInfo.tpDirection = Direction::DIRECTION0; + screenInfo.uniqueId = uniq; + screenInfos.push_back(screenInfo); } displayGroupInfo.windowsInfo = windowsInfo; displayGroupInfo.displaysInfo = displaysInfo; - InputManager::GetInstance()->UpdateDisplayInfo(displayGroupInfo); + + UserScreenInfo userScreenInfo; + userScreenInfo.displayGroups.push_back(displayGroupInfo); + userScreenInfo.screens = screenInfos; + InputManager::GetInstance()->UpdateDisplayInfo(userScreenInfo); MMI_HILOGD("Update display info success"); } } // namespace MMI diff --git a/util/common/include/struct_multimodal.h b/util/common/include/struct_multimodal.h index 03860e19e3..2788a90dbf 100644 --- a/util/common/include/struct_multimodal.h +++ b/util/common/include/struct_multimodal.h @@ -255,20 +255,15 @@ struct EventJoyStickAxis { EventJoyStickAxisAbsInfo abs_wheel; }; -struct NormalizedCoords { - double x {}; - double y {}; +struct MMICoordinate2D { + double x { 0.0f }; + double y { 0.0f }; }; -struct PhysicalCoordinate { - double x {}; - double y {}; -}; - -struct LogicalCoordinate { - int32_t x {}; - int32_t y {}; -}; +using NormalizedCoords = MMICoordinate2D; +using PhysicalCoordinate = MMICoordinate2D; +using LogicalCoordinate = MMICoordinate2D; +using GlobalCoords = MMICoordinate2D; struct LogicalRectangle { LogicalCoordinate point; @@ -403,6 +398,7 @@ struct EventTouch { int32_t seatSlot {}; PhysicalCoordinate coordF {}; LogicalCoordinate point {}; + GlobalCoords globalCoord {}; // 全局坐标 LogicalRectangle toolRect {}; DEVICE_TYPE deviceType { DEVICE_TYPE::DEVICE_TYPE_UNKNOWN }; double pressure {}; -- Gitee