1# oh_window_event_filter.h 2 3## 概述 4 5定义窗口管理按键事件过滤的接口,当多模输入的事件经过窗口时,可以通过过滤接口拦截事件不让事件往下分发。 6 7**引用文件:** <window_manager/oh_window_event_filter.h> 8 9**库:** libnative_window_manager.so 10 11**系统能力:** SystemCapability.Window.SessionManager 12 13**起始版本:** 12 14 15**相关模块:** [WindowManager](capi-windowmanager.md) 16 17## 汇总 18 19### 函数 20 21| 名称 | typedef关键字 | 描述 | 22| -- | -- | -- | 23| [typedef bool (\*OH_NativeWindowManager_KeyEventFilter)(Input_KeyEvent* keyEvent)](#oh_nativewindowmanager_keyeventfilter) | OH_NativeWindowManager_KeyEventFilter | 定义多模按键的过滤函数。 | 24| [WindowManager_ErrorCode OH_NativeWindowManager_RegisterKeyEventFilter(int32_t windowId,OH_NativeWindowManager_KeyEventFilter keyEventFilter)](#oh_nativewindowmanager_registerkeyeventfilter) | - | 注册按键事件的过滤函数。 | 25| [WindowManager_ErrorCode OH_NativeWindowManager_UnregisterKeyEventFilter(int32_t windowId)](#oh_nativewindowmanager_unregisterkeyeventfilter) | - | 取消注册窗口的按键事件过滤函数。 | 26| [typedef bool (\*OH_NativeWindowManager_MouseEventFilter)(Input_MouseEvent* mouseEvent)](#oh_nativewindowmanager_mouseeventfilter) | OH_NativeWindowManager_MouseEventFilter | 定义多模鼠标事件的过滤函数。 | 27| [WindowManager_ErrorCode OH_NativeWindowManager_RegisterMouseEventFilter(int32_t windowId,OH_NativeWindowManager_MouseEventFilter mouseEventFilter)](#oh_nativewindowmanager_registermouseeventfilter) | - | 注册鼠标事件的过滤函数。 | 28| [WindowManager_ErrorCode OH_NativeWindowManager_UnregisterMouseEventFilter(int32_t windowId)](#oh_nativewindowmanager_unregistermouseeventfilter) | - | 取消注册窗口的鼠标事件过滤函数。 | 29| [typedef bool (\*OH_NativeWindowManager_TouchEventFilter)(Input_TouchEvent* touchEvent)](#oh_nativewindowmanager_toucheventfilter) | OH_NativeWindowManager_TouchEventFilter | 定义多模触摸事件的过滤函数。 | 30| [WindowManager_ErrorCode OH_NativeWindowManager_RegisterTouchEventFilter(int32_t windowId,OH_NativeWindowManager_TouchEventFilter touchEventFilter)](#oh_nativewindowmanager_registertoucheventfilter) | - | 注册触摸事件的过滤函数。 | 31| [WindowManager_ErrorCode OH_NativeWindowManager_UnregisterTouchEventFilter(int32_t windowId)](#oh_nativewindowmanager_unregistertoucheventfilter) | - | 取消注册窗口的触摸事件过滤函数。 | 32 33## 函数说明 34 35### OH_NativeWindowManager_KeyEventFilter() 36 37``` 38typedef bool (*OH_NativeWindowManager_KeyEventFilter)(Input_KeyEvent* keyEvent) 39``` 40 41**描述** 42 43定义多模按键的过滤函数。 44 45**起始版本:** 12 46 47 48**参数:** 49 50| 参数项 | 描述 | 51| -- | -- | 52| [Input_KeyEvent](../apis-input-kit/capi-input-input-keyevent.md)* keyEvent | 多模按键事件,具体可见[Input_KeyEvent](../apis-input-kit/capi-input-input-keyevent.md),事件定义在oh_input_manager中。 | 53 54**返回:** 55 56| 类型 | 说明 | 57| -- | -- | 58| bool | 返回是否过滤该事件。返回true窗口不再往下分发,返回false表示不拦截。 | 59 60### OH_NativeWindowManager_RegisterKeyEventFilter() 61 62``` 63WindowManager_ErrorCode OH_NativeWindowManager_RegisterKeyEventFilter(int32_t windowId,OH_NativeWindowManager_KeyEventFilter keyEventFilter) 64``` 65 66**描述** 67 68注册按键事件的过滤函数。 69 70**起始版本:** 12 71 72 73**参数:** 74 75| 参数项 | 描述 | 76| -- | -- | 77| int32_t windowId | 需要过滤按键事件的窗口ID。 | 78| [OH_NativeWindowManager_KeyEventFilter](#oh_nativewindowmanager_keyeventfilter) keyEventFilter | 多模按键的过滤函数。 | 79 80**返回:** 81 82| 类型 | 说明 | 83| -- | -- | 84| [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode) | 返回窗口管理接口的通用状态码,具体可见[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**描述** 93 94取消注册窗口的按键事件过滤函数。 95 96**起始版本:** 12 97 98 99**参数:** 100 101| 参数项 | 描述 | 102| -- | -- | 103| int32_t windowId | 需要取消过滤按键事件的窗口ID。 | 104 105**返回:** 106 107| 类型 | 说明 | 108| -- | -- | 109| [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode) | 返回窗口管理接口的通用状态码,具体可见[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**描述** 118 119定义多模鼠标事件的过滤函数。 120 121**起始版本:** 15 122 123 124**参数:** 125 126| 参数项 | 描述 | 127| -- | -- | 128| [Input_MouseEvent](../apis-input-kit/capi-input-input-mouseevent.md)* mouseEvent | 多模鼠标事件,具体可见[Input_MouseEvent](../apis-input-kit/capi-input-input-mouseevent.md),事件定义在oh_input_manager中。 | 129 130**返回:** 131 132| 类型 | 说明 | 133| -- | -- | 134| bool | 返回是否过滤该事件。true表示过滤该事件,不会继续往下分发;false表示不过滤不拦截此事件,将会继续分发。 | 135 136### OH_NativeWindowManager_RegisterMouseEventFilter() 137 138``` 139WindowManager_ErrorCode OH_NativeWindowManager_RegisterMouseEventFilter(int32_t windowId,OH_NativeWindowManager_MouseEventFilter mouseEventFilter) 140``` 141 142**描述** 143 144注册鼠标事件的过滤函数。 145 146**起始版本:** 15 147 148 149**参数:** 150 151| 参数项 | 描述 | 152| -- | -- | 153| int32_t windowId | 需要过滤鼠标事件的窗口ID。 | 154| [OH_NativeWindowManager_MouseEventFilter](#oh_nativewindowmanager_mouseeventfilter) mouseEventFilter | 多模鼠标事件的过滤函数。 | 155 156**返回:** 157 158| 类型 | 说明 | 159| -- | -- | 160| [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode) | 返回窗口管理接口的通用状态码,具体可见[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**描述** 169 170取消注册窗口的鼠标事件过滤函数。 171 172**起始版本:** 15 173 174 175**参数:** 176 177| 参数项 | 描述 | 178| -- | -- | 179| int32_t windowId | 需要取消过滤鼠标事件的窗口ID。 | 180 181**返回:** 182 183| 类型 | 说明 | 184| -- | -- | 185| [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode) | 返回窗口管理接口的通用状态码,具体可见[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**描述** 194 195定义多模触摸事件的过滤函数。 196 197**起始版本:** 15 198 199 200**参数:** 201 202| 参数项 | 描述 | 203| -- | -- | 204| [Input_TouchEvent](../apis-input-kit/capi-input-input-touchevent.md)* touchEvent | 多模触摸事件,具体可见[Input_TouchEvent](../apis-input-kit/capi-input-input-touchevent.md),事件定义在oh_input_manager中。 | 205 206**返回:** 207 208| 类型 | 说明 | 209| -- | -- | 210| bool | 返回是否过滤该事件。true表示过滤该事件,不会继续往下分发;false表示不过滤不拦截此事件,将会继续分发。 | 211 212### OH_NativeWindowManager_RegisterTouchEventFilter() 213 214``` 215WindowManager_ErrorCode OH_NativeWindowManager_RegisterTouchEventFilter(int32_t windowId,OH_NativeWindowManager_TouchEventFilter touchEventFilter) 216``` 217 218**描述** 219 220注册触摸事件的过滤函数。 221 222**起始版本:** 15 223 224 225**参数:** 226 227| 参数项 | 描述 | 228| -- | -- | 229| int32_t windowId | 需要过滤触摸事件的窗口ID。 | 230| [OH_NativeWindowManager_TouchEventFilter](#oh_nativewindowmanager_toucheventfilter) touchEventFilter | 多模触摸事件的过滤函数。 | 231 232**返回:** 233 234| 类型 | 说明 | 235| -- | -- | 236| [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode) | 返回窗口管理接口的通用状态码,具体可见[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**描述** 245 246取消注册窗口的触摸事件过滤函数。 247 248**起始版本:** 15 249 250 251**参数:** 252 253| 参数项 | 描述 | 254| -- | -- | 255| int32_t windowId | 需要取消过滤触摸事件的窗口ID。 | 256 257**返回:** 258 259| 类型 | 说明 | 260| -- | -- | 261| [WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode) | 返回窗口管理接口的通用状态码,具体可见[WindowManager_ErrorCode](capi-oh-window-comm-h.md#windowmanager_errorcode)。 | 262 263 264