ui_input_event.h

Overview

Provides ArkUI event definitions on the native side.

File to include: <arkui/ui_input_event.h>

Library: libace_ndk.z.so

System capability: SystemCapability.ArkUI.ArkUI.Full

Since: 12

Related module: ArkUI_EventModule

Sample: NdkInputEvent, CoastingAxisEventNDK

Summary

Structs

Name typedef Keyword Description
ArkUI_UIInputEvent ArkUI_UIInputEvent Defines the UI input event.
ArkUI_CoastingAxisEvent ArkUI_CoastingAxisEvent Defines the coasting axis event.
ArkUI_TouchTestInfo ArkUI_TouchTestInfo Defines touch test information.
ArkUI_TouchTestInfoItem ArkUI_TouchTestInfoItem Defines touch test information items.
ArkUI_TouchTestInfoItem* ArkUI_TouchTestInfoItemHandle Defines the handle of touch test information items.
ArkUI_TouchTestInfoItemHandle* ArkUI_TouchTestInfoItemArray Defines the handle array of touch test information items.

Enums

Name typedef Keyword Description
ArkUI_UIInputEvent_Type ArkUI_UIInputEvent_Type Enumerates the UI input event types.
anonymous1 - Enumerates the action types of the input event.
anonymous2 - Enumerates the tool types of the input event.
anonymous3 - Enumerates the source types of the input event.
HitTestMode HitTestMode Enumerates the hit test modes.
anonymous4 - Enumerates the action types of the mouse event.
anonymous5 - Enumerates the button types of the mouse event.
ArkUI_ModifierKeyName ArkUI_ModifierKeyName Enumerates the modifier keys.
anonymous6 - Enumerates the axis types for focus axis events.
ArkUI_InteractionHand ArkUI_InteractionHand Defines whether the touch event is from the left or right hand.
anonymous7 - Enumerates the action types for axis events.
anonymous8 - Enumerates the axis types for axis events.
ArkUI_CoastingAxisEventPhase ArkUI_CoastingAxisEventPhase Enumerates the phases of coasting axis events.
ArkUI_CompetitionStrategy ArkUI_CompetitionStrategy Strategy that determines whether the gesture identification result between the event injector and the injected end is in a competition scenario. This strategy determines how the event injector interacts with the gesture processing logic of the injected end. In non-competition scenarios, the gestures of the two parties are triggered simultaneously. In competition scenarios, only the gesture of one party is triggered.
ArkUI_TouchTestStrategy ArkUI_TouchTestStrategy Defines the touch test policy.

Functions

