harmony 鸿蒙oh_window_event_filter.h

  • 2025-06-12
  • 浏览 (4)

oh_window_event_filter.h

Overview

The oh_window_event_filter.h file declares the APIs for a window to filter multimodal key events. When a multimodal input event passes through the window, the window can interrupt the event to prevent it from being further distributed.

File to include:

Library: libnative_window_manager.so

System capability: SystemCapability.Window.SessionManager

Since: 12

Related module: WindowManager

Summary

Functions

|Name|typedef Keyword|Description| |–|–|–| |typedef bool (*OH_NativeWindowManager_KeyEventFilter)(Input_KeyEvent* keyEvent)|OH_NativeWindowManager_KeyEventFilter|Defines a function for filtering multimodal key events.| |WindowManager_ErrorCode OH_NativeWindowManager_RegisterKeyEventFilter(int32_t windowId,OH_NativeWindowManager_KeyEventFilter keyEventFilter)|-|Registers the function for filtering multimodal key events.| |WindowManager_ErrorCode OH_NativeWindowManager_UnregisterKeyEventFilter(int32_t windowId)|-|Unregisters the function for filtering multimodal key events.| |typedef bool (*OH_NativeWindowManager_MouseEventFilter)(Input_MouseEvent* mouseEvent)|OH_NativeWindowManager_MouseEventFilter|Defines a function for filtering multimodal mouse events.| |WindowManager_ErrorCode OH_NativeWindowManager_RegisterMouseEventFilter(int32_t windowId,OH_NativeWindowManager_MouseEventFilter mouseEventFilter)|-|Registers the function for filtering multimodal mouse events.| |WindowManager_ErrorCode OH_NativeWindowManager_UnregisterMouseEventFilter(int32_t windowId)|-|Unregisters the function for filtering multimodal mouse events.| |typedef bool (*OH_NativeWindowManager_TouchEventFilter)(Input_TouchEvent* touchEvent)|OH_NativeWindowManager_TouchEventFilter|Defines a function for filtering multimodal touch events.| |WindowManager_ErrorCode OH_NativeWindowManager_RegisterTouchEventFilter(int32_t windowId,OH_NativeWindowManager_TouchEventFilter touchEventFilter)|-|Registers the function for filtering multimodal touch events.| |WindowManager_ErrorCode OH_NativeWindowManager_UnregisterTouchEventFilter(int32_t windowId)|-|Unregisters the function for filtering multimodal touch events.|

Function Description

OH_NativeWindowManager_KeyEventFilter()

typedef bool (*OH_NativeWindowManager_KeyEventFilter)(Input_KeyEvent* keyEvent)

Description

Defines a function for filtering multimodal key events.

Since: 12

Parameters

|Parameter|Description| |–|–| |Input_KeyEvent* keyEvent|Pointer to the multimodal key event. For details, see Input_KeyEvent. The event is defined in oh_input_manager.|

Return value

|Type|Description| |–|–| |bool|Whether the event will be intercepted. The value true means that the event will be intercepted, and false means the opposite.|

OH_NativeWindowManager_RegisterKeyEventFilter()

WindowManager_ErrorCode OH_NativeWindowManager_RegisterKeyEventFilter(int32_t windowId,OH_NativeWindowManager_KeyEventFilter keyEventFilter)

Description

Registers the function for filtering multimodal key events.

Since: 12

Parameters

|Parameter|Description| |–|–| |int32_t windowId|ID of the window for which the function is registered.| |OH_NativeWindowManager_KeyEventFilter keyEventFilter|Function to register.|

Return value

|Type|Description| |–|–| |WindowManager_ErrorCode|Status code defined in WindowManager_ErrorCode.|

OH_NativeWindowManager_UnregisterKeyEventFilter()

WindowManager_ErrorCode OH_NativeWindowManager_UnregisterKeyEventFilter(int32_t windowId)

Description

Unregisters the function for filtering multimodal key events.

Since: 12

Parameters

|Parameter|Description| |–|–| |int32_t windowId|ID of the window for which the function is unregistered.|

Return value

|Type|Description| |–|–| |WindowManager_ErrorCode|Status code defined in WindowManager_ErrorCode.|

