Module input_manager

Module input_manager 

Source
Available on crate feature api-12 only.
Expand description

Provides functions such as event injection and status query.

System capability: SystemCapability.MultimodalInput.Input.Core

Structs§

InputErrorCode
Enumerates error codes.
InputEvent_MouseAxis
Mouse axis types.
InputEvent_SourceType
Enumerates event source types.
Input_DeviceInfoapi-13
Represents information about the input device.
Input_DeviceListenerapi-13
Defines a listener for device insertion and removal events.
Input_InjectionStatusapi-20
Enumerates the injection authorization status.
Input_InterceptorEventCallback
Defines the structure for the interceptor of event callbacks, including mouseCallback, touchCallback, and axisCallback.
Input_InterceptorOptions
Defines event interceptor options.
Input_KeyEventAction
Enumerates key event types.
Input_KeyStateAction
Enumerated values of key event action.
Input_KeyboardTypeapi-13
Enumerates keyboard types.
Input_MouseEventAction
Enumerated values of mouse event action.
Input_MouseEventButton
Enumerated values of mouse event button.
Input_TouchEventAction
Enumerated values of touch event action.

Functions§

OH_Input_AddAxisEventMonitor
Adds a listener for the specified type of axis events.
OH_Input_AddAxisEventMonitorForAll
Adds a listener for all types of axis events. The axis event types are defined in InputEvent_AxisEventType.
OH_Input_AddHotkeyMonitorapi-14
Subscribes to shortcut key events.
OH_Input_AddInputEventInterceptor
Adds an interceptor for input events, including mouse, touch, and axis events. If multiple interceptors are added, only the first one takes effect.
OH_Input_AddKeyEventHookapi-21
Add a keyEvent interception hook function. Before using this interface, the user needs to authorize it in the settings.
OH_Input_AddKeyEventInterceptor
Adds a key event interceptor. If multiple interceptors are added, only the first one takes effect.
OH_Input_AddKeyEventMonitor
Adds a listener of key events.
OH_Input_AddMouseEventMonitor
Adds a listener for mouse events, including mouse click and movement events, but not scroll wheel events. Scroll wheel events are axis events.
OH_Input_AddTouchEventMonitor
Add a listener for touch events.
OH_Input_CancelInjection
Cancels event injection and revokes authorization.
OH_Input_CreateAllSystemHotkeysapi-14
Creates an array of Input_Hotkey instances.
OH_Input_CreateAxisEvent
Creates an axis event object.
OH_Input_CreateDeviceInfoapi-13
Creates a deviceInfo object.
OH_Input_CreateHotkeyapi-14
Creates a hot key object.
OH_Input_CreateKeyEvent
Creates a key event object.
OH_Input_CreateKeyState
Creates a key status enumeration object.
OH_Input_CreateMouseEvent
Creates a mouse event object.
OH_Input_CreateTouchEvent
Creates a touch event object.
OH_Input_DestroyAllSystemHotkeysapi-14
Destroys an array of Input_Hotkey instances and reclaims memory.
OH_Input_DestroyAxisEvent
Destroys an axis event object.
OH_Input_DestroyDeviceInfoapi-13
Destroys a deviceInfo object.
OH_Input_DestroyHotkeyapi-14
Destroys a hot key object.
OH_Input_DestroyKeyEvent
Destroys a key event object.
OH_Input_DestroyKeyState
Destroys a key status enumeration object.
OH_Input_DestroyMouseEvent
Destroys a mouse event object.
OH_Input_DestroyTouchEvent
Destroys a touch event object.
OH_Input_DispatchToNextHandlerapi-21
Redispatches keyEvent. Only keyEvent intercepted by hook functions can be redispatched, and the event order must be maintained during redispatching. The hook function intercepts the input event and then redistributes it for 3 seconds. If this time is exceeded, calling this function will return INPUT_PARAMETER_ERROR. Re-dispatching requires event pairing, usually starting with one or more KEY_ACTION_DOWN and ending with KEY_ACTION_UP or KEY_ACTION_CANCEL. Only KEY_ACTION_UP or KEY_ACTION_CANCEL is redispatched, the function call succeeds, but no actual dispatch is made. If an event is dispatched that is not intercepted by the hook function, the function call succeeds, but no actual dispatch action is taken.
OH_Input_GetAllSystemHotkeysapi-14
Obtains all hot keys supported by the system.
OH_Input_GetAxisEventAction
Obtains the axis event action.
OH_Input_GetAxisEventActionTime
Obtains the time when an axis event occurs.
OH_Input_GetAxisEventAxisValue
Obtains the axis value for the specified axis type of the axis event.
OH_Input_GetAxisEventDisplayIdapi-15
Obtains the displayId of an axis event.
OH_Input_GetAxisEventDisplayX
Obtains the X coordinate of an axis event.
OH_Input_GetAxisEventDisplayY
Obtains the Y coordinate of an axis event.
OH_Input_GetAxisEventGlobalXapi-20
Queries the global X coordinate of the axis event.
OH_Input_GetAxisEventGlobalYapi-20
Queries the global Y coordinate of the axis event.
OH_Input_GetAxisEventSourceType
Obtains the axis event source type.
OH_Input_GetAxisEventType
Obtains the axis event type.
OH_Input_GetAxisEventWindowIdapi-15
Obtains the windowId of an axis event.
OH_Input_GetCapabilitiesapi-13
Obtains the capabilities of an input device, for example, a touchscreen, touchpad, or keyboard.
OH_Input_GetDeviceapi-13
Obtains the information about an input device.
OH_Input_GetDeviceAddressapi-13
Obtains the physical address of an input device.
OH_Input_GetDeviceIdapi-13
Obtains the ID of an input device.
OH_Input_GetDeviceIdsapi-13
Obtains the IDs of all input devices.
OH_Input_GetDeviceNameapi-13
Obtains the name of an input device.
OH_Input_GetDeviceProductapi-13
Obtains the product information of an input device.
OH_Input_GetDeviceVendorapi-13
Obtains the vendor information of an input device.
OH_Input_GetDeviceVersionapi-13
Obtains the version information of an input device.
OH_Input_GetFinalKeyapi-14
Obtains a modified key.
OH_Input_GetFunctionKeyStateapi-15
Obtains the function key status.
OH_Input_GetIntervalSinceLastInputapi-14
Obtains the interval since the last system input event.
OH_Input_GetKeyCode
Obtains the key value of a key status enumeration object.
OH_Input_GetKeyEventAction
Obtains the key event type.
OH_Input_GetKeyEventActionTime
Obtains the time when a key event occurs.
OH_Input_GetKeyEventDisplayIdapi-15
Obtains the displayId of a key event.
OH_Input_GetKeyEventIdapi-21
Get the eventId of the keyEvent.
OH_Input_GetKeyEventKeyCode
Obtains the key value of a key event.
OH_Input_GetKeyEventWindowIdapi-15
Obtains the windowId of a key event.
OH_Input_GetKeyPressed
Checks whether the key specific to a key status enumeration object is pressed.
OH_Input_GetKeyState
Queries the key state.
OH_Input_GetKeySwitch
Obtains the key switch of the key status enumeration object.
OH_Input_GetKeyboardTypeapi-13
Obtains the keyboard type of an input device.
OH_Input_GetMouseEventAction
Obtains the action of a mouse event.
OH_Input_GetMouseEventActionTime
Obtains the time when a mouse event occurs.
OH_Input_GetMouseEventAxisType
Obtains the axis type of a mouse event.
OH_Input_GetMouseEventAxisValue
Obtains the axis value of a mouse event.
OH_Input_GetMouseEventButton
Obtains the button of a mouse event.
OH_Input_GetMouseEventDisplayIdapi-15
Obtains the displayId of a mouse event.
OH_Input_GetMouseEventDisplayX
Obtains the X coordinate of a mouse event.
OH_Input_GetMouseEventDisplayY
Obtains the Y coordinate of a mouse event.
OH_Input_GetMouseEventGlobalXapi-20
Queries the global X coordinate of the mouse event.
OH_Input_GetMouseEventGlobalYapi-20
Queries the global Y coordinate of the mouse event.
OH_Input_GetMouseEventWindowIdapi-15
Obtains the windowId of a mouse event.
OH_Input_GetPointerLocationapi-20
Get pointer location.
OH_Input_GetPreKeysapi-14
Obtains a modifier key.
OH_Input_GetRepeatapi-14
Checks whether to report repeated key events.
OH_Input_GetTouchEventAction
Obtains the action of a touch event.
OH_Input_GetTouchEventActionTime
Obtains the time when a touch event occurs.
OH_Input_GetTouchEventDisplayIdapi-15
Obtains the displayId of a touch event.
OH_Input_GetTouchEventDisplayX
Obtains the X coordinate of a touch event.
OH_Input_GetTouchEventDisplayY
Obtains the Y coordinate of a touch event.
OH_Input_GetTouchEventFingerId
Obtains the finger ID of a touch event.
OH_Input_GetTouchEventGlobalXapi-20
Queries the global X coordinate of the touch event.
OH_Input_GetTouchEventGlobalYapi-20
Queries the global Y coordinate of the touch event.
OH_Input_GetTouchEventWindowIdapi-15
Obtains the windowId of a touch event.
OH_Input_InjectKeyEvent
Inject system keys. since API 20, it is recommended to use OH_Input_RequestInjection to request authorization before using the interface, and then use OH_Input_QueryAuthorizedStatus to query the authorization status. When the authorization status is AUTHORIZED, use the interface.
OH_Input_InjectMouseEvent
Inject mouse event. since API 20, it is recommended to use OH_Input_RequestInjection to request authorization before using the interface, and then use OH_Input_QueryAuthorizedStatus to query the authorization status. When the authorization status is AUTHORIZED, use the interface.
OH_Input_InjectMouseEventGlobalapi-20
Inject mouse event using global coordinate. since API 20, it is recommended to use OH_Input_RequestInjection to request authorization before using the interface, and then use OH_Input_QueryAuthorizedStatus to query the authorization status. When the authorization status is AUTHORIZED, use the interface.
OH_Input_InjectTouchEvent
Inject touch event. since API 20, it is recommended to use OH_Input_RequestInjection to request authorization before using the interface, and then use OH_Input_QueryAuthorizedStatus to query the authorization status. When the authorization status is AUTHORIZED, use the interface.
OH_Input_InjectTouchEventGlobalapi-20
Inject touch event using global coordinate. since API 20, it is recommended to use OH_Input_RequestInjection to request authorization before using the interface, and then use OH_Input_QueryAuthorizedStatus to query the authorization status. When the authorization status is AUTHORIZED, use the interface.
OH_Input_QueryAuthorizedStatusapi-20
Queries the injection authorization status.
OH_Input_QueryMaxTouchPointsapi-20
Queries the maximum number of touch points supported by the current device. If -1 is returned, the number is unknown.
OH_Input_RegisterDeviceListenerapi-13
Registers a listener for device hot swap events.
OH_Input_RemoveAxisEventMonitor
Removes the listener for the specified type of axis events.
OH_Input_RemoveAxisEventMonitorForAll
Removes the listener for all types of axis events.
OH_Input_RemoveHotkeyMonitorapi-14
Unsubscribes from shortcut key events.
OH_Input_RemoveInputEventInterceptor
Removes an interceptor for input events, including mouse, touch, and axis events.
OH_Input_RemoveKeyEventHookapi-21
Remove keyEvent interception hook function.
OH_Input_RemoveKeyEventInterceptor
Removes a key event interceptor.
OH_Input_RemoveKeyEventMonitor
Removes a key event listener.
OH_Input_RemoveMouseEventMonitor
Removes a mouse event listener.
OH_Input_RemoveTouchEventMonitor
Removes a touch event listener.
OH_Input_RequestInjectionapi-20
Requests for injection authorization.
OH_Input_SetAxisEventAction
Sets the axis event action.
OH_Input_SetAxisEventActionTime
Sets the time when an axis event occurs.
OH_Input_SetAxisEventAxisValue
Sets the axis value of the axis type specified by the axis event.
OH_Input_SetAxisEventDisplayIdapi-15
Sets the displayId of an axis event.
OH_Input_SetAxisEventDisplayX
Sets the X coordinate of an axis event.
OH_Input_SetAxisEventDisplayY
Sets the Y coordinate of an axis event.
OH_Input_SetAxisEventGlobalXapi-20
Set the global X coordinate of the axis event.
OH_Input_SetAxisEventGlobalYapi-20
Set the global Y coordinate of the axis event.
OH_Input_SetAxisEventSourceType
Sets the axis event source type.
OH_Input_SetAxisEventType
Sets the axis event type.
OH_Input_SetAxisEventWindowIdapi-15
Sets the windowId of an axis event.
OH_Input_SetFinalKeyapi-14
Sets a modified key.
OH_Input_SetKeyCode
Sets the key value of a key status enumeration object.
OH_Input_SetKeyEventAction
Sets the key event type.
OH_Input_SetKeyEventActionTime
Sets the time when a key event occurs.
OH_Input_SetKeyEventDisplayIdapi-15
Sets the displayId for a key event.
OH_Input_SetKeyEventKeyCode
Sets the key value for a key event.
OH_Input_SetKeyEventWindowIdapi-15
Sets the windowId for a key event.
OH_Input_SetKeyPressed
Sets whether the key specific to a key status enumeration object is pressed.
OH_Input_SetKeySwitch
Sets the key switch of the key status enumeration object.
OH_Input_SetMouseEventAction
Sets the action for a mouse event.
OH_Input_SetMouseEventActionTime
Sets the time when a mouse event occurs.
OH_Input_SetMouseEventAxisType
Sets the axis type for mouse event.
OH_Input_SetMouseEventAxisValue
Sets the axis value for a mouse axis event.
OH_Input_SetMouseEventButton
Sets the button for a mouse event.
OH_Input_SetMouseEventDisplayIdapi-15
Sets the displayId for a mouse event.
OH_Input_SetMouseEventDisplayX
Sets the X coordinate for a mouse event.
OH_Input_SetMouseEventDisplayY
Sets the Y coordinate for a mouse event.
OH_Input_SetMouseEventGlobalXapi-20
Set the global X coordinate of the mouse event.
OH_Input_SetMouseEventGlobalYapi-20
Set the global Y coordinate of the mouse event.
OH_Input_SetMouseEventWindowIdapi-15
Sets the windowId for a mouse event.
OH_Input_SetPreKeysapi-14
Sets a modifier key.
OH_Input_SetRepeatapi-14
Specifies whether to report repeated key events.
OH_Input_SetTouchEventAction
Sets the action for a touch event.
OH_Input_SetTouchEventActionTime
Sets the time when a touch event occurs.
OH_Input_SetTouchEventDisplayIdapi-15
Sets the displayId for a touch event.
OH_Input_SetTouchEventDisplayX
Sets the X coordinate for a touch event.
OH_Input_SetTouchEventDisplayY
Sets the Y coordinate for a touch event.
OH_Input_SetTouchEventFingerId
Sets the finger ID for the touch event.
OH_Input_SetTouchEventGlobalXapi-20
Set the global X coordinate of the touch event.
OH_Input_SetTouchEventGlobalYapi-20
Set the global Y coordinate of the touch event.
OH_Input_SetTouchEventWindowIdapi-15
Sets the windowId for a touch event.
OH_Input_UnregisterDeviceListenerapi-13
Unregisters the listener for device hot swap events.
OH_Input_UnregisterDeviceListenersapi-13
Unregisters the listener for all device hot swap events.

Type Aliases§

Input_AxisEventCallback
Defines a lifecycle callback for axisEvent. If the callback is triggered, axisEvent will be destroyed.
Input_DeviceAddedCallbackapi-13
Defines the callback for device addition events.
Input_DeviceRemovedCallbackapi-13
Defines the callback for device removal events.
Input_HotkeyCallbackapi-14
Callback used to return shortcut key events.
Input_InjectAuthorizeCallbackapi-20
Defines the event injection callback.
Input_KeyEventCallback
Defines a lifecycle callback for keyEvent. If the callback is triggered, keyEvent will be destroyed.
Input_MouseEventCallback
Defines a lifecycle callback for mouseEvent. If the callback is triggered, mouseEvent will be destroyed.
Input_Result
Input_TouchEventCallback
Defines a lifecycle callback for touchEvent. If the callback is triggered, touchEvent will be destroyed.