Name Description
int32_t OH_ArkUI_UIInputEvent_GetType(const ArkUI_UIInputEvent* event) Obtains the type of a UI input event. Before accessing an ArkUI_UIInputEvent pointer, use this API to determine the type of the input event. This API returns a value from the ArkUI_UIInputEvent_Type enum. It helps ensure compatibility with subsequent accessors. For example, if the event is a touch event, which is directional, you can use OH_ArkUI_UIInputEvent_GetXXX or OH_ArkUI_PointerEvent_GetXXX for access. Using OH_ArkUI_KeyEvent_GetXXX to access the event may produce undefined behavior. For unsupported event types, this API returns the default value 0.
int32_t OH_ArkUI_UIInputEvent_GetAction(const ArkUI_UIInputEvent* event) Obtains the action type of an input event. The action type defines the phase of a basic event (for example, start or end) and characterizes its behavior, such as touch down or touch up. Action types are specific to the event category: UI_TOUCH_EVENT_ACTION_XXX for touch events and UI_MOUSE_EVENT_ACTION_XXX for mouse events.
int32_t OH_ArkUI_UIInputEvent_GetSourceType(const ArkUI_UIInputEvent* event) Obtains the source type of a UI input event. The source represents the physical device, such as a touchscreen or mouse device, that generates the input event. It is defined by the UI_INPUT_EVENT_SOURCE_TYPE_XXX enum. This is different from the input tool, which is the device used to interact with the source, for example, a finger or stylus. However, in certain cases, the input source and the input tool can be the same. For example, a mouse device acts as both the source and tool for click events.
int32_t OH_ArkUI_UIInputEvent_GetToolType(const ArkUI_UIInputEvent* event) Obtains the tool type of a UI input event. The input tool is the device used to interact with the input source, such as a finger or stylus. These tools themselves do not generate events but can drive the input source device to continuously generate events. The returned type is defined by the enumerated value of UI_INPUT_EVENT_TOOL_TYPE_XXX.
int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent* event) Obtains the time when a specified UI input event occurs. The unit is ns.
uint32_t OH_ArkUI_PointerEvent_GetPointerCount(const ArkUI_UIInputEvent* event) Obtains the number of contact points from a pointer event (such as a touch, mouse, or axis event). Pointer events are typically events that carry position information, such as touch events, where the location of the event can be determined. Non-pointer events, such as key events, do not have position information and do not involve touch points, so this API is not applicable to key events. For touch events, this API returns the number of active touch points, for example, fingers on the screen. For mouse and axis events, this API always returns 1, as they are single-pointer interactions.
int32_t OH_ArkUI_PointerEvent_GetPointerId(const ArkUI_UIInputEvent* event, uint32_t pointerIndex) Obtains the unique ID of a contact point from a pointer event (such as a touch, mouse, or axis event). The ID distinguishes between multiple touch points from the same input device. The return value itself does not have any other meaning beyond identifying the touch point.
int32_t OH_ArkUI_PointerEvent_GetChangedPointerId(const ArkUI_UIInputEvent* event, uint32_t* pointerIndex) Obtains the ID of the touch pointer that triggers the current touch event.
float OH_ArkUI_PointerEvent_GetCurrentLocalX(const ArkUI_UIInputEvent* event) Obtains the X coordinate relative to the upper left corner of the current component from a pointer event(such as a touch event, mouse event, or axis event) based on the real-time location.
float OH_ArkUI_PointerEvent_GetCurrentLocalXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex) Obtains the X coordinate of a specific contact point relative to the upper left corner of the current component from a pointer event(such as a touch event, mouse event, or axis event) based on the real-time location. For all types of events, an index value less than 0 is considered invalid. For mouse and axis events, an index value other than 0 is considered invalid. For touch events, this API is used to obtain the X coordinate of a specific contact point relative to the upper left corner of the current component based on the given index.
float OH_ArkUI_PointerEvent_GetCurrentLocalY(const ArkUI_UIInputEvent* event) Obtains the Y coordinate relative to the upper left corner of the current component from a pointer event(such as a touch event, mouse event, or axis event) based on the real-time location.
float OH_ArkUI_PointerEvent_GetCurrentLocalYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex) Obtains the Y coordinate of a specific contact point relative to the upper left corner of the current component from a pointer event(such as a touch event, mouse event, or axis event) based on the real-time location. For all types of events, an index value less than 0 is considered invalid. For mouse and axis events, an index value other than 0 is considered invalid. For touch events, this API is used to obtain the Y coordinate of a specific contact point relative to the upper left corner of the current component based on the given index.
float OH_ArkUI_PointerEvent_GetX(const ArkUI_UIInputEvent* event) Obtains the x-coordinate relative to the upper left corner of the current component from a pointer event (such as a touch, mouse, or axis event).
float OH_ArkUI_PointerEvent_GetXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex) Obtains the x-coordinate of a specific contact point relative to the upper left corner of the current component from a pointer event (such as a touch, mouse, or axis event). For mouse and axis events, this API returns the default value of 0.0f if the given index is greater than 0.
float OH_ArkUI_PointerEvent_GetY(const ArkUI_UIInputEvent* event) Obtains the y-coordinate relative to the upper left corner of the current component from a pointer event (such as a touch, mouse, or axis event).
float OH_ArkUI_PointerEvent_GetYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex) Obtains the y-coordinate of a specific contact point relative to the upper left corner of the current component from a pointer event (such as a touch, mouse, or axis event). For mouse and axis events, this API returns the default value of 0.0f if the given index is greater than 0.
float OH_ArkUI_PointerEvent_GetWindowX(const ArkUI_UIInputEvent* event) Obtains the x-coordinate relative to the upper left corner of the current application window from a pointer event (such as a touch, mouse, or axis event).
float OH_ArkUI_PointerEvent_GetWindowXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex) Obtains the x-coordinate of a specific contact point relative to the upper left corner of the current application window from a pointer event (such as a touch, mouse, or axis event). For mouse and axis events, this API returns the default value of 0.0f if the given index is greater than 0.
float OH_ArkUI_PointerEvent_GetWindowY(const ArkUI_UIInputEvent* event) Obtains the y-coordinate relative to the upper left corner of the current application window from a pointer event (such as a touch, mouse, or axis event).
float OH_ArkUI_PointerEvent_GetWindowYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex) Obtains the y-coordinate of a specific contact point relative to the upper left corner of the current application window from a pointer event (such as a touch, mouse, or axis event). For mouse and axis events, this API returns the default value of 0.0f if the given index is greater than 0.
float OH_ArkUI_PointerEvent_GetDisplayX(const ArkUI_UIInputEvent* event) Obtains the x-coordinate relative to the upper left corner of the current screen from a pointer event (such as a touch, mouse, or axis event).
float OH_ArkUI_PointerEvent_GetDisplayXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex) Obtains the x-coordinate of a specific contact point relative to the upper left corner of the current screen from a pointer event (such as a touch, mouse, or axis event). For mouse and axis events, this API returns the default value of 0.0f if the given index is greater than 0.
float OH_ArkUI_PointerEvent_GetDisplayY(const ArkUI_UIInputEvent* event) Obtains the y-coordinate relative to the upper left corner of the current screen from a pointer event (such as a touch, mouse, or axis event).
float OH_ArkUI_PointerEvent_GetDisplayYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex) Obtains the y-coordinate of a specific contact point relative to the upper left corner of the current screen from a pointer event (such as a touch, mouse, or axis event). For mouse and axis events, this API returns the default value of 0.0f if the given index is greater than 0.
float OH_ArkUI_PointerEvent_GetGlobalDisplayX(const ArkUI_UIInputEvent* event) Obtains the x-coordinate relative to the global display from a pointer event (such as a touch, mouse, or axis event). The position information can be obtained only from a ArkUI_UIInputEvent event.
float OH_ArkUI_PointerEvent_GetGlobalDisplayXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex) Obtains the x-coordinate relative to the global display from a pointer event (such as a touch, mouse, or axis event). Position information can only be obtained from pointer events. For mouse and axis events, if the provided pointerIndex is greater than 0, this API always returns the default value 0.0f.
float OH_ArkUI_PointerEvent_GetGlobalDisplayY(const ArkUI_UIInputEvent* event) Obtains the y-coordinate relative to the global display from a pointer event (such as a touch, mouse, or axis event). The position information can be obtained only from a ArkUI_UIInputEvent event.
float OH_ArkUI_PointerEvent_GetGlobalDisplayYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex) Obtains the y-coordinate relative to the global display from a pointer event (such as a touch, mouse, or axis event). Position information can only be obtained from pointer events. For mouse and axis events, if the provided pointerIndex is greater than 0, this API always returns the default value 0.0f.
float OH_ArkUI_PointerEvent_GetPressure(const ArkUI_UIInputEvent* event, uint32_t pointerIndex) Obtains the pressure applied to the touchscreen from a pointer event (such as a touch event).
float OH_ArkUI_PointerEvent_GetTiltX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex) Obtains the angle relative to the YZ plane from a pointer event (for example, a touch event). The value range is [-90, 90], in deg. A positive value indicates a rightward tilt. This API is applicable only to stylus-based touch events from devices that support tilt angle reporting.
float OH_ArkUI_PointerEvent_GetTiltY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex) Obtains the angle relative to the XZ plane from a pointer event (for example, a touch event). The value range is [-90, 90], in deg. A positive value indicates a downward tilt. This API is applicable only to stylus-based touch events from devices that support tilt angle reporting.
int32_t OH_ArkUI_PointerEvent_GetRollAngle(const ArkUI_UIInputEvent* event, double* rollAngle) Obtains the rotation angle of the stylus around the z-axis from a UI input event.
float OH_ArkUI_PointerEvent_GetTouchAreaWidth(const ArkUI_UIInputEvent* event, uint32_t pointerIndex) Obtains the width of the touch area for a pointer event. This API is applicable only to finger-based touch events, and the return value typically represents the radius of a circular touch area.
float OH_ArkUI_PointerEvent_GetTouchAreaHeight(const ArkUI_UIInputEvent* event, uint32_t pointerIndex) Obtains the height of the touch area for a pointer event. This API is applicable only to finger-based touch events, and the return value typically represents the radius of a circular touch area.
int32_t OH_ArkUI_PointerEvent_GetInteractionHand(const ArkUI_UIInputEvent *event, ArkUI_InteractionHand *hand) Checks whether an event is triggered by a left-hand or right-hand tap. This API is only effective on some touch devices.
int32_t OH_ArkUI_PointerEvent_GetInteractionHandByIndex(const ArkUI_UIInputEvent *event, int32_t pointerIndex, ArkUI_InteractionHand *hand) Checks whether an event is triggered by a left-hand or right-hand tap. This API is only effective on some touch devices.
uint32_t OH_ArkUI_PointerEvent_GetHistorySize(const ArkUI_UIInputEvent* event) Obtains the number of historical events from a pointer event. Pointer events supported by this API contain only touch and mouse events. A historical event is the raw event that occurs between the current event and the previous event. This API is applicable only to the move phase (touch or mouse movement) of a pointer event. If this API is called in other states, the default value 0 is returned. Touch events are supported since API version 12, and mouse events are supported since API version 26.0.0.
int64_t OH_ArkUI_PointerEvent_GetHistoryEventTime(const ArkUI_UIInputEvent* event, uint32_t historyIndex) Obtains the occurrence time of a historical event from a pointer event. Pointer events supported by this API contain only touch and mouse events. Touch events are supported since API version 12, and mouse events are supported since API version 26.0.0.
uint32_t OH_ArkUI_PointerEvent_GetHistoryPointerCount(const ArkUI_UIInputEvent* event, uint32_t historyIndex) Obtains the number of contact points in a specific historical event from a pointer event. Pointer events supported by this API contain only touch events.
int32_t OH_ArkUI_PointerEvent_GetHistoryPointerId(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex) Obtains the unique ID of a contact point in a specific historical event from a pointer event. Pointer events supported by this API contain only touch events. The ID distinguishes between multiple touch points from the same input device. The return value itself does not have any other meaning beyond identifying the touch point.
float OH_ArkUI_PointerEvent_GetHistoryX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex) Obtains the X-coordinate of a specific contact point in a specific historical event relative to the upper left corner of the current component from a pointer event. Pointer events supported by this API contain only touch and mouse events. For mouse events, this API returns the default value 0.0f if the given value of pointerIndex is greater than 0. Touch events are supported since API version 12, and mouse events are supported since API version 26.0.0.
float OH_ArkUI_PointerEvent_GetHistoryY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex) Obtains the Y-coordinate of a specific contact point in a specific historical event relative to the upper left corner of the current component from a pointer event. Pointer events supported by this API contain only touch and mouse events. For mouse events, this API returns the default value 0.0f if the given value of pointerIndex is greater than 0. Touch events are supported since API version 12, and mouse events are supported since API version 26.0.0.
float OH_ArkUI_PointerEvent_GetHistoryWindowX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex) Obtains the X-coordinate of a specific contact point in a specific historical event relative to the upper left corner of the current application window from a pointer event. Pointer events supported by this API contain only touch and mouse events. For mouse events, this API returns the default value 0.0f if the given value of pointerIndex is greater than 0. Touch events are supported since API version 12, and mouse events are supported since API version 26.0.0.
float OH_ArkUI_PointerEvent_GetHistoryWindowY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex) Obtains the Y-coordinate of a specific contact point in a specific historical event relative to the upper left corner of the current application window from a pointer event. Pointer events supported by this API contain only touch and mouse events. For mouse events, this API returns the default value 0.0f if the given value of pointerIndex is greater than 0. Touch events are supported since API version 12, and mouse events are supported since API version 26.0.0.
float OH_ArkUI_PointerEvent_GetHistoryDisplayX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex) Obtains the X-coordinate of a specific contact point in a specific historical event relative to the upper left corner of the current screen from a pointer event. Pointer events supported by this API contain only touch and mouse events. For mouse events, this API returns the default value 0.0f if the given value of pointerIndex is greater than 0. Touch events are supported since API version 12, and mouse events are supported since API version 26.0.0.
float OH_ArkUI_PointerEvent_GetHistoryDisplayY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex) Obtains the Y-coordinate of a specific contact point in a specific historical event relative to the upper left corner of the current screen from a pointer event. Pointer events supported by this API contain only touch and mouse events. For mouse events, this API returns the default value 0.0f if the given value of pointerIndex is greater than 0. Touch events are supported since API version 12, and mouse events are supported since API version 26.0.0.
float OH_ArkUI_PointerEvent_GetHistoryGlobalDisplayX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex) Obtains the X-coordinate relative to the global display for a specific touch point in a historical event from a pointer event at the given pointer index and history index. Pointer events supported by this API contain only touch and mouse events. Position information can only be obtained from pointer events. For mouse events, this API returns the default value 0.0f if the given value of pointerIndex is greater than 0. Touch events are supported since API version 20, and mouse events are supported since API version 26.0.0.
float OH_ArkUI_PointerEvent_GetHistoryGlobalDisplayY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex) Obtains the Y-coordinate relative to the global display for a specific touch point in a historical event from a pointer event at the given pointer index and history index. Pointer events supported by this API contain only touch and mouse events. Position information can only be obtained from pointer events. For mouse events, this API returns the default value 0.0f if the given value of pointerIndex is greater than 0. Touch events are supported since API version 20, and mouse events are supported since API version 26.0.0.
float OH_ArkUI_PointerEvent_GetHistoryPressure(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex) Obtains the pressure applied to the touchscreen in a specific historical event from a pointer event (such as a touch event).
float OH_ArkUI_PointerEvent_GetHistoryTiltX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex) Obtains the angle relative to the YZ plane in a specific historical event from a pointer event (such as a touch event). The value range is [-90, 90], in deg. A positive value indicates a rightward tilt.
float OH_ArkUI_PointerEvent_GetHistoryTiltY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex) Obtains the angle relative to the XZ plane in a specific historical event from a pointer event (such as a touch event). The value range is [-90, 90], in deg. A positive value indicates a downward tilt.
float OH_ArkUI_PointerEvent_GetHistoryTouchAreaWidth(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex) Obtains the width of the touch area in a specific historical event from a pointer event (such as a touch event).
float OH_ArkUI_PointerEvent_GetHistoryTouchAreaHeight(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex) Obtains the height of the touch area in a specific historical event from a pointer event (such as a touch event).
double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent* event) Obtains the value of the vertical scroll axis for this axis event. This value is typically generated by mouse wheel scrolling or two-finger vertical swiping on a touchpad. If the value is generated by mouse wheel scrolling: 1. The reported value is in degrees and represents the angular increment of a single scroll, not the total accumulation. 2. The reported value includes the user's scroll step configuration (see OH_ArkUI_AxisEvent_GetScrollStep). 3. The sign of the value indicates the direction: positive for forward scrolling and negative for backward scrolling. If the value is generated by two-finger vertical swiping on a touchpad: 1. The reported value is in px and represents the scroll increment, not the total accumulation. 2. The reported value does not include the user's scroll step configuration OH_ArkUI_AxisEvent_GetScrollStep. 3. The sign of the value indicates the direction: positive for swiping up and negative for swiping down. 4. The direction is affected by the system settings for natural scrolling. Under normal circumstances, vertical scroll axis events only drive vertical swipe gestures. However, if the mouse pointer is over a scrollable area where the scrollable directions are consistent, the vertical scroll axis event can drive the swipe gestures in this scrollable area, even if they are defined as horizontal.
double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent* event) Obtains the value of the horizontal scroll axis for this axis event. This value is generated by two-finger horizontal swiping on a touchpad.
double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent* event) Obtains the scale value of the pinch axis for this axis event. This value is generated by a two-finger pinch gesture on a touchpad. The reported scale value is relative to the initial state when the system first detects the pinch gesture, with an initial scale value of 1.0. During the pinch operation, the scale value decreases from 1.0 towards 0.0 when the user pinches inward and increases from 1.0 when the user spreads fingers outward.
int32_t OH_ArkUI_AxisEvent_GetAxisAction(const ArkUI_UIInputEvent* event) Obtains the action type of this axis event.
int32_t OH_ArkUI_AxisEvent_HasAxis(const ArkUI_UIInputEvent* event, int32_t axis) Checks whether this axis event contains the specified axis type.
int32_t OH_ArkUI_PointerEvent_SetInterceptHitTestMode(const ArkUI_UIInputEvent* event, HitTestMode mode) Sets the touch test mode. This API only applies to scenarios raw input events are received, such as when NODE_ON_TOUCH is used for touch event handling. It cannot be used with ArkUI_UIInputEvent objects obtained from gesture events through OH_ArkUI_GestureEvent_GetRawInputEvent.
int32_t OH_ArkUI_MouseEvent_GetMouseButton(const ArkUI_UIInputEvent* event) Obtains the button type of a mouse event.
int32_t OH_ArkUI_MouseEvent_GetMouseAction(const ArkUI_UIInputEvent* event) Obtains the action type of a mouse event.
int32_t OH_ArkUI_PointerEvent_SetStopPropagation(const ArkUI_UIInputEvent* event, bool stopPropagation) Sets whether to stop event propagation. This API only applies to scenarios raw input events are received, such as when NODE_ON_TOUCH is used for touch event handling. It cannot be used with ArkUI_UIInputEvent objects obtained from gesture events through OH_ArkUI_GestureEvent_GetRawInputEvent.
int32_t OH_ArkUI_UIInputEvent_GetDeviceId(const ArkUI_UIInputEvent* event) Obtains the ID of the input device that triggers a key event.
int32_t OH_ArkUI_UIInputEvent_GetPressedKeys(const ArkUI_UIInputEvent* event, int32_t* pressedKeyCodes, int32_t* length) Obtains all pressed keys. Currently, only key events are supported.
double OH_ArkUI_FocusAxisEvent_GetAxisValue(const ArkUI_UIInputEvent* event, int32_t axis) Obtains the axis value of a focus axis event.
int32_t OH_ArkUI_FocusAxisEvent_SetStopPropagation(const ArkUI_UIInputEvent* event, bool stopPropagation) Sets whether to prevent a focus axis event from bubbling up.
int32_t OH_ArkUI_UIInputEvent_GetModifierKeyStates(const ArkUI_UIInputEvent* event, uint64_t* keys) Obtains the modifier key states for a UI input event. This API outputs the state of all modifier keys at the time of the event through the keys parameter. You can determine which keys are pressed by performing bitwise operations with the modifier key types defined in ArkUI_ModifierKeyName.
int32_t OH_ArkUI_AxisEvent_SetPropagation(const ArkUI_UIInputEvent* event, bool propagation) Sets whether to enable axis event propagation (bubbling). By default, axis events do not bubble and are only sent to the first component that can respond to axis events. You can enable axis event bubbling when an axis event is received to allow the event to be passed to the next ancestor component in the response chain that can handle axis events. This API cannot be used on axis events obtained from gesture events.
int32_t OH_ArkUI_AxisEvent_GetScrollStep(const ArkUI_UIInputEvent* event) Obtains the scroll step coefficient for a wheel-based axis event. This API returns the user-configured scroll scale factor.
float OH_ArkUI_UIInputEvent_GetEventTargetWidth(const ArkUI_UIInputEvent* event) Obtains the width of the component hit by an event.
float OH_ArkUI_UIInputEvent_GetEventTargetHeight(const ArkUI_UIInputEvent* event) Obtains the height of the component hit by an event.
float OH_ArkUI_UIInputEvent_GetEventTargetPositionX(const ArkUI_UIInputEvent* event) Obtains the x-coordinate of the component hit by an event.
float OH_ArkUI_UIInputEvent_GetEventTargetPositionY(const ArkUI_UIInputEvent* event) Obtains the y-coordinate of the component hit by an event.
float OH_ArkUI_UIInputEvent_GetEventTargetGlobalPositionX(const ArkUI_UIInputEvent* event) Obtains the global x-coordinate of the component hit by an event.
float OH_ArkUI_UIInputEvent_GetEventTargetGlobalPositionY(const ArkUI_UIInputEvent* event) Obtains the global y-coordinate of the component hit by an event.
int64_t OH_ArkUI_PointerEvent_GetPressedTimeByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex) Obtains the press time of a specific touch point. This API is effective only for touch events.
float OH_ArkUI_MouseEvent_GetRawDeltaX(const ArkUI_UIInputEvent* event) Obtains the movement delta of the mouse along the X axis in a two-dimensional plane. The value is the original movement data of the mouse hardware, which is expressed in the unit of the mouse movement distance in the physical world. The reported value is determined by the hardware, not the physical or logical pixels of the screen.
float OH_ArkUI_MouseEvent_GetRawDeltaY(const ArkUI_UIInputEvent* event) Obtains the movement delta of the mouse along the Y axis in a two-dimensional plane. The value is the original movement data of the mouse hardware, which is expressed in the unit of the mouse movement distance in the physical world. The reported value is determined by the hardware, not the physical or logical pixels of the screen.
int32_t OH_ArkUI_MouseEvent_GetPressedButtons(const ArkUI_UIInputEvent* event, int32_t* pressedButtons, int32_t* length) Obtains the pressed buttons from a mouse event.
int32_t OH_ArkUI_UIInputEvent_GetTargetDisplayId(const ArkUI_UIInputEvent* event) Obtains the ID of the screen where the UI input event occurs.
bool OH_ArkUI_HoverEvent_IsHovered(const ArkUI_UIInputEvent* event) Checks whether the cursor is hovering over this component.
int32_t OH_ArkUI_PointerEvent_CreateClonedEvent(const ArkUI_UIInputEvent* event, ArkUI_UIInputEvent** clonedEvent) Creates a cloned event pointer based on an event pointer. This API is effective only for touch events.
int32_t OH_ArkUI_PointerEvent_DestroyClonedEvent(const ArkUI_UIInputEvent* event) Destroys a cloned event pointer.
int32_t OH_ArkUI_PointerEvent_SetClonedEventLocalPosition(const ArkUI_UIInputEvent* event, float x, float y) Sets the x-coordinate and y-coordinate of a cloned event relative to the upper left corner of the current component.
int32_t OH_ArkUI_PointerEvent_SetClonedEventLocalPositionByIndex(const ArkUI_UIInputEvent* event, float x, float y, int32_t pointerIndex) Sets the x-coordinate and y-coordinate of a specific contact point of a cloned event relative to the upper left corner of the current component.
int32_t OH_ArkUI_PointerEvent_SetClonedEventActionType(const ArkUI_UIInputEvent* event, int32_t actionType) Sets the action type of a cloned event.
int32_t OH_ArkUI_PointerEvent_SetClonedEventChangedFingerId(const ArkUI_UIInputEvent* event, int32_t fingerId) Sets the touch point ID of a cloned pointer event.
int32_t OH_ArkUI_PointerEvent_SetClonedEventFingerIdByIndex(const ArkUI_UIInputEvent* event, int32_t fingerId, int32_t pointerIndex) Sets the touch point ID of a specific contact point of a cloned event.
int32_t OH_ArkUI_PointerEvent_PostClonedEvent(ArkUI_NodeHandle node, const ArkUI_UIInputEvent* event) Posts a cloned event to a specific node.
ArkUI_ErrorCode OH_ArkUI_PointerEvent_CreateClonedPointerEvent(const ArkUI_UIInputEvent* event, ArkUI_UIInputEvent** clonedEvent) Creates a clone event for a specified event. This API applies to touch, mouse, and axis events.
ArkUI_ErrorCode OH_ArkUI_PointerEvent_CreatePointerEvent(ArkUI_UIInputEvent** event, ArkUI_UIInputEvent_Type type) Creates a new event (not clone the existing event). This API applies to touch, mouse, and axis events.
ArkUI_ErrorCode OH_ArkUI_PointerEvent_DestroyClonedPointerEvent(const ArkUI_UIInputEvent* event) Destroys a cloned event pointer. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetActionType(const ArkUI_UIInputEvent* event, int32_t type) Sets an action type for a cloned event. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetSourceType(const ArkUI_UIInputEvent* event, int32_t sourceType) Sets a source type for a cloned event. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetToolType(const ArkUI_UIInputEvent* event, int32_t toolType) Sets a tool type for a cloned event. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetPressure(const ArkUI_UIInputEvent* event, float pressure) Sets the pressure applied to a touchscreen for a cloned event. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetPressureByIndex(const ArkUI_UIInputEvent* event, float pressure, int32_t pointerIndex) Sets the pressure applied to a touchscreen for a specific touch point in a cloned event. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetEventTime(const ArkUI_UIInputEvent* event, int64_t timestamp) Sets the time when a cloned UI input event occurs. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetDeviceId(const ArkUI_UIInputEvent* event, int32_t deviceId) Sets the ID of the device that triggers a cloned UI input event. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetTargetDisplayId(const ArkUI_UIInputEvent* event, int32_t targetDisplayId) Sets the ID of the display where a cloned UI input event occurs. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetChangedFingerId(const ArkUI_UIInputEvent* event, int32_t fingerId) Sets the touch point ID for a cloned pointer event. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetFingerIdByIndex(const ArkUI_UIInputEvent* event, int32_t fingerId, int32_t pointerIndex) Sets the touch point ID of a specific contact point for a cloned event. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetChangedWindowPosition(const ArkUI_UIInputEvent* event, float x, float y) Sets the X-coordinate and Y-coordinate of a cloned event relative to the upper left corner of the current window. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetWindowPositionByIndex(const ArkUI_UIInputEvent* event, float x, float y, int32_t pointerIndex) Sets the X-coordinate and Y-coordinate of a specific contact point of a cloned event relative to the upper left corner of the current window. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetChangedScreenPosition(const ArkUI_UIInputEvent* event, float x, float y) Sets the X-coordinate and Y-coordinate of a cloned event relative to the upper left corner of the current screen. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetScreenPositionByIndex(const ArkUI_UIInputEvent* event, float x, float y, int32_t pointerIndex) Sets the X-coordinate and Y-coordinate of a specific contact point of a cloned event relative to the upper left corner of the current screen. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetChangedGlobalDisplayPosition(const ArkUI_UIInputEvent* event, float x, float y) Sets the coordinates of a cloned event in the global coordinate system. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetGlobalDisplayPositionByIndex(const ArkUI_UIInputEvent* event, float x, float y, int32_t pointerIndex) Sets the coordinates of a cloned event in the global coordinate system. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetHandleId(const ArkUI_UIInputEvent* event, int32_t eventHandleId) Sets the unique handle of an event processing session. This handle must be used for any further operations on the event. For a given finger, only one event with this handle is in the active state at a time. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetTiltAngle(const ArkUI_UIInputEvent* event, float tiltX, float tiltY) Sets the tilt angle of a cloned event relative to the XZ and YZ planes. The value range is [-90, 90]. A positive value indicates a tilt to the right. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetRollAngle(const ArkUI_UIInputEvent* event, float rollAngle) Sets the rotation angle of the stylus around the Z-axis in a cloned event. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetPressedKeys(const ArkUI_UIInputEvent* event, int32_t* pressedKeyCodes, int32_t length) Sets all pressed keys in a cloned event. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetChangedTouchArea(const ArkUI_UIInputEvent* event, float width, float height) Sets the width and height of the finger contact area for a cloned event. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetTouchAreaByIndex(const ArkUI_UIInputEvent* event, float width, float height, int32_t pointerIndex) Sets the width and height of the finger contact area for a specific contact point of a cloned event. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetChangedInteractionHand(const ArkUI_UIInputEvent* event, int32_t hand) Sets whether a cloned event is triggered by the left or right hand. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetInteractionHandByIndex(const ArkUI_UIInputEvent* event, int32_t hand, int32_t pointerIndex) Sets whether a specific contact point of a cloned event is triggered by the left or right hand. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetPressedTimeByIndex(const ArkUI_UIInputEvent* event, int64_t pressedTime, int32_t pointerIndex) Sets the time when a specific touch point is pressed in a cloned event. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetPinchAxisScaleValue(const ArkUI_UIInputEvent* event, double pinchAxisScaleValue) Sets the pinch axis scaling value for a cloned event. This API applies to axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetHorizontalAxisScaleValue(const ArkUI_UIInputEvent* event, double horizontalAxisScaleValue) Sets the horizontal axis scaling value for a cloned event. This API applies to axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetVerticalAxisScaleValue(const ArkUI_UIInputEvent* event, double verticalAxisScaleValue) Sets the vertical axis scaling value for a cloned event. This API applies to axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetScrollStep(const ArkUI_UIInputEvent* event, int32_t scrollStep) Sets the scrolling step coefficient for a cloned event. This API applies to axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetMouseButton(const ArkUI_UIInputEvent* event, int32_t button) Sets a button type for a cloned event. This API applies to mouse events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetRawDeltaX(const ArkUI_UIInputEvent* event, float rawDeltaX) Sets the movement delta of the mouse along the x-axis in a two-dimensional plane. The value is the original movement data of the mouse hardware, which is expressed in the unit of the mouse movement distance in the physical world. This API applies to mouse events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetRawDeltaY(const ArkUI_UIInputEvent* event, float rawDeltaY) Sets the movement delta of the mouse along the y-axis in a two-dimensional plane. The value is the original movement data of the mouse hardware, which is expressed in the unit of the mouse movement distance in the physical world. This API applies to mouse events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetPressedButtons(const ArkUI_UIInputEvent* event, const int32_t* pressedButtons, int32_t length) Sets the pressed keys in a cloned event. This API applies to mouse events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_PointerEvent_PostClonedEventWithStrategy(ArkUI_NodeHandle node, const ArkUI_UIInputEvent* event, ArkUI_CompetitionStrategy strategy) Posts a cloned event to a specific node using a specified competition strategy. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.
ArkUI_ErrorCode OH_ArkUI_UIInputEvent_GetLatestStatus() Obtains the result code of the most recent API call related to an ArkUI_UIInputEvent object. This API is typically unnecessary for normal operations, but can be used to verify ambiguous return values
ArkUI_CoastingAxisEvent OH_ArkUI_UIInputEvent_GetCoastingAxisEvent(ArkUI_UIInputEvent* event) Obtains the pointer to a coasting axis event.
int64_t OH_ArkUI_CoastingAxisEvent_GetEventTime(ArkUI_CoastingAxisEvent event) Obtains the time when a coasting axis event occurs.
ArkUI_CoastingAxisEventPhase OH_ArkUI_CoastingAxisEvent_GetPhase(ArkUI_CoastingAxisEvent event) Obtains the scroll phase of the specified coasting axis event.
float OH_ArkUI_CoastingAxisEvent_GetDeltaY(ArkUI_CoastingAxisEvent event) Obtains the vertical delta value of the specified coasting axis event. Unit: px, representing the single scroll increment (not the total scroll amount). Negative values indicate a downward direction (fingers swiping from top to bottom), and positive values indicate an upward direction (fingers swiping from bottom to top).
float OH_ArkUI_CoastingAxisEvent_GetDeltaX(ArkUI_CoastingAxisEvent event) Obtains the horizontal delta value of the specified coasting axis event. Unit: px, representing the single scroll increment (not the total scroll amount). Positive values indicate a rightward direction (fingers swiping from right to left), and negative values indicate a leftward direction (fingers swiping from left to right).
int32_t OH_ArkUI_CoastingAxisEvent_SetPropagation(ArkUI_CoastingAxisEvent event, bool propagation) Sets whether to enable event propagation for the specified coasting axis event. By default, event propagation is disabled.
ArkUI_ErrorCode OH_ArkUI_TouchTestInfo_GetTouchTestInfoList(ArkUI_TouchTestInfo* info, ArkUI_TouchTestInfoItemArray* array, int32_t* size) Obtains the array of touch test information items from the touch test information.
float OH_ArkUI_TouchTestInfoItem_GetX(const ArkUI_TouchTestInfoItem* info) Obtains the X coordinate relative to the upper left corner of the child component from the touch test information item, in px.
float OH_ArkUI_TouchTestInfoItem_GetY(const ArkUI_TouchTestInfoItem* info) Obtains the Y coordinate relative to the upper left corner of the child component from the touch test information item, in px.
float OH_ArkUI_TouchTestInfoItem_GetWindowX(const ArkUI_TouchTestInfoItem* info) Obtains the X coordinate relative to the upper left corner of the current application window from the touch test information item, in px.
float OH_ArkUI_TouchTestInfoItem_GetWindowY(const ArkUI_TouchTestInfoItem* info) Obtains the Y coordinate relative to the upper left corner of the current application window from the touch test information item, in px.
float OH_ArkUI_TouchTestInfoItem_GetXRelativeToParent(const ArkUI_TouchTestInfoItem* info) Obtains the X coordinate relative to the upper left corner of the parent component from the touch test information item, in px.
float OH_ArkUI_TouchTestInfoItem_GetYRelativeToParent(const ArkUI_TouchTestInfoItem* info) Obtains the Y coordinate relative to the upper left corner of the parent component from the touch test information item, in px.
ArkUI_ErrorCode OH_ArkUI_TouchTestInfoItem_GetChildRect(const ArkUI_TouchTestInfoItem* info, ArkUI_Rect* childRect) Obtains the boundary rectangle information of the child component from the touch test information item.
ArkUI_ErrorCode OH_ArkUI_TouchTestInfoItem_GetChildId(const ArkUI_TouchTestInfoItem* info, char* buffer, int32_t bufferSize) Obtains the ID of the child component from the touch test information item.
ArkUI_ErrorCode OH_ArkUI_TouchTestInfo_SetTouchResultStrategy(ArkUI_TouchTestInfo* info, ArkUI_TouchTestStrategy strategy) Sets the touch test policy, that is, the behavior of a component and its child components in a hit test.
ArkUI_ErrorCode OH_ArkUI_TouchTestInfo_SetTouchResultId(ArkUI_TouchTestInfo* info, const char* id) Sets the ID of a child component involved in a hit test.

