Skip to main content

OH_Input_AddInputEventInterceptor

Function OH_Input_AddInputEventInterceptor 

Source
pub unsafe extern "C" fn OH_Input_AddInputEventInterceptor(
    callback: *mut Input_InterceptorEventCallback,
    option: *mut Input_InterceptorOptions,
) -> Input_Result
Expand description

@brief Adds an interceptor for input events, including mouse, touch, and axis events. Only the first addition takes effect. Subsequent requests will return error code {@link INPUT_REPEAT_INTERCEPTOR}. Key events are intercepted only when the application window is hit.

@permission ohos.permission.INTERCEPT_INPUT_EVENT @param callback Pointer to the structure of the interceptor event callback. For details, see {@link Input_InterceptorEventCallback}. @param option Options for event interception. If null is passed, the default value is used. @return {@link INPUT_SUCCESS} if the operation is successful;
{@link INPUT_PERMISSION_DENIED} if permission verification fails;
{@link INPUT_PARAMETER_ERROR} if the callback is empty or no listener is added;
{@link INPUT_REPEAT_INTERCEPTOR} if an interceptor is repeatedly added;
{@link INPUT_SERVICE_EXCEPTION} if the service is abnormal. @syscap SystemCapability.MultimodalInput.Input.Core @since 12