1# oh_window_event_filter.h 2 3## Overview 4 5The 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. 6 7**File to include**: <window_manager/oh_window_event_filter.h> 8 9**Library**: libnative_window_manager.so 10 11**System capability**: SystemCapability.Window.SessionManager 12 13**Since**: 12 14 15**Related module**: [WindowManager](capi-windowmanager.md) 16 17## Summary 18 19### Functions 20 21| Name| typedef Keyword| Description| 22| -- | -- | -- | 23| [typedef bool (\*OH_NativeWindowManager_KeyEventFilter)(Input_KeyEvent* keyEvent)](#oh_nativewindowmanager_keyeventfilter) | OH_NativeWindowManager_KeyEventFilter | Defines a function for filtering multimodal key events.| 24| [WindowManager_ErrorCode OH_NativeWindowManager_RegisterKeyEventFilter(int32_t windowId,OH_NativeWindowManager_KeyEventFilter keyEventFilter)](#oh_nativewindowmanager_registerkeyeventfilter) | - | Registers a function for filtering multimodal key events.| 25| [WindowManager_ErrorCode OH_NativeWindowManager_UnregisterKeyEventFilter(int32_t windowId)](#oh_nativewindowmanager_unregisterkeyeventfilter) | - | Unregisters a function for filtering multimodal key events.| 26| [typedef bool (\*OH_NativeWindowManager_MouseEventFilter)(Input_MouseEvent* mouseEvent)](#oh_nativewindowmanager_mouseeventfilter) | OH_NativeWindowManager_MouseEventFilter | Defines a function for filtering multimodal mouse events.| 27| [WindowManager_ErrorCode OH_NativeWindowManager_RegisterMouseEventFilter(int32_t windowId,OH_NativeWindowManager_MouseEventFilter mouseEventFilter)](#oh_nativewindowmanager_registermouseeventfilter) | - | Registers a function for filtering multimodal mouse events.| 28| [WindowManager_ErrorCode OH_NativeWindowManager_UnregisterMouseEventFilter(int32_t windowId)](#oh_nativewindowmanager_unregistermouseeventfilter) | - | Unregisters a function for filtering multimodal mouse events.| 29| [typedef bool (\*OH_NativeWindowManager_TouchEventFilter)(Input_TouchEvent* touchEvent)](#oh_nativewindowmanager_toucheventfilter) | OH_NativeWindowManager_TouchEventFilter | Defines a function for filtering multimodal touch events.| 30| [WindowManager_ErrorCode OH_NativeWindowManager_RegisterTouchEventFilter(int32_t windowId,OH_NativeWindowManager_TouchEventFilter touchEventFilter)](#oh_nativewindowmanager_registertoucheventfilter) | - | Registers a function for filtering multimodal touch events.| 31| [WindowManager_ErrorCode OH_NativeWindowManager_UnregisterTouchEventFilter(int32_t windowId)](#oh_nativewindowmanager_unregistertoucheventfilter) | - | Unregisters a function for filtering multimodal touch events.| 32 33## Function Description 34 35### OH_NativeWindowManager_KeyEventFilter() 36 37``` 38typedef bool (*OH_NativeWindowManager_KeyEventFilter)(Input_KeyEvent* keyEvent) 39``` 40 41**Description** 42 43Defines a function for filtering multimodal key events. 44 45**Since**: 12 46 47 48**Parameters** 49 50| Parameter| Description| 51| -- | -- | 52| [Input_KeyEvent](../apis-input-kit/capi-input-input-keyevent.md)* keyEvent | Pointer to the multimodal key event. For details, see [Input_KeyEvent](../apis-input-kit/capi-input-input-keyevent.md). The event is defined in **oh_input_manager**.| 53 54**Return value** 55 56| Type| Description| 57| -- | -- | 58| bool | Whether the event will be intercepted. **true** if intercepted, **false** otherwise.| 59 60### OH_NativeWindowManager_RegisterKeyEventFilter() 61 62``` 63WindowManager_ErrorCode OH_NativeWindowManager_RegisterKeyEventFilter(int32_t windowId,OH_NativeWindowManager_KeyEventFilter keyEventFilter) 64``` 65 66**Description** 67 68Registers a function for filtering multimodal key events. 69 70**Since**: 12 71 72 73**Parameters** 74 75| Parameter| Description| 76| -- | -- | 77| int32_t windowId | ID of the window for which the function is registered.| 78| [OH_NativeWindowManager_KeyEventFilter](#oh_nativewindowmanager_keyeventfilter) keyEventFilter | Function to register.| 79 80**Return value** 81 82| Type| Description| 83| -- | -- | 84| [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode) | Status code defined in [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode).| 85 86### OH_NativeWindowManager_UnregisterKeyEventFilter() 87 88``` 89WindowManager_ErrorCode OH_NativeWindowManager_UnregisterKeyEventFilter(int32_t windowId) 90``` 91 92**Description** 93 94Unregisters a function for filtering multimodal key events. 95 96**Since**: 12 97 98 99**Parameters** 100 101| Parameter| Description| 102| -- | -- | 103| int32_t windowId | ID of the window for which the function is unregistered.| 104 105**Return value** 106 107| Type| Description| 108| -- | -- | 109| [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode) | Status code defined in [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode).| 110 111### OH_NativeWindowManager_MouseEventFilter() 112 113``` 114typedef bool (*OH_NativeWindowManager_MouseEventFilter)(Input_MouseEvent* mouseEvent) 115``` 116 117**Description** 118 119Defines a function for filtering multimodal mouse events. 120 121**Since**: 15 122 123 124**Parameters** 125 126| Parameter| Description| 127| -- | -- | 128| [Input_MouseEvent](../apis-input-kit/capi-input-input-mouseevent.md)* mouseEvent | Pointer to the multimodal mouse event. For details, see [Input_MouseEvent](../apis-input-kit/capi-input-input-mouseevent.md). The event is defined in **oh_input_manager**.| 129 130**Return value** 131 132| Type| Description| 133| -- | -- | 134| bool | Whether the event will be intercepted. **true** if the event will be intercepted; returns **false** otherwise.| 135 136### OH_NativeWindowManager_RegisterMouseEventFilter() 137 138``` 139WindowManager_ErrorCode OH_NativeWindowManager_RegisterMouseEventFilter(int32_t windowId,OH_NativeWindowManager_MouseEventFilter mouseEventFilter) 140``` 141 142**Description** 143 144Registers a function for filtering multimodal mouse events. 145 146**Since**: 15 147 148 149**Parameters** 150 151| Parameter| Description| 152| -- | -- | 153| int32_t windowId | ID of the window for which the function is registered.| 154| [OH_NativeWindowManager_MouseEventFilter](#oh_nativewindowmanager_mouseeventfilter) mouseEventFilter | Function to register.| 155 156**Return value** 157 158| Type| Description| 159| -- | -- | 160| [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode) | Status code defined in [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode).| 161 162### OH_NativeWindowManager_UnregisterMouseEventFilter() 163 164``` 165WindowManager_ErrorCode OH_NativeWindowManager_UnregisterMouseEventFilter(int32_t windowId) 166``` 167 168**Description** 169 170Unregisters a function for filtering multimodal mouse events. 171 172**Since**: 15 173 174 175**Parameters** 176 177| Parameter| Description| 178| -- | -- | 179| int32_t windowId | ID of the window for which the function is unregistered.| 180 181**Return value** 182 183| Type| Description| 184| -- | -- | 185| [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode) | Status code defined in [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode).| 186 187### OH_NativeWindowManager_TouchEventFilter() 188 189``` 190typedef bool (*OH_NativeWindowManager_TouchEventFilter)(Input_TouchEvent* touchEvent) 191``` 192 193**Description** 194 195Defines a function for filtering multimodal touch events. 196 197**Since**: 15 198 199 200**Parameters** 201 202| Parameter| Description| 203| -- | -- | 204| [Input_TouchEvent](../apis-input-kit/capi-input-input-touchevent.md)* touchEvent | Pointer to the multimodal touch event. For details, see [Input_TouchEvent](../apis-input-kit/capi-input-input-touchevent.md). The event is defined in **oh_input_manager**.| 205 206**Return value** 207 208| Type| Description| 209| -- | -- | 210| bool | Whether the event will be intercepted. **true** if the event will be intercepted; returns **false** otherwise.| 211 212### OH_NativeWindowManager_RegisterTouchEventFilter() 213 214``` 215WindowManager_ErrorCode OH_NativeWindowManager_RegisterTouchEventFilter(int32_t windowId,OH_NativeWindowManager_TouchEventFilter touchEventFilter) 216``` 217 218**Description** 219 220Registers a function for filtering multimodal touch events. 221 222**Since**: 15 223 224 225**Parameters** 226 227| Parameter| Description| 228| -- | -- | 229| int32_t windowId | ID of the window for which the function is registered.| 230| [OH_NativeWindowManager_TouchEventFilter](#oh_nativewindowmanager_toucheventfilter) touchEventFilter | Function to register.| 231 232**Return value** 233 234| Type| Description| 235| -- | -- | 236| [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode) | Status code defined in [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode).| 237 238### OH_NativeWindowManager_UnregisterTouchEventFilter() 239 240``` 241WindowManager_ErrorCode OH_NativeWindowManager_UnregisterTouchEventFilter(int32_t windowId) 242``` 243 244**Description** 245 246Unregisters a function for filtering multimodal touch events. 247 248**Since**: 15 249 250 251**Parameters** 252 253| Parameter| Description| 254| -- | -- | 255| int32_t windowId | ID of the window for which the function is unregistered.| 256 257**Return value** 258 259| Type| Description| 260| -- | -- | 261| [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode) | Status code defined in [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode).| 262