Enum Description

ArkUI_UIInputEvent_Type

enum ArkUI_UIInputEvent_Type

Description

Enumerates the UI input event types.

Since: 12

Value Description
ARKUI_UIINPUTEVENT_TYPE_UNKNOWN = 0 Unknown.
ARKUI_UIINPUTEVENT_TYPE_TOUCH = 1 Touch event.
ARKUI_UIINPUTEVENT_TYPE_AXIS = 2 Axis event.
ARKUI_UIINPUTEVENT_TYPE_MOUSE = 3 Mouse event.
ARKUI_UIINPUTEVENT_TYPE_KEY = 4 Key event.
Since: 20
ARKUI_UIINPUTEVENT_TYPE_DIGITAL_CROWN = 5 Crown event.
Since: 24

anonymous1

enum anonymous1

Description

Enumerates the action types of the input event.

Since: 12

Value Description
UI_TOUCH_EVENT_ACTION_CANCEL = 0 Cancellation of touch.
UI_TOUCH_EVENT_ACTION_DOWN = 1 Pressing of touch.
UI_TOUCH_EVENT_ACTION_MOVE = 2 Moving of touch.
UI_TOUCH_EVENT_ACTION_UP = 3 Lifting of touch.

anonymous2

enum anonymous2

Description

Enumerates the tool types of the input event.

Since: 12

Value Description
UI_INPUT_EVENT_TOOL_TYPE_UNKNOWN = 0 Unknown tool type.
UI_INPUT_EVENT_TOOL_TYPE_FINGER = 1 Finger.
UI_INPUT_EVENT_TOOL_TYPE_PEN = 2 Stylus.
UI_INPUT_EVENT_TOOL_TYPE_MOUSE = 3 Mouse.
UI_INPUT_EVENT_TOOL_TYPE_TOUCHPAD = 4 Touchpad.
UI_INPUT_EVENT_TOOL_TYPE_JOYSTICK = 5 Joystick.

anonymous3

enum anonymous3

Description

Enumerates the source types of the input event.

Since: 12

Value Description
UI_INPUT_EVENT_SOURCE_TYPE_UNKNOWN = 0 Unknown input source.
UI_INPUT_EVENT_SOURCE_TYPE_MOUSE = 1 Mouse.
UI_INPUT_EVENT_SOURCE_TYPE_TOUCH_SCREEN = 2 Touchscreen.
UI_INPUT_EVENT_SOURCE_TYPE_KEY = 4 Key.
Since: 22
UI_INPUT_EVENT_SOURCE_TYPE_JOYSTICK = 5 Joystick.
Since: 22

HitTestMode

enum HitTestMode

Description

Enumerates the hit test modes.

Since: 12

Value Description
HTM_DEFAULT = 0 Default hit test mode. The node itself and its child nodes respond to the hit test, but block the hit test of sibling nodes. It does not affect the hit test of ancestor nodes.
HTM_BLOCK = 1 The node itself responds to the hit test and blocks the hit test of child nodes, sibling nodes, and ancestor nodes.
HTM_TRANSPARENT = 2 Both the node itself and its child nodes respond to the hit test and do not block the hit test of sibling nodes and ancestor nodes.
HTM_NONE = 3 The node itself does not respond to the hit test and does not block the hit test of child nodes, sibling nodes, and ancestor nodes.
HTM_BLOCK_HIERARCHY = 4 The node itself and its child nodes respond to the hit test, preventing all sibling nodes and parent nodes with lower priority from participating in the hit test.
Since: 20
HTM_BLOCK_DESCENDANTS = 5 The node itself does not respond to the hit test, and all its descendants (children, grandchildren, and more) also do not respond to the hit test. It does not affect the hit test of ancestor nodes.
Since: 20

anonymous4

enum anonymous4

Description

Enumerates the action types of the mouse event.

Since: 12

Value Description
UI_MOUSE_EVENT_ACTION_UNKNOWN = 0 Unknown action.
UI_MOUSE_EVENT_ACTION_PRESS = 1 The mouse button is pressed.
UI_MOUSE_EVENT_ACTION_RELEASE = 2 The mouse button is released.
UI_MOUSE_EVENT_ACTION_MOVE = 3 The mouse cursor moves.
UI_MOUSE_EVENT_ACTION_CANCEL = 13 The mouse button action is canceled.
Since: 18

anonymous5

enum anonymous5

Description

Enumerates the button types of the mouse event.

Since: 12

Value Description
UI_MOUSE_EVENT_BUTTON_NONE = 0 No button.
UI_MOUSE_EVENT_BUTTON_LEFT = 1 Left button.
UI_MOUSE_EVENT_BUTTON_RIGHT = 2 Right button.
UI_MOUSE_EVENT_BUTTON_MIDDLE = 3 Middle button.
UI_MOUSE_EVENT_BUTTON_BACK = 4 Back button on the left of the mouse.
UI_MOUSE_EVENT_BUTTON_FORWARD = 5 Forward button on the left of the mouse.

ArkUI_ModifierKeyName

enum ArkUI_ModifierKeyName

Description

Enumerates the modifier keys.

Since: 12

Value Description
ARKUI_MODIFIER_KEY_CTRL = 1 << 0 Ctrl.
ARKUI_MODIFIER_KEY_SHIFT = 1 << 1 Shift.
ARKUI_MODIFIER_KEY_ALT = 1 << 2 Alt.
ARKUI_MODIFIER_KEY_FN = 1 << 3 Fn (for debugging purposes only; typically, the Fn key state is not reported)

anonymous6

enum anonymous6

Description

Defines the axis types of the focus axis event.

Since: 15

Value Description
UI_FOCUS_AXIS_EVENT_ABS_X = 0 Game controller X-axis.
UI_FOCUS_AXIS_EVENT_ABS_Y = 1 Game controller Y-axis.
UI_FOCUS_AXIS_EVENT_ABS_Z = 2 Game controller Z-axis.
UI_FOCUS_AXIS_EVENT_ABS_RZ = 3 Game controller RZ-axis.
UI_FOCUS_AXIS_EVENT_ABS_GAS = 4 Game controller GAS-axis.
UI_FOCUS_AXIS_EVENT_ABS_BRAKE = 5 Game controller BRAKE-axis.
UI_FOCUS_AXIS_EVENT_ABS_HAT0X = 6 Game controller HAT0X-axis.
UI_FOCUS_AXIS_EVENT_ABS_HAT0Y = 7 Game controller HAT0Y-axis.
UI_FOCUS_AXIS_EVENT_ABS_RX = 8 Game controller RX-axis.
Since: 23
UI_FOCUS_AXIS_EVENT_ABS_RY = 9 Game controller RY-axis.
Since: 23
UI_FOCUS_AXIS_EVENT_ABS_THROTTLE = 10 Game controller THROTTLE-axis.
Since: 23
UI_FOCUS_AXIS_EVENT_ABS_RUDDER = 11 Game controller RUDDER-axis.
Since: 23
UI_FOCUS_AXIS_EVENT_ABS_WHEEL = 12 Game controller WHEEL-axis.
Since: 23
UI_FOCUS_AXIS_EVENT_ABS_HAT1X = 13 Game controller HAT1X-axis.
Since: 23
UI_FOCUS_AXIS_EVENT_ABS_HAT1Y = 14 Game controller HAT1Y-axis.
Since: 23
UI_FOCUS_AXIS_EVENT_ABS_HAT2X = 15 Game controller HAT2X-axis.
Since: 23
UI_FOCUS_AXIS_EVENT_ABS_HAT2Y = 16 Game controller HAT2Y-axis.
Since: 23
UI_FOCUS_AXIS_EVENT_ABS_HAT3X = 17 Game controller HAT3X-axis.
Since: 23
UI_FOCUS_AXIS_EVENT_ABS_HAT3Y = 18 Game controller HAT3Y-axis.
Since: 23

