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