• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Native XComponent
2
3
4## Overview
5
6Describes the surface and touch event held by the ArkUI XComponent, which can be used for the EGL/OpenGL ES and media data input and displayed on the ArkUI XComponent. For details, see [XComponent Development](../../napi/xcomponent-guidelines.md)
7
8**Since**
9
108
11
12
13## Summary
14
15
16### Files
17
18| Name                                      | Description                                      |
19| ---------------------------------------- | ---------------------------------------- |
20| [native_interface_xcomponent.h](native__interface__xcomponent_8h.md) | Declares the APIs for accessing **NativeXComponent**.<br>**File to include**: &lt;ace/xcomponent/native_interface_xcomponent.h&gt;<br>**Library**: libace_ndk.z.so|
21| [native_xcomponent_key_event.h](native__xcomponent__key__event_8h.md) | Declares the enums used to access **NativeXComponent** key events.<br>**File to include**: &lt;ace/xcomponent/native_xcomponent_key_event.h&gt;<br>**Library**: libace_ndk.z.so|
22
23
24### Structs
25
26| Name                                      | Description                   |
27| ---------------------------------------- | --------------------- |
28| [OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md) | Describes the touch point of the touch event.         |
29| [OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md) | Describes the touch event.                |
30| [OH_NativeXComponent_MouseEvent](_o_h___native_x_component___mouse_event.md) | Describes the mouse event.                |
31| [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) | Registers callbacks for the surface lifecycle and touch event.|
32| [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md) | Registers callbacks for the mouse event.           |
33| [OH_NativeXComponent_ExpectedRateRange](_o_h___native_x_component___expected_rate_range.md) | Defines the expected frame rate range. |
34
35
36### Types
37
38| Name                                      | Description                                  |
39| ---------------------------------------- | ------------------------------------ |
40| [OH_NativeXComponent](#oh_nativexcomponent) | Provides an encapsulated **OH_NativeXComponent** instance.         |
41| [OH_NativeXComponent_Callback](#oh_nativexcomponent_callback) | Registers callbacks for the surface lifecycle and touch event.               |
42| [OH_NativeXComponent_MouseEvent_Callback](#oh_nativexcomponent_mouseevent_callback) | Registers callbacks for the mouse event.                          |
43| [OH_NativeXComponent_KeyEvent](#oh_nativexcomponent_keyevent) | Provides an encapsulated **OH_NativeXComponent_KeyEvent** instance.|
44
45
46### Enums
47
48| Name                                      | Description        |
49| ---------------------------------------- | ---------- |
50| { OH_NATIVEXCOMPONENT_RESULT_SUCCESS = 0, OH_NATIVEXCOMPONENT_RESULT_FAILED = -1, OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER = -2 } | Enumerates the API access states.|
51| [OH_NativeXComponent_TouchEventType](#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.   |
52| [OH_NativeXComponent_TouchPointToolType](#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.  |
53| [OH_NativeXComponent_EventSourceType](#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.  |
54| [OH_NativeXComponent_MouseEventAction](#oh_nativexcomponent_mouseeventaction) { OH_NATIVEXCOMPONENT_MOUSE_NONE = 0, OH_NATIVEXCOMPONENT_MOUSE_PRESS, OH_NATIVEXCOMPONENT_MOUSE_RELEASE, OH_NATIVEXCOMPONENT_MOUSE_MOVE } | Enumerates the mouse event actions.   |
55| [OH_NativeXComponent_MouseEventButton](#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.   |
56| [OH_NativeXComponent_KeyCode](#oh_nativexcomponent_keycode) {<br>KEY_UNKNOWN = -1, KEY_FN = 0, KEY_HOME = 1, KEY_BACK = 2,KEY_MEDIA_PLAY_PAUSE = 10, KEY_MEDIA_STOP = 11, KEY_MEDIA_NEXT = 12, KEY_MEDIA_PREVIOUS = 13,<br>KEY_MEDIA_REWIND = 14, KEY_MEDIA_FAST_FORWARD = 15, KEY_VOLUME_UP = 16, KEY_VOLUME_DOWN = 17,<br>KEY_POWER = 18, KEY_CAMERA = 19, KEY_VOLUME_MUTE = 22, KEY_MUTE = 23,KEY_BRIGHTNESS_UP = 40, KEY_BRIGHTNESS_DOWN = 41, KEY_0 = 2000, KEY_1 = 2001,<br>KEY_2 = 2002, KEY_3 = 2003, KEY_4 = 2004, KEY_5 = 2005,<br>KEY_6 = 2006, KEY_7 = 2007, KEY_8 = 2008, KEY_9 = 2009,<br>KEY_STAR = 2010, KEY_POUND = 2011, KEY_DPAD_UP = 2012, KEY_DPAD_DOWN = 2013,KEY_DPAD_LEFT = 2014, KEY_DPAD_RIGHT = 2015, KEY_DPAD_CENTER = 2016,<br>KEY_A = 2017,<br>KEY_B = 2018, KEY_C = 2019, KEY_D = 2020, KEY_E = 2021,<br>KEY_F = 2022, KEY_G = 2023, KEY_H = 2024, KEY_I = 2025,<br>KEY_J = 2026, KEY_K = 2027, KEY_L = 2028, KEY_M = 2029,<br>KEY_N = 2030, KEY_O = 2031, KEY_P = 2032, KEY_Q = 2033,<br>KEY_R = 2034, KEY_S = 2035, KEY_T = 2036, KEY_U = 2037,<br>KEY_V = 2038, KEY_W = 2039, KEY_X = 2040, KEY_Y = 2041,<br>KEY_Z = 2042, KEY_COMMA = 2043, KEY_PERIOD = 2044, KEY_ALT_LEFT = 2045,<br>KEY_ALT_RIGHT = 2046, KEY_SHIFT_LEFT = 2047, KEY_SHIFT_RIGHT = 2048, KEY_TAB = 2049,<br>KEY_SPACE = 2050, KEY_SYM = 2051, KEY_EXPLORER = 2052, KEY_ENVELOPE = 2053,<br>KEY_ENTER = 2054, KEY_DEL = 2055, KEY_GRAVE = 2056, KEY_MINUS = 2057,<br>KEY_EQUALS = 2058, KEY_LEFT_BRACKET = 2059, KEY_RIGHT_BRACKET = 2060, KEY_BACKSLASH = 2061,<br>KEY_SEMICOLON = 2062, KEY_APOSTROPHE = 2063, KEY_SLASH = 2064, KEY_AT = 2065,<br>KEY_PLUS = 2066, KEY_MENU = 2067, KEY_PAGE_UP = 2068, KEY_PAGE_DOWN = 2069,<br>KEY_ESCAPE = 2070, KEY_FORWARD_DEL = 2071, KEY_CTRL_LEFT = 2072, KEY_CTRL_RIGHT = 2073,<br>KEY_CAPS_LOCK = 2074, KEY_SCROLL_LOCK = 2075, KEY_META_LEFT = 2076, KEY_META_RIGHT = 2077,<br>KEY_FUNCTION = 2078, KEY_SYSRQ = 2079, KEY_BREAK = 2080, KEY_MOVE_HOME = 2081,<br>KEY_MOVE_END = 2082, KEY_INSERT = 2083, KEY_FORWARD = 2084, KEY_MEDIA_PLAY = 2085,<br>KEY_MEDIA_PAUSE = 2086, KEY_MEDIA_CLOSE = 2087, KEY_MEDIA_EJECT = 2088, KEY_MEDIA_RECORD = 2089,<br>KEY_F1 = 2090, KEY_F2 = 2091, KEY_F3 = 2092, KEY_F4 = 2093,<br>KEY_F5 = 2094, KEY_F6 = 2095, KEY_F7 = 2096, KEY_F8 = 2097,<br>KEY_F9 = 2098, KEY_F10 = 2099, KEY_F11 = 2100, KEY_F12 = 2101,<br>KEY_NUM_LOCK = 2102, KEY_NUMPAD_0 = 2103, KEY_NUMPAD_1 = 2104, KEY_NUMPAD_2 = 2105,<br>KEY_NUMPAD_3 = 2106, KEY_NUMPAD_4 = 2107, KEY_NUMPAD_5 = 2108, KEY_NUMPAD_6 = 2109,<br>KEY_NUMPAD_7 = 2110, KEY_NUMPAD_8 = 2111, KEY_NUMPAD_9 = 2112, KEY_NUMPAD_DIVIDE = 2113,<br>KEY_NUMPAD_MULTIPLY = 2114, KEY_NUMPAD_SUBTRACT = 2115, KEY_NUMPAD_ADD = 2116, KEY_NUMPAD_DOT = 2117,<br>KEY_NUMPAD_COMMA = 2118, KEY_NUMPAD_ENTER = 2119, KEY_NUMPAD_EQUALS = 2120, KEY_NUMPAD_LEFT_PAREN = 2121,<br>KEY_NUMPAD_RIGHT_PAREN = 2122, KEY_VIRTUAL_MULTITASK = 2210, KEY_SLEEP = 2600, KEY_ZENKAKU_HANKAKU = 2601,<br>KEY_102ND = 2602, KEY_RO = 2603, KEY_KATAKANA = 2604, KEY_HIRAGANA = 2605,<br>KEY_HENKAN = 2606, KEY_KATAKANA_HIRAGANA = 2607, KEY_MUHENKAN = 2608, KEY_LINEFEED = 2609,<br>KEY_MACRO = 2610, KEY_NUMPAD_PLUSMINUS = 2611, KEY_SCALE = 2612, KEY_HANGUEL = 2613,<br>KEY_HANJA = 2614, KEY_YEN = 2615, KEY_STOP = 2616, KEY_AGAIN = 2617,<br>KEY_PROPS = 2618, KEY_UNDO = 2619, KEY_COPY = 2620, KEY_OPEN = 2621,<br>KEY_PASTE = 2622, KEY_FIND = 2623, KEY_CUT = 2624, KEY_HELP = 2625,<br>KEY_CALC = 2626, KEY_FILE = 2627, KEY_BOOKMARKS = 2628, KEY_NEXT = 2629,<br>KEY_PLAYPAUSE = 2630, KEY_PREVIOUS = 2631, KEY_STOPCD = 2632, KEY_CONFIG = 2634,<br>KEY_REFRESH = 2635, KEY_EXIT = 2636, KEY_EDIT = 2637, KEY_SCROLLUP = 2638,<br>KEY_SCROLLDOWN = 2639, KEY_NEW = 2640, KEY_REDO = 2641, KEY_CLOSE = 2642,<br>KEY_PLAY = 2643, KEY_BASSBOOST = 2644, KEY_PRINT = 2645, KEY_CHAT = 2646,<br>KEY_FINANCE = 2647, KEY_CANCEL = 2648, KEY_KBDILLUM_TOGGLE = 2649, KEY_KBDILLUM_DOWN = 2650,<br>KEY_KBDILLUM_UP = 2651, KEY_SEND = 2652, KEY_REPLY = 2653, KEY_FORWARDMAIL = 2654,<br>KEY_SAVE = 2655, KEY_DOCUMENTS = 2656, KEY_VIDEO_NEXT = 2657, KEY_VIDEO_PREV = 2658,<br>KEY_BRIGHTNESS_CYCLE = 2659, KEY_BRIGHTNESS_ZERO = 2660, KEY_DISPLAY_OFF = 2661, KEY_BTN_MISC = 2662,<br>KEY_GOTO = 2663, KEY_INFO = 2664, KEY_PROGRAM = 2665, KEY_PVR = 2666,<br>KEY_SUBTITLE = 2667, KEY_FULL_SCREEN = 2668, KEY_KEYBOARD = 2669, KEY_ASPECT_RATIO = 2670,<br>KEY_PC = 2671, KEY_TV = 2672, KEY_TV2 = 2673, KEY_VCR = 2674,<br>KEY_VCR2 = 2675, KEY_SAT = 2676, KEY_CD = 2677, KEY_TAPE = 2678,<br>KEY_TUNER = 2679, KEY_PLAYER = 2680, KEY_DVD = 2681, KEY_AUDIO = 2682,<br>KEY_VIDEO = 2683, KEY_MEMO = 2684, KEY_CALENDAR = 2685, KEY_RED = 2686,<br>KEY_GREEN = 2687, KEY_YELLOW = 2688, KEY_BLUE = 2689, KEY_CHANNELUP = 2690,<br>KEY_CHANNELDOWN = 2691, KEY_LAST = 2692, KEY_RESTART = 2693, KEY_SLOW = 2694,<br>KEY_SHUFFLE = 2695, KEY_VIDEOPHONE = 2696, KEY_GAMES = 2697, KEY_ZOOMIN = 2698,<br>KEY_ZOOMOUT = 2699, KEY_ZOOMRESET = 2700, KEY_WORDPROCESSOR = 2701, KEY_EDITOR = 2702,<br>KEY_SPREADSHEET = 2703, KEY_GRAPHICSEDITOR = 2704, KEY_PRESENTATION = 2705, KEY_DATABASE = 2706,<br>KEY_NEWS = 2707, KEY_VOICEMAIL = 2708, KEY_ADDRESSBOOK = 2709, KEY_MESSENGER = 2710,<br>KEY_BRIGHTNESS_TOGGLE = 2711, KEY_SPELLCHECK = 2712, KEY_COFFEE = 2713, KEY_MEDIA_REPEAT = 2714,<br>KEY_IMAGES = 2715, KEY_BUTTONCONFIG = 2716, KEY_TASKMANAGER = 2717, KEY_JOURNAL = 2718,<br>KEY_CONTROLPANEL = 2719, KEY_APPSELECT = 2720, KEY_SCREENSAVER = 2721, KEY_ASSISTANT = 2722,<br>KEY_KBD_LAYOUT_NEXT = 2723, KEY_BRIGHTNESS_MIN = 2724, KEY_BRIGHTNESS_MAX = 2725, KEY_KBDINPUTASSIST_PREV = 2726,<br>KEY_KBDINPUTASSIST_NEXT = 2727, KEY_KBDINPUTASSIST_PREVGROUP = 2728, KEY_KBDINPUTASSIST_NEXTGROUP = 2729, KEY_KBDINPUTASSIST_ACCEPT = 2730,<br>KEY_KBDINPUTASSIST_CANCEL = 2731, KEY_FRONT = 2800, KEY_SETUP = 2801, KEY_WAKEUP = 2802,<br>KEY_SENDFILE = 2803, KEY_DELETEFILE = 2804, KEY_XFER = 2805, KEY_PROG1 = 2806,<br>KEY_PROG2 = 2807, KEY_MSDOS = 2808, KEY_SCREENLOCK = 2809, KEY_DIRECTION_ROTATE_DISPLAY = 2810,<br>KEY_CYCLEWINDOWS = 2811, KEY_COMPUTER = 2812, KEY_EJECTCLOSECD = 2813, KEY_ISO = 2814,<br>KEY_MOVE = 2815, KEY_F13 = 2816, KEY_F14 = 2817, KEY_F15 = 2818,<br>KEY_F16 = 2819, KEY_F17 = 2820, KEY_F18 = 2821, KEY_F19 = 2822,<br>KEY_F20 = 2823, KEY_F21 = 2824, KEY_F22 = 2825, KEY_F23 = 2826,<br>KEY_F24 = 2827, KEY_PROG3 = 2828, KEY_PROG4 = 2829, KEY_DASHBOARD = 2830,<br>KEY_SUSPEND = 2831, KEY_HP = 2832, KEY_SOUND = 2833, KEY_QUESTION = 2834,<br>KEY_CONNECT = 2836, KEY_SPORT = 2837, KEY_SHOP = 2838, KEY_ALTERASE = 2839,<br>KEY_SWITCHVIDEOMODE = 2841, KEY_BATTERY = 2842, KEY_BLUETOOTH = 2843, KEY_WLAN = 2844,<br>KEY_UWB = 2845, KEY_WWAN_WIMAX = 2846, KEY_RFKILL = 2847, KEY_CHANNEL = 3001,<br>KEY_BTN_0 = 3100, KEY_BTN_1 = 3101, KEY_BTN_2 = 3102, KEY_BTN_3 = 3103,<br>KEY_BTN_4 = 3104, KEY_BTN_5 = 3105, KEY_BTN_6 = 3106, KEY_BTN_7 = 3107,<br>KEY_BTN_8 = 3108, KEY_BTN_9 = 3109<br>} | Enumerates the mouse event key codes.  |
57| [OH_NativeXComponent_KeyAction](#oh_nativexcomponent_keyaction) { OH_NATIVEXCOMPONENT_KEY_ACTION_UNKNOWN = -1, OH_NATIVEXCOMPONENT_KEY_ACTION_DOWN = 0, OH_NATIVEXCOMPONENT_KEY_ACTION_UP } | Enumerates the key event actions.   |
58
59
60### Functions
61
62| Name                                      | Description                                    |
63| ---------------------------------------- | -------------------------------------- |
64| [OH_NativeXComponent_GetXComponentId](#oh_nativexcomponent_getxcomponentid) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, char \*id, uint64_t \*size) | Obtains the ID of the ArkUI XComponent.           |
65| [OH_NativeXComponent_GetXComponentSize](#oh_nativexcomponent_getxcomponentsize) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, const void \*window, uint64_t \*width, uint64_t \*height) | Obtains the size of the surface held by the ArkUI XComponent. |
66| [OH_NativeXComponent_GetXComponentOffset](#oh_nativexcomponent_getxcomponentoffset) ([OH_NativeXComponent](#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.|
67| [OH_NativeXComponent_GetTouchEvent](#oh_nativexcomponent_gettouchevent) ([OH_NativeXComponent](#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.       |
68| [OH_NativeXComponent_GetTouchPointToolType](#oh_nativexcomponent_gettouchpointtooltype) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, uint32_t pointIndex, [OH_NativeXComponent_TouchPointToolType](#oh_nativexcomponent_touchpointtooltype) \*toolType) | Obtains the ArkUI XComponent touch point tool type.       |
69| [OH_NativeXComponent_GetTouchPointTiltX](#oh_nativexcomponent_gettouchpointtiltx) ([OH_NativeXComponent](#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.    |
70| [OH_NativeXComponent_GetTouchPointTiltY](#oh_nativexcomponent_gettouchpointtilty) ([OH_NativeXComponent](#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.    |
71| [OH_NativeXComponent_GetMouseEvent](#oh_nativexcomponent_getmouseevent) ([OH_NativeXComponent](#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.       |
72| [OH_NativeXComponent_RegisterCallback](#oh_nativexcomponent_registercallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) \*callback) | Registers a callback for this **OH_NativeXComponent** instance.          |
73| [OH_NativeXComponent_RegisterMouseEventCallback](#oh_nativexcomponent_registermouseeventcallback) ([OH_NativeXComponent](#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.      |
74| [OH_NativeXComponent_RegisterFocusEventCallback](#oh_nativexcomponent_registerfocuseventcallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](#oh_nativexcomponent) \*component, void \*window)) | Registers the focus obtaining event callback for this **OH_NativeXComponent** instance.      |
75| [OH_NativeXComponent_RegisterKeyEventCallback](#oh_nativexcomponent_registerkeyeventcallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](#oh_nativexcomponent) \*component, void \*window)) | Registers the key event callback for this **OH_NativeXComponent** instance.      |
76| [OH_NativeXComponent_RegisterBlurEventCallback](#oh_nativexcomponent_registerblureventcallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](#oh_nativexcomponent) \*component, void \*window)) | Registers the focus loss event callback for this **OH_NativeXComponent** instance.      |
77| [OH_NativeXComponent_GetKeyEvent](#oh_nativexcomponent_getkeyevent) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, [OH_NativeXComponent_KeyEvent](#oh_nativexcomponent_keyevent) \*\*keyEvent) | Obtains the key event scheduled by the ArkUI XComponent.       |
78| [OH_NativeXComponent_GetKeyEventAction](#oh_nativexcomponent_getkeyeventaction) ([OH_NativeXComponent_KeyEvent](#oh_nativexcomponent_keyevent) \*keyEvent, [OH_NativeXComponent_KeyAction](#oh_nativexcomponent_keyaction) \*action) | Obtains the action of the specified key event.                          |
79| [OH_NativeXComponent_GetKeyEventCode](#oh_nativexcomponent_getkeyeventcode) ([OH_NativeXComponent_KeyEvent](#oh_nativexcomponent_keyevent) \*keyEvent, [OH_NativeXComponent_KeyCode](#oh_nativexcomponent_keycode) \*code) | Obtains the key code of the specified key event.                         |
80| [OH_NativeXComponent_GetKeyEventSourceType](#oh_nativexcomponent_getkeyeventsourcetype) ([OH_NativeXComponent_KeyEvent](#oh_nativexcomponent_keyevent) \*keyEvent, [OH_NativeXComponent_EventSourceType](#oh_nativexcomponent_eventsourcetype) \*sourceType) | Obtains the source type of the specified key event.                       |
81| [OH_NativeXComponent_GetKeyEventDeviceId](#oh_nativexcomponent_getkeyeventdeviceid) ([OH_NativeXComponent_KeyEvent](#oh_nativexcomponent_keyevent) \*keyEvent, int64_t \*deviceId) | Obtains the device ID of the specified key event.                        |
82| [OH_NativeXComponent_GetKeyEventTimeStamp](#oh_nativexcomponent_getkeyeventtimestamp) ([OH_NativeXComponent_KeyEvent](#oh_nativexcomponent_keyevent) \*keyEvent, int64_t \*timeStamp) | Obtains the timestamp of the specified key event.                         |
83| [OH_NativeXComponent_SetExpectedFrameRateRange](#oh_nativexcomponent_setexpectedframeraterange) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, [OH_NativeXComponent_ExpectedRateRange](_o_h___native_x_component___expected_rate_range.md) \*range) | Sets the expected frame rate range.                                          |
84| [OH_NativeXComponent_RegisterOnFrameCallback](#oh_nativexcomponent_registeronframecallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](#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.|
85| [OH_NativeXComponent_UnregisterOnFrameCallback](#oh_nativexcomponent_unregisteronframecallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component) | Deregisters the display update callback for this **OH_NativeXComponent** instance and disables the callback for each frame.|
86
87
88### Variables
89
90| Name                                      | Description                            |
91| ---------------------------------------- | ------------------------------ |
92| **OH_XCOMPONENT_ID_LEN_MAX** = 128 | Maximum length of the ArkUI XComponent ID. |
93| **OH_MAX_TOUCH_POINTS_NUMBER** = 10 | Maximum number of identifiable touch points in a touch event.           |
94| [OH_NativeXComponent_TouchPoint::id](#id-12) = 0 | Unique identifier of the finger.                     |
95| [OH_NativeXComponent_TouchPoint::screenX](#screenx-13) = 0.0 | X coordinate of the touch point relative to the left edge of the application window where the XComponent is located.|
96| [OH_NativeXComponent_TouchPoint::screenY](#screeny-13) = 0.0 | Y coordinate of the touch point relative to the left edge of the application window where the XComponent is located.|
97| [OH_NativeXComponent_TouchPoint::x](#x-13) = 0.0 | X coordinate of the touch point relative to the left edge of the XComponent.    |
98| [OH_NativeXComponent_TouchPoint::y](#y-13) = 0.0 | Y coordinate of the touch point relative to the upper edge of the XComponent.    |
99| [OH_NativeXComponent_TouchPoint::type](#type-12) = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN | Touch type of the touch event.                    |
100| [OH_NativeXComponent_TouchPoint::size](#size-12) = 0.0 | Contact area between the finger pad and the screen.                 |
101| [OH_NativeXComponent_TouchPoint::force](#force-12) = 0.0 | Pressure of the touch event.                    |
102| [OH_NativeXComponent_TouchPoint::timeStamp](#timestamp-12) = 0 | Timestamp of the touch point.                   |
103| [OH_NativeXComponent_TouchPoint::isPressed](#ispressed) = false | Whether the current point is pressed.                     |
104| [OH_NativeXComponent_TouchEvent::id](#id-22) = 0 | Unique identifier of the finger.                     |
105| [OH_NativeXComponent_TouchEvent::screenX](#screenx-23) = 0.0 | X coordinate of the touch point relative to the left edge of the screen.              |
106| [OH_NativeXComponent_TouchEvent::screenY](#screeny-23) = 0.0 | Y coordinate of the touch point relative to the upper edge of the screen.              |
107| [OH_NativeXComponent_TouchEvent::x](#x-23) = 0.0 | X coordinate of the touch point relative to the left edge of the XComponent.    |
108| [OH_NativeXComponent_TouchEvent::y](#y-23) = 0.0 | Y coordinate of the touch point relative to the upper edge of the XComponent.    |
109| [OH_NativeXComponent_TouchEvent::type](#type-22) = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN | Touch type of the touch event.                    |
110| [OH_NativeXComponent_TouchEvent::size](#size-22) = 0.0 | Contact area between the finger pad and the screen.                 |
111| [OH_NativeXComponent_TouchEvent::force](#force-22) = 0.0 | Pressure of the touch event.                    |
112| [OH_NativeXComponent_TouchEvent::deviceId](#deviceid) = 0 | ID of the device where the current touch event is triggered.               |
113| [OH_NativeXComponent_TouchEvent::timeStamp](#timestamp-22) = 0 | Timestamp of the touch event.                   |
114| [OH_NativeXComponent_TouchEvent::touchPoints](#touchpoints) [OH_MAX_TOUCH_POINTS_NUMBER] | Array of the touch points.                     |
115| [OH_NativeXComponent_TouchEvent::numPoints](#numpoints) = 0 | Number of current touch points.                     |
116| [OH_NativeXComponent_MouseEvent::x](#x-33) = 0.0 | X coordinate of the clicked point relative to the upper left corner of the component.          |
117| [OH_NativeXComponent_MouseEvent::y](#y-33)= 0.0 | Y coordinate of the clicked point relative to the upper left corner of the component.          |
118| [OH_NativeXComponent_MouseEvent::screenX](#screenx-33)= 0.0 | X coordinate of the clicked point relative to the upper left corner of the screen.            |
119| [OH_NativeXComponent_MouseEvent::screenY](#screeny-33)= 0.0 | Y coordinate of the clicked point relative to the upper left corner of the screen.            |
120| [OH_NativeXComponent_MouseEvent::timestamp](#timestamp)= 0 | Timestamp of the mouse event.                   |
121| [OH_NativeXComponent_MouseEvent::action](#action)= [OH_NativeXComponent_MouseEventAction::OH_NATIVEXCOMPONENT_MOUSE_NONE](#oh_nativexcomponent_mouseeventaction) | Action of the mouse event.                     |
122| [OH_NativeXComponent_MouseEvent::button](#button)= [OH_NativeXComponent_MouseEventButton::OH_NATIVEXCOMPONENT_NONE_BUTTON](#oh_nativexcomponent_mouseeventbutton) | Enumerates the mouse event buttons.                       |
123| [OH_NativeXComponent_Callback::OnSurfaceCreated](#onsurfacecreated) | Invoked when a surface is created.                 |
124| [OH_NativeXComponent_Callback::OnSurfaceChanged](#onsurfacechanged) | Invoked when the surface changes.                |
125| [OH_NativeXComponent_Callback::OnSurfaceDestroyed](#onsurfacedestroyed) | Invoked when the surface is destroyed.               |
126| [OH_NativeXComponent_Callback::DispatchTouchEvent](#dispatchtouchevent) | Invoked when a touch event is triggered.                  |
127| [OH_NativeXComponent_MouseEvent_Callback::DispatchMouseEvent](#dispatchmouseevent) | Invoked when a mouse event is triggered.                  |
128| [OH_NativeXComponent_MouseEvent_Callback::DispatchHoverEvent](#dispatchhoverevent) | Invoked when a hover event is triggered.                  |
129
130
131## Type Description
132
133
134### OH_NativeXComponent
135
136```
137typedef struct OH_NativeXComponent OH_NativeXComponent
138```
139
140**Description**
141
142Provides an encapsulated **OH_NativeXComponent** instance.
143
144**Since**
145
1468
147
148
149### OH_NativeXComponent_Callback
150
151```
152typedef struct OH_NativeXComponent_Callback OH_NativeXComponent_Callback
153```
154
155**Description**
156
157Registers callbacks for the surface lifecycle and touch event.
158
159**Since**
160
1618
162
163
164### OH_NativeXComponent_KeyEvent
165
166```
167typedef struct OH_NativeXComponent_KeyEvent OH_NativeXComponent_KeyEvent
168```
169
170**Description**
171
172Provides an encapsulated **OH_NativeXComponent_KeyEvent** instance.
173
174**Since**
175
17610
177
178
179### OH_NativeXComponent_MouseEvent_Callback
180
181```
182typedef struct OH_NativeXComponent_MouseEvent_Callback OH_NativeXComponent_MouseEvent_Callback
183```
184
185**Description**
186
187Registers callbacks for the mouse event.
188
189**Since**
190
1919
192
193
194## Enum Description
195
196
197### anonymous enum
198
199```
200anonymous enum
201```
202
203**Description**
204
205Enumerates the API access states.
206
207| Value                                     | Description   |
208| ---------------------------------------- | ----- |
209| OH_NATIVEXCOMPONENT_RESULT_SUCCESS       | Success.|
210| OH_NATIVEXCOMPONENT_RESULT_FAILED        | Failure.|
211| OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER | Invalid parameter.|
212
213**Since**
214
2158
216
217
218### OH_NativeXComponent_EventSourceType
219
220```
221enum OH_NativeXComponent_EventSourceType
222```
223
224**Description**
225
226Enumerates the touch event source types.
227
228| Value                                     | Description                 |
229| ---------------------------------------- | ------------------- |
230| OH_NATIVEXCOMPONENT_SOURCE_TYPE_UNKNOWN  | Unknown source type.          |
231| OH_NATIVEXCOMPONENT_SOURCE_TYPE_MOUSE    | Source that generates a mouse multi-click event.   |
232| OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHSCREEN | Source that generates a touchscreen multi-touch event.|
233| OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHPAD | Source that generates a touchpad multi-touch event.|
234| OH_NATIVEXCOMPONENT_SOURCE_TYPE_JOYSTICK | Source that generates a joystick multi-touch event.|
235| OH_NATIVEXCOMPONENT_SOURCE_TYPE_KEYBOARD | Source that generates a key event.     |
236
237**Since**
238
2399
240
241
242### OH_NativeXComponent_KeyAction
243
244```
245enum OH_NativeXComponent_KeyAction
246```
247
248**Description**
249
250Enumerates the key event actions.
251
252| Value                                   | Description      |
253| -------------------------------------- | -------- |
254| OH_NATIVEXCOMPONENT_KEY_ACTION_UNKNOWN | Unknown key event action.|
255| OH_NATIVEXCOMPONENT_KEY_ACTION_DOWN    | Button press. |
256| OH_NATIVEXCOMPONENT_KEY_ACTION_UP      | Button release. |
257
258**Since**
259
26010
261
262
263### OH_NativeXComponent_KeyCode
264
265```
266enum OH_NativeXComponent_KeyCode
267```
268
269**Description**
270
271Enumerates the mouse event key codes.
272
273| Value                         | Description                         |
274| ---------------------------- | --------------------------- |
275| KEY_UNKNOWN                  | Unknown key.                       |
276| KEY_FN                       | Function (Fn) key.                    |
277| KEY_HOME                     | Function (Home) key.                  |
278| KEY_BACK                     | Back key.                        |
279| KEY_MEDIA_PLAY_PAUSE         | Multimedia key - play/pause.            |
280| KEY_MEDIA_STOP               | Multimedia key - stop.               |
281| KEY_MEDIA_NEXT               | Multimedia key - next song.              |
282| KEY_MEDIA_PREVIOUS           | Multimedia key - previous song.              |
283| KEY_MEDIA_REWIND             | Multimedia key - rewind.               |
284| KEY_MEDIA_FAST_FORWARD       | Multimedia key - fast-forward.               |
285| KEY_VOLUME_UP                | Volume Up key.                      |
286| KEY_VOLUME_DOWN              | Volume Down key.                      |
287| KEY_POWER                    | Power key.                        |
288| KEY_CAMERA                   | Camera key.                        |
289| KEY_VOLUME_MUTE              | Speaker Mute key.                     |
290| KEY_MUTE                     | Microphone Mute key.                      |
291| KEY_BRIGHTNESS_UP            | Brightness key - turn up.             |
292| KEY_BRIGHTNESS_DOWN          | Brightness key - turn down.             |
293| KEY_0                        | Key **0**.                      |
294| KEY_1                        | Key **1**.                      |
295| KEY_2                        | Key **2**.                      |
296| KEY_3                        | Key **3**.                      |
297| KEY_4                        | Key **4**.                      |
298| KEY_5                        | Key **5**.                      |
299| KEY_6                        | Key **6**.                      |
300| KEY_7                        | Key **7**.                      |
301| KEY_8                        | Key **8**.                      |
302| KEY_9                        | Key **9**.                      |
303| KEY_STAR                     | Key **\***.                     |
304| KEY_POUND                    | Key **\#**.                     |
305| KEY_DPAD_UP                  | Navigation key - up.                |
306| KEY_DPAD_DOWN                | Navigation key - down.                |
307| KEY_DPAD_LEFT                | Navigation key - left.                |
308| KEY_DPAD_RIGHT               | Navigation key - right.                |
309| KEY_DPAD_CENTER              | Navigation key - OK.               |
310| KEY_A                        | Key **A**.                      |
311| KEY_B                        | Key **B**.                      |
312| KEY_C                        | Key **C**.                      |
313| KEY_D                        | Key **D**.                      |
314| KEY_E                        | Key **E**.                      |
315| KEY_F                        | Key **F**.                      |
316| KEY_G                        | Key **G**.                      |
317| KEY_H                        | Key **H**.                      |
318| KEY_I                        | Key **I**.                      |
319| KEY_J                        | Key **J**.                      |
320| KEY_K                        | Key **K**.                      |
321| KEY_L                        | Key **L**.                      |
322| KEY_M                        | Key **M**.                      |
323| KEY_N                        | Key **N**.                      |
324| KEY_O                        | Key **O**.                      |
325| KEY_P                        | Key **P**.                      |
326| KEY_Q                        | Key **Q**.                      |
327| KEY_R                        | Key **R**.                      |
328| KEY_S                        | Key **S**.                      |
329| KEY_T                        | Key **T**.                      |
330| KEY_U                        | Key **U**.                      |
331| KEY_V                        | Key **V**.                      |
332| KEY_W                        | Key **W**.                      |
333| KEY_X                        | Key **X**.                      |
334| KEY_Y                        | Key **Y**.                      |
335| KEY_Z                        | Key **Z**.                      |
336| KEY_COMMA                    | Key **,**.                      |
337| KEY_PERIOD                   | Key **.**.                      |
338| KEY_ALT_LEFT                 | Left Alt key.                      |
339| KEY_ALT_RIGHT                | Right Alt key.                      |
340| KEY_SHIFT_LEFT               | Left Shift key.                    |
341| KEY_SHIFT_RIGHT              | Right Shift key.                    |
342| KEY_TAB                      | Tab key.                       |
343| KEY_SPACE                    | Space key.                        |
344| KEY_SYM                      | Symbol key.                    |
345| KEY_EXPLORER                 | Explorer key, which is used to start the explorer application.      |
346| KEY_ENVELOPE                 | Email key, which is used to start the email application.    |
347| KEY_ENTER                    | Enter key.                        |
348| KEY_DEL                      | Delete key.                        |
349| KEY_GRAVE                    | Key **`**.                      |
350| KEY_MINUS                    | Key **-**.                      |
351| KEY_EQUALS                   | Key **=**.                      |
352| KEY_LEFT_BRACKET             | Key **[**.                      |
353| KEY_RIGHT_BRACKET            | Key **]**.                      |
354| KEY_BACKSLASH                | Key **\**.                      |
355| KEY_SEMICOLON                | Key **;**.                      |
356| KEY_APOSTROPHE               | Key **'**.           |
357| KEY_SLASH                    | Key **/**.                      |
358| KEY_AT                       | Key **\@**.                     |
359| KEY_PLUS                     | Key **+**.                      |
360| KEY_MENU                     | Menu key.                        |
361| KEY_PAGE_UP                  | Page Up key.                      |
362| KEY_PAGE_DOWN                | Page Down key.                      |
363| KEY_ESCAPE                   | ESC key.                       |
364| KEY_FORWARD_DEL              | Delete key.                        |
365| KEY_CTRL_LEFT                | Left Ctrl key.                     |
366| KEY_CTRL_RIGHT               | Right Ctrl key.                     |
367| KEY_CAPS_LOCK                | Caps Lock key.                      |
368| KEY_SCROLL_LOCK              | Scroll Lock key.                      |
369| KEY_META_LEFT                | Left Meta key.                     |
370| KEY_META_RIGHT               | Right Meta key.                     |
371| KEY_FUNCTION                 | Function key.                        |
372| KEY_SYSRQ                    | System Request/Print Screen key.                 |
373| KEY_BREAK                    | Break/Pause key.               |
374| KEY_MOVE_HOME                | Move to Home key.                   |
375| KEY_MOVE_END                 | Move to End key.                   |
376| KEY_INSERT                   | Insert key.                        |
377| KEY_FORWARD                  | Forward key.                        |
378| KEY_MEDIA_PLAY               | Multimedia key - play.               |
379| KEY_MEDIA_PAUSE              | Multimedia key - pause.               |
380| KEY_MEDIA_CLOSE              | Multimedia key - close.               |
381| KEY_MEDIA_EJECT              | Multimedia key - eject.               |
382| KEY_MEDIA_RECORD             | Multimedia key - record.               |
383| KEY_F1                       | F1 key.                     |
384| KEY_F2                       | F2 key.                     |
385| KEY_F3                       | F3 key.                     |
386| KEY_F4                       | F4 key.                     |
387| KEY_F5                       | F5 key.                     |
388| KEY_F6                       | F6 key.                     |
389| KEY_F7                       | F7 key.                     |
390| KEY_F8                       | F8 key.                     |
391| KEY_F9                       | F9 key.                     |
392| KEY_F10                      | F10 key.                    |
393| KEY_F11                      | F11 key.                    |
394| KEY_F12                      | F12 key.                    |
395| KEY_NUM_LOCK                 | Number Lock key.                       |
396| KEY_NUMPAD_0                 | Key **0** on numeric keypad.                   |
397| KEY_NUMPAD_1                 | Key **1** on numeric keypad.                   |
398| KEY_NUMPAD_2                 | Key **2** on numeric keypad.                   |
399| KEY_NUMPAD_3                 | Key **3** on numeric keypad.                   |
400| KEY_NUMPAD_4                 | Key **4** on numeric keypad.                   |
401| KEY_NUMPAD_5                 | Key **5** on numeric keypad.                   |
402| KEY_NUMPAD_6                 | Key **6** on numeric keypad.                   |
403| KEY_NUMPAD_7                 | Key **7** on numeric keypad.                   |
404| KEY_NUMPAD_8                 | Key **8** on numeric keypad.                   |
405| KEY_NUMPAD_9                 | Key **9** on numeric keypad.                   |
406| KEY_NUMPAD_DIVIDE            | Key **/** on numeric keypad.                   |
407| KEY_NUMPAD_MULTIPLY          | Key ***** on numeric keypad.                  |
408| KEY_NUMPAD_SUBTRACT          | Key **-** on numeric keypad.                   |
409| KEY_NUMPAD_ADD               | Key **+** on numeric keypad.                   |
410| KEY_NUMPAD_DOT               | Key **.** on numeric keypad.                   |
411| KEY_NUMPAD_COMMA             | Key **,** on numeric keypad.                   |
412| KEY_NUMPAD_ENTER             | Enter key on numeric keypad.                    |
413| KEY_NUMPAD_EQUALS            | Key **=** on numeric keypad.                   |
414| KEY_NUMPAD_LEFT_PAREN        | Key **(** on numeric keypad.                   |
415| KEY_NUMPAD_RIGHT_PAREN       | Key **)** on numeric keypad.                   |
416| KEY_VIRTUAL_MULTITASK        | Multi-task key.                     |
417| KEY_SLEEP                    | Sleep key.                        |
418| KEY_ZENKAKU_HANKAKU          | Zenkaku/Hankaku key.                   |
419| KEY_102ND                    | 102nd key.                    |
420| KEY_RO                       | Ro key.                      |
421| KEY_KATAKANA                 | Katakana key.                     |
422| KEY_HIRAGANA                 | Hiragana key.                     |
423| KEY_HENKAN                   | Henkan key.                      |
424| KEY_KATAKANA_HIRAGANA        | Katakana/Hiragana key.                 |
425| KEY_MUHENKAN                 | Muhenkan key.                     |
426| KEY_LINEFEED                 | Linefeed key.                        |
427| KEY_MACRO                    | Macro key.                         |
428| KEY_NUMPAD_PLUSMINUS         | Plus/Minus key on the numeric keypad.               |
429| KEY_SCALE                    | Scale key.                        |
430| KEY_HANGUEL                  | Hanguel key.                      |
431| KEY_HANJA                    | Hanja key.                      |
432| KEY_YEN                      | Yen key.                        |
433| KEY_STOP                     | Stop key.                        |
434| KEY_AGAIN                    | Again key.                        |
435| KEY_PROPS                    | Props key.                        |
436| KEY_UNDO                     | Undo key.                        |
437| KEY_COPY                     | Copy key.                        |
438| KEY_OPEN                     | Open key.                        |
439| KEY_PASTE                    | Paste key.                        |
440| KEY_FIND                     | Find key.                        |
441| KEY_CUT                      | Cut key.                        |
442| KEY_HELP                     | Help key.                        |
443| KEY_CALC                     | Calc key, which is used to start the calculator application.       |
444| KEY_FILE                     | File key.                       |
445| KEY_BOOKMARKS                | Bookmarks key.                        |
446| KEY_NEXT                     | Next key.                      |
447| KEY_PLAYPAUSE                | Play/Pause key.                     |
448| KEY_PREVIOUS                 | Previous key.                      |
449| KEY_STOPCD                   | Stop CD key.                      |
450| KEY_CONFIG                   | Config key.                        |
451| KEY_REFRESH                  | Refresh key.                        |
452| KEY_EXIT                     | Exit key.                        |
453| KEY_EDIT                     | Edit key.                        |
454| KEY_SCROLLUP                 | Scroll Up key.                      |
455| KEY_SCROLLDOWN               | Scroll Down key.                      |
456| KEY_NEW                      | New key.                        |
457| KEY_REDO                     | Redo key.                        |
458| KEY_CLOSE                    | Close key.                        |
459| KEY_PLAY                     | Play key.                        |
460| KEY_BASSBOOST                | Bass Boost key.                      |
461| KEY_PRINT                    | Print key.                        |
462| KEY_CHAT                     | Chat key.                        |
463| KEY_FINANCE                  | Finance key.                        |
464| KEY_CANCEL                   | Cancel key.                        |
465| KEY_KBDILLUM_TOGGLE          | Keyboard Illumination Toggle key.                    |
466| KEY_KBDILLUM_DOWN            | Keyboard Illumination Up key.                    |
467| KEY_KBDILLUM_UP              | Keyboard Illumination Down key.                    |
468| KEY_SEND                     | Send key.                        |
469| KEY_REPLY                    | Reply key.                        |
470| KEY_FORWARDMAIL              | Forward Mail key.                      |
471| KEY_SAVE                     | Save key.                        |
472| KEY_DOCUMENTS                | Documents key.                        |
473| KEY_VIDEO_NEXT               | Next Video key.                     |
474| KEY_VIDEO_PREV               | Previous Video key.                     |
475| KEY_BRIGHTNESS_CYCLE         | Brightness Cycle key.                      |
476| KEY_BRIGHTNESS_ZERO          | Brightness Zero key.                    |
477| KEY_DISPLAY_OFF              | Display Off Key.                      |
478| KEY_BTN_MISC                 | Misc Button key.                 |
479| KEY_GOTO                     | Goto key.                        |
480| KEY_INFO                     | Info key.                      |
481| KEY_PROGRAM                  | Program key.                        |
482| KEY_PVR                      | PVR key.                |
483| KEY_SUBTITLE                 | Subtitle key.                        |
484| KEY_FULL_SCREEN              | Full Screen key.                        |
485| KEY_KEYBOARD                 | Keyboard.                         |
486| KEY_ASPECT_RATIO             | Aspect Ratio key.                   |
487| KEY_PC                       | Port Control key.                      |
488| KEY_TV                       | TV key.                        |
489| KEY_TV2                      | TV key 2.                       |
490| KEY_VCR                      | VCR key.                     |
491| KEY_VCR2                     | VCR key 2.                    |
492| KEY_SAT                      | SAT key.            |
493| KEY_CD                       | CD key.                        |
494| KEY_TAPE                     | Tape key.                        |
495| KEY_TUNER                    | Tuner key.                       |
496| KEY_PLAYER                   | Player key.                       |
497| KEY_DVD                      | DVD key.                       |
498| KEY_AUDIO                    | Audio key.                        |
499| KEY_VIDEO                    | Video key.                        |
500| KEY_MEMO                     | Memo key.                       |
501| KEY_CALENDAR                 | Calendar key.                        |
502| KEY_RED                      | Red indicator.                      |
503| KEY_GREEN                    | Green indicator.                      |
504| KEY_YELLOW                   | Yellow indicator.                      |
505| KEY_BLUE                     | Blue indicator.                      |
506| KEY_CHANNELUP                | Channel Up key.                      |
507| KEY_CHANNELDOWN              | Channel Down key.                      |
508| KEY_LAST                     | Last key.                        |
509| KEY_RESTART                  | Restart key.                        |
510| KEY_SLOW                     | Slow key.                        |
511| KEY_SHUFFLE                  | Shuffle key.                      |
512| KEY_VIDEOPHONE               | Videophone key.                      |
513| KEY_GAMES                    | Games key.                        |
514| KEY_ZOOMIN                   | Zoom in key.                        |
515| KEY_ZOOMOUT                  | Zoom out key.                        |
516| KEY_ZOOMRESET                | Zoom Reset key.                      |
517| KEY_WORDPROCESSOR            | Word Processor key.                      |
518| KEY_EDITOR                   | Editor key.                       |
519| KEY_SPREADSHEET              | Spreadsheet key.                      |
520| KEY_GRAPHICSEDITOR           | Graphics Editor key.                     |
521| KEY_PRESENTATION             | Presentation key.                      |
522| KEY_DATABASE                 | Database key.                      |
523| KEY_NEWS                     | News key.                        |
524| KEY_VOICEMAIL                | Voicemail key.                       |
525| KEY_ADDRESSBOOK              | Address book key.                        |
526| KEY_MESSENGER                | Messenger key.                        |
527| KEY_BRIGHTNESS_TOGGLE        | Brightness Toggle key.                      |
528| KEY_SPELLCHECK               | Spell Check key.                     |
529| KEY_COFFEE                   | Coffee key, which is used to launch screen lock or screen saver.                 |
530| KEY_MEDIA_REPEAT             | Media Repeat key.                      |
531| KEY_IMAGES                   | Images key.                        |
532| KEY_BUTTONCONFIG             | Button Configuration key.                      |
533| KEY_TASKMANAGER              | Task Manager key.                      |
534| KEY_JOURNAL                  | Log key.                       |
535| KEY_CONTROLPANEL             | Control Panel key.                      |
536| KEY_APPSELECT                | App Select key.                    |
537| KEY_SCREENSAVER              | Screen Saver key.                    |
538| KEY_ASSISTANT                | Assistant key.                        |
539| KEY_KBD_LAYOUT_NEXT          | Next Keyboard Layout key.                   |
540| KEY_BRIGHTNESS_MIN           | Min Brightness key.                      |
541| KEY_BRIGHTNESS_MAX           | Max Brightness key.                      |
542| KEY_KBDINPUTASSIST_PREV      | Keyboard Input-assisted Previous key.        |
543| KEY_KBDINPUTASSIST_NEXT      | Keyboard Input-assisted Next key.            |
544| KEY_KBDINPUTASSIST_PREVGROUP | Keyboard Input-assisted Previous key.        |
545| KEY_KBDINPUTASSIST_NEXTGROUP | Keyboard Input-assisted Next key.            |
546| KEY_KBDINPUTASSIST_ACCEPT    | Keyboard Input-assisted Accept key.          |
547| KEY_KBDINPUTASSIST_CANCEL    | Keyboard Input-assisted Cancel key.          |
548| KEY_FRONT                    | Front key, which is used to launch the windshield defogger.                  |
549| KEY_SETUP                    | Setup key.                        |
550| KEY_WAKEUP                   | Wakeup key.                        |
551| KEY_SENDFILE                 | Send File key.                     |
552| KEY_DELETEFILE               | Delete File key.                     |
553| KEY_XFER                     | XFER key, which is used to start file transfer.               |
554| KEY_PROG1                    | Program key 1.                       |
555| KEY_PROG2                    | Program key 2.                       |
556| KEY_MSDOS                    | MS-DOS key.           |
557| KEY_SCREENLOCK               | Screen Lock key.                      |
558| KEY_DIRECTION_ROTATE_DISPLAY | Directional Rotation Display key.                    |
559| KEY_CYCLEWINDOWS             | Windows Cycle key.                 |
560| KEY_COMPUTER                 | Keys.                         |
561| KEY_EJECTCLOSECD             | Eject CD key.                      |
562| KEY_ISO                      | ISO key.                       |
563| KEY_MOVE                     | Move key.                        |
564| KEY_F13                      | F13 key.                    |
565| KEY_F14                      | F14 key.                    |
566| KEY_F15                      | F15 key.                    |
567| KEY_F16                      | F16 key.                    |
568| KEY_F17                      | F17 key.                    |
569| KEY_F18                      | F18 key.                    |
570| KEY_F19                      | F19 key.                    |
571| KEY_F20                      | F20 key.                    |
572| KEY_F21                      | F21 key.                    |
573| KEY_F22                      | F22 key.                    |
574| KEY_F23                      | F23 key.                    |
575| KEY_F24                      | F24 key.                    |
576| KEY_PROG3                    | Program key 3.                       |
577| KEY_PROG4                    | Program key 4.                       |
578| KEY_DASHBOARD                | Dashboard.                        |
579| KEY_SUSPEND                  | Suspend key.                        |
580| KEY_HP                       | HP key.                      |
581| KEY_SOUND                    | Sound key.                        |
582| KEY_QUESTION                 | Question key.                       |
583| KEY_CONNECT                  | Connect key.                        |
584| KEY_SPORT                    | Sport key.                       |
585| KEY_SHOP                     | Shop key.                        |
586| KEY_ALTERASE                 | Alternate key.                        |
587| KEY_SWITCHVIDEOMODE          | Switch Video Mode key (monitor, LCD, and TV, etc.).|
588| KEY_BATTERY                  | Battery key.                       |
589| KEY_BLUETOOTH                | Bluetooth key.                       |
590| KEY_WLAN                     | WLAN key.                      |
591| KEY_UWB                      | Ultra-wideband key.                   |
592| KEY_WWAN_WIMAX               | WWAN WiMAX key.          |
593| KEY_RFKILL                   | RF Kill key.                  |
594| KEY_CHANNEL                  | Channel key.                      |
595| KEY_BTN_0                    | Button 0.                        |
596| KEY_BTN_1                    | Button 1.                        |
597| KEY_BTN_2                    | Button 2.                        |
598| KEY_BTN_3                    | Button 3.                        |
599| KEY_BTN_4                    | Button 4.                        |
600| KEY_BTN_5                    | Button 5.                        |
601| KEY_BTN_6                    | Button 6.                        |
602| KEY_BTN_7                    | Button 7.                        |
603| KEY_BTN_8                    | Button 8.                        |
604| KEY_BTN_9                    | Button 9.                        |
605
606**Since**
607
60810
609
610
611### OH_NativeXComponent_MouseEventAction
612
613```
614enum OH_NativeXComponent_MouseEventAction
615```
616
617**Description**
618
619Enumerates the mouse event actions.
620
621| Value                              | Description              |
622| --------------------------------- | ---------------- |
623| OH_NATIVEXCOMPONENT_MOUSE_NONE    | Invalid mouse event.   |
624| OH_NATIVEXCOMPONENT_MOUSE_PRESS   | Mouse button press.  |
625| OH_NATIVEXCOMPONENT_MOUSE_RELEASE | Mouse button release.  |
626| OH_NATIVEXCOMPONENT_MOUSE_MOVE    | Mouse movement.|
627
628**Since**
629
6309
631
632
633### OH_NativeXComponent_MouseEventButton
634
635```
636enum OH_NativeXComponent_MouseEventButton
637```
638
639**Description**
640
641Enumerates the mouse event buttons.
642
643| Value                               | Description               |
644| ---------------------------------- | ----------------- |
645| OH_NATIVEXCOMPONENT_NONE_BUTTON    | No button.  |
646| OH_NATIVEXCOMPONENT_LEFT_BUTTON    | Left mouse button.   |
647| OH_NATIVEXCOMPONENT_RIGHT_BUTTON   | Right mouse button.   |
648| OH_NATIVEXCOMPONENT_MIDDLE_BUTTON  | Middle mouse button.   |
649| OH_NATIVEXCOMPONENT_BACK_BUTTON    | Back button on the left of the mouse.|
650| OH_NATIVEXCOMPONENT_FORWARD_BUTTON | Forward key on the left of the mouse.|
651
652**Since**
653
6549
655
656
657### OH_NativeXComponent_TouchEventType
658
659```
660enum OH_NativeXComponent_TouchEventType
661```
662
663**Description**
664
665Enumerates the touch event types.
666
667| Value                        | Description                   |
668| --------------------------- | --------------------- |
669| OH_NATIVEXCOMPONENT_DOWN    | The touch event is triggered when a finger is pressed.         |
670| OH_NATIVEXCOMPONENT_UP      | The touch event is triggered when a finger is lifted.         |
671| OH_NATIVEXCOMPONENT_MOVE    | The touch event is triggered when a finger is moved on the screen.|
672| OH_NATIVEXCOMPONENT_CANCEL  | The event is triggered when a touch event is canceled.         |
673| OH_NATIVEXCOMPONENT_UNKNOWN | Invalid touch type.             |
674
675**Since**
676
6778
678
679
680### OH_NativeXComponent_TouchPointToolType
681
682```
683enum OH_NativeXComponent_TouchPointToolType
684```
685
686**Description**
687
688Enumerates the touch point tool types.
689
690| Value                                   | Description      |
691| -------------------------------------- | -------- |
692| OH_NATIVEXCOMPONENT_TOOL_TYPE_UNKNOWN  | Unknown tool type.|
693| OH_NATIVEXCOMPONENT_TOOL_TYPE_FINGER   | Finger.  |
694| OH_NATIVEXCOMPONENT_TOOL_TYPE_PEN      | Stylus.  |
695| OH_NATIVEXCOMPONENT_TOOL_TYPE_RUBBER   | Rubber. |
696| OH_NATIVEXCOMPONENT_TOOL_TYPE_BRUSH    | Brush.  |
697| OH_NATIVEXCOMPONENT_TOOL_TYPE_PENCIL   | Pencil.  |
698| OH_NATIVEXCOMPONENT_TOOL_TYPE_AIRBRUSH | Air brush.  |
699| OH_NATIVEXCOMPONENT_TOOL_TYPE_MOUSE    | Mouse.  |
700| OH_NATIVEXCOMPONENT_TOOL_TYPE_LENS     | Lens. |
701
702**Since**
703
7049
705
706
707## Function Description
708
709
710### OH_NativeXComponent_GetKeyEvent()
711
712```
713int32_t OH_NativeXComponent_GetKeyEvent (OH_NativeXComponent * component, OH_NativeXComponent_KeyEvent ** keyEvent )
714```
715
716**Description**
717
718Obtains the key event scheduled by ArkUI XComponent.
719
720**Parameters**
721
722| Name       | Description                           |
723| --------- | ----------------------------- |
724| component | Pointer to the **OH_NativeXComponent** instance.|
725| keyEvent  | Pointer to the current key event.             |
726
727**Returns**
728
729Returns the status code of the execution.
730
731**Since**
732
73310
734
735
736### OH_NativeXComponent_GetKeyEventAction()
737
738```
739int32_t OH_NativeXComponent_GetKeyEventAction (OH_NativeXComponent_KeyEvent * keyEvent, OH_NativeXComponent_KeyAction * action )
740```
741
742**Description**
743
744Obtains the action of the specified key event.
745
746**Parameters**
747
748| Name      | Description                                    |
749| -------- | -------------------------------------- |
750| keyEvent | Pointer to the **OH_NativeXComponent_KeyEvent** instance.|
751| action   | Pointer to the key event action.                        |
752
753**Returns**
754
755Returns the status code of the execution.
756
757**Since**
758
75910
760
761
762### OH_NativeXComponent_GetKeyEventCode()
763
764```
765int32_t OH_NativeXComponent_GetKeyEventCode (OH_NativeXComponent_KeyEvent * keyEvent, OH_NativeXComponent_KeyCode * code )
766```
767
768**Description**
769
770Obtains the key code of the specified key event.
771
772**Parameters**
773
774| Name      | Description                                    |
775| -------- | -------------------------------------- |
776| keyEvent | Pointer to the **OH_NativeXComponent_KeyEvent** instance.|
777| code     | Pointer to the key code of the key event.                       |
778
779**Returns**
780
781Returns the status code of the execution.
782
783**Since**
784
78510
786
787
788### OH_NativeXComponent_GetKeyEventDeviceId()
789
790```
791int32_t OH_NativeXComponent_GetKeyEventDeviceId (OH_NativeXComponent_KeyEvent * keyEvent, int64_t * deviceId )
792```
793
794**Description**
795
796Obtains the device ID of the specified key event.
797
798**Parameters**
799
800| Name      | Description                                    |
801| -------- | -------------------------------------- |
802| keyEvent | Pointer to the **OH_NativeXComponent_KeyEvent** instance.|
803| deviceId | Pointer to the device ID of the key event.                      |
804
805**Returns**
806
807Returns the status code of the execution.
808
809**Since**
810
81110
812
813
814### OH_NativeXComponent_GetKeyEventSourceType()
815
816```
817int32_t OH_NativeXComponent_GetKeyEventSourceType (OH_NativeXComponent_KeyEvent * keyEvent, OH_NativeXComponent_EventSourceType * sourceType )
818```
819
820**Description**
821
822Obtains the source type of the specified key event.
823
824**Parameters**
825
826| Name        | Description                                    |
827| ---------- | -------------------------------------- |
828| keyEvent   | Pointer to the **OH_NativeXComponent_KeyEvent** instance.|
829| sourceType | Pointer to the source type of the key event.                     |
830
831**Returns**
832
833Returns the status code of the execution.
834
835**Since**
836
83710
838
839
840### OH_NativeXComponent_GetKeyEventTimeStamp()
841
842```
843int32_t OH_NativeXComponent_GetKeyEventTimeStamp (OH_NativeXComponent_KeyEvent * keyEvent, int64_t * timeStamp )
844```
845
846**Description**
847
848Obtains the timestamp of the specified key event.
849
850**Parameters**
851
852| Name       | Description                                    |
853| --------- | -------------------------------------- |
854| keyEvent  | Pointer to the **OH_NativeXComponent_KeyEvent** instance.|
855| timeStamp | Pointer to the timestamp of the key event.                       |
856
857**Returns**
858
859Returns the status code of the execution.
860
861**Since**
862
86310
864
865
866### OH_NativeXComponent_GetMouseEvent()
867
868```
869int32_t OH_NativeXComponent_GetMouseEvent (OH_NativeXComponent * component, const void * window, OH_NativeXComponent_MouseEvent * mouseEvent )
870```
871
872**Description**
873
874Obtains the mouse event scheduled by ArkUI XComponent.
875
876**Parameters**
877
878| Name        | Description                           |
879| ---------- | ----------------------------- |
880| component  | Pointer to the **OH_NativeXComponent** instance.|
881| window     | Handle to the **NativeWindow** instance.             |
882| mouseEvent | Pointer to the current mouse event.               |
883
884**Returns**
885
886Returns the status code of the execution.
887
888**Since**
889
8909
891
892
893### OH_NativeXComponent_GetTouchEvent()
894
895```
896int32_t OH_NativeXComponent_GetTouchEvent (OH_NativeXComponent * component, const void * window, OH_NativeXComponent_TouchEvent * touchEvent )
897```
898
899**Description**
900
901Obtains the touch event scheduled by the ArkUI XComponent.
902
903**Parameters**
904
905| Name        | Description                           |
906| ---------- | ----------------------------- |
907| component  | Pointer to the **OH_NativeXComponent** instance.|
908| window     | Handle to the **NativeWindow** instance.            |
909| touchEvent | Pointer to the current touch event.               |
910
911**Returns**
912
913Returns the status code of the execution.
914
915**Since**
916
9178
918
919
920### OH_NativeXComponent_GetTouchPointTiltX()
921
922```
923int32_t OH_NativeXComponent_GetTouchPointTiltX (OH_NativeXComponent * component, uint32_t pointIndex, float * tiltX )
924```
925
926**Description**
927
928Obtains the angle between the Y-Z plane of the ArkUI XComponent touch point and the x-axis.
929
930**Parameters**
931
932| Name        | Description                           |
933| ---------- | ----------------------------- |
934| component  | Pointer to the **OH_NativeXComponent** instance.|
935| pointIndex | Pointer to the index of the touch point.                  |
936| tiltX      | Pointer to the angle between the Y-Z plane of the touch point and the x-axis.                 |
937
938**Returns**
939
940Returns the status code of the execution.
941
942**Since**
943
9449
945
946
947### OH_NativeXComponent_GetTouchPointTiltY()
948
949```
950int32_t OH_NativeXComponent_GetTouchPointTiltY (OH_NativeXComponent * component, uint32_t pointIndex, float * tiltY )
951```
952
953**Description**
954
955Obtains the angle between the X-Z plane of the ArkUI XComponent touch point and the x-axis.
956
957**Parameters**
958
959| Name        | Description                           |
960| ---------- | ----------------------------- |
961| component  | Pointer to the **OH_NativeXComponent** instance.|
962| pointIndex | Pointer to the index of the touch point.                  |
963| tiltY      | Pointer to the angle between the X-Z plane of the touch point and the y-axis.                 |
964
965**Returns**
966
967Returns the status code of the execution.
968
969**Since**
970
9719
972
973
974### OH_NativeXComponent_GetTouchPointToolType()
975
976```
977int32_t OH_NativeXComponent_GetTouchPointToolType (OH_NativeXComponent * component, uint32_t pointIndex, OH_NativeXComponent_TouchPointToolType * toolType )
978```
979
980**Description**
981
982Obtains the ArkUI XComponent touch point tool type.
983
984**Parameters**
985
986| Name        | Description                           |
987| ---------- | ----------------------------- |
988| component  | Pointer to the **OH_NativeXComponent** instance.|
989| pointIndex | Pointer to the index of the touch point.                  |
990| toolType   | Pointer to the tool type.                 |
991
992**Returns**
993
994Returns the status code of the execution.
995
996**Since**
997
9989
999
1000
1001### OH_NativeXComponent_GetXComponentId()
1002
1003```
1004int32_t OH_NativeXComponent_GetXComponentId (OH_NativeXComponent * component, char * id, uint64_t * size )
1005```
1006
1007**Description**
1008
1009Obtain the ID of ArkUI XComponent.
1010
1011**Parameters**
1012
1013| Name       | Description                                      |
1014| --------- | ---------------------------------------- |
1015| component | Pointer to the **OH_NativeXComponent** instance.           |
1016| id        | Pointer to the character buffer for storing the ID of the **OH_NativeXComponent** instance. Note that null terminators will be attached to the character buffer, so the size of the character buffer should be at least one unit greater than the length of the real ID. The recommended size is [OH_XCOMPONENT_ID_LEN_MAX + 1].|
1017| size      | Pointer to the length of the ID.                            |
1018
1019**Returns**
1020
1021Returns the status code of the execution.
1022
1023**Since**
1024
10258
1026
1027
1028### OH_NativeXComponent_GetXComponentOffset()
1029
1030```
1031int32_t OH_NativeXComponent_GetXComponentOffset (OH_NativeXComponent * component, const void * window, double * x, double * y )
1032```
1033
1034**Description**
1035
1036Obtains the offset of the ArkUI XComponent relative to the upper left vertex of the screen.
1037
1038**Parameters**
1039
1040| Name       | Description                           |
1041| --------- | ----------------------------- |
1042| component | Pointer to the **OH_NativeXComponent** instance.|
1043| window    | Handle to the **NativeWindow** instance.            |
1044| x         | Pointer to the x coordinate of the current surface.        |
1045| y         | Pointer to the y coordinate of the current surface.        |
1046
1047**Returns**
1048
1049Returns the status code of the execution.
1050
1051**Since**
1052
10538
1054
1055
1056### OH_NativeXComponent_GetXComponentSize()
1057
1058```
1059int32_t OH_NativeXComponent_GetXComponentSize (OH_NativeXComponent * component, const void * window, uint64_t * width, uint64_t * height )
1060```
1061
1062**Description**
1063
1064Obtains the size of the surface held by the ArkUI XComponent.
1065
1066**Parameters**
1067
1068| Name       | Description                           |
1069| --------- | ----------------------------- |
1070| component | Pointer to the **OH_NativeXComponent** instance.|
1071| window    | Handle to the **NativeWindow** instance.            |
1072| width     | Pointer to the width of the current surface.          |
1073| height    | Pointer to the height of the current surface.          |
1074
1075**Returns**
1076
1077Returns the status code of the execution.
1078
1079**Since**
1080
10818
1082
1083
1084### OH_NativeXComponent_RegisterBlurEventCallback()
1085
1086```
1087int32_t OH_NativeXComponent_RegisterBlurEventCallback (OH_NativeXComponent * component, void(*callback)(OH_NativeXComponent *component, void *window))
1088```
1089
1090**Description**
1091
1092Registers the focus loss event callback for this **OH_NativeXComponent** instance.
1093
1094**Parameters**
1095
1096| Name       | Description                           |
1097| --------- | ----------------------------- |
1098| component | Pointer to the **OH_NativeXComponent** instance.|
1099| callback  | Pointer to the focus loss event callback.               |
1100
1101**Returns**
1102
1103Returns the status code of the execution.
1104
1105**Since**
1106
11078
1108
1109
1110### OH_NativeXComponent_RegisterCallback()
1111
1112```
1113int32_t OH_NativeXComponent_RegisterCallback (OH_NativeXComponent * component, OH_NativeXComponent_Callback * callback )
1114```
1115
1116**Description**
1117
1118Registers a callback for this **OH_NativeXComponent** instance.
1119
1120**Parameters**
1121
1122| Name       | Description                           |
1123| --------- | ----------------------------- |
1124| component | Pointer to the **OH_NativeXComponent** instance.|
1125| callback  | Pointer to the surface lifecycle and touch event callback.   |
1126
1127**Returns**
1128
1129Returns the status code of the execution.
1130
1131**Since**
1132
11338
1134
1135
1136### OH_NativeXComponent_RegisterFocusEventCallback()
1137
1138```
1139int32_t OH_NativeXComponent_RegisterFocusEventCallback (OH_NativeXComponent * component, void(*callback)(OH_NativeXComponent *component, void *window))
1140```
1141
1142**Description**
1143
1144Registers the focus obtaining event callback for this **OH_NativeXComponent** instance.
1145
1146**Parameters**
1147
1148| Name       | Description                           |
1149| --------- | ----------------------------- |
1150| component | Pointer to the **OH_NativeXComponent** instance.|
1151| callback  | Pointer to the focus obtaining event callback.               |
1152
1153**Returns**
1154
1155Returns the status code of the execution.
1156
1157**Since**
1158
115910
1160
1161
1162### OH_NativeXComponent_RegisterKeyEventCallback()
1163
1164```
1165int32_t OH_NativeXComponent_RegisterKeyEventCallback (OH_NativeXComponent * component, void(*callback)(OH_NativeXComponent *component, void *window))
1166```
1167
1168**Description**
1169
1170Registers the key event callback for this **OH_NativeXComponent** instance.
1171
1172**Parameters**
1173
1174| Name       | Description                           |
1175| --------- | ----------------------------- |
1176| component | Pointer to the **OH_NativeXComponent** instance.|
1177| callback  | Pointer to the key event callback.               |
1178
1179**Returns**
1180
1181Returns the status code of the execution.
1182
1183**Since**
1184
118510
1186
1187
1188### OH_NativeXComponent_RegisterMouseEventCallback()
1189
1190```
1191int32_t OH_NativeXComponent_RegisterMouseEventCallback (OH_NativeXComponent * component, OH_NativeXComponent_MouseEvent_Callback * callback )
1192```
1193
1194**Description**
1195
1196Registers the mouse event callback for this **OH_NativeXComponent** instance.
1197
1198**Parameters**
1199
1200| Name       | Description                           |
1201| --------- | ----------------------------- |
1202| component | Pointer to the **OH_NativeXComponent** instance.|
1203| callback  | Pointer to the mouse event callback.               |
1204
1205**Returns**
1206
1207Returns the status code of the execution.
1208
1209**Since**
1210
12119
1212
1213### OH_NativeXComponent_RegisterOnFrameCallback()
1214
1215```
1216int32_t OH_NativeXComponent_RegisterOnFrameCallback (OH_NativeXComponent * component, void(*)(OH_NativeXComponent *component, uint64_t timestamp, uint64_t targetTimestamp) callback )
1217```
1218**Description**
1219
1220Registers the display update callback for this **OH_NativeXComponent** instance and enables the callback for each frame.
1221
1222**Parameters**
1223
1224| Name| Description|
1225| -------- | -------- |
1226| component | Pointer to the **OH_NativeXComponent** instance. |
1227| callback | Pointer to the display update callback. |
1228
1229**Returns**
1230
1231Returns the status code of the execution.
1232
1233**Since**
1234
123511
1236
1237
1238### OH_NativeXComponent_SetExpectedFrameRateRange()
1239
1240```
1241int32_t OH_NativeXComponent_SetExpectedFrameRateRange (OH_NativeXComponent * component, OH_NativeXComponent_ExpectedRateRange * range )
1242```
1243**Description**
1244
1245Sets the expected frame rate range.
1246
1247**Parameters**
1248
1249| Name| Description|
1250| -------- | -------- |
1251| component | Pointer to the **OH_NativeXComponent** instance. |
1252| range | Pointer to the expected frame rate range.|
1253
1254**Returns**
1255
1256Returns the status code of the execution.
1257
1258**Since**
1259
126011
1261
1262
1263### OH_NativeXComponent_UnregisterOnFrameCallback()
1264
1265```
1266int32_t OH_NativeXComponent_UnregisterOnFrameCallback (OH_NativeXComponent * component)
1267```
1268**Description**
1269
1270Deregisters the display update callback for this **OH_NativeXComponent** instance and disables the callback for each frame.
1271
1272**Parameters**
1273
1274| Name| Description|
1275| -------- | -------- |
1276| component | Pointer to the **OH_NativeXComponent** instance. |
1277
1278**Returns**
1279
1280Returns the status code of the execution.
1281
1282**Since**
1283
128411
1285<!--  -->
1286
1287## Variable Description
1288
1289
1290### OH_XCOMPONENT_ID_LEN_MAX
1291
1292```
1293const uint32_t OH_XCOMPONENT_ID_LEN_MAX = 128
1294```
1295
1296
1297**Description**
1298
1299
1300Maximum length of the ArkUI XComponent ID.
1301
1302
1303**Since**
1304
1305
13068
1307
1308
1309### OH_MAX_TOUCH_POINTS_NUMBER
1310
1311```
1312const uint32_t OH_MAX_TOUCH_POINTS_NUMBER = 10
1313```
1314
1315**Description**
1316
1317Maximum number of identifiable touch points in a touch event.
1318
1319**Since**
1320
13218
1322
1323
1324### action
1325
1326```
1327OH_NativeXComponent_MouseEventAction OH_NativeXComponent_MouseEvent::action
1328```
1329
1330**Description**
1331
1332Action of the mouse event.
1333
1334**Since**
1335
13368
1337
1338
1339### button
1340
1341```
1342OH_NativeXComponent_MouseEventButton OH_NativeXComponent_MouseEvent::button
1343```
1344
1345**Description**
1346
1347Mouse event button.
1348
1349**Since**
1350
13518
1352
1353
1354### deviceId
1355
1356```
1357int64_t OH_NativeXComponent_TouchEvent::deviceId = 0
1358```
1359
1360**Description**
1361
1362ID of the device where the current touch event is triggered.
1363
1364**Since**
1365
13668
1367
1368
1369### DispatchHoverEvent
1370
1371```
1372void(* OH_NativeXComponent_MouseEvent_Callback::DispatchHoverEvent) (OH_NativeXComponent *component, bool isHover)
1373```
1374
1375**Description**
1376
1377Invoked when a hover event is triggered.
1378
1379**Since**
1380
13818
1382
1383
1384### DispatchMouseEvent
1385
1386```
1387void(* OH_NativeXComponent_MouseEvent_Callback::DispatchMouseEvent) (OH_NativeXComponent *component, void *window)
1388```
1389
1390**Description**
1391
1392Invoked when a mouse event is triggered.
1393
1394**Since**
1395
13968
1397
1398
1399### DispatchTouchEvent
1400
1401```
1402void(* OH_NativeXComponent_Callback::DispatchTouchEvent) (OH_NativeXComponent *component, void *window)
1403```
1404
1405**Description**
1406
1407Invoked when a touch event is triggered.
1408
1409**Since**
1410
14118
1412
1413
1414### force [1/2]
1415
1416```
1417float OH_NativeXComponent_TouchPoint::force = 0.0
1418```
1419
1420**Description**
1421
1422Pressure of the touch event.
1423
1424**Since**
1425
14268
1427
1428
1429### force [2/2]
1430
1431```
1432float OH_NativeXComponent_TouchEvent::force = 0.0
1433```
1434
1435**Description**
1436
1437Pressure of the touch event.
1438
1439**Since**
1440
14418
1442
1443
1444### id [1/2]
1445
1446```
1447int32_t OH_NativeXComponent_TouchPoint::id = 0
1448```
1449
1450**Description**
1451
1452Unique identifier of the finger.
1453
1454**Since**
1455
14568
1457
1458
1459### id [2/2]
1460
1461```
1462int32_t OH_NativeXComponent_TouchEvent::id = 0
1463```
1464
1465**Description**
1466
1467Unique identifier of the finger.
1468
1469**Since**
1470
14718
1472
1473
1474### isPressed
1475
1476```
1477bool OH_NativeXComponent_TouchPoint::isPressed = false
1478```
1479
1480**Description**
1481
1482Whether the current point is pressed.
1483
1484**Since**
1485
14868
1487
1488
1489### numPoints
1490
1491```
1492uint32_t OH_NativeXComponent_TouchEvent::numPoints = 0
1493```
1494
1495**Description**
1496
1497Number of current touch points.
1498
1499**Since**
1500
15018
1502
1503
1504### OnSurfaceChanged
1505
1506```
1507void(* OH_NativeXComponent_Callback::OnSurfaceChanged) (OH_NativeXComponent *component, void *window)
1508```
1509
1510**Description**
1511
1512Invoked when the surface changes.
1513
1514**Since**
1515
15168
1517
1518
1519### OnSurfaceCreated
1520
1521```
1522void(* OH_NativeXComponent_Callback::OnSurfaceCreated) (OH_NativeXComponent *component, void *window)
1523```
1524
1525**Description**
1526
1527Invoked when a surface is created.
1528
1529**Since**
1530
15318
1532
1533
1534### OnSurfaceDestroyed
1535
1536```
1537void(* OH_NativeXComponent_Callback::OnSurfaceDestroyed) (OH_NativeXComponent *component, void *window)
1538```
1539
1540**Description**
1541
1542Invoked when the surface is destroyed.
1543
1544**Since**
1545
15468
1547
1548
1549### screenX [1/3]
1550
1551```
1552float OH_NativeXComponent_TouchPoint::screenX = 0.0
1553```
1554
1555**Description**
1556
1557X coordinate of the touch point relative to the left edge of the application window where the XComponent is located.
1558
1559**Since**
1560
15618
1562
1563
1564### screenX [2/3]
1565
1566```
1567float OH_NativeXComponent_TouchEvent::screenX = 0.0
1568```
1569
1570**Description**
1571
1572X coordinate of the touch point relative to the left edge of the screen.
1573
1574**Since**
1575
15768
1577
1578
1579### screenX [3/3]
1580
1581```
1582float OH_NativeXComponent_MouseEvent::screenX
1583```
1584
1585**Description**
1586
1587X coordinate of the clicked point relative to the upper left corner of the screen.
1588
1589**Since**
1590
15918
1592
1593
1594### screenY [1/3]
1595
1596```
1597float OH_NativeXComponent_TouchPoint::screenY = 0.0
1598```
1599
1600**Description**
1601
1602Y coordinate of the touch point relative to the left edge of the application window where the XComponent is located.
1603
1604**Since**
1605
16068
1607
1608
1609### screenY [2/3]
1610
1611```
1612float OH_NativeXComponent_TouchEvent::screenY = 0.0
1613```
1614
1615**Description**
1616
1617Y coordinate of the touch point relative to the upper edge of the screen.
1618
1619**Since**
1620
16218
1622
1623
1624### screenY [3/3]
1625
1626```
1627float OH_NativeXComponent_MouseEvent::screenY
1628```
1629
1630**Description**
1631
1632Y coordinate of the clicked point relative to the upper left corner of the screen.
1633
1634**Since**
1635
16368
1637
1638
1639### size [1/2]
1640
1641```
1642double OH_NativeXComponent_TouchPoint::size = 0.0
1643```
1644
1645**Description**
1646
1647Contact area between the finger pad and the screen.
1648
1649**Since**
1650
16518
1652
1653
1654### size [2/2]
1655
1656```
1657double OH_NativeXComponent_TouchEvent::size = 0.0
1658```
1659
1660**Description**
1661
1662Contact area between the finger pad and the screen.
1663
1664**Since**
1665
16668
1667
1668
1669### timeStamp [1/2]
1670
1671```
1672long long OH_NativeXComponent_TouchPoint::timeStamp = 0
1673```
1674
1675**Description**
1676
1677Timestamp of the touch point.
1678
1679**Since**
1680
16818
1682
1683
1684### timeStamp [2/2]
1685
1686```
1687long long OH_NativeXComponent_TouchEvent::timeStamp = 0
1688```
1689
1690**Description**
1691
1692Timestamp of the touch event.
1693
1694**Since**
1695
16968
1697
1698
1699### timestamp
1700
1701```
1702int64_t OH_NativeXComponent_MouseEvent::timestamp
1703```
1704
1705**Description**
1706
1707Timestamp of the mouse event.
1708
1709**Since**
1710
17118
1712
1713
1714### touchPoints
1715
1716```
1717OH_NativeXComponent_TouchPoint OH_NativeXComponent_TouchEvent::touchPoints[OH_MAX_TOUCH_POINTS_NUMBER]
1718```
1719
1720**Description**
1721
1722Array of the touch points.
1723
1724**Since**
1725
17268
1727
1728
1729### type [1/2]
1730
1731```
1732OH_NativeXComponent_TouchEventType OH_NativeXComponent_TouchPoint::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN
1733```
1734
1735**Description**
1736
1737Touch type of the touch point.
1738
1739**Since**
1740
17418
1742
1743
1744### type [2/2]
1745
1746```
1747OH_NativeXComponent_TouchEventType OH_NativeXComponent_TouchEvent::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN
1748```
1749
1750**Description**
1751
1752Touch type of the touch event.
1753
1754**Since**
1755
17568
1757
1758
1759### x [1/3]
1760
1761```
1762float OH_NativeXComponent_TouchPoint::x = 0.0
1763```
1764
1765**Description**
1766
1767X coordinate of the touch point relative to the left edge of the XComponent.
1768
1769**Since**
1770
17718
1772
1773
1774### x [2/3]
1775
1776```
1777float OH_NativeXComponent_TouchEvent::x = 0.0
1778```
1779
1780**Description**
1781
1782X coordinate of the touch point relative to the left edge of the XComponent.
1783
1784**Since**
1785
17868
1787
1788
1789### x [3/3]
1790
1791```
1792float OH_NativeXComponent_MouseEvent::x
1793```
1794
1795**Description**
1796
1797X coordinate of the clicked point relative to the upper left corner of the component.
1798
1799**Since**
1800
18018
1802
1803
1804### y [1/3]
1805
1806```
1807float OH_NativeXComponent_TouchPoint::y = 0.0
1808```
1809
1810**Description**
1811
1812Y coordinate of the touch point relative to the upper edge of the XComponent.
1813
1814**Since**
1815
18168
1817
1818
1819### y [2/3]
1820
1821```
1822float OH_NativeXComponent_TouchEvent::y = 0.0
1823```
1824
1825**Description**
1826
1827Y coordinate of the touch point relative to the upper edge of the XComponent.
1828
1829**Since**
1830
18318
1832
1833
1834### y [3/3]
1835
1836```
1837float OH_NativeXComponent_MouseEvent::y
1838```
1839
1840**Description**
1841
1842Y coordinate of the clicked point relative to the upper left corner of the component.
1843
1844**Since**
1845
18468
1847
1848### expected
1849
1850```
1851int32_t OH_NativeXComponent_ExpectedRateRange::expected
1852```
1853**Description**
1854
1855Expected frame rate range.
1856
1857**Since**
1858
185911
1860
1861### max
1862
1863```
1864int32_t OH_NativeXComponent_ExpectedRateRange::max
1865```
1866**Description**
1867
1868Maximum value of the expected frame rate range.
1869
1870**Since**
1871
187211
1873
1874
1875### min
1876
1877```
1878int32_t OH_NativeXComponent_ExpectedRateRange::min
1879```
1880**Description**
1881
1882Minimum value of the expected frame rate range.
1883
1884**Since**
1885
188611
1887