ArkUI_InteractionHand

enum ArkUI_InteractionHand

Description

Defines whether the touch event is from the left or right hand.

Since: 15

Value Description
ARKUI_EVENT_HAND_NONE = 0 Unknown.
ARKUI_EVENT_HAND_LEFT = 1 Left hand.
ARKUI_EVENT_HAND_RIGHT = 2 Right hand.

anonymous7

enum anonymous7

Description

Defines the action types of the axis event.

Since: 15

Value Description
UI_AXIS_EVENT_ACTION_NONE = 0 The axis event is abnormal.
UI_AXIS_EVENT_ACTION_BEGIN = 1 The axis event begins.
UI_AXIS_EVENT_ACTION_UPDATE = 2 The axis event is updated.
UI_AXIS_EVENT_ACTION_END = 3 The axis event ends.
UI_AXIS_EVENT_ACTION_CANCEL = 4 The axis event is canceled.

anonymous8

enum anonymous8

Description

Enumerates the axis types for axis events.

Since: 22

Value Description
UI_AXIS_TYPE_VERTICAL_AXIS = 0 Vertical axis.
UI_AXIS_TYPE_HORIZONTAL_AXIS = 1 Horizontal axis.
UI_AXIS_TYPE_PINCH_AXIS = 2 Pinch axis.

ArkUI_CoastingAxisEventPhase

enum ArkUI_CoastingAxisEventPhase

Description

Enumerates the phases of coasting axis events.

Since: 22

Value Description
ARKUI_COASTING_AXIS_EVENT_PHASE_NONE = 0 Invalid coasting axis event phase, serving as an abnormal default value. You can verify that the coasting axis phase is not this value to confirm event validity.
ARKUI_COASTING_AXIS_EVENT_PHASE_BEGIN = 1 The coasting axis event begins. This is the initial event in the coasting phase.
ARKUI_COASTING_AXIS_EVENT_PHASE_UPDATE = 2 The coasting axis event updates. In this phase, you can obtain the coasting axis delta value to handle scroll offset calculations.
ARKUI_COASTING_AXIS_EVENT_PHASE_END = 3 The coasting axis event ends. This phase is triggered when coasting stops due to braking (for example, the user re-engages the touchpad during coasting, or interacts via a mouse or touchscreen) or natural decay to rest. Upon reaching this phase, immediately terminate the coasting scroll effect.

ArkUI_TouchTestStrategy

enum ArkUI_TouchTestStrategy

Description

Defines the touch test policy.

Since: 22

Value Description
ARKUI_TOUCH_TEST_STRATEGY_DEFAULT = 0 Custom dispatch has no effect. The system dispatches events based on the hit status of the current node.
ARKUI_TOUCH_TEST_STRATEGY_FORWARD_COMPETITION = 1 The event is dispatched to a specified child node, and the system determines whether to dispatch events to other sibling nodes.
ARKUI_TOUCH_TEST_STRATEGY_FORWARD = 2 The event is dispatched to a specified child node, and the system will not dispatch events to other sibling nodes.

ArkUI_CompetitionStrategy

enum ArkUI_CompetitionStrategy

Description

Strategy that determines whether the gesture identification result between the event injector and the injected end is in a competition scenario. This strategy determines how the event injector interacts with the gesture processing logic of the injected end. In non-competition scenarios, the gestures of the two parties are triggered simultaneously. In competition scenarios, only the gesture of one party is triggered.

Since: 24

Value Description
ARKUI_COMPETITION_STRATEGY_DEFAULT = 0 Non-competition strategy. The injected event does not compete with any existing gesture. The injected event and existing gestures can be processed independently and concurrently.
ARKUI_COMPETITION_STRATEGY_COMPETITION = 1 Competition strategy The gestures between the event injector and the injected end are in competition, and only the gestures of one party can be processed.

ArkUI_CrownEvent_Action

enum ArkUI_CrownEvent_Action

Description

Defines the phases of a crown event.

Since: 24

Value Description
ARKUI_CROWNEVENT_ACTION_UNKNOWN = 0 Unknown phase of the crown event.
ARKUI_CROWNEVENT_ACTION_UPDATE = 1 The crown event is updated.
ARKUI_CROWNEVENT_ACTION_END = 2 The crown event ends.

Function Description

OH_ArkUI_UIInputEvent_GetType()

int32_t OH_ArkUI_UIInputEvent_GetType(const ArkUI_UIInputEvent* event)

Description

Obtains the type of a UI input event. Before accessing an ArkUI_UIInputEvent pointer, use this API to determine the type of the input event. This API returns a value from the ArkUI_UIInputEvent_Type enum. It helps ensure compatibility with subsequent accessors. For example, if the event is a touch event, which is directional, you can use OH_ArkUI_UIInputEvent_GetXXX or OH_ArkUI_PointerEvent_GetXXX for access. Using OH_ArkUI_KeyEvent_GetXXX to access the event may produce undefined behavior. For unsupported event types, this API returns the default value 0.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
int32_t Type of the UI input event. Returns 0 if any parameter error occurs.

OH_ArkUI_UIInputEvent_GetAction()

int32_t OH_ArkUI_UIInputEvent_GetAction(const ArkUI_UIInputEvent* event)

Description

Obtains the action type of an input event. The action type defines the phase of a basic event (for example, start or end) and characterizes its behavior, such as touch down or touch up. Action types are specific to the event category: UI_TOUCH_EVENT_ACTION for touch events and UI_MOUSE_EVENT_ACTION for mouse events. For axis events, use OH_ArkUI_AxisEvent_GetAxisAction to obtain the action type, which returns UI_AXIS_EVENT_ACTION. For key events, use OH_ArkUI_KeyEvent_GetType to obtain the action type, which returns ArkUI_KeyEventType.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
int32_t Action type of the UI input event. Returns -1 if any parameter error occurs.

OH_ArkUI_UIInputEvent_GetSourceType()

int32_t OH_ArkUI_UIInputEvent_GetSourceType(const ArkUI_UIInputEvent* event)

Description

Obtains the source type of a UI input event. The source represents the physical device, such as a touchscreen or mouse device, that generates the input event. It is defined by UI_INPUT_EVENT_SOURCE_TYPE. This is different from the input tool, which is the device used to interact with the source, for example, a finger or stylus. However, in certain cases, the input source and the input tool can be the same. For example, a mouse device acts as both the source and tool for click events. For key events, obtaining the source type is not supported, and in such cases, the API will return an unknown value.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
int32_t Source type of the UI input event.

OH_ArkUI_UIInputEvent_GetToolType()

int32_t OH_ArkUI_UIInputEvent_GetToolType(const ArkUI_UIInputEvent* event)

Description

Obtains the tool type of a UI input event. The input tool is the device used to interact with the input source, such as a finger or stylus. These tools themselves do not generate events but can drive the input source device to continuously generate events. The returned type is defined by the enumerated value of UI_INPUT_EVENT_TOOL_TYPE. For key events, obtaining the tool type is not supported, and in such cases, the API will return an unknown value.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
int32_t Tool type of the UI input event.

OH_ArkUI_UIInputEvent_GetEventTime()

int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent* event)

Description

Obtains the time when a specified UI input event occurs. The unit is ns.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
int64_t Time when the UI input event occurs. Returns 0 if any parameter error occurs.

OH_ArkUI_PointerEvent_GetPointerCount()

uint32_t OH_ArkUI_PointerEvent_GetPointerCount(const ArkUI_UIInputEvent* event)

Description

Obtains the number of contact points from a pointer event (such as a touch, mouse, or axis event). Pointer events are typically events that carry position information, such as touch events, where the location of the event can be determined. Non-pointer events, such as key events, do not have position information and do not involve points, so this API always returns 0. For touch events, this API returns the number of active touch points, for example, fingers on the screen. For mouse and axis events, this API always returns 1, as they are single-pointer interactions.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
uint32_t Number of contact points in the pointer event.

OH_ArkUI_PointerEvent_GetPointerId()

int32_t OH_ArkUI_PointerEvent_GetPointerId(const ArkUI_UIInputEvent* event, uint32_t pointerIndex)

Description

Obtains the unique ID of a contact point from a pointer event (such as a touch, mouse, or axis event). The ID distinguishes between multiple touch points from the same input device. The return value itself does not have any other meaning beyond identifying the touch point.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
int32_t Unique ID of the specific contact point.

OH_ArkUI_PointerEvent_GetChangedPointerId()

int32_t OH_ArkUI_PointerEvent_GetChangedPointerId(const ArkUI_UIInputEvent* event, uint32_t* pointerIndex)

Description

Obtains the ID of the touch pointer that triggers the current touch event.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t* pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_PointerEvent_GetX()

float OH_ArkUI_PointerEvent_GetX(const ArkUI_UIInputEvent* event)

Description

Obtains the x-coordinate relative to the upper left corner of the current component from a pointer event (such as a touch, mouse, or axis event).

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
float X-coordinate relative to the upper left corner of the current component, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetXByIndex()

float OH_ArkUI_PointerEvent_GetXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex)

Description

Obtains the x-coordinate of a specific contact point relative to the upper left corner of the current component from a pointer event (such as a touch, mouse, or axis event). For mouse and axis events, this API returns the default value of 0.0f if the given index is greater than 0.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
float X-coordinate of the specific contact point relative to the upper left corner of the current component, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetY()

float OH_ArkUI_PointerEvent_GetY(const ArkUI_UIInputEvent* event)

Description

Obtains the y-coordinate relative to the upper left corner of the current component from a pointer event (such as a touch, mouse, or axis event).

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
float Y-coordinate relative to the upper left corner of the current component, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetYByIndex()

float OH_ArkUI_PointerEvent_GetYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex)

Description

Obtains the y-coordinate of a specific contact point relative to the upper left corner of the current component from a pointer event (such as a touch, mouse, or axis event). For mouse and axis events, this API returns the default value of 0.0f if the given index is greater than 0.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
float Y-coordinate of the specific contact point relative to the upper left corner of the current component, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetCurrentLocalX()

float OH_ArkUI_PointerEvent_GetCurrentLocalX(const ArkUI_UIInputEvent* event)

Description

Obtains the X coordinate relative to the upper left corner of the current component from a pointer event(such as a touch event, mouse event, or axis event) based on the real-time location.

Since: 26.0.0

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
float X coordinate of the current pointer event relative to the upper left corner of the current component. The default unit is px, which can vary according to the setting of setLengthMetricUnit. If a parameter error occurs, 0.0f is returned.

OH_ArkUI_PointerEvent_GetCurrentLocalXByIndex()

float OH_ArkUI_PointerEvent_GetCurrentLocalXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex)

Description

Obtains the X coordinate of a specific contact point relative to the upper left corner of the current component from a pointer event(such as a touch event, mouse event, or axis event) based on the real-time location.

For all types of events, an index value less than 0 is considered invalid.

For mouse and axis events, an index value other than 0 is considered invalid.

For touch events, this API is used to obtain the X coordinate of a specific contact point relative to the upper left corner of the current component based on the given index.

Since: 26.0.0

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
float X coordinate of the specific contact point relative to the upper left corner of the current component. The default unit is px, which can vary according to the setting of setLengthMetricUnit. If a parameter error occurs, 0.0f is returned.

OH_ArkUI_PointerEvent_GetCurrentLocalY()

float OH_ArkUI_PointerEvent_GetCurrentLocalY(const ArkUI_UIInputEvent* event)

Description

Obtains the Y coordinate relative to the upper left corner of the current component from a pointer event(such as a touch event, mouse event, or axis event) based on the real-time location.

Since: 26.0.0

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
float Y coordinate of the current pointer event relative to the upper left corner of the current component. The default unit is px, which can vary according to the setting of setLengthMetricUnit. If a parameter error occurs, 0.0f is returned.

OH_ArkUI_PointerEvent_GetCurrentLocalYByIndex()

float OH_ArkUI_PointerEvent_GetCurrentLocalYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex)

Description

Obtains the Y coordinate of a specific contact point relative to the upper left corner of the current component from a pointer event(such as a touch event, mouse event, or axis event) based on the real-time location.

For all types of events, an index value less than 0 is considered invalid.

For mouse and axis events, an index value other than 0 is considered invalid.

For touch events, this API is used to obtain the Y coordinate of a specific contact point relative to the upper left corner of the current component based on the given index.

Since: 26.0.0

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
float Y coordinate of the specific contact point relative to the upper left corner of the current component. The default unit is px, which can vary according to the setting of setLengthMetricUnit. If a parameter error occurs, 0.0f is returned.

OH_ArkUI_PointerEvent_GetWindowX()

float OH_ArkUI_PointerEvent_GetWindowX(const ArkUI_UIInputEvent* event)

Description

Obtains the x-coordinate relative to the upper left corner of the current application window from a pointer event (such as a touch, mouse, or axis event).

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
float X-coordinate relative to the upper left corner of the current application window, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetWindowXByIndex()

float OH_ArkUI_PointerEvent_GetWindowXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex)

Description

Obtains the x-coordinate of a specific contact point relative to the upper left corner of the current application window from a pointer event (such as a touch, mouse, or axis event). For mouse and axis events, this API returns the default value of 0.0f if the given index is greater than 0.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
float X-coordinate of the specific contact point relative to the upper left corner of the current application window, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetWindowY()

float OH_ArkUI_PointerEvent_GetWindowY(const ArkUI_UIInputEvent* event)

Description

Obtains the y-coordinate relative to the upper left corner of the current application window from a pointer event (such as a touch, mouse, or axis event).

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
float Y-coordinate relative to the upper left corner of the current application window, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetWindowYByIndex()

float OH_ArkUI_PointerEvent_GetWindowYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex)

Description

Obtains the y-coordinate of a specific contact point relative to the upper left corner of the current application window from a pointer event (such as a touch, mouse, or axis event). For mouse and axis events, this API returns the default value of 0.0f if the given index is greater than 0.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
float Y-coordinate of the specific contact point relative to the upper left corner of the current application window, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetDisplayX()

float OH_ArkUI_PointerEvent_GetDisplayX(const ArkUI_UIInputEvent* event)

Description

Obtains the x-coordinate relative to the upper left corner of the current screen from a pointer event (such as a touch, mouse, or axis event).

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
float X-coordinate relative to the upper left corner of the current screen, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetDisplayXByIndex()

float OH_ArkUI_PointerEvent_GetDisplayXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex)

Description

Obtains the x-coordinate of a specific contact point relative to the upper left corner of the current screen from a pointer event (such as a touch, mouse, or axis event). For mouse and axis events, this API returns the default value of 0.0f if the given index is greater than 0.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
float X-coordinate of the specific contact point relative to the upper left corner of the current screen, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetDisplayY()

float OH_ArkUI_PointerEvent_GetDisplayY(const ArkUI_UIInputEvent* event)

Description

Obtains the y-coordinate relative to the upper left corner of the current screen from a pointer event (such as a touch, mouse, or axis event).

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
float Y-coordinate relative to the upper left corner of the current screen, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetDisplayYByIndex()

