1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
// automatically generated by rust-bindgen 0.71.1
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#[cfg(feature = "api-17")]
use crate::window_comm::WindowManager_Rect;
use crate::window_comm::{
WindowManager_AvoidArea, WindowManager_AvoidAreaType, WindowManager_WindowProperties,
};
#[cfg(feature = "api-21")]
use crate::window_comm::{WindowManager_MainWindowInfo, WindowManager_WindowSnapshotConfig};
#[cfg(feature = "api-20")]
use ohos_sys_opaque_types::Input_TouchEvent;
use ohos_sys_opaque_types::OH_PixelmapNative;
/// Callback interface for getting main windows' snapshot.
///
/// # Arguments
///
/// * `snapshotPixelMapList` - List of windows' snapshot
///
/// * `snapshotListSize` - Size of snapshotPixelMapList
///
/// Available since API-level: 21
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
pub type OH_WindowManager_WindowSnapshotCallback = ::core::option::Option<
unsafe extern "C" fn(
snapshotPixelMapList: *mut *const OH_PixelmapNative,
snapshotListSize: usize,
),
>;
extern "C" {
/// Set whether to show status bar.
///
/// # Arguments
///
/// * `windowId` - WindowId when window is created.
///
/// * `enabled` - If true, the status bar is displayed. If false, the status bar is hidden.
///
/// * `enableAnimation` - If true, the status bar is displayed and hidden with animation.
/// If false, the status bar is displayed and hidden with no animation.
///
/// # Returns
///
/// * Returns the result code.
/// [`OK`] the function call is successful.
/// [`WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED`] capability not supported.
/// [`WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL`] this window state is abnormal.
/// [`WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL`] the window manager service works abnormally.
///
/// Available since API-level: 15
#[cfg(feature = "api-15")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
pub fn OH_WindowManager_SetWindowStatusBarEnabled(
windowId: i32,
enabled: bool,
enableAnimation: bool,
) -> i32;
/// Set status bar content color.
///
/// # Arguments
///
/// * `windowId` - WindowId when window is created.
///
/// * `color` - The color value to set, the format is ARGB.
///
/// # Returns
///
/// * Returns the result code.
/// [`OK`] the function call is successful.
/// [`WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED`] capability not supported.
/// [`WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL`] this window state is abnormal.
/// [`WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL`] the window manager service works abnormally.
///
/// Available since API-level: 15
#[cfg(feature = "api-15")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
pub fn OH_WindowManager_SetWindowStatusBarColor(windowId: i32, color: i32) -> i32;
/// Set whether to show navigation bar.
///
/// # Arguments
///
/// * `windowId` - WindowId when window is created.
///
/// * `enabled` - If true, the navigation bar is displayed. If false, the navigation bar is hidden.
///
/// * `enableAnimation` - If true, the navigation bar is displayed and hidden with animation.
/// If false, the navigation bar is displayed and hidden with no animation.
///
/// # Returns
///
/// * Returns the result code.
/// [`OK`] the function call is successful.
/// [`WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED`] capability not supported.
/// [`WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL`] this window state is abnormal.
/// [`WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL`] the window manager service works abnormally.
///
/// Available since API-level: 15
#[cfg(feature = "api-15")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
pub fn OH_WindowManager_SetWindowNavigationBarEnabled(
windowId: i32,
enabled: bool,
enableAnimation: bool,
) -> i32;
/// Get the avoid area
///
/// # Arguments
///
/// * `windowId` - WindowId when window is created.
///
/// * `type` - Type of the avoid area.
///
/// * `avoidArea` - Indicates the pointer to a WindowManager_AvoidArea object.
///
/// # Returns
///
/// * Returns the result code.
/// [`OK`] the function call is successful, return avoid area ptr in avoidArea.
/// [`WINDOW_MANAGER_ERRORCODE_INVALID_PARAM`] parameter error.
/// [`WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL`] this window state is abnormal.
/// [`WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL`] the window manager service works abnormally.
///
/// Available since API-level: 15
#[cfg(feature = "api-15")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
pub fn OH_WindowManager_GetWindowAvoidArea(
windowId: i32,
type_: WindowManager_AvoidAreaType,
avoidArea: *mut WindowManager_AvoidArea,
) -> i32;
/// Checks whether the window is displayed.
///
/// # Arguments
///
/// * `windowId` - WindowId when window is created.
///
/// * `isShow` - Whether the window is displayed. The value true means that the window is displayed, and false means the opposite.
///
/// # Returns
///
/// * Returns the result code.
/// [`OK`] the function call is successful.
/// [`WINDOW_MANAGER_ERRORCODE_INVALID_PARAM`] parameter error.
/// [`WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL`] this window state is abnormal.
///
/// Available since API-level: 15
#[cfg(feature = "api-15")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
pub fn OH_WindowManager_IsWindowShown(windowId: i32, isShow: *mut bool) -> i32;
/// Show window.
///
/// # Arguments
///
/// * `windowId` - WindowId when window is created.
///
/// # Returns
///
/// * Returns the result code.
/// [`OK`] the function call is successful.
/// [`WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL`] this window state is abnormal.
/// [`WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL`] the window manager service works abnormally.
///
/// Available since API-level: 15
#[cfg(feature = "api-15")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
pub fn OH_WindowManager_ShowWindow(windowId: i32) -> i32;
/// Set window touchable
///
/// # Arguments
///
/// * `windowId` - WindowId when window is created.
///
/// * `isTouchable` - Indicates whether the specified window can be touched.
///
/// # Returns
///
/// * Returns the result code.
/// [`OK`] the function call is successful.
/// [`WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL`] this window state is abnormal.
/// [`WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL`] the window manager service works abnormally.
///
/// Available since API-level: 15
#[cfg(feature = "api-15")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
pub fn OH_WindowManager_SetWindowTouchable(windowId: i32, isTouchable: bool) -> i32;
/// Set focusable property of window.
///
/// # Arguments
///
/// * `windowId` - WindowId when window is created.
///
/// * `isFocusable` - Window can be focused or not.
///
/// # Returns
///
/// * Returns the result code.
/// [`OK`] the function call is successful.
/// [`WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL`] this window state is abnormal.
/// [`WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL`] the window manager service works abnormally.
///
/// Available since API-level: 15
#[cfg(feature = "api-15")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
pub fn OH_WindowManager_SetWindowFocusable(windowId: i32, isFocusable: bool) -> i32;
/// Sets the background color of window.
///
/// # Arguments
///
/// * `windowId` - WindowId when window is created.
///
/// * `color` - the specified color.
///
/// # Returns
///
/// * Returns the result code.
/// [`OK`] the function call is successful.
/// [`WINDOW_MANAGER_ERRORCODE_INVALID_PARAM`] parameter error.
/// [`WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL`] this window state is abnormal.
///
/// Available since API-level: 15
#[cfg(feature = "api-15")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
pub fn OH_WindowManager_SetWindowBackgroundColor(
windowId: i32,
color: *const ::core::ffi::c_char,
) -> i32;
/// Sets the brightness of window.
///
/// # Arguments
///
/// * `windowId` - WindowId when window is created.
///
/// * `brightness` - the specified brightness value.
///
/// # Returns
///
/// * Returns the result code.
/// [`OK`] the function call is successful.
/// [`WINDOW_MANAGER_ERRORCODE_INVALID_PARAM`] parameter error.
/// [`WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL`] this window state is abnormal.
/// [`WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL`] the window manager service works abnormally.
///
/// Available since API-level: 15
#[cfg(feature = "api-15")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
pub fn OH_WindowManager_SetWindowBrightness(windowId: i32, brightness: f32) -> i32;
/// Sets whether keep screen on or not.
///
/// # Arguments
///
/// * `windowId` - WindowId when window is created.
///
/// * `isKeepScreenOn` - keep screen on if true, or not if false.
///
/// # Returns
///
/// * Returns the result code.
/// [`OK`] the function call is successful.
/// [`WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL`] this window state is abnormal.
/// [`WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL`] the window manager service works abnormally.
///
/// Available since API-level: 15
#[cfg(feature = "api-15")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
pub fn OH_WindowManager_SetWindowKeepScreenOn(windowId: i32, isKeepScreenOn: bool) -> i32;
/// Sets whether is private mode or not.
///
/// `ohos.permission.PRIVACY_WINDOW`
/// # Arguments
///
/// * `windowId` - WindowId when window is created.
///
/// * `isPrivacy` - In private mode if true, or not if false.
///
/// # Returns
///
/// * Returns the result code.
/// [`OK`] the function call is successful.
/// [`WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL`] this window state is abnormal.
/// [`WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL`] the window manager service works abnormally.
/// [`WINDOW_MANAGER_ERRORCODE_NO_PERMISSION`] permission verification failed.
///
/// Available since API-level: 15
#[cfg(feature = "api-15")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
pub fn OH_WindowManager_SetWindowPrivacyMode(windowId: i32, isPrivacy: bool) -> i32;
/// Get the properties of current window.
///
/// # Arguments
///
/// * `windowId` - WindowId when window is created.
///
/// * `windowProperties` - Properties of current window.
///
/// # Returns
///
/// * Returns the result code.
/// [`OK`] the function call is successful, return window properties ptr in windowProperties.
/// [`WINDOW_MANAGER_ERRORCODE_INVALID_PARAM`] parameter error.
/// [`WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL`] this window state is abnormal.
///
/// Available since API-level: 15
#[cfg(feature = "api-15")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
pub fn OH_WindowManager_GetWindowProperties(
windowId: i32,
windowProperties: *mut WindowManager_WindowProperties,
) -> i32;
/// Obtains snapshot of window.
///
/// # Arguments
///
/// * `windowId` - windowId when window is created.
///
/// * `pixelMap` - snapshot of window.
///
/// # Returns
///
/// * Returns the result code.
/// [`OK`] the function call is successful, return pixel map ptr in pixelMap.
/// [`WINDOW_MANAGER_ERRORCODE_INVALID_PARAM`] parameter error.
/// [`WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL`] the window manager service works abnormally.
///
/// Available since API-level: 15
#[cfg(feature = "api-15")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-15")))]
pub fn OH_WindowManager_Snapshot(windowId: i32, pixelMap: *mut OH_PixelmapNative) -> i32;
/// Get layout info of all windows on the selected display.
///
/// # Arguments
///
/// * `displayId` - Indicate the id of display.
///
/// * `windowLayoutInfoList` - Pointer to the layout information of the visible windows on the specified screen.
///
/// * `windowLayoutInfoSize` - Pointer to the size of the array of layout information of the visible windows on the
/// specified screen.
///
/// # Returns
///
/// * Returns the result code.
/// [`OK`] the function call is successful, return Window layout info list.
/// [`WINDOW_MANAGER_ERRORCODE_INVALID_PARAM`] parameter error.
/// [`WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED`] capability not supported.
/// [`WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL`] the window manager service works abnormally.
///
/// Available since API-level: 17
#[cfg(feature = "api-17")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-17")))]
pub fn OH_WindowManager_GetAllWindowLayoutInfoList(
displayId: i64,
windowLayoutInfoList: *mut *mut WindowManager_Rect,
windowLayoutInfoSize: *mut usize,
) -> i32;
/// Release the memory of window layout info list.
///
/// # Arguments
///
/// * `windowLayoutInfoList` - Pointer to the layout information of the visible windows on the specified screen.
///
/// Available since API-level: 17
#[cfg(feature = "api-17")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-17")))]
pub fn OH_WindowManager_ReleaseAllWindowLayoutInfoList(
windowLayoutInfoList: *mut WindowManager_Rect,
);
/// app can inject a touchEvent to target window without Focus and zOrder changed, just send to ArkUI.
///
/// # Arguments
///
/// * `windowId` - windowId when window is created.
///
/// * `touchEvent` - multimodal touchEvent.
///
/// * `windowX` - The position of the event relative to the abscissa of the window.
///
/// * `windowY` - The position of the event relative to the ordinate of the window.
///
/// # Returns
///
/// * Returns the result code.
/// [`OK`] the function call is successful.
/// [`WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL`] this window state is abnormal.
/// [`WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL`] the window manager service works abnormally.
///
/// Available since API-level: 20
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub fn OH_WindowManager_InjectTouchEvent(
windowId: i32,
touchEvent: *mut Input_TouchEvent,
windowX: i32,
windowY: i32,
) -> i32;
/// Get all main window info on device.
///
/// ohos.permission.CUSTOM_SCREEN_CAPTURE
/// # Arguments
///
/// * `infoList` - Indicates the pointer to a main window info list.
///
/// * `mainWindowInfoSize` - The size of main window info list.
///
/// # Returns
///
/// * Returns the status code of the execution.
/// [`WS_OK`] the function call is successful.
/// [`WINDOW_MANAGER_ERRORCODE_NO_PERMISSION`] permission verification failed.
/// [`WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED`] capability not supported.
/// [`WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL`] the window manager service works abnormally.
///
/// Available since API-level: 21
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
pub fn OH_WindowManager_GetAllMainWindowInfo(
infoList: *mut *mut WindowManager_MainWindowInfo,
mainWindowInfoSize: *mut usize,
) -> i32;
/// Release all main window info list.
///
/// # Arguments
///
/// * `infoList` - Pointer to the main window info list.
///
/// Available since API-level: 21
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
pub fn OH_WindowManager_ReleaseAllMainWindowInfo(infoList: *mut WindowManager_MainWindowInfo);
/// Get snapshot of the specified windows.
///
/// ohos.permission.CUSTOM_SCREEN_CAPTURE
/// # Arguments
///
/// * `windowIdList` - Main window id list for getting snapshot.
///
/// * `windowIdListSize` - Size of main window id list.
///
/// * `config` - Configuration for getting snapshot.
///
/// * `callback` - Snapshot callback object.
///
/// # Returns
///
/// * Returns the status code of the execution.
/// [`WS_OK`] the function call is successful.
/// [`WINDOW_MANAGER_ERRORCODE_NO_PERMISSION`] permission verification failed.
/// [`WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED`] capability not supported.
/// [`WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL`] the window manager service works abnormally.
///
/// Available since API-level: 21
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
pub fn OH_WindowManager_GetMainWindowSnapshot(
windowIdList: *mut i32,
windowIdListSize: usize,
config: WindowManager_WindowSnapshotConfig,
callback: OH_WindowManager_WindowSnapshotCallback,
) -> i32;
/// Release main window snapshot list.
///
/// # Arguments
///
/// * `snapshotPixelMapList` - Indicates the pointer of a windows' snapshot list.
///
/// Available since API-level: 21
#[cfg(feature = "api-21")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
pub fn OH_WindowManager_ReleaseMainWindowSnapshot(
snapshotPixelMapList: *const OH_PixelmapNative,
);
}