1# native_interface_xcomponent.h 2 3 4## Overview 5 6Declares the APIs for accessing **NativeXComponent**. 7 8**Library**: libace_ndk.z.so 9 10**File to include**: <ace/xcomponent/native_interface_xcomponent.h> 11 12**Since**: 8 13 14**Related module**: [Native XComponent](_o_h___native_x_component.md) 15 16 17## Summary 18 19 20### Structs 21 22| Name| Description| 23| -------- | -------- | 24| struct [OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md) | Describes the touch point of the touch event.| 25| struct [OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md) | Defines the touch event. | 26| struct [OH_NativeXComponent_HistoricalPoint](_o_h___native_x_component___historical_point.md) | Defines the historical touch point.| 27| struct [OH_NativeXComponent_MouseEvent](_o_h___native_x_component___mouse_event.md) | Describes the mouse event. | 28| struct [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) | Registers callbacks for the surface lifecycle and touch event. | 29| struct [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md) | Registers callbacks for the mouse event. | 30| struct [OH_NativeXComponent_ExpectedRateRange](_o_h___native_x_component___expected_rate_range.md) | Defines the expected frame rate range. | 31 32 33### Types 34 35| Name| Description| 36| -------- | -------- | 37| typedef struct [OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) [OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) | Provides an encapsulated **OH_NativeXComponent** instance. | 38| typedef struct [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) [OH_NativeXComponent_Callback](_o_h___native_x_component.md#oh_nativexcomponent_callback) | Registers callbacks for the surface lifecycle and touch event. | 39| typedef struct [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md) [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component.md#oh_nativexcomponent_mouseevent_callback) | Registers callbacks for the mouse event. | 40| typedef struct [OH_NativeXComponent_KeyEvent](_o_h___native_x_component.md#oh_nativexcomponent_keyevent) [OH_NativeXComponent_KeyEvent](_o_h___native_x_component.md#oh_nativexcomponent_keyevent) | Provides an encapsulated **OH_NativeXComponent_KeyEvent** instance.| 41| typedef struct [OH_NativeXComponent_ExtraMouseEventInfo](_o_h___native_x_component.md#oh_nativexcomponent_extramouseeventinfo) [OH_NativeXComponent_ExtraMouseEventInfo](_o_h___native_x_component.md#oh_nativexcomponent_extramouseeventinfo) | Provides an encapsulated instance of extended mouse event information.| 42| typedef struct [OH_ArkUI_SurfaceCallback](_o_h___native_x_component.md#oh_arkui_surfacecallback) [OH_ArkUI_SurfaceCallback](_o_h___native_x_component.md#oh_arkui_surfacecallback) | Defines Surface lifecycle callback functions.| 43| typedef struct [OH_ArkUI_SurfaceHolder](_o_h___native_x_component.md#oh_arkui_surfaceholder) [OH_ArkUI_SurfaceHolder](_o_h___native_x_component.md#oh_arkui_surfaceholder) | Provides an encapsulated **OH_ArkUI_SurfaceHolder** instance.| 44| typedef struct NativeWindow [OHNativeWindow](_o_h___native_x_component.md#ohnativewindow) | Provides an encapsulated **NativeWindow** instance.| 45 46 47### Enums 48 49| Name| Description| 50| -------- | -------- | 51| { OH_NATIVEXCOMPONENT_RESULT_SUCCESS = 0, OH_NATIVEXCOMPONENT_RESULT_FAILED = -1, OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER = -2 } | Enumerates the API access states. | 52| [OH_NativeXComponent_TouchEventType](_o_h___native_x_component.md#oh_nativexcomponent_toucheventtype) {<br>OH_NATIVEXCOMPONENT_DOWN = 0, OH_NATIVEXCOMPONENT_UP, OH_NATIVEXCOMPONENT_MOVE, OH_NATIVEXCOMPONENT_CANCEL,<br>OH_NATIVEXCOMPONENT_UNKNOWN<br>} | Enumerates the touch event types. | 53| [OH_NativeXComponent_TouchPointToolType](_o_h___native_x_component.md#oh_nativexcomponent_touchpointtooltype) {<br>OH_NATIVEXCOMPONENT_TOOL_TYPE_UNKNOWN = 0, OH_NATIVEXCOMPONENT_TOOL_TYPE_FINGER, OH_NATIVEXCOMPONENT_TOOL_TYPE_PEN, OH_NATIVEXCOMPONENT_TOOL_TYPE_RUBBER,<br>OH_NATIVEXCOMPONENT_TOOL_TYPE_BRUSH, OH_NATIVEXCOMPONENT_TOOL_TYPE_PENCIL, OH_NATIVEXCOMPONENT_TOOL_TYPE_AIRBRUSH, OH_NATIVEXCOMPONENT_TOOL_TYPE_MOUSE,<br>OH_NATIVEXCOMPONENT_TOOL_TYPE_LENS<br>} | Enumerates the touch point tool types. | 54| [OH_NativeXComponent_EventSourceType](_o_h___native_x_component.md#oh_nativexcomponent_eventsourcetype) {<br>OH_NATIVEXCOMPONENT_SOURCE_TYPE_UNKNOWN = 0, OH_NATIVEXCOMPONENT_SOURCE_TYPE_MOUSE, OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHSCREEN, OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHPAD,<br>OH_NATIVEXCOMPONENT_SOURCE_TYPE_JOYSTICK, OH_NATIVEXCOMPONENT_SOURCE_TYPE_KEYBOARD<br>} | Enumerates the touch event source types. | 55| [OH_NativeXComponent_TouchEvent_SourceTool](_o_h___native_x_component.md#oh_nativexcomponent_touchevent_sourcetool) {<br>OH_NATIVEXCOMPONENT_SOURCETOOL_UNKNOWN = 0, OH_NATIVEXCOMPONENT_SOURCETOOL_FINGER, OH_NATIVEXCOMPONENT_SOURCETOOL_PEN, OH_NATIVEXCOMPONENT_SOURCETOOL_RUBBER,<br>OH_NATIVEXCOMPONENT_SOURCETOOL_BRUSH, OH_NATIVEXCOMPONENT_SOURCETOOL_PENCIL, OH_NATIVEXCOMPONENT_SOURCETOOL_AIRBRUSH, OH_NATIVEXCOMPONENT_SOURCETOOL_MOUSE,<br>OH_NATIVEXCOMPONENT_SOURCETOOL_LENS, OH_NATIVEXCOMPONENT_SOURCETOOL_TOUCHPAD<br>} | Enumerates the source tool types of touch events.| 56| [OH_NativeXComponent_MouseEventAction](_o_h___native_x_component.md#oh_nativexcomponent_mouseeventaction) {<br>OH_NATIVEXCOMPONENT_MOUSE_NONE = 0, OH_NATIVEXCOMPONENT_MOUSE_PRESS, OH_NATIVEXCOMPONENT_MOUSE_RELEASE, OH_NATIVEXCOMPONENT_MOUSE_MOVE,<br>OH_NATIVEXCOMPONENT_MOUSE_CANCEL<br>} | Enumerates mouse event actions.| 57| [OH_NativeXComponent_MouseEventButton](_o_h___native_x_component.md#oh_nativexcomponent_mouseeventbutton) {<br>OH_NATIVEXCOMPONENT_NONE_BUTTON = 0, OH_NATIVEXCOMPONENT_LEFT_BUTTON = 0x01, OH_NATIVEXCOMPONENT_RIGHT_BUTTON = 0x02, OH_NATIVEXCOMPONENT_MIDDLE_BUTTON = 0x04,<br>OH_NATIVEXCOMPONENT_BACK_BUTTON = 0x08, OH_NATIVEXCOMPONENT_FORWARD_BUTTON = 0x10<br>} | Enumerates the mouse event buttons. | 58|[ArkUI_XComponent_ImageAnalyzerState](_o_h___native_x_component.md#arkui_xcomponent_imageanalyzerstate) { ARKUI_XCOMPONENT_AI_ANALYSIS_FINISHED = 0, ARKUI_XCOMPONENT_AI_ANALYSIS_DISABLED = 110000, ARKUI_XCOMPONENT_AI_ANALYSIS_UNSUPPORTED = 110001, ARKUI_XCOMPONENT_AI_ANALYSIS_ONGOING = 110002, ARKUI_XCOMPONENT_AI_ANALYSIS_STOPPED = 110003}|Enumerates the AI image analyzer error codes of the XComponent.| 59 60 61### Functions 62 63| Name| Description| 64| -------- | -------- | 65| int32_t [OH_NativeXComponent_GetXComponentId](_o_h___native_x_component.md#oh_nativexcomponent_getxcomponentid) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, char \*id, uint64_t \*size) | Obtain the ID of ArkUI XComponent. | 66| int32_t [OH_NativeXComponent_GetXComponentSize](_o_h___native_x_component.md#oh_nativexcomponent_getxcomponentsize) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, const void \*window, uint64_t \*width, uint64_t \*height) | Obtains the size of the surface held by the ArkUI XComponent. | 67| int32_t [OH_NativeXComponent_GetXComponentOffset](_o_h___native_x_component.md#oh_nativexcomponent_getxcomponentoffset) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, const void \*window, double \*x, double \*y) | Obtains the offset of the ArkUI XComponent relative to the upper left vertex of the screen. | 68| int32_t [OH_NativeXComponent_GetTouchEvent](_o_h___native_x_component.md#oh_nativexcomponent_gettouchevent) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, const void \*window, [OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md) \*touchEvent) | Obtains the touch event scheduled by the ArkUI XComponent. | 69| int32_t [OH_NativeXComponent_GetTouchPointToolType](_o_h___native_x_component.md#oh_nativexcomponent_gettouchpointtooltype) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, uint32_t pointIndex, [OH_NativeXComponent_TouchPointToolType](_o_h___native_x_component.md#oh_nativexcomponent_touchpointtooltype) \*toolType) | Obtains the ArkUI XComponent touch point tool type. | 70| int32_t [OH_NativeXComponent_GetTouchPointTiltX](_o_h___native_x_component.md#oh_nativexcomponent_gettouchpointtiltx) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, uint32_t pointIndex, float \*tiltX) | Obtains the angle between the Y-Z plane of the ArkUI XComponent touch point and the x-axis. | 71| int32_t [OH_NativeXComponent_GetTouchPointTiltY](_o_h___native_x_component.md#oh_nativexcomponent_gettouchpointtilty) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, uint32_t pointIndex, float \*tiltY) | Obtains the angle between the X-Z plane of the ArkUI XComponent touch point and the y-axis. | 72| int32_t [OH_NativeXComponent_GetTouchPointWindowX](_o_h___native_x_component.md#oh_nativexcomponent_gettouchpointwindowx) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, uint32_t pointIndex, float \*windowX) | Obtains the X coordinate of the touch point relative to the upper left corner of the application window where the ArkUI XComponent is located. | 73| int32_t [OH_NativeXComponent_GetTouchPointWindowY](_o_h___native_x_component.md#oh_nativexcomponent_gettouchpointwindowy) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, uint32_t pointIndex, float \*windowY) | Obtains the Y coordinate of the touch point relative to the upper left corner of the application window where the ArkUI XComponent is located. | 74| int32_t [OH_NativeXComponent_GetTouchPointDisplayX](_o_h___native_x_component.md#oh_nativexcomponent_gettouchpointdisplayx) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, uint32_t pointIndex, float \*displayX) | Obtains the X coordinate of the touch point relative to the upper left corner of the screen where the ArkUI XComponent is located. | 75| int32_t [OH_NativeXComponent_GetTouchPointDisplayY](_o_h___native_x_component.md#oh_nativexcomponent_gettouchpointdisplayy) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, uint32_t pointIndex, float \*displayY) | Obtains the Y coordinate of the touch point relative to the upper left corner of the screen where the ArkUI XComponent is located. | 76| int32_t [OH_NativeXComponent_GetHistoricalPoints](_o_h___native_x_component.md#oh_nativexcomponent_gethistoricalpoints) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, const void \*window, int32_t \*size, [OH_NativeXComponent_HistoricalPoint](_o_h___native_x_component___historical_point.md) \*\*historicalPoints) | Obtains the historical touch points of the XComponent. | 77| int32_t [OH_NativeXComponent_GetMouseEvent](_o_h___native_x_component.md#oh_nativexcomponent_getmouseevent) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, const void \*window, [OH_NativeXComponent_MouseEvent](_o_h___native_x_component___mouse_event.md) \*mouseEvent) | Obtains the mouse event scheduled by ArkUI XComponent. | 78| int32_t [OH_NativeXComponent_RegisterCallback](_o_h___native_x_component.md#oh_nativexcomponent_registercallback) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) \*callback) | Registers a callback for this **OH_NativeXComponent** instance. | 79| int32_t [OH_NativeXComponent_RegisterMouseEventCallback](_o_h___native_x_component.md#oh_nativexcomponent_registermouseeventcallback) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md) \*callback) | Registers the mouse event callback for this **OH_NativeXComponent** instance. | 80| int32_t [OH_NativeXComponent_RegisterFocusEventCallback](_o_h___native_x_component.md#oh_nativexcomponent_registerfocuseventcallback) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void \*window)) | Registers the focus obtaining event callback for this **OH_NativeXComponent** instance. | 81| int32_t [OH_NativeXComponent_RegisterKeyEventCallback](_o_h___native_x_component.md#oh_nativexcomponent_registerkeyeventcallback) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void \*window)) | Registers the key event callback for this **OH_NativeXComponent** instance. | 82| int32_t [OH_NativeXComponent_RegisterKeyEventCallbackWithResult](_o_h___native_x_component.md#oh_nativexcomponent_registerkeyeventcallbackwithresult) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, bool(\*callback)([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void \*window)) | Registers a key event callback with a return value for this **OH_NativeXComponent** instance. | 83| int32_t [OH_NativeXComponent_RegisterBlurEventCallback](_o_h___native_x_component.md#oh_nativexcomponent_registerblureventcallback) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void \*window)) | Registers the focus loss event callback for this **OH_NativeXComponent** instance. | 84| int32_t [OH_NativeXComponent_GetKeyEvent](_o_h___native_x_component.md#oh_nativexcomponent_getkeyevent) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, [OH_NativeXComponent_KeyEvent](_o_h___native_x_component.md#oh_nativexcomponent_keyevent) \*\*keyEvent) | Obtains the key event scheduled by ArkUI XComponent. | 85| int32_t [OH_NativeXComponent_GetKeyEventAction](_o_h___native_x_component.md#oh_nativexcomponent_getkeyeventaction) ([OH_NativeXComponent_KeyEvent](_o_h___native_x_component.md#oh_nativexcomponent_keyevent) \*keyEvent, [OH_NativeXComponent_KeyAction](_o_h___native_x_component.md#oh_nativexcomponent_keyaction) \*action) | Obtains the action of the specified key event. | 86| int32_t [OH_NativeXComponent_GetKeyEventCode](_o_h___native_x_component.md#oh_nativexcomponent_getkeyeventcode) ([OH_NativeXComponent_KeyEvent](_o_h___native_x_component.md#oh_nativexcomponent_keyevent) \*keyEvent, [OH_NativeXComponent_KeyCode](_o_h___native_x_component.md#oh_nativexcomponent_keycode) \*code) | Obtains the key code of the specified key event. | 87| int32_t [OH_NativeXComponent_GetKeyEventSourceType](_o_h___native_x_component.md#oh_nativexcomponent_getkeyeventsourcetype) ([OH_NativeXComponent_KeyEvent](_o_h___native_x_component.md#oh_nativexcomponent_keyevent) \*keyEvent, [OH_NativeXComponent_EventSourceType](_o_h___native_x_component.md#oh_nativexcomponent_eventsourcetype) \*sourceType) | Obtains the source type of the specified key event. | 88| int32_t [OH_NativeXComponent_GetKeyEventDeviceId](_o_h___native_x_component.md#oh_nativexcomponent_getkeyeventdeviceid) ([OH_NativeXComponent_KeyEvent](_o_h___native_x_component.md#oh_nativexcomponent_keyevent) \*keyEvent, int64_t \*deviceId) | Obtains the device ID of the specified key event. | 89| int32_t [OH_NativeXComponent_GetKeyEventTimeStamp](_o_h___native_x_component.md#oh_nativexcomponent_getkeyeventtimestamp) ([OH_NativeXComponent_KeyEvent](_o_h___native_x_component.md#oh_nativexcomponent_keyevent) \*keyEvent, int64_t \*timeStamp) | Obtains the timestamp of the specified key event. | 90| int32_t [OH_NativeXComponent_SetExpectedFrameRateRange](_o_h___native_x_component.md#oh_nativexcomponent_setexpectedframeraterange) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, [OH_NativeXComponent_ExpectedRateRange](_o_h___native_x_component___expected_rate_range.md) \*range) | Sets the expected frame rate range. | 91| int32_t [OH_NativeXComponent_RegisterOnFrameCallback](_o_h___native_x_component.md#oh_nativexcomponent_registeronframecallback) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, uint64_t timestamp, uint64_t targetTimestamp)) | Registers the display update callback for this **OH_NativeXComponent** instance and enables the callback for each frame. | 92| int32_t [OH_NativeXComponent_UnregisterOnFrameCallback](_o_h___native_x_component.md#oh_nativexcomponent_unregisteronframecallback) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component) | Deregisters the display update callback for this **OH_NativeXComponent** instance and disables the callback for each frame. | 93| int32_t [OH_NativeXComponent_AttachNativeRootNode](_o_h___native_x_component.md#oh_nativexcomponent_attachnativerootnode) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, [ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) root) | Attaches the UI component created through the native API of ArkUI to this **OH_NativeXComponent** instance. | 94| int32_t [OH_NativeXComponent_DetachNativeRootNode](_o_h___native_x_component.md#oh_nativexcomponent_detachnativerootnode) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, [ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) root) | Detaches the native component of ArkUI from this **OH_NativeXComponent** instance. | 95| int32_t [OH_NativeXComponent_RegisterUIInputEventCallback](_o_h___native_x_component.md#oh_nativexcomponent_registeruiinputeventcallback) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, [ArkUI_UIInputEvent_Type](_ark_u_i___event_module.md#arkui_uiinputevent_type) type), [ArkUI_UIInputEvent_Type](_ark_u_i___event_module.md#arkui_uiinputevent_type) type) | Registers a UI input event callback for an **OH_NativeXComponent** instance and enables the callback to be invoked when a UI input event is received. | 96| int32_t [OH_NativeXComponent_RegisterOnTouchInterceptCallback](_o_h___native_x_component.md#oh_nativexcomponent_registerontouchinterceptcallback) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, [HitTestMode](_ark_u_i___event_module.md#hittestmode)(\*callback)([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event)) | Registers a custom event intercept callback for an **OH_NativeXComponent** and enables the callback during the hit test. | 97| int32_t [OH_NativeXComponent_SetNeedSoftKeyboard](_o_h___native_x_component.md#oh_nativexcomponent_setneedsoftkeyboard) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, bool needSoftKeyboard) | Sets whether the soft keyboard is required for an **OH_NativeXComponent** instance. | 98| int32_t [OH_NativeXComponent_RegisterSurfaceShowCallback](_o_h___native_x_component.md#oh_nativexcomponent_registersurfaceshowcallback) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void \*window)) | Registers a surface display callback for an **OH_NativeXComponent** instance. The callback is invoked whenever the application is switched to the foreground. | 99| int32_t [OH_NativeXComponent_RegisterSurfaceHideCallback](_o_h___native_x_component.md#oh_nativexcomponent_registersurfacehidecallback) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void \*window)) | Registers a surface hiding callback for an **OH_NativeXComponent** instance. The callback is invoked whenever the application is switched to the background. | 100| int32_t [OH_NativeXComponent_GetTouchEventSourceType](_o_h___native_x_component.md#oh_nativexcomponent_gettoucheventsourcetype) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, int32_t pointId, [OH_NativeXComponent_EventSourceType](_o_h___native_x_component.md#oh_nativexcomponent_eventsourcetype) \*sourceType) | Obtains the touch event source type of an **OH_NativeXComponent** instance. | 101| [OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \* [OH_NativeXComponent_GetNativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent_getnativexcomponent) ([ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) node) | Obtains the pointer to an **OH_NativeXComponent** instance based on the specified component instance created by the native API. | 102| int32_t [OH_NativeXComponent_GetNativeAccessibilityProvider](_o_h___native_x_component.md#oh_nativexcomponent_getnativeaccessibilityprovider) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, [ArkUI_AccessibilityProvider](./arkui_native_interface_accessibility.md#arkui_accessibilityprovider) \*\*handle) | Obtains the accessibility provider handle for an ArkUI XComponent. | 103| int32_t [OH_NativeXComponent_RegisterKeyEventCallbackWithResult](_o_h___native_x_component.md#oh_nativexcomponent_registerkeyeventcallbackwithresult) ([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, bool(\*callback)([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent) \*component, void \*window)) | Registers a key event callback with a return value for this **OH_NativeXComponent** instance. | 104|int32_t [OH_ArkUI_XComponent_StartImageAnalyzer](_o_h___native_x_component.md#oh_arkui_xcomponent_startimageanalyzer) ([ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) node, void \*userData,void (\*callback)([ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) node, [ArkUI_XComponent_ImageAnalyzerState](_o_h___native_x_component.md#arkui_xcomponent_imageanalyzerstate) statusCode, void \*userData))|Starts AI image analysis for this XComponent instance.| 105|int32_t [OH_ArkUI_XComponent_StopImageAnalyzer](_o_h___native_x_component.md#oh_arkui_xcomponent_stopimageanalyzer)([ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) node)|Stops AI image analysis for this XComponent instance.| 106|[OH_ArkUI_SurfaceCallback](_o_h___native_x_component.md#oh_arkui_surfacecallback)* [OH_ArkUI_SurfaceCallback_Create](_o_h___native_x_component.md#oh_arkui_surfacecallback_create)()|Creates an **OH_ArkUI_SurfaceCallback** object.| 107|void [OH_ArkUI_SurfaceCallback_Dispose](_o_h___native_x_component.md#oh_arkui_surfacecallback_dispose)([OH_ArkUI_SurfaceCallback](_o_h___native_x_component.md#oh_arkui_surfacecallback)* callback)|Disposes of an **OH_ArkUI_SurfaceCallback** object.| 108|[OH_ArkUI_SurfaceHolder](_o_h___native_x_component.md#oh_arkui_surfaceholder)* [OH_ArkUI_SurfaceHolder_Create](_o_h___native_x_component.md#oh_arkui_surfaceholder_create)([ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) node)|Creates an **OH_ArkUI_SurfaceHolder** object for an XComponent.| 109|void [OH_ArkUI_SurfaceHolder_Dispose](_o_h___native_x_component.md#oh_arkui_surfaceholder_dispose)([OH_ArkUI_SurfaceHolder](_o_h___native_x_component.md#oh_arkui_surfaceholder)* surfaceHolder)|Disposes of an **OH_ArkUI_SurfaceHolder** object.| 110|int32_t [OH_NativeXComponent_GetExtraMouseEventInfo](_o_h___native_x_component.md#oh_nativexcomponent_getextramouseeventinfo)([OH_NativeXComponent](_o_h___native_x_component.md#oh_nativexcomponent)* component, [OH_NativeXComponent_ExtraMouseEventInfo](_o_h___native_x_component.md#oh_nativexcomponent_getextramouseeventinfo)** extraMouseEventInfo)| Obtains extended mouse event information from an **OH_NativeXComponent** instance.| 111|int32_t [OH_NativeXComponent_GetMouseEventModifierKeyStates](_o_h___native_x_component.md#oh_nativexcomponent_getmouseeventmodifierkeystates)([OH_NativeXComponent_ExtraMouseEventInfo](_o_h___native_x_component.md#oh_nativexcomponent_getextramouseeventinfo)* ExtraMouseEventInfo, uint64_t* keys)|Obtains the state of modifier keys from an **OH_NativeXComponent_ExtraMouseEventInfo** instance.| 112|int32_t [OH_NativeXComponent_GetKeyEventModifierKeyStates](_o_h___native_x_component.md#oh_nativexcomponent_getkeyeventmodifierkeystates)([OH_NativeXComponent_KeyEvent](_o_h___native_x_component.md#oh_nativexcomponent_keyevent)* keyEvent, uint64_t* keys)|Obtains the state of modifier keys from a key event.| 113|int32_t [OH_NativeXComponent_GetKeyEventNumLockState](_o_h___native_x_component.md#oh_nativexcomponent_getkeyeventnumlockstate)([OH_NativeXComponent_KeyEvent](_o_h___native_x_component.md#oh_nativexcomponent_keyevent)* keyEvent, bool* isNumLockOn) | Obtains the state of the NumLock key from a key event.| 114|int32_t [OH_NativeXComponent_GetKeyEventCapsLockState](_o_h___native_x_component.md#oh_nativexcomponent_getkeyeventcapslockstate)([OH_NativeXComponent_KeyEvent](_o_h___native_x_component.md#oh_nativexcomponent_keyevent)* keyEvent, bool* isCapsLockOn)| Obtains the state of the CapsLock key from a key event.| 115|int32_t [OH_NativeXComponent_GetKeyEventScrollLockState](_o_h___native_x_component.md#oh_nativexcomponent_getkeyeventscrolllockstate)([OH_NativeXComponent_KeyEvent](_o_h___native_x_component.md#oh_nativexcomponent_keyevent)* keyEvent, bool* isScrollLockOn) | Obtains the state of the ScrollLock key from a key event.| 116|int32_t [OH_ArkUI_XComponent_SetExpectedFrameRateRange](_o_h___native_x_component.md#oh_arkui_xcomponent_setexpectedframeraterange)([ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) node, [OH_NativeXComponent_ExpectedRateRange](_o_h___native_x_component___expected_rate_range.md) range)|Sets the expected frame rate range for the XComponent.| 117|int32_t [OH_ArkUI_XComponent_RegisterOnFrameCallback](_o_h___native_x_component.md#oh_arkui_xcomponent_registeronframecallback)([ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) node,void (*callback)([ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) node, uint64_t timestamp, uint64_t targetTimestamp))|Registers a frame callback function for the XComponent.| 118|int32_t [OH_ArkUI_XComponent_UnregisterOnFrameCallback](_o_h___native_x_component.md#oh_arkui_xcomponent_unregisteronframecallback)([ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) node)|Unregisters the frame callback function for the XComponent.| 119|int32_t [OH_ArkUI_XComponent_SetNeedSoftKeyboard](_o_h___native_x_component.md#oh_arkui_xcomponent_setneedsoftkeyboard)([ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) node, bool needSoftKeyboard) | Sets whether the soft keyboard is required for the XComponent.| 120|[ArkUI_AccessibilityProvider](arkui_native_interface_accessibility.md#arkui_accessibilityprovider)* [OH_ArkUI_AccessibilityProvider_Create](_o_h___native_x_component.md#oh_arkui_accessibilityprovider_create)([ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) node) | Creates an **ArkUI_AccessibilityProvider** instance for the XComponent.| 121|void [OH_ArkUI_AccessibilityProvider_Dispose](_o_h___native_x_component.md#oh_arkui_accessibilityprovider_dispose)([ArkUI_AccessibilityProvider](arkui_native_interface_accessibility.md#arkui_accessibilityprovider)* provider)|Destroys the [ArkUI_AccessibilityProvider](arkui_native_interface_accessibility.md#arkui_accessibilityprovider) instance created using [OH_ArkUI_AccessibilityProvider_Create](_o_h___native_x_component.md#oh_arkui_accessibilityprovider_create).| 122|void [OH_ArkUI_SurfaceCallback_SetSurfaceShowEvent](_o_h___native_x_component.md#oh_arkui_surfacecallback_setsurfaceshowevent)([OH_ArkUI_SurfaceCallback](_o_h___native_x_component.md#oh_arkui_surfacecallback)* callback,void (\*onSurfaceShow)([OH_ArkUI_SurfaceHolder](_o_h___native_x_component.md#oh_arkui_surfaceholder)* surfaceHolder))|Sets the Surface show callback for this **OH_ArkUI_SurfaceCallback** instance.| 123|void [OH_ArkUI_SurfaceCallback_SetSurfaceHideEvent](_o_h___native_x_component.md#oh_arkui_surfacecallback_setsurfacehideevent)([OH_ArkUI_SurfaceCallback](_o_h___native_x_component.md#oh_arkui_surfacecallback)* callback,void (\*onSurfaceHide)([OH_ArkUI_SurfaceHolder](_o_h___native_x_component.md#oh_arkui_surfaceholder)* surfaceHolder))|Sets the Surface hiding callback for this **OH_ArkUI_SurfaceCallback** instance.| 124|int32_t [OH_ArkUI_SurfaceHolder_SetUserData](_o_h___native_x_component.md#oh_arkui_surfaceholder_setuserdata)([OH_ArkUI_SurfaceHolder](_o_h___native_x_component.md#oh_arkui_surfaceholder)* surfaceHolder,void* userData)|Stores custom data in an **OH_ArkUI_SurfaceHolder** instance.| 125|void* [OH_ArkUI_SurfaceHolder_GetUserData](_o_h___native_x_component.md#oh_arkui_surfaceholder_getuserdata)([OH_ArkUI_SurfaceHolder](_o_h___native_x_component.md#oh_arkui_surfaceholder)* surfaceHolder)|Obtains the custom data stored in an **OH_ArkUI_SurfaceHolder** instance.| 126|void [OH_ArkUI_SurfaceCallback_SetSurfaceCreatedEvent](_o_h___native_x_component.md#oh_arkui_surfacecallback_setsurfacecreatedevent)([OH_ArkUI_SurfaceCallback](_o_h___native_x_component.md#oh_arkui_surfacecallback)* callback,void (\*onSurfaceCreated)([OH_ArkUI_SurfaceHolder](_o_h___native_x_component.md#oh_arkui_surfaceholder)\* surfaceHolder))|Sets the creation callback event in the Surface lifecycle callback.| 127|void [OH_ArkUI_SurfaceCallback_SetSurfaceChangedEvent](_o_h___native_x_component.md#oh_arkui_surfacecallback_setsurfacechangedevent)([OH_ArkUI_SurfaceCallback](_o_h___native_x_component.md#oh_arkui_surfacecallback)* callback,void (\*onSurfaceChanged)([OH_ArkUI_SurfaceHolder](_o_h___native_x_component.md#oh_arkui_surfaceholder)\* surfaceHolder,uint64_t width,uint64_t height))|Sets the size change callback event in the Surface lifecycle callback. | 128|void [OH_ArkUI_SurfaceCallback_SetSurfaceDestroyedEvent](_o_h___native_x_component.md#oh_arkui_surfacecallback_setsurfacedestroyedevent)([OH_ArkUI_SurfaceCallback](_o_h___native_x_component.md#oh_arkui_surfacecallback)* callback,void (\*onSurfaceDestroyed)([OH_ArkUI_SurfaceHolder](_o_h___native_x_component.md#oh_arkui_surfaceholder)\* surfaceHolder))|Sets the destruction callback event in the Surface lifecycle callback.| 129|int32_t [OH_ArkUI_SurfaceHolder_AddSurfaceCallback](_o_h___native_x_component.md#oh_arkui_surfaceholder_addsurfacecallback)([OH_ArkUI_SurfaceHolder](_o_h___native_x_component.md#oh_arkui_surfaceholder)* surfaceHolder,[OH_ArkUI_SurfaceCallback](_o_h___native_x_component.md#oh_arkui_surfacecallback)* callback)|Adds a Surface lifecycle callback to an **OH_ArkUI_SurfaceHolder** instance.| 130|int32_t [OH_ArkUI_SurfaceHolder_RemoveSurfaceCallback](_o_h___native_x_component.md#oh_arkui_surfaceholder_removesurfacecallback)([OH_ArkUI_SurfaceHolder](_o_h___native_x_component.md#oh_arkui_surfaceholder)* surfaceHolder,[OH_ArkUI_SurfaceCallback](_o_h___native_x_component.md#oh_arkui_surfacecallback)* callback)|Removes a previously added Surface lifecycle callback from an **OH_ArkUI_SurfaceHolder** instance.| 131|[OHNativeWindow](_o_h___native_x_component.md#ohnativewindow)* [OH_ArkUI_XComponent_GetNativeWindow](_o_h___native_x_component.md#oh_arkui_xcomponent_getnativewindow)([OH_ArkUI_SurfaceHolder](_o_h___native_x_component.md#oh_arkui_surfaceholder)* surfaceHolder)|Obtains the **NativeWindow** instance associated with an **OH_ArkUI_SurfaceHolder** instance.| 132|int32_t [OH_ArkUI_XComponent_SetAutoInitialize](_o_h___native_x_component.md#oh_arkui_xcomponent_setautoinitialize)([ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) node,bool autoInitialize)|Sets whether the XComponent needs to automatically initialize the Surface.| 133|int32_t [OH_ArkUI_XComponent_Initialize](_o_h___native_x_component.md#oh_arkui_xcomponent_initialize)([ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) node)|Initializes the Surface held by the XComponent.| 134|int32_t [OH_ArkUI_XComponent_Finalize](_o_h___native_x_component.md#oh_arkui_xcomponent_finalize)([ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) node)|Destroys the Surface held by the XComponent.| 135|int32_t [OH_ArkUI_XComponent_IsInitialized](_o_h___native_x_component.md#oh_arkui_xcomponent_isinitialized)([ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) node, bool* isInitialized)|Checks whether the Surface held by the XComponent is initialized.| 136 137 138### Variables 139 140| Name| Description| 141| -------- | -------- | 142| const uint32_t **OH_XCOMPONENT_ID_LEN_MAX** = 128 | Maximum length of the ArkUI XComponent ID.| 143| const uint32_t **OH_MAX_TOUCH_POINTS_NUMBER** = 10 | Maximum number of identifiable touch points in a touch event.| 144