1# WindowManager_NativeModule
2
3
4## Overview
5
6The WindowManager_NativeModule module provides the capabilities of managing application windows.
7
8**Since**: 12
9
10
11## Summary
12
13
14### Files
15
16| Name| Description|
17| -------- | -------- |
18| [oh_window_comm.h](oh__window__comm_8h.md) | Declares the common enums and definitions of the window manager.|
19| [oh_window_event_filter.h](oh__window__event__filter_8h.md) | 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.|
20
21
22### Types
23
24| Name| Description|
25| -------- | -------- |
26| typedef enum [WindowManager_ErrorCode](#windowmanager_errorcode)  [WindowManager_ErrorCode](#windowmanager_errorcode) | Defines an enum for the status codes returned by the window manager interface.|
27| typedef bool(\*[OH_NativeWindowManager_KeyEventFilter](#oh_nativewindowmanager_keyeventfilter)) (Input_KeyEvent \*keyEvent) | Defines a function for filtering a multimodal key event.|
28
29
30### Enums
31
32| Name| Description|
33| -------- | -------- |
34| [WindowManager_ErrorCode](#windowmanager_errorcode) { OK = 0, INVAILD_WINDOW_ID = 1000, SERVICE_ERROR = 2000 } | Enumerates the status codes returned by the window manager interface.|
35
36
37### Functions
38
39| Name| Description|
40| -------- | -------- |
41| [WindowManager_ErrorCode](#windowmanager_errorcode)  [OH_NativeWindowManager_RegisterKeyEventFilter](#oh_nativewindowmanager_registerkeyeventfilter) (int32_t windowId, [OH_NativeWindowManager_KeyEventFilter](#oh_nativewindowmanager_keyeventfilter) keyEventFilter) | Registers the function for filtering a multimodal key event.|
42| [WindowManager_ErrorCode](#windowmanager_errorcode)  [OH_NativeWindowManager_UnregisterKeyEventFilter](#oh_nativewindowmanager_unregisterkeyeventfilter) (int32_t windowId) | Unregisters the function for filtering a multimodal key event.|
43
44
45## Type Description
46
47
48### OH_NativeWindowManager_KeyEventFilter
49
50```
51typedef bool(* OH_NativeWindowManager_KeyEventFilter) (Input_KeyEvent *keyEvent)
52```
53
54**Description**
55
56Defines a function for filtering a multimodal key event.
57
58**Since**: 12
59
60**Parameters**
61
62| Name| Description|
63| -------- | -------- |
64| keyEvent | Multimodal key event. For details, see **Input_KeyEvent**. The event is defined in **oh_input_manager**.|
65
66**Returns**
67
68Returns **true** if the event will be intercepted; returns **false** otherwise.
69
70
71### WindowManager_ErrorCode
72
73```
74typedef enum WindowManager_ErrorCode WindowManager_ErrorCode
75```
76
77**Description**
78
79Defines an enum for the status codes returned by the window manager interface.
80
81**Since**: 12
82
83
84## Enum Description
85
86
87### WindowManager_ErrorCode
88
89```
90enum WindowManager_ErrorCode
91```
92
93**Description**
94
95Enumerates the status codes returned by the window manager interface.
96
97**Since**: 12
98
99| Value| Description|
100| -------- | -------- |
101| OK | Operation successful.|
102| INVAILD_WINDOW_ID | Invalid window ID.|
103| SERVICE_ERROR | Service error.|
104
105
106## Function Description
107
108
109### OH_NativeWindowManager_RegisterKeyEventFilter()
110
111```
112WindowManager_ErrorCode OH_NativeWindowManager_RegisterKeyEventFilter (int32_t windowId, OH_NativeWindowManager_KeyEventFilter keyEventFilter )
113```
114
115**Description**
116
117Registers the function for filtering a multimodal key event.
118
119**Since**: 12
120
121**Parameters**
122
123| Name| Description|
124| -------- | -------- |
125| windowId | ID of the window for which the function is registered.|
126| keyEventFilter | Function for filtering a multimodal key event.|
127
128**Returns**
129
130Returns a status code defined in [WindowManager_ErrorCode](#windowmanager_errorcode).
131
132
133### OH_NativeWindowManager_UnregisterKeyEventFilter()
134
135```
136WindowManager_ErrorCode OH_NativeWindowManager_UnregisterKeyEventFilter (int32_t windowId)
137```
138
139**Description**
140
141Unregisters the function for filtering a multimodal key event.
142
143**Since**: 12
144
145**Parameters**
146
147| Name| Description|
148| -------- | -------- |
149| windowId | ID of the window for which the function is unregistered.|
150
151**Returns**
152
153Returns a status code defined in [WindowManager_ErrorCode](#windowmanager_errorcode).
154