float OH_ArkUI_PointerEvent_GetDisplayYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex)

Description

Obtains the y-coordinate of a specific contact point relative to the upper left corner of the current screen from a pointer event (such as a touch, mouse, or axis event). For mouse and axis events, this API returns the default value of 0.0f if the given index is greater than 0.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
float Y-coordinate of the specific contact point relative to the upper left corner of the current screen, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetGlobalDisplayX()

float OH_ArkUI_PointerEvent_GetGlobalDisplayX(const ArkUI_UIInputEvent* event)

Description

Obtains the x-coordinate relative to the global display from a pointer event (such as a touch, mouse, or axis event). The position information can be obtained only from a ArkUI_UIInputEvent event.

Since: 20

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
float X-coordinate relative to the global display, in px. 0.0f is returned if any parameter error occurs (for example, if the event does not contain position information).

OH_ArkUI_PointerEvent_GetGlobalDisplayXByIndex()

float OH_ArkUI_PointerEvent_GetGlobalDisplayXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex)

Description

Obtains the x-coordinate relative to the global display from a pointer event (such as a touch, mouse, or axis event). Position information can only be obtained from pointer events. For mouse and axis events, if the provided pointerIndex is greater than 0, this API always returns the default value 0.0f.

Since: 20

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list. Valid value range: [0, OH_ArkUI_PointerEvent_GetPointerCount() – 1]

Return value

Type Description
float X-coordinate of the specific contact point relative to the global display, in px. Returns 0.0f if any parameter error occurs.

OH_ArkUI_PointerEvent_GetGlobalDisplayY()

float OH_ArkUI_PointerEvent_GetGlobalDisplayY(const ArkUI_UIInputEvent* event)

Description

Obtains the y-coordinate relative to the global display from a pointer event (such as a touch, mouse, or axis event). The position information can be obtained only from a ArkUI_UIInputEvent event.

Since: 20

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
float Y-coordinate relative to the global display, in px. 0.0f is returned if any parameter error occurs (for example, if the event does not contain position information).

OH_ArkUI_PointerEvent_GetGlobalDisplayYByIndex()

float OH_ArkUI_PointerEvent_GetGlobalDisplayYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex)

Description

Obtains the y-coordinate relative to the global display from a pointer event (such as a touch, mouse, or axis event). Position information can only be obtained from pointer events. For mouse and axis events, if the provided pointerIndex is greater than 0, this API always returns the default value 0.0f.

Since: 20

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list. Valid value range: [0, OH_ArkUI_PointerEvent_GetPointerCount() – 1]

Return value

Type Description
float Y-coordinate relative to the global display, in px. Returns 0.0f if any parameter error occurs.

OH_ArkUI_PointerEvent_GetPressure()

float OH_ArkUI_PointerEvent_GetPressure(const ArkUI_UIInputEvent* event, uint32_t pointerIndex)

Description

Obtains the pressure applied to the touchscreen from a pointer event (such as a touch event).

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
float Touch pressure generated by the current pointer event. The value range is [0, 1]. The pressure is positively correlated with the value. If the parameter is abnormal, the default value 0.0f is returned. On some devices, the return value may be greater than 1 due to different hardware parameter configurations.

OH_ArkUI_PointerEvent_GetTiltX()

float OH_ArkUI_PointerEvent_GetTiltX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex)

Description

Obtains the angle relative to the YZ plane from a pointer event (for example, a touch event). The value range is [-90, 90], in deg. A positive value indicates a rightward tilt. This API is applicable only to stylus-based touch events from devices that support tilt angle reporting.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
float Angle relative to the YZ plane.

OH_ArkUI_PointerEvent_GetTiltY()

float OH_ArkUI_PointerEvent_GetTiltY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex)

Description

Obtains the angle relative to the XZ plane from a pointer event (for example, a touch event). The value range is [-90, 90], in deg. A positive value indicates a downward tilt. This API is applicable only to stylus-based touch events from devices that support tilt angle reporting.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
float Angle relative to the XZ plane.

OH_ArkUI_PointerEvent_GetRollAngle()

int32_t OH_ArkUI_PointerEvent_GetRollAngle(const ArkUI_UIInputEvent* event, double* rollAngle)

Description

Obtains the rotation angle of the stylus around the z-axis from a UI input event.

Since: 17

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the current UI input event.
double* rollAngle Rotation angle of the stylus around the z-axis, in deg.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_PointerEvent_GetTouchAreaWidth()

float OH_ArkUI_PointerEvent_GetTouchAreaWidth(const ArkUI_UIInputEvent* event, uint32_t pointerIndex)

Description

Obtains the width of the touch area for a pointer event. This API is applicable only to finger-based touch events, and the return value typically represents the radius of a circular touch area.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
float Width of the touch area, in px.

OH_ArkUI_PointerEvent_GetTouchAreaHeight()

float OH_ArkUI_PointerEvent_GetTouchAreaHeight(const ArkUI_UIInputEvent* event, uint32_t pointerIndex)

Description

Obtains the height of the touch area for a pointer event. This API is applicable only to finger-based touch events, and the return value typically represents the radius of a circular touch area.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
float Height of the touch area, in px.

OH_ArkUI_PointerEvent_GetInteractionHand()

int32_t OH_ArkUI_PointerEvent_GetInteractionHand(const ArkUI_UIInputEvent *event, ArkUI_InteractionHand *hand)

Description

Checks whether an event is triggered by a left-hand or right-hand tap. This API is only effective on some touch devices. The value is not available immediately upon press. Until the system infers the result, this API will return NONE. Do not rely on the return value for critical functionality.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent *event Pointer to the UI input event.
ArkUI_InteractionHand *hand Whether the touch point is from the left or right hand.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_PointerEvent_GetInteractionHandByIndex()

int32_t OH_ArkUI_PointerEvent_GetInteractionHandByIndex(const ArkUI_UIInputEvent *event, int32_t pointerIndex, ArkUI_InteractionHand *hand)

Description

Checks whether an event is triggered by a left-hand or right-hand tap. This API is only effective on some touch devices. The value is not available immediately upon press. Until the system infers the result, this API will return NONE. Do not rely on the return value for critical functionality.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent *event Pointer to the UI input event.
int32_t pointerIndex Index of the target touch point in the multi-touch data list.
ArkUI_InteractionHand *hand Whether the touch point is from the left or right hand.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_PointerEvent_GetHistorySize()

uint32_t OH_ArkUI_PointerEvent_GetHistorySize(const ArkUI_UIInputEvent* event)

Description

Obtains the number of historical events from a pointer event. Pointer events supported by this API contain only touch and mouse events. A historical event is the raw event that occurs between the current event and the previous event. This API is applicable only to the move phase (touch or mouse movement) of a pointer event. If this API is called in other states, the default value 0 is returned. Touch events are supported since API version 12, and mouse events are supported since API version 26.0.0.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
uint32_t Number of historical events.

OH_ArkUI_PointerEvent_GetHistoryEventTime()

int64_t OH_ArkUI_PointerEvent_GetHistoryEventTime(const ArkUI_UIInputEvent* event, uint32_t historyIndex)

Description

Obtains the occurrence time of a historical event from a pointer event. Pointer events supported by this API contain only touch and mouse events. Touch events are supported since API version 12, and mouse events are supported since API version 26.0.0.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t historyIndex Index of the target historical event.

Return value

Type Description
int64_t Time when the UI input event occurs, in ns. Returns 0 if a parameter error occurs.

OH_ArkUI_PointerEvent_GetHistoryPointerCount()

uint32_t OH_ArkUI_PointerEvent_GetHistoryPointerCount(const ArkUI_UIInputEvent* event, uint32_t historyIndex)

Description

Obtains the number of contact points in a specific historical event from a pointer event. Pointer events supported by this API contain only touch events.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t historyIndex Index of the target historical event.

Return value

Type Description
uint32_t Number of contact points in the specified historical event.

OH_ArkUI_PointerEvent_GetHistoryPointerId()

int32_t OH_ArkUI_PointerEvent_GetHistoryPointerId(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex)

Description

Obtains the unique ID of a contact point in a specific historical event from a pointer event. Pointer events supported by this API contain only touch events. The ID distinguishes between multiple touch points from the same input device. The return value itself does not have any other meaning beyond identifying the touch point.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.
uint32_t historyIndex Index of the target historical event.

Return value

Type Description
int32_t ID of the corresponding contact point in the specified historical event.

OH_ArkUI_PointerEvent_GetHistoryX()

float OH_ArkUI_PointerEvent_GetHistoryX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex)

Description

Obtains the X-coordinate of a specific contact point in a specific historical event relative to the upper left corner of the current component from a pointer event. Pointer events supported by this API contain only touch and mouse events. For mouse events, this API returns the default value 0.0f if the given value of pointerIndex is greater than 0. Touch events are supported since API version 12, and mouse events are supported since API version 26.0.0.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.
uint32_t historyIndex Index of the target historical event.

Return value

Type Description
float X-coordinate of the specific contact point in the specific historical event relative to the upper left corner of the current component, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetHistoryY()

float OH_ArkUI_PointerEvent_GetHistoryY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex)

Description

Obtains the Y-coordinate of a specific contact point in a specific historical event relative to the upper left corner of the current component from a pointer event. Pointer events supported by this API contain only touch and mouse events. For mouse events, this API returns the default value 0.0f if the given value of pointerIndex is greater than 0. Touch events are supported since API version 12, and mouse events are supported since API version 26.0.0.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.
uint32_t historyIndex Index of the target historical event.

Return value

Type Description
float Y-coordinate of the specific contact point in the specific historical event relative to the upper left corner of the current component, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetHistoryWindowX()

float OH_ArkUI_PointerEvent_GetHistoryWindowX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex)

Description

Obtains the X-coordinate of a specific contact point in a specific historical event relative to the upper left corner of the current application window from a pointer event. Pointer events supported by this API contain only touch and mouse events. For mouse events, this API returns the default value 0.0f if the given value of pointerIndex is greater than 0. Touch events are supported since API version 12, and mouse events are supported since API version 26.0.0.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.
uint32_t historyIndex Index of the target historical event.

Return value

Type Description
float X-coordinate of the specific contact point in the specific historical event relative to the upper left corner of the current application window, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetHistoryWindowY()

float OH_ArkUI_PointerEvent_GetHistoryWindowY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex)

Description

Obtains the Y-coordinate of a specific contact point in a specific historical event relative to the upper left corner of the current application window from a pointer event. Pointer events supported by this API contain only touch and mouse events. For mouse events, this API returns the default value 0.0f if the given value of pointerIndex is greater than 0. Touch events are supported since API version 12, and mouse events are supported since API version 26.0.0.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.
uint32_t historyIndex Index of the target historical event.

Return value

Type Description
float Y-coordinate of the specific contact point in the specific historical event relative to the upper left corner of the current application window, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetHistoryDisplayX()

float OH_ArkUI_PointerEvent_GetHistoryDisplayX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex)

Description

Obtains the X-coordinate of a specific contact point in a specific historical event relative to the upper left corner of the current screen from a pointer event. Pointer events supported by this API contain only touch and mouse events. For mouse events, this API returns the default value 0.0f if the given value of pointerIndex is greater than 0. Touch events are supported since API version 12, and mouse events are supported since API version 26.0.0.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.
uint32_t historyIndex Index of the target historical event.

Return value

Type Description
float X-coordinate of the specific contact point in the specific historical event relative to the upper left corner of the current screen, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetHistoryDisplayY()

float OH_ArkUI_PointerEvent_GetHistoryDisplayY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex)

Description

Obtains the Y-coordinate of a specific contact point in a specific historical event relative to the upper left corner of the current screen from a pointer event. Pointer events supported by this API contain only touch and mouse events. For mouse events, this API returns the default value 0.0f if the given value of pointerIndex is greater than 0. Touch events are supported since API version 12, and mouse events are supported since API version 26.0.0.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.
uint32_t historyIndex Index of the target historical event.

Return value

Type Description
float Y-coordinate of the specific contact point in the specific historical event relative to the upper left corner of the current screen, in px. Returns 0.0f if a parameter error occurs.

OH_ArkUI_PointerEvent_GetHistoryGlobalDisplayX()

float OH_ArkUI_PointerEvent_GetHistoryGlobalDisplayX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex)

Description

Obtains the X-coordinate relative to the global display for a specific touch point in a historical event from a pointer event at the given pointer index and history index. Pointer events supported by this API contain only touch and mouse events. Position information can only be obtained from pointer events. For mouse events, this API returns the default value 0.0f if the given value of pointerIndex is greater than 0. Touch events are supported since API version 20, and mouse events are supported since API version 26.0.0.

Since: 20

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list. Valid value range: [0, OH_ArkUI_PointerEvent_GetPointerCount() – 1]
uint32_t historyIndex Historical value to be returned. The value must be less than OH_ArkUI_PointerEvent_GetHistorySize.

Return value

Type Description
float X-coordinate of the specific contact point in the specific historical event relative to the global display, in px. Returns 0.0f if any parameter error occurs.

OH_ArkUI_PointerEvent_GetHistoryGlobalDisplayY()

float OH_ArkUI_PointerEvent_GetHistoryGlobalDisplayY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex)

Description

Obtains the Y-coordinate relative to the global display for a specific touch point in a historical event from a pointer event at the given pointer index and history index. Pointer events supported by this API contain only touch and mouse events. Position information can only be obtained from pointer events. For mouse events, this API returns the default value 0.0f if the given value of pointerIndex is greater than 0. Touch events are supported since API version 20, and mouse events are supported since API version 26.0.0.

Since: 20

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list. Valid value range: [0, OH_ArkUI_PointerEvent_GetPointerCount() – 1]
uint32_t historyIndex Historical value to be returned. The value must be less than OH_ArkUI_PointerEvent_GetHistorySize.

Return value

Type Description
float Y-coordinate of the specific contact point in the specific historical event relative to the global display, in px. Returns 0.0f if any parameter error occurs.

OH_ArkUI_PointerEvent_GetHistoryPressure()

float OH_ArkUI_PointerEvent_GetHistoryPressure(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex)

Description

Obtains the pressure applied to the touchscreen in a specific historical event from a pointer event (such as a touch event).

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.
uint32_t historyIndex Index of the target historical event.

Return value

Type Description
float Touch pressure generated by the current pointer event. The value range is [0, 1]. The pressure is positively correlated with the value. If the parameter is abnormal, the default value 0.0f is returned. On some devices, the return value may be greater than 1 due to different hardware parameter configurations.

OH_ArkUI_PointerEvent_GetHistoryTiltX()

float OH_ArkUI_PointerEvent_GetHistoryTiltX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex)

Description

Obtains the angle relative to the YZ plane in a specific historical event from a pointer event (such as a touch event). The value range is [-90, 90], in deg. A positive value indicates a rightward tilt.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.
uint32_t historyIndex Index of the target historical event.

Return value

Type Description
float Angle relative to the YZ plane.

OH_ArkUI_PointerEvent_GetHistoryTiltY()

float OH_ArkUI_PointerEvent_GetHistoryTiltY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex)

Description

Obtains the angle relative to the XZ plane in a specific historical event from a pointer event (such as a touch event). The value range is [-90, 90], in deg. A positive value indicates a downward tilt.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.
uint32_t historyIndex Index of the target historical event.

Return value

Type Description
float Angle relative to the XZ plane.