OH_NativeWindowManager_MouseEventFilter()

typedef bool (*OH_NativeWindowManager_MouseEventFilter)(Input_MouseEvent* mouseEvent)

Description

Defines a function for filtering multimodal mouse events.

Since: 15

Parameters

|Parameter|Description| |–|–| |Input_MouseEvent* mouseEvent|Pointer to the multimodal mouse event. For details, see Input_MouseEvent. The event is defined in oh_input_manager.|

Return value

|Type|Description| |–|–| |bool|Whether the event will be intercepted. true if the event will be intercepted; returns false otherwise.|

OH_NativeWindowManager_RegisterMouseEventFilter()

WindowManager_ErrorCode OH_NativeWindowManager_RegisterMouseEventFilter(int32_t windowId,OH_NativeWindowManager_MouseEventFilter mouseEventFilter)

Description

Registers the function for filtering multimodal mouse events.

Since: 15

Parameters

|Parameter|Description| |–|–| |int32_t windowId|ID of the window for which the function is registered.| |OH_NativeWindowManager_MouseEventFilter mouseEventFilter|Function to register.|

Return value

|Type|Description| |–|–| |WindowManager_ErrorCode|Status code defined in WindowManager_ErrorCode.|

OH_NativeWindowManager_UnregisterMouseEventFilter()

WindowManager_ErrorCode OH_NativeWindowManager_UnregisterMouseEventFilter(int32_t windowId)

Description

Unregisters the function for filtering multimodal mouse events.

Since: 15

Parameters

|Parameter|Description| |–|–| |int32_t windowId|ID of the window for which the function is unregistered.|

Return value

|Type|Description| |–|–| |WindowManager_ErrorCode|Status code defined in WindowManager_ErrorCode.|

OH_NativeWindowManager_TouchEventFilter()

typedef bool (*OH_NativeWindowManager_TouchEventFilter)(Input_TouchEvent* touchEvent)

Description

Defines a function for filtering multimodal touch events.

Since: 15

Parameters

|Parameter|Description| |–|–| |Input_TouchEvent* touchEvent|Pointer to the multimodal touch event. For details, see Input_TouchEvent. The event is defined in oh_input_manager.|

Return value

|Type|Description| |–|–| |bool|Whether the event will be intercepted. true if the event will be intercepted; returns false otherwise.|

OH_NativeWindowManager_RegisterTouchEventFilter()

WindowManager_ErrorCode OH_NativeWindowManager_RegisterTouchEventFilter(int32_t windowId,OH_NativeWindowManager_TouchEventFilter touchEventFilter)

Description

Registers the function for filtering multimodal touch events.

Since: 15

Parameters

|Parameter|Description| |–|–| |int32_t windowId|ID of the window for which the function is registered.| |OH_NativeWindowManager_TouchEventFilter touchEventFilter|Function to register.|

Return value

|Type|Description| |–|–| |WindowManager_ErrorCode|Status code defined in WindowManager_ErrorCode.|

OH_NativeWindowManager_UnregisterTouchEventFilter()

WindowManager_ErrorCode OH_NativeWindowManager_UnregisterTouchEventFilter(int32_t windowId)

Description

Unregisters the function for filtering multimodal touch events.

Since: 15

Parameters

|Parameter|Description| |–|–| |int32_t windowId|ID of the window for which the function is unregistered.|

Return value

|Type|Description| |–|–| |WindowManager_ErrorCode|Status code defined in WindowManager_ErrorCode.|

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkUI

harmony 鸿蒙ARKUI_TextPickerCascadeRangeContent

harmony 鸿蒙ARKUI_TextPickerRangeContent

harmony 鸿蒙ArkUI_AnimateCompleteCallback

harmony 鸿蒙ArkUI_AttributeItem

harmony 鸿蒙ArkUI_ColorStop

harmony 鸿蒙ArkUI_ContextCallback

harmony 鸿蒙ArkUI_EventModule

harmony 鸿蒙ArkUI_ExpectedFrameRateRange

harmony 鸿蒙ArkUI_IntOffset

0  赞