From 7d40ab102596eea51b1b4d69baa41f6a248c11d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B0=B8=E5=87=AF?= Date: Sat, 9 Aug 2025 20:46:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E5=AD=98=E7=A9=BA=E6=B4=9E=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘永凯 --- frameworks/core/event/axis_event.h | 14 ++++---- frameworks/core/event/touch_event.h | 50 ++++++++++++++--------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/frameworks/core/event/axis_event.h b/frameworks/core/event/axis_event.h index 283780da017..4827067f274 100644 --- a/frameworks/core/event/axis_event.h +++ b/frameworks/core/event/axis_event.h @@ -32,27 +32,27 @@ namespace OHOS::Ace { struct UIInputEvent { virtual ~UIInputEvent() = default; TimeStamp time; - UIInputEventType eventType = UIInputEventType::NONE; ConvertInfo convertInfo = { UIInputEventType::NONE, UIInputEventType::NONE }; + UIInputEventType eventType = UIInputEventType::NONE; }; struct PointerEvent : public UIInputEvent { virtual ~PointerEvent() = default; - explicit PointerEvent(float x = {}, float y = {}, float screenX = {}, - float screenY = {}, double globalDisplayX = {}, double globalDisplayY = {}, TimeStamp time = {}) - :x(x), y(y), screenX(screenX), screenY(screenY), globalDisplayX(globalDisplayX), globalDisplayY(globalDisplayY) + explicit PointerEvent(float x = {}, float y = {}, float screenX = {}, float screenY = {}, + double globalDisplayX = {}, double globalDisplayY = {}, TimeStamp time = {}) + : globalDisplayX(globalDisplayX), globalDisplayY(globalDisplayY), x(x), y(y), screenX(screenX), screenY(screenY) { this->time = time; } + double globalDisplayX = {}; + double globalDisplayY = {}; float x = {}; float y = {}; float screenX = {}; float screenY = {}; - bool passThrough = {}; // ID of the node to which this event is being explicitly posted (not necessarily the original target) int32_t postEventNodeId = {}; - double globalDisplayX = {}; - double globalDisplayY = {}; + bool passThrough = {}; }; struct AxisEvent final : public PointerEvent { diff --git a/frameworks/core/event/touch_event.h b/frameworks/core/event/touch_event.h index 84a87abf442..768b6e93fa5 100755 --- a/frameworks/core/event/touch_event.h +++ b/frameworks/core/event/touch_event.h @@ -66,44 +66,39 @@ struct TouchPoint final { */ struct TouchEvent final : public PointerEvent { ~TouchEvent() = default; - // the active changed point info - // The ID is used to identify the point of contact between the finger and the screen. Different fingers have - // different ids. - int32_t id = 0; + // historical points + std::vector history; + std::vector pressedKeyCodes_; + std::list childTouchTestList; + // all points on the touch screen. + std::vector pointers; + std::shared_ptr pointerEvent { nullptr }; + double size = 0.0; + int64_t deviceId = 0; + uint64_t modifierKeyState = 0; + TimeStamp pressedTime; TouchType type = TouchType::UNKNOWN; TouchType pullType = TouchType::UNKNOWN; - double size = 0.0; - float force = 0.0f; std::optional tiltX; std::optional tiltY; std::optional rollAngle; - int64_t deviceId = 0; + // the active changed point info + // The ID is used to identify the point of contact between the finger and the screen. Different fingers have + // different ids. + int32_t id = 0; + float force = 0.0f; int32_t targetDisplayId = 0; SourceType sourceType = SourceType::NONE; SourceTool sourceTool = SourceTool::UNKNOWN; int32_t touchEventId = 0; int32_t operatingHand = 0; - bool isInterpolated = false; - bool isMouseTouchTest = false; - bool isFalsified = false; - // all points on the touch screen. - std::vector pointers; - std::shared_ptr pointerEvent { nullptr }; - // historical points - std::vector history; - std::vector pressedKeyCodes_; - std::list childTouchTestList; // Coordinates relative to the upper-left corner of the current component float localX = 0.0f; float localY = 0.0f; int32_t originalId = 0; - bool isInjected = false; - bool isPrivacyMode = false; // Save historical touch point slope. float inputXDeltaSlope = 0.0f; float inputYDeltaSlope = 0.0f; - bool isPassThroughMode = false; - TimeStamp pressedTime; int32_t width = 0; int32_t height = 0; float targetPositionX = 0.0; @@ -112,7 +107,12 @@ struct TouchEvent final : public PointerEvent { float targetGlobalPositionY = 0.0; float widthArea = 0.0; float heightArea = 0.0; - uint64_t modifierKeyState = 0; + bool isInterpolated = false; + bool isMouseTouchTest = false; + bool isFalsified = false; + bool isInjected = false; + bool isPrivacyMode = false; + bool isPassThroughMode = false; TouchEvent() { @@ -148,10 +148,10 @@ struct TouchEvent final : public PointerEvent { TouchEvent& SetInputYDeltaSlope(float inputYDeltaSlope); TouchEvent& SetPressedKeyCodes(const std::vector& pressedKeyCodes); TouchEvent& SetIsPassThroughMode(bool isPassThroughMode); - TouchEvent& SetOperatingHand(int32_t operatingHand); TouchEvent& SetPressedTime(TimeStamp pressedTime); TouchEvent& SetWidth(int32_t width); TouchEvent& SetHeight(int32_t height); + TouchEvent& SetOperatingHand(int32_t operatingHand); TouchEvent CloneWith(float scale) const; TouchEvent CloneWith(float scale, float offsetX, float offsetY, std::optional pointId) const; void ToJsonValue(std::unique_ptr& json) const; @@ -194,11 +194,11 @@ struct TouchRestrict final { { forbiddenType |= gestureType; } + TouchEvent touchEvent = {}; + std::list childTouchTestList = {}; SourceType sourceType = SourceType::NONE; SourceType hitTestType = SourceType::TOUCH; InputEventType inputEventType = InputEventType::TOUCH_SCREEN; - TouchEvent touchEvent = {}; - std::list childTouchTestList = {}; // use to dump event tree NG::EventTreeType touchTestType = NG::EventTreeType::TOUCH; }; -- Gitee