OH_ArkUI_PointerEvent_GetHistoryTouchAreaWidth()

float OH_ArkUI_PointerEvent_GetHistoryTouchAreaWidth(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex)

Description

Obtains the width of the touch area in a specific historical event from a pointer event (such as a touch event).

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.
uint32_t historyIndex Index of the target historical event.

Return value

Type Description
float Width of the touch area, in px.

OH_ArkUI_PointerEvent_GetHistoryTouchAreaHeight()

float OH_ArkUI_PointerEvent_GetHistoryTouchAreaHeight(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex)

Description

Obtains the height of the touch area in a specific historical event from a pointer event (such as a touch event).

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.
uint32_t historyIndex Index of the target historical event.

Return value

Type Description
float Height of the touch area, in px.

OH_ArkUI_AxisEvent_GetVerticalAxisValue()

double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent* event)

Description

Obtains the value of the vertical scroll axis for this axis event. This value is typically generated by mouse wheel scrolling or two-finger vertical swiping on a touchpad. If the value is generated by mouse wheel scrolling: 1. The reported value is in degrees and represents the angular increment of a single scroll, not the total accumulation. 2. The reported value includes the user's scroll step configuration (see OH_ArkUI_AxisEvent_GetScrollStep). 3. The sign of the value indicates the direction: positive for backward scrolling and negative for forward scrolling. If the value is generated by two-finger vertical swiping on a touchpad: 1. The reported value is in px and represents the scroll increment, not the total accumulation. 2. The reported value does not include the user's scroll step configuration OH_ArkUI_AxisEvent_GetScrollStep. 3. The sign of the value indicates the direction: positive for swiping up and negative for swiping down. 4. The direction is affected by the system settings for natural scrolling. Under normal circumstances, vertical scroll axis events only drive vertical swipe gestures. However, if the mouse pointer is over a scrollable area where the scrollable directions are consistent, the vertical scroll axis event can drive the swipe gestures in this scrollable area, even if they are defined as horizontal.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
double Value of the vertical scroll axis of the current axis event. Returns 0.0 if any parameter error occurs.

OH_ArkUI_AxisEvent_GetHorizontalAxisValue()

double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent* event)

Description

Obtains the value of the horizontal scroll axis for this axis event. This value is generated by two-finger horizontal swiping on a touchpad. Note: 1. The reported value is in px and represents the incremental scroll amount, not the total scroll amount. 2. The reported value does not include the user's scroll step configuration OH_ArkUI_AxisEvent_GetScrollStep. 3. The sign of the value indicates the direction: positive for swiping left and negative for swiping right. 4. The direction is affected by the system settings for natural scrolling.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
double Value of the horizontal scroll axis of the current axis event. Returns 0.0 if any parameter error occurs.

OH_ArkUI_AxisEvent_GetPinchAxisScaleValue()

double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent* event)

Description

Obtains the scale value of the pinch axis for this axis event. This value is generated by a two-finger pinch gesture on a touchpad. The reported scale value is relative to the initial state when the system first detects the pinch gesture, with an initial scale value of 1.0. During the pinch operation, the scale value decreases from 1.0 towards 0.0 when the user pinches inward and increases from 1.0 when the user spreads fingers outward.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
double Scale value of the pinch axis of the current axis event. Returns 0.0 if any parameter error occurs.

OH_ArkUI_AxisEvent_GetAxisAction()

int32_t OH_ArkUI_AxisEvent_GetAxisAction(const ArkUI_UIInputEvent* event)

Description

Obtains the action type of this axis event.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
int32_t Action type of the current axis event. For details, see anonymous7. If a non-axis event is input, 0 is returned by default.

OH_ArkUI_AxisEvent_HasAxis()

int32_t OH_ArkUI_AxisEvent_HasAxis(const ArkUI_UIInputEvent* event, int32_t axis)

Description

Checks whether this axis event contains the specified axis type.

Since: 22

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
int32_t axis Axis type of the axis event, specified using UI_AXIS_TYPE.

Return value

Type Description
int32_t Whether the current axis event contains the specified axis type. Returns true if the axis event contains the specified axis type, and false otherwise.

OH_ArkUI_PointerEvent_SetInterceptHitTestMode()

int32_t OH_ArkUI_PointerEvent_SetInterceptHitTestMode(const ArkUI_UIInputEvent* event, HitTestMode mode)

Description

Sets the touch test mode. This API only applies to scenarios raw input events are received, such as when NODE_ON_TOUCH is used for touch event handling. It cannot be used with ArkUI_UIInputEvent objects obtained from gesture events through OH_ArkUI_GestureEvent_GetRawInputEvent.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
HitTestMode mode Touch test mode. The parameter type is HitTestMode.

Return value

Type Description
int32_t Result code.

OH_ArkUI_MouseEvent_GetMouseButton()

int32_t OH_ArkUI_MouseEvent_GetMouseButton(const ArkUI_UIInputEvent* event)

Description

Obtains the button type of a mouse event.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
int32_t Mouse button type. The value is defined by the anonymous5 enumeration. If the API is called in a non-mouse event, the return value is -1.

OH_ArkUI_MouseEvent_GetMouseAction()

int32_t OH_ArkUI_MouseEvent_GetMouseAction(const ArkUI_UIInputEvent* event)

Description

Obtains the action type of a mouse event.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
int32_t Mouse action type. The value is defined by the anonymous4 enumeration. If the API is called in a non-mouse event, the return value is -1.

OH_ArkUI_PointerEvent_SetStopPropagation()

int32_t OH_ArkUI_PointerEvent_SetStopPropagation(const ArkUI_UIInputEvent* event, bool stopPropagation)

Description

Sets whether to stop event propagation. This API only applies to scenarios raw input events are received, such as when NODE_ON_TOUCH is used for touch event handling, and does not apply to axis events. It cannot be used with ArkUI_UIInputEvent objects obtained from gesture events through OH_ArkUI_GestureEvent_GetRawInputEvent.

Since: 12

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
bool stopPropagation Whether to stop event propagation. The value true means to stop event propagation, and false means the opposite.

Return value

Type Description
int32_t Result code. Returns 0 if the operation is successful; returns 401 if the operation fails, possibly because a parameter error, for example, null pointer for the event parameter, occurs.

OH_ArkUI_UIInputEvent_GetDeviceId()

int32_t OH_ArkUI_UIInputEvent_GetDeviceId(const ArkUI_UIInputEvent* event)

Description

Obtains the device ID of the current UI input event.

Since: 14

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.

Return value

Type Description
int32_t Device ID of the current UI input event.

OH_ArkUI_UIInputEvent_GetPressedKeys()

int32_t OH_ArkUI_UIInputEvent_GetPressedKeys(const ArkUI_UIInputEvent* event, int32_t* pressedKeyCodes, int32_t* length)

Description

Obtains all pressed keys. Currently, only key events are supported.

Since: 14

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t* pressedKeyCodes Array of all pressed keys. The caller is responsible for allocating the memory space to which the array points.
int32_t* length Dual-purpose parameter: As input, it indicates the length of the provided pressedKeyCodes array; as output, it indicates the number of pressed keys.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_BUFFER_SIZE_NOT_ENOUGH if the memory is insufficient.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_FocusAxisEvent_GetAxisValue()

double OH_ArkUI_FocusAxisEvent_GetAxisValue(const ArkUI_UIInputEvent* event, int32_t axis)

Description

Obtains the axis value of a focus axis event.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t axis Axis type of the focus axis event. For details, see anonymous6.

Return value

Type Description
double Axis value of the focus axis event. Returns 0.0 if any parameter error occurs.

OH_ArkUI_FocusAxisEvent_SetStopPropagation()

int32_t OH_ArkUI_FocusAxisEvent_SetStopPropagation(const ArkUI_UIInputEvent* event, bool stopPropagation)

Description

Sets whether to prevent a focus axis event from bubbling up.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
bool stopPropagation Whether to stop event propagation. The value true means to stop event propagation, and false means the opposite.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_UIInputEvent_GetModifierKeyStates()

int32_t OH_ArkUI_UIInputEvent_GetModifierKeyStates(const ArkUI_UIInputEvent* event, uint64_t* keys)

Description

Obtains the modifier key states for a UI input event. This API outputs the state of all modifier keys at the time of the event through the keys parameter. You can determine which keys are pressed by performing bitwise operations with the modifier key types defined in ArkUI_ModifierKeyName.

Since: 17

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
uint64_t* keys Pointer to the combination of pressed modifier keys. The application can use bitwise operations to determine which keys are pressed.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_AxisEvent_SetPropagation()

int32_t OH_ArkUI_AxisEvent_SetPropagation(const ArkUI_UIInputEvent* event, bool propagation)

Description

Sets whether to enable axis event propagation (bubbling). By default, axis events do not bubble and are only sent to the first component that can respond to axis events. You can enable axis event bubbling when an axis event is received to allow the event to be passed to the next ancestor component in the response chain that can handle axis events. This API cannot be used on axis events obtained from gesture events.

Since: 17

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
bool propagation Whether to enable event propagation. The value true means to enable event propagation, and false means the opposite.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_AxisEvent_GetScrollStep()

int32_t OH_ArkUI_AxisEvent_GetScrollStep(const ArkUI_UIInputEvent* event)

Description

Obtains the scroll step coefficient for a wheel-based axis event. This API returns the user-configured scroll scale factor.

Since: 17

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the ArkUI_UIInputEvent object.

Return value

Type Description
int32_t Scroll step configuration of the mouse wheel axis event. For non-mouse events, the default value 0 is returned.

OH_ArkUI_UIInputEvent_GetEventTargetWidth()

float OH_ArkUI_UIInputEvent_GetEventTargetWidth(const ArkUI_UIInputEvent* event)

Description

Obtains the width of the component hit by an event.

Since: 17

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the ArkUI_UIInputEvent object.

Return value

Type Description
float Width of the component hit by an event, in pixels. If any parameter error occurs, 0.0f is returned.

OH_ArkUI_UIInputEvent_GetEventTargetHeight()

float OH_ArkUI_UIInputEvent_GetEventTargetHeight(const ArkUI_UIInputEvent* event)

Description

Obtains the height of the component hit by an event.

Since: 17

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the ArkUI_UIInputEvent object.

Return value

Type Description
float Height of the component hit by an event, in pixels. If any parameter error occurs, 0.0f is returned.

OH_ArkUI_UIInputEvent_GetEventTargetPositionX()

float OH_ArkUI_UIInputEvent_GetEventTargetPositionX(const ArkUI_UIInputEvent* event)

Description

Obtains the x-coordinate of the component hit by an event.

Since: 17

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the ArkUI_UIInputEvent object.

Return value

Type Description
float X-coordinate of the component hit by an event, in pixels. If any parameter error occurs, 0.0f is returned.

OH_ArkUI_UIInputEvent_GetEventTargetPositionY()

float OH_ArkUI_UIInputEvent_GetEventTargetPositionY(const ArkUI_UIInputEvent* event)

Description

Obtains the y-coordinate of the component hit by an event.

Since: 17

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the ArkUI_UIInputEvent object.

Return value

Type Description
float Y-coordinate of the component hit by an event, in pixels. If any parameter error occurs, 0.0f is returned.

OH_ArkUI_UIInputEvent_GetEventTargetGlobalPositionX()

float OH_ArkUI_UIInputEvent_GetEventTargetGlobalPositionX(const ArkUI_UIInputEvent* event)

Description

Obtains the global x-coordinate of the component hit by an event.

Since: 17

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the ArkUI_UIInputEvent object.

Return value

Type Description
float Global x-coordinate of the component hit by an event, in pixels. If any parameter error occurs, 0.0f is returned.

OH_ArkUI_UIInputEvent_GetEventTargetGlobalPositionY()

float OH_ArkUI_UIInputEvent_GetEventTargetGlobalPositionY(const ArkUI_UIInputEvent* event)

Description

Obtains the global y-coordinate of the component hit by an event.

Since: 17

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the ArkUI_UIInputEvent object.

Return value

Type Description
float Global y-coordinate of the component hit by an event, in pixels. If any parameter error occurs, 0.0f is returned.

OH_ArkUI_PointerEvent_GetPressedTimeByIndex()

int64_t OH_ArkUI_PointerEvent_GetPressedTimeByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex)

Description

Obtains the press time of a specific touch point. This API is effective only for touch events.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
uint32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
int64_t Press time of the specific touch point, in ns. Returns 0 if any parameter error occurs.

OH_ArkUI_MouseEvent_GetRawDeltaX()

float OH_ArkUI_MouseEvent_GetRawDeltaX(const ArkUI_UIInputEvent* event)

Description

Obtains the movement delta of the mouse along the X axis in a two-dimensional plane. The value is the original movement data of the mouse hardware, which is expressed in the unit of the mouse movement distance in the physical world. The reported value is determined by the hardware, not the physical or logical pixels of the screen.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.

Return value

Type Description
float Movement delta of the mouse device along the X axis in the two-dimensional plane, which is expressed in the unit of the mouse movement distance in the physical world. If any parameter error occurs, 0.0f is returned.
Note: In versions earlier than API version 26.0.0, the return value is not the original movement data of the mouse hardware. Instead, the original data is scaled down by a factor of X, where X is the system display size rate. Since API version 26.0.0, the return value is the original movement data of the mouse hardware.

OH_ArkUI_MouseEvent_GetRawDeltaY()

float OH_ArkUI_MouseEvent_GetRawDeltaY(const ArkUI_UIInputEvent* event)

Description

Obtains the movement delta of the mouse along the Y axis in a two-dimensional plane. The value is the original movement data of the mouse hardware, which is expressed in the unit of the mouse movement distance in the physical world. The reported value is determined by the hardware, not the physical or logical pixels of the screen.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.

Return value

Type Description
float Movement delta of the mouse device along the Y axis in the two-dimensional plane, which is expressed in the unit of the mouse movement distance in the physical world. If any parameter error occurs, 0.0f is returned.
Note: In versions earlier than API version 26.0.0, the return value is not the original movement data of the mouse hardware. Instead, the original data is scaled down by a factor of X, where X is the system display size rate. Since API version 26.0.0, the return value is the original movement data of the mouse hardware.

OH_ArkUI_MouseEvent_GetPressedButtons()

int32_t OH_ArkUI_MouseEvent_GetPressedButtons(const ArkUI_UIInputEvent* event, int32_t* pressedButtons, int32_t* length)

Description

Obtains the pressed buttons from a mouse event.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t* pressedButtons Array of the pressed buttons. Create an integer array to store the button values. For button code definitions, see anonymous5.
int32_t* length Total length of the array.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR if the input buffer size is invalid.

OH_ArkUI_UIInputEvent_GetTargetDisplayId()

int32_t OH_ArkUI_UIInputEvent_GetTargetDisplayId(const ArkUI_UIInputEvent* event)

Description

Obtains the ID of the screen where the UI input event occurs.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.

Return value

Type Description
int32_t Screen ID. Returns 0 if any parameter error occurs.

OH_ArkUI_HoverEvent_IsHovered()

bool OH_ArkUI_HoverEvent_IsHovered(const ArkUI_UIInputEvent* event)

Description

Checks whether the cursor is hovering over this component.

Since: 17

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.

Return value

Type Description
bool Returns true if the cursor is hovering over the current component.
Returns false if the cursor is not hovering over the current component.

