From 91eb81b2924dc5b9c37ecd5a87b08460363118b0 Mon Sep 17 00:00:00 2001 From: cq_0418 Date: Wed, 12 Feb 2025 16:33:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=85=A5=E4=BA=8B=E4=BB=B6=E9=80=8F?= =?UTF-8?q?=E4=BC=A0flag=E4=BD=BF=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cq_0418 --- .../innerkits/proxy/include/window_info.h | 9 ++++++- .../include/input_windows_manager.h | 1 + .../src/input_windows_manager.cpp | 10 +++++++ .../test/input_windows_manager_test.cpp | 27 +++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/interfaces/native/innerkits/proxy/include/window_info.h b/interfaces/native/innerkits/proxy/include/window_info.h index 3f0a8d3b05..636f3e3ff4 100644 --- a/interfaces/native/innerkits/proxy/include/window_info.h +++ b/interfaces/native/innerkits/proxy/include/window_info.h @@ -216,7 +216,14 @@ struct WindowInfo { * * @since 12 */ - static constexpr uint32_t FLAG_BIT_HANDWRITING = 2; + static constexpr uint32_t FLAG_BIT_HANDWRITING = 1 << 1; + + /** + * exclude inject event window + * + * @since 14 + */ + static constexpr uint32_t FLAG_BIT_EXCLUDE_INJECT_EVENT = 1 << 2; /** * Globally unique identifier of the window diff --git a/service/window_manager/include/input_windows_manager.h b/service/window_manager/include/input_windows_manager.h index 12b90e0d1a..b17e06fb99 100644 --- a/service/window_manager/include/input_windows_manager.h +++ b/service/window_manager/include/input_windows_manager.h @@ -302,6 +302,7 @@ void UpdateDisplayXYInOneHandMode(double& physicalX, double& physicalY, const Di #ifdef OHOS_BUILD_ENABLE_TOUCH bool SkipAnnotationWindow(uint32_t flag, int32_t toolType); + bool SkipExcludeInjectEventWindow(uint32_t windowFlag, bool isInjectEvent); bool SkipNavigationWindow(WindowInputType windowType, int32_t toolType); void HandleGestureInjection(bool gestureInject); int32_t UpdateTouchScreenTarget(std::shared_ptr pointerEvent); diff --git a/service/window_manager/src/input_windows_manager.cpp b/service/window_manager/src/input_windows_manager.cpp index 7052270cd5..3c19fcb156 100644 --- a/service/window_manager/src/input_windows_manager.cpp +++ b/service/window_manager/src/input_windows_manager.cpp @@ -3157,6 +3157,12 @@ bool InputWindowsManager::SkipAnnotationWindow(uint32_t flag, int32_t toolType) toolType == PointerEvent::TOOL_TYPE_FINGER); } +bool InputWindowsManager::SkipExcludeInjectEventWindow(uint32_t windowFlag, bool isInjectEvent) +{ + return isInjectEvent && + (windowFlag & WindowInfo::FLAG_BIT_EXCLUDE_INJECT_EVENT) == WindowInfo::FLAG_BIT_EXCLUDE_INJECT_EVENT; +} + bool InputWindowsManager::SkipNavigationWindow(WindowInputType windowType, int32_t toolType) { MMI_HILOGD("windowType:%{public}d, toolType:%{public}d", static_cast(windowType), toolType); @@ -3480,6 +3486,10 @@ int32_t InputWindowsManager::UpdateTouchScreenTarget(std::shared_ptrHasFlag(InputEvent::EVENT_FLAG_SIMULATE))) { + winMap.insert({item.id, item}); + continue; + } if (SkipAnnotationWindow(item.flags, pointerItem.GetToolType())) { winMap.insert({item.id, item}); continue; diff --git a/service/window_manager/test/input_windows_manager_test.cpp b/service/window_manager/test/input_windows_manager_test.cpp index 1ab6f52e91..00948d62d6 100644 --- a/service/window_manager/test/input_windows_manager_test.cpp +++ b/service/window_manager/test/input_windows_manager_test.cpp @@ -1806,6 +1806,33 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SkipAnnotationWindow_0 EXPECT_FALSE(result); } +/** + * @tc.name: InputWindowsManagerTest_SkipExcludeInjectEventWindow_001 + * @tc.desc: This test verifies the functionality of determining whether to draw the pointer + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SkipExcludeInjectEventWindow_001, TestSize.Level1) +{ + CALL_TEST_DEBUG; + uint32_t flag = WindowInfo::FLAG_BIT_EXCLUDE_INJECT_EVENT; + bool isInjectEvent = true; + bool result = WIN_MGR->SkipExcludeInjectEventWindow(flag, isInjectEvent); + EXPECT_TRUE(result); + flag = WindowInfo::FLAG_BIT_EXCLUDE_INJECT_EVENT; + isInjectEvent = false; + result = WIN_MGR->SkipExcludeInjectEventWindow(flag, isInjectEvent); + EXPECT_FALSE(result); + flag = 0; + isInjectEvent = true; + result = WIN_MGR->SkipExcludeInjectEventWindow(flag, isInjectEvent); + EXPECT_FALSE(result); + flag = 0; + isInjectEvent = false; + result = WIN_MGR->SkipExcludeInjectEventWindow(flag, isInjectEvent); + EXPECT_FALSE(result); +} + /** * @tc.name: InputWindowsManagerTest_UpdateTouchScreenTarget_001 * @tc.desc: This test verifies the functionality of updating the touch screen target -- Gitee