OH_ArkUI_PointerEvent_CreateClonedEvent()

int32_t OH_ArkUI_PointerEvent_CreateClonedEvent(const ArkUI_UIInputEvent* event, ArkUI_UIInputEvent** clonedEvent)

Description

Creates a cloned event pointer based on an event pointer. This API is effective only for touch events.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
ArkUI_UIInputEvent** clonedEvent Pointer to the target ArkUI_UIInputEvent object.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_PointerEvent_DestroyClonedEvent()

int32_t OH_ArkUI_PointerEvent_DestroyClonedEvent(const ArkUI_UIInputEvent* event)

Description

Destroys a cloned event pointer.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_PointerEvent_SetClonedEventLocalPosition()

int32_t OH_ArkUI_PointerEvent_SetClonedEventLocalPosition(const ArkUI_UIInputEvent* event, float x, float y)

Description

Sets the x-coordinate and y-coordinate of a cloned event relative to the upper left corner of the current component.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
float x X-coordinate relative to the upper left corner of the current component, in px.
float y Y-coordinate relative to the upper left corner of the current component, in px.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_PointerEvent_SetClonedEventLocalPositionByIndex()

int32_t OH_ArkUI_PointerEvent_SetClonedEventLocalPositionByIndex(const ArkUI_UIInputEvent* event, float x, float y, int32_t pointerIndex)

Description

Sets the x-coordinate and y-coordinate of a specific contact point of a cloned event relative to the upper left corner of the current component.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
float x X-coordinate relative to the upper left corner of the current component, in px.
float y Y-coordinate relative to the upper left corner of the current component, in px.
int32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_PointerEvent_SetClonedEventActionType()

int32_t OH_ArkUI_PointerEvent_SetClonedEventActionType(const ArkUI_UIInputEvent* event, int32_t actionType)

Description

Sets the action type of a cloned event.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t actionType Action type of the cloned event.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_PointerEvent_SetClonedEventChangedFingerId()

int32_t OH_ArkUI_PointerEvent_SetClonedEventChangedFingerId(const ArkUI_UIInputEvent* event, int32_t fingerId)

Description

Sets the touch point ID of a cloned pointer event.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t fingerId ID of the touch point that triggers the event.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_PointerEvent_SetClonedEventFingerIdByIndex()

int32_t OH_ArkUI_PointerEvent_SetClonedEventFingerIdByIndex(const ArkUI_UIInputEvent* event, int32_t fingerId, int32_t pointerIndex)

Description

Sets the touch point ID of a specific contact point of a cloned event.

Since: 15

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t fingerId Touch point ID of the specific contact point.
int32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_PointerEvent_PostClonedEvent()

int32_t OH_ArkUI_PointerEvent_PostClonedEvent(ArkUI_NodeHandle node, const ArkUI_UIInputEvent* event)

Description

Posts a cloned event to a specific node.

Since: 15

Parameters

Name Description
ArkUI_NodeHandle node Target node.
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_CODE_POST_CLONED_COMPONENT_STATUS_ABNORMAL if the component status is abnormal.
Returns ARKUI_ERROR_CODE_POST_CLONED_NO_COMPONENT_HIT_TO_RESPOND_TO_THE_EVENT if no component is hit to respond to the event.

OH_ArkUI_PointerEvent_CreateClonedPointerEvent()

ArkUI_ErrorCode OH_ArkUI_PointerEvent_CreateClonedPointerEvent(const ArkUI_UIInputEvent* event, ArkUI_UIInputEvent** clonedEvent)

Description

Creates a clone event for a specified event. This API applies to touch, mouse, and axis events.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
ArkUI_UIInputEvent** clonedEvent Pointer to the target ArkUI_UIInputEvent object.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_PointerEvent_CreatePointerEvent()

ArkUI_ErrorCode OH_ArkUI_PointerEvent_CreatePointerEvent(ArkUI_UIInputEvent** event, ArkUI_UIInputEvent_Type type)

Description

Creates a new event (not clone the existing event). This API applies to touch, mouse, and axis events.

Since: 24

Parameters

Name Description
ArkUI_UIInputEvent** event Double pointer to the new ArkUI_UIInputEvent object.
ArkUI_UIInputEvent_Type type Event type of ArkUI_UIInputEvent. The value can be ARKUI_UIINPUTEVENT_TYPE_TOUCH, ARKUI_UIINPUTEVENT_TYPE_AXIS, or ARKUI_UIINPUTEVENT_TYPE_MOUSE.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_PointerEvent_DestroyClonedPointerEvent()

ArkUI_ErrorCode OH_ArkUI_PointerEvent_DestroyClonedPointerEvent(const ArkUI_UIInputEvent* event)

Description

Destroys a cloned event pointer. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_ClonedEvent_SetActionType()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetActionType(const ArkUI_UIInputEvent* event, int32_t type)

Description

Sets an action type for a cloned event. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t type Type of the cloned event, including UI_TOUCH_EVENT_ACTION for the touch event, UI_MOUSE_EVENT_ACTION for the mouse event, and UI_AXIS_EVENT_ACTION for the axis event.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_ClonedEvent_SetSourceType()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetSourceType(const ArkUI_UIInputEvent* event, int32_t sourceType)

Description

Sets a source type for a cloned event. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t sourceType Source type of the clone event. The value is an integer within the range of [0,5]. The value 0 indicates unknown, 1 indicates the mouse, 2 indicates the touchscreen, 4 indicates the keyboard, and 5 indicates the handle control.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_ClonedEvent_SetToolType()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetToolType(const ArkUI_UIInputEvent* event, int32_t toolType)

Description

Sets a tool type for a cloned event. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t toolType Tool type of the cloned event. The value is defined in the UI_INPUT_EVENT_TOOL_TYPE enumeration.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_ClonedEvent_SetPressure()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetPressure(const ArkUI_UIInputEvent* event, float pressure)

Description

Sets the pressure applied to a touchscreen for a cloned event. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
float pressure Pressure applied to the touchscreen. The value range is [0,1]. For some devices, the value may be greater than 1.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetPressureByIndex()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetPressureByIndex(const ArkUI_UIInputEvent* event, float pressure, int32_t pointerIndex)

Description

Sets the pressure applied to a touchscreen for a specific touch point in a cloned event. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
float pressure Pressure applied to the touchscreen. The value range is [0,1]. For some devices, the value may be greater than 1.
int32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetEventTime()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetEventTime(const ArkUI_UIInputEvent* event, int64_t timestamp)

Description

Sets the time when a cloned UI input event occurs. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int64_t timestamp Time when the cloned UI input event occurs, in ns.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_ClonedEvent_SetDeviceId()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetDeviceId(const ArkUI_UIInputEvent* event, int32_t deviceId)

Description

Sets the ID of the device that triggers a cloned UI input event. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t deviceId ID of the device that triggers the cloned UI input event, which can be obtained by calling OH_ArkUI_UIInputEvent_GetDeviceId.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_ClonedEvent_SetTargetDisplayId()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetTargetDisplayId(const ArkUI_UIInputEvent* event, int32_t targetDisplayId)

Description

Sets the ID of the display where a cloned UI input event occurs. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t targetDisplayId ID of the display where the cloned UI input event occurs, which can be obtained by calling OH_ArkUI_UIInputEvent_GetTargetDisplayId.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_ClonedEvent_SetChangedFingerId()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetChangedFingerId(const ArkUI_UIInputEvent* event, int32_t fingerId)

Description

Sets the touch point ID for a cloned pointer event. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t fingerId ID of the touch point that triggers the event, which can be obtained by calling OH_ArkUI_PointerEvent_GetPointerId.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetFingerIdByIndex()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetFingerIdByIndex(const ArkUI_UIInputEvent* event, int32_t fingerId, int32_t pointerIndex)

Description

Sets the touch point ID of a specific contact point in a cloned event. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t fingerId Touch point ID of the specific contact point, which can be obtained by calling OH_ArkUI_PointerEvent_GetChangedPointerId.
int32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetChangedWindowPosition()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetChangedWindowPosition(const ArkUI_UIInputEvent* event, float x, float y)

Description

Sets the X-coordinate and Y-coordinate of a cloned event relative to the upper left corner of the current window. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
float x X-coordinate of the event relative to the upper left corner of the current window, in px.
float y Y-coordinate of the event relative to the upper left corner of the current window, in px.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_ClonedEvent_SetWindowPositionByIndex()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetWindowPositionByIndex(const ArkUI_UIInputEvent* event, float x, float y, int32_t pointerIndex)

Description

Sets the X-coordinate and Y-coordinate of a specific contact point of a cloned event relative to the upper left corner of the current window. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
float x X-coordinate of the event relative to the upper left corner of the current window, in px.
float y Y-coordinate of the event relative to the upper left corner of the current window, in px.
int32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetChangedScreenPosition()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetChangedScreenPosition(const ArkUI_UIInputEvent* event, float x, float y)

Description

Sets the X-coordinate and Y-coordinate of a cloned event relative to the upper left corner of the current screen. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
float x X-coordinate of the event relative to the upper left corner of the current screen, in px.
float y Y-coordinate of the event relative to the upper left corner of the current screen, in px.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_ClonedEvent_SetScreenPositionByIndex()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetScreenPositionByIndex(const ArkUI_UIInputEvent* event, float x, float y, int32_t pointerIndex)

Description

Sets the X-coordinate and Y-coordinate of a specific contact point of a cloned event relative to the upper left corner of the current screen. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
float x X-coordinate of the event relative to the upper left corner of the current screen, in px.
float y Y-coordinate of the event relative to the upper left corner of the current screen, in px.
int32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetChangedGlobalDisplayPosition()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetChangedGlobalDisplayPosition(const ArkUI_UIInputEvent* event, float x, float y)

Description

Sets the coordinates of a cloned event in the global coordinate system. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
float x X-coordinate of the event relative to the global display, in px.
float y Y-coordinate of the event relative to the global display, in px.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_ClonedEvent_SetGlobalDisplayPositionByIndex()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetGlobalDisplayPositionByIndex(const ArkUI_UIInputEvent* event, float x, float y, int32_t pointerIndex)

Description

Sets the coordinates of a cloned event in the global coordinate system. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
float x X-coordinate of the event relative to the global display, in px.
float y Y-coordinate of the event relative to the global display, in px.
int32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetHandleId()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetHandleId(const ArkUI_UIInputEvent* event, int32_t eventHandleId)

Description

Sets the unique handle of an event processing session. This handle must be used for any further operations on the event. For a given finger, only one event with this handle is in the active state at a time. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t eventHandleId Unique handle of an event processing session.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_ClonedEvent_SetTiltAngle()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetTiltAngle(const ArkUI_UIInputEvent* event, float tiltX, float tiltY)

Description

Sets the tilt angle of a cloned event relative to the XZ and YZ planes. The value range is [-90, 90]. A positive value indicates a tilt to the right. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
float tiltX Tilt angle of the cloned event relative to the YZ plane, in deg.
float tiltY Tilt angle of the cloned event relative to the XZ plane, in deg.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetRollAngle()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetRollAngle(const ArkUI_UIInputEvent* event, float rollAngle)

Description

Sets the rotation angle of the stylus around the Z-axis in a cloned event. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
float rollAngle Rotation angle of the stylus around the Z-axis in the cloned event, in deg.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetPressedKeys()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetPressedKeys(const ArkUI_UIInputEvent* event, int32_t* pressedKeyCodes, int32_t length)

Description

Sets all pressed keys in a cloned event. This API applies to touch, mouse, and axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t* pressedKeyCodes Array of all pressed key values. The value is ArkUI_KeyCode.
int32_t length Length of the array of the pressed keys.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.

OH_ArkUI_ClonedEvent_SetChangedTouchArea()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetChangedTouchArea(const ArkUI_UIInputEvent* event, float width, float height)

Description

Sets the width and height of the finger contact area for a cloned event. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
float width Width of the touch area of the cloned event, in px.
float height Height of the touch area of the cloned event, in px.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetTouchAreaByIndex()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetTouchAreaByIndex(const ArkUI_UIInputEvent* event, float width, float height, int32_t pointerIndex)

Description

Sets the width and height of the finger contact area for a specific contact point of a cloned event. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
float width Width of the touch area of the cloned event, in px.
float height Height of the touch area of the cloned event, in px.
int32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetChangedInteractionHand()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetChangedInteractionHand(const ArkUI_UIInputEvent* event, int32_t hand)

Description

Sets whether a cloned event is triggered by the left or right hand. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t hand Whether the touch point is on the left or right hand. ARKUI_EVENT_HAND_LEFT indicates the left hand, and ARKUI_EVENT_HAND_RIGHT indicates the right hand.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetInteractionHandByIndex()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetInteractionHandByIndex(const ArkUI_UIInputEvent* event, int32_t hand, int32_t pointerIndex)

Description

Sets whether a specific contact point of a cloned event is triggered by the left or right hand. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t hand Whether the touch point is on the left or right hand. ARKUI_EVENT_HAND_LEFT indicates the left hand, and ARKUI_EVENT_HAND_RIGHT indicates the right hand.
int32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetPressedTimeByIndex()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetPressedTimeByIndex(const ArkUI_UIInputEvent* event, int64_t pressedTime, int32_t pointerIndex)

Description

Sets the time when a specific touch point is pressed in a cloned event. This API applies to touch events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int64_t pressedTime Time when the specific touch point, in ns.
int32_t pointerIndex Index of the target touch point in the multi-touch data list.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetPinchAxisScaleValue()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetPinchAxisScaleValue(const ArkUI_UIInputEvent* event, double pinchAxisScaleValue)

Description

Sets the pinch axis scaling value for a cloned event. This API applies to axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
double pinchAxisScaleValue Scaling value of the pinch axis, in vp. The value range is [0, +∞).

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetHorizontalAxisScaleValue()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetHorizontalAxisScaleValue(const ArkUI_UIInputEvent* event, double horizontalAxisScaleValue)

Description

Sets the horizontal axis scaling value for a cloned event. This API applies to axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
double horizontalAxisScaleValue Horizontal axis scaling value, in vp.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetVerticalAxisScaleValue()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetVerticalAxisScaleValue(const ArkUI_UIInputEvent* event, double verticalAxisScaleValue)

Description

Sets the vertical axis scaling value for a cloned event. This API applies to axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
double verticalAxisScaleValue Vertical axis scaling value, in vp.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetScrollStep()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetScrollStep(const ArkUI_UIInputEvent* event, int32_t scrollStep)

Description

Sets the scrolling step coefficient for a cloned event. This API applies to axis events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t scrollStep Scrolling step coefficient of the cloned event. The value is an integer within the range of [0, 65535].

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetMouseButton()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetMouseButton(const ArkUI_UIInputEvent* event, int32_t button)

Description

Sets a button type for a cloned event. This API applies to mouse events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
int32_t button Mouse button type of the clone event. The value is defined by the anonymous5 enumeration.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetRawDeltaX()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetRawDeltaX(const ArkUI_UIInputEvent* event, float rawDeltaX)

Description

Sets the movement delta of the mouse along the x-axis in a two-dimensional plane. The value is the original movement data of the mouse hardware, which is expressed in the unit of the mouse movement distance in the physical world. This API applies to mouse events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
float rawDeltaX X-axis offset of the mouse position relative to the position in the previously reported mouse event.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetRawDeltaY()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetRawDeltaY(const ArkUI_UIInputEvent* event, float rawDeltaY)

Description

Sets the movement delta of the mouse along the y-axis in a two-dimensional plane. The value is the original movement data of the mouse hardware, which is expressed in the unit of the mouse movement distance in the physical world. This API applies to mouse events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
float rawDeltaY Y-axis offset of the mouse position relative to the position in the previously reported mouse event.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_ClonedEvent_SetPressedButtons()

ArkUI_ErrorCode OH_ArkUI_ClonedEvent_SetPressedButtons(const ArkUI_UIInputEvent* event, const int32_t* pressedButtons, int32_t length)

Description

Sets the pressed keys in a cloned event. This API applies to mouse events. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
const int32_t* pressedButtons Pointer to the array of the pressed keys. For the values of the keys, see anonymous5.
int32_t length Length of the array of the pressed keys.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_INPUT_EVENT_TYPE_NOT_SUPPORTED if the event type is not supported.

OH_ArkUI_PointerEvent_PostClonedEventWithStrategy()

ArkUI_ErrorCode OH_ArkUI_PointerEvent_PostClonedEventWithStrategy(ArkUI_NodeHandle node, const ArkUI_UIInputEvent* event, ArkUI_CompetitionStrategy strategy)

Description

Posts a cloned event to a specific node using a specified competition strategy. This API can be used only for the ArkUI_UIInputEvent objects created by OH_ArkUI_PointerEvent_CreateClonedPointerEvent and OH_ArkUI_PointerEvent_CreatePointerEvent.

Since: 24

Parameters

Name Description
ArkUI_NodeHandle node Target node.
const ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.
ArkUI_CompetitionStrategy strategy Competition strategy. The value is ArkUI_CompetitionStrategy.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT if the input event pointer is not a cloned event pointer.
Returns ARKUI_ERROR_CODE_POST_CLONED_COMPONENT_STATUS_ABNORMAL if the component status is abnormal.
Returns ARKUI_ERROR_CODE_POST_CLONED_NO_COMPONENT_HIT_TO_RESPOND_TO_THE_EVENT if no component is hit to respond to the event.

OH_ArkUI_UIInputEvent_GetLatestStatus()

ArkUI_ErrorCode OH_ArkUI_UIInputEvent_GetLatestStatus()

Description

Obtains the result code of the most recent API call related to an ArkUI_UIInputEvent object. This API is typically unnecessary for normal operations, but can be used to verify ambiguous return values

Since: 20

Return value

Type Description
ArkUI_ErrorCode Result code of the most recent API call related to the ArkUI_UIInputEvent object.

OH_ArkUI_UIInputEvent_GetCoastingAxisEvent()

ArkUI_CoastingAxisEvent* OH_ArkUI_UIInputEvent_GetCoastingAxisEvent(ArkUI_UIInputEvent* event)

Description

Obtains the coasting axis event from the specified component event. A valid event is available only when the user slides two fingers a certain distance on the touchpad and quickly releases them, and a component registered with the NODE_ON_COASTING_AXIS_EVENT event exists at the pointer position. This API must be called after the ArkUI_UIInputEvent object is obtained from the ArkUI_NodeEvent object.

The coasting axis event is triggered only when the user performs a two-finger swipe and releases on the touchpad, so it is exclusive to touchpad devices. This event generates axis values that gradually attenuate based on the initial swipe velocity after finger release. Due to factors such as refresh rate and performance constraints, the axis value of the current event may be higher or lower than the previous one. The following behavior will interrupt the coasting axis event and immediately trigger ARKUI_COASTING_AXIS_EVENT_PHASE_END:

  1. Touching the touchpad

  2. Scrolling the mouse wheel

  3. Clicking a node registered for coasting axis events (clicking unregistered nodes has no effect). For example, if node A registers the event and node B is being scrolled during coasting, clicking node B will not interrupt the event. Click event interruption is affected by OH_ArkUI_PointerEvent_SetInterceptHitTestMode. If the tapped area contains any nodes that can respond to coasting axis events, the coasting axis event will be forcibly terminated.

  4. Application hibernation (such as minimization and screen lock)

Since: 22

Parameters

Name Description
ArkUI_UIInputEvent* event Pointer to the target ArkUI_UIInputEvent object.

Return value

Type Description
ArkUI_CoastingAxisEvent Pointer to the coasting axis event. Returns a null pointer if no coasting axis event occurs or if parameters are invalid.

OH_ArkUI_CoastingAxisEvent_GetEventTime()

int64_t OH_ArkUI_CoastingAxisEvent_GetEventTime(ArkUI_CoastingAxisEvent* event)

Description

Obtains the time when a coasting axis event occurs.

Since: 22

Parameters

Name Description
ArkUI_CoastingAxisEvent* event Pointer to the coasting axis event.

Return value

Type Description
int64_t Time when the UI input event occurs, in ns. If any parameter error occurs, 0 is returned.

OH_ArkUI_CoastingAxisEvent_GetPhase()

ArkUI_CoastingAxisEventPhase OH_ArkUI_CoastingAxisEvent_GetPhase(ArkUI_CoastingAxisEvent* event)

Description

Obtains the scroll phase of the specified coasting axis event.

Since: 22

Parameters

Name Description
ArkUI_CoastingAxisEvent* event Pointer to the coasting axis event.

Return value

Type Description
ArkUI_CoastingAxisEventPhase Event phase. For details, see ArkUI_CoastingAxisEventPhase.
Returns ARKUI_COASTING_AXIS_EVENT_PHASE_NONE if any parameter error occurs.

OH_ArkUI_CoastingAxisEvent_GetDeltaY

float OH_ArkUI_CoastingAxisEvent_GetDeltaY(ArkUI_CoastingAxisEvent* event)

Description

Obtains the vertical delta value of the specified coasting axis event. Unit: px, representing the single scroll increment (not the total scroll amount). Negative values indicate a downward direction (fingers swiping from top to bottom), and positive values indicate an upward direction (fingers swiping from bottom to top).

Since: 22

Parameters

Name Description
ArkUI_CoastingAxisEvent* event Pointer to the coasting axis event.

Return value

Type Description
float Y-axis delta value, in px. Returns 0.0f if any parameter error occurs.

OH_ArkUI_CoastingAxisEvent_GetDeltaX

float OH_ArkUI_CoastingAxisEvent_GetDeltaX(ArkUI_CoastingAxisEvent* event)

Description

Obtains the horizontal delta value of the specified coasting axis event. Unit: px, representing the single scroll increment (not the total scroll amount). Positive values indicate a rightward direction (fingers swiping from right to left), and negative values indicate a leftward direction (fingers swiping from left to right).

Since: 22

Parameters

Name Description
ArkUI_CoastingAxisEvent* event Pointer to the coasting axis event.

Return value

Type Description
float X-axis delta value, in px. Returns 0.0f if any parameter error occurs.

OH_ArkUI_CoastingAxisEvent_SetPropagation()

int32_t OH_ArkUI_CoastingAxisEvent_SetPropagation(ArkUI_CoastingAxisEvent* event, bool propagation)

Description

Sets whether to enable event propagation for the specified coasting axis event. By default, event propagation is disabled.

Since: 22

Parameters

Name Description
ArkUI_CoastingAxisEvent* event Pointer to the coasting axis event.
bool propagation Whether to enable event propagation. true: enable; false: disable.

Return value

Type Description
int32_t Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_TouchTestInfo_GetTouchTestInfoList

ArkUI_ErrorCode OH_ArkUI_TouchTestInfo_GetTouchTestInfoList(ArkUI_TouchTestInfo* info,
    ArkUI_TouchTestInfoItemArray* array, int32_t* size);

Description

Obtains the array of touch test information items.

Since: 22

Parameters

Name Description
ArkUI_TouchTestInfo* info Pointer to the touch test information.
ArkUI_TouchTestInfoItemArray* array Pointer to the array of touch test information items.
int32_t* size Size of the array of touch test information items.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_TouchTestInfoItem_GetX

float OH_ArkUI_TouchTestInfoItem_GetX(const ArkUI_TouchTestInfoItem* info);

Description

Obtains the X coordinate relative to the upper left corner of the child component from the touch test information item, in px.

Since: 22

Parameters

Name Description
const ArkUI_TouchTestInfoItem* info Pointer to a touch test information item.

Return value

Type Description
float X coordinate relative to the upper left corner of the child component, in px. If the parameter value is incorrect, 0.0f is returned.

OH_ArkUI_TouchTestInfoItem_GetY

float OH_ArkUI_TouchTestInfoItem_GetY(const ArkUI_TouchTestInfoItem* info);

Description

Obtains the Y coordinate relative to the upper left corner of the child component from the touch test information item, in px.

Since: 22

Parameters

Name Description
const ArkUI_TouchTestInfoItem* info Pointer to a touch test information item.

Return value

Type Description
float Y coordinate relative to the upper left corner of the child component, in px. If the parameter value is incorrect, 0.0f is returned.

OH_ArkUI_TouchTestInfoItem_GetWindowX

float OH_ArkUI_TouchTestInfoItem_GetWindowX(const ArkUI_TouchTestInfoItem* info);

Description

Obtains the X coordinate relative to the upper left corner of the current application window from the touch test information item, in px.

Since: 22

Parameters

Name Description
const ArkUI_TouchTestInfoItem* info Pointer to a touch test information item.

Return value

Type Description
float X coordinate relative to the upper left corner of the current application window, in px. If the parameter value is incorrect, 0.0f is returned.

OH_ArkUI_TouchTestInfoItem_GetWindowY

float OH_ArkUI_TouchTestInfoItem_GetWindowY(const ArkUI_TouchTestInfoItem* info);

Description

Obtains the Y coordinate relative to the upper left corner of the current application window from the touch test information item, in px.

Since: 22

Parameters

Name Description
const ArkUI_TouchTestInfoItem* info Pointer to a touch test information item.

Return value

Type Description
float Y coordinate relative to the upper left corner of the current application window, in px. If the parameter value is incorrect, 0.0f is returned.

OH_ArkUI_TouchTestInfoItem_GetXRelativeToParent

float OH_ArkUI_TouchTestInfoItem_GetXRelativeToParent(const ArkUI_TouchTestInfoItem* info);

Description

Obtains the X coordinate relative to the upper left corner of the parent component from the touch test information item, in px.

Since: 22

Parameters

Name Description
const ArkUI_TouchTestInfoItem* info Pointer to a touch test information item.

Return value

Type Description
float X coordinate relative to the upper left corner of the parent component, in px. If the parameter value is incorrect, 0.0f is returned.

OH_ArkUI_TouchTestInfoItem_GetYRelativeToParent

float OH_ArkUI_TouchTestInfoItem_GetYRelativeToParent(const ArkUI_TouchTestInfoItem* info);

Description

Obtains the Y coordinate relative to the upper left corner of the parent component from the touch test information item, in px.

Since: 22

Parameters

Name Description
const ArkUI_TouchTestInfoItem* info Pointer to a touch test information item.

Return value

Type Description
float Y coordinate relative to the upper left corner of the parent component, in px. If the parameter value is incorrect, 0.0f is returned.

OH_ArkUI_TouchTestInfoItem_GetChildRect

ArkUI_ErrorCode OH_ArkUI_TouchTestInfoItem_GetChildRect(const ArkUI_TouchTestInfoItem* info, ArkUI_Rect* childRect);

Description

Obtains the boundary rectangle information of the child component from the touch test information item.

Since: 22

Parameters

Name Description
const ArkUI_TouchTestInfoItem* info Pointer to a touch test information item.
ArkUI_Rect* childRect Pointer to the boundary rectangle of the child component, which is used to store the obtained boundary rectangle information.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_TouchTestInfoItem_GetChildId

ArkUI_ErrorCode OH_ArkUI_TouchTestInfoItem_GetChildId(const ArkUI_TouchTestInfoItem* info, char* buffer,
    int32_t bufferSize);

Description

Obtains the ID of the child component from the touch test information item.

Since: 22

Parameters

Name Description
const ArkUI_TouchTestInfoItem* info Pointer to a touch test information item.
char* buffer Storage buffer.
int32_t bufferSize Buffer size.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.
Returns ARKUI_ERROR_CODE_BUFFER_SIZE_NOT_ENOUGH if the buffer space is insufficient.

OH_ArkUI_TouchTestInfo_SetTouchResultStrategy

ArkUI_ErrorCode OH_ArkUI_TouchTestInfo_SetTouchResultStrategy(ArkUI_TouchTestInfo* info, ArkUI_TouchTestStrategy strategy);

Description

Sets the touch test policy, that is, the behavior of a component and its child components in a hit test.

Since: 22

Parameters

Name Description
ArkUI_TouchTestInfo* info Pointer to the touch test information.
ArkUI_TouchTestStrategy strategy Touch test policy, defining the behavior rules of a component and its child components in a hit test.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_TouchTestInfo_SetTouchResultId

ArkUI_ErrorCode OH_ArkUI_TouchTestInfo_SetTouchResultId(ArkUI_TouchTestInfo* info, const char* id);

Description

Sets the ID of a child component involved in a hit test.

Since: 22

Parameters

Name Description
ArkUI_TouchTestInfo* info Pointer to the touch test information.
const char* id ID of a child component, which specifies the target child component involved in a hit test.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_DigitalCrownEvent_GetEventTime()

int64_t OH_ArkUI_DigitalCrownEvent_GetEventTime(const ArkUI_UIInputEvent* event)

Description

Obtains the time when a crown event occurs. The unit is ns.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
int64_t Time when the UI input event occurs. If a parameter error occurs, 0 is returned.

OH_ArkUI_DigitalCrownEvent_GetAngularVelocity()

double OH_ArkUI_DigitalCrownEvent_GetAngularVelocity(const ArkUI_UIInputEvent* event)

Description

Obtains the angular velocity at which a crown event occurs. The unit is °/s.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
double Angular velocity at which the UI input event occurs. If a parameter error occurs, 0.0 is returned.

OH_ArkUI_DigitalCrownEvent_GetDegree()

double OH_ArkUI_DigitalCrownEvent_GetDegree(const ArkUI_UIInputEvent* event)

Description

Obtains the rotation angle at which a crown event occurs. The unit is °.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
double Rotation angle at which the UI input event occurs. If a parameter error occurs, 0.0 is returned.

OH_ArkUI_DigitalCrownEvent_GetAction()

ArkUI_CrownEvent_Action OH_ArkUI_DigitalCrownEvent_GetAction(const ArkUI_UIInputEvent* event)

Description

Obtains the phase at which a crown event occurs.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.

Return value

Type Description
ArkUI_CrownEvent_Action Action of rotating the crown when the UI input event occurs. If a parameter error occurs, ARKUI_CROWNEVENT_ACTION_UNKNOWN is returned.

OH_ArkUI_DigitalCrownEvent_SetStopPropagation()

ArkUI_ErrorCode OH_ArkUI_DigitalCrownEvent_SetStopPropagation(const ArkUI_UIInputEvent* event, bool stopPropagation)

Description

Sets whether to stop event propagation. This API applies only when the input parameter UIInputEvent contains a crown event object.

Since: 24

Parameters

Name Description
const ArkUI_UIInputEvent* event Pointer to the UI input event.
bool stopPropagation Whether to stop event propagation. The value true means to stop event propagation, and false means the opposite.

Return value

Type Description
ArkUI_ErrorCode Result code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.