• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OH_WINDOW_COMM_H
17 #define OH_WINDOW_COMM_H
18 
19 #include "stdint.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 /**
26  * @brief The native pixel map information defined by Image Kit.
27  *
28  * @since 16
29  */
30 struct OH_PixelmapNative;
31 
32 /**
33  * @brief Enumerates the result types of the wm interface
34  *
35  * @since 12
36  */
37 typedef enum {
38     /** succ. */
39     OK = 0,
40     /**
41      * @error No permission.
42      *
43      * @since 16
44      */
45     WINDOW_MANAGER_ERRORCODE_NO_PERMISSION = 201,
46     /**
47      * @error Param is invalid.
48      *
49      * @since 15
50      */
51     WINDOW_MANAGER_ERRORCODE_INVALID_PARAM = 401,
52     /**
53      * @error Device not support.
54      *
55      * @since 15
56      */
57     WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED = 801,
58     /** window id is invaild. */
59     INVAILD_WINDOW_ID = 1000,
60     /** failed. */
61     SERVICE_ERROR = 2000,
62     /**
63      * @error Window state is abnormal.
64      *
65      * @since 15
66      */
67     WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL = 1300002,
68     /**
69      * @error Window manager service works abnormally.
70      *
71      * @since 15
72      */
73     WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL = 1300003,
74     /**
75      * @error Picture-In-Picture failed to destroy.
76      *
77      * @since 20
78      */
79     WINDOW_MANAGER_ERRORCODE_PIP_DESTROY_FAILED = 1300011,
80     /**
81      * @error Picture-In-Picture state is abnormal.
82      *
83      * @since 20
84      */
85     WINDOW_MANAGER_ERRORCODE_PIP_STATE_ABNORMAL = 1300012,
86     /**
87      * @error Picture-In-Picture failed to create.
88      *
89      * @since 20
90      */
91     WINDOW_MANAGER_ERRORCODE_PIP_CREATE_FAILED = 1300013,
92     /**
93      * @error Picture-In-Picture internal error.
94      *
95      * @since 20
96      */
97     WINDOW_MANAGER_ERRORCODE_PIP_INTERNAL_ERROR = 1300014,
98     /**
99      * @error Picture-In-Picture repeated operation.
100      *
101      * @since 20
102      */
103     WINDOW_MANAGER_ERRORCODE_PIP_REPEATED_OPERATION = 1300015,
104     /**
105      * @error Parameter is incorrect.
106      * @since 20
107      */
108     WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM = 1300016,
109 } WindowManager_ErrorCode;
110 
111 /**
112  * @brief Enumerates the avoid area types.
113  *
114  * @since 15
115  */
116 typedef enum {
117     /** System. */
118     WINDOW_MANAGER_AVOID_AREA_TYPE_SYSTEM = 0,
119     /** Cutout. */
120     WINDOW_MANAGER_AVOID_AREA_TYPE_CUTOUT = 1,
121     /** System gesture. */
122     WINDOW_MANAGER_AVOID_AREA_TYPE_SYSTEM_GESTURE = 2,
123     /** Keyboard. */
124     WINDOW_MANAGER_AVOID_AREA_TYPE_KEYBOARD = 3,
125     /** Navigation indicator. */
126     WINDOW_MANAGER_AVOID_AREA_TYPE_NAVIGATION_INDICATOR = 4,
127 } WindowManager_AvoidAreaType;
128 
129 /**
130  * @brief The type of a window
131  *
132  * @since 16
133  */
134 typedef enum {
135     /** Sub window. */
136     WINDOW_MANAGER_WINDOW_TYPE_APP = 0,
137     /** Main Window. */
138     WINDOW_MANAGER_WINDOW_TYPE_MAIN = 1,
139     /** Float. */
140     WINDOW_MANAGER_WINDOW_TYPE_FLOAT = 8,
141     /** Dialog. */
142     WINDOW_MANAGER_WINDOW_TYPE_DIALOG = 16,
143 } WindowManager_WindowType;
144 
145 /**
146  * @brief Defines the window rect data structure.
147  *
148  * @since 15
149  */
150 typedef struct {
151     /** X-axis of the window. */
152     int32_t posX;
153     /** Y-axis of the window. */
154     int32_t posY;
155     /** Width of the window. */
156     uint32_t width;
157     /** Height of the window. */
158     uint32_t height;
159 } WindowManager_Rect;
160 
161 /**
162  * @brief Properties of window
163  *
164  * @since 16
165 */
166 typedef struct {
167     /** The position and size of the window */
168     WindowManager_Rect windowRect;
169     /** The position relative to the window and size of drawable area */
170     WindowManager_Rect drawableRect;
171     /** Window type */
172     WindowManager_WindowType type;
173     /** Whether the window is displayed in full screen mode. The default value is false */
174     bool isFullScreen;
175     /** Whether the window layout is in full screen mode(whether the window is immersive). The default value is false */
176     bool isLayoutFullScreen;
177     /** Whether the window can gain focus. The default value is true */
178     bool focusable;
179     /** Whether the window is touchable. The default value is false */
180     bool touchable;
181     /** Brightness value of window */
182     float brightness;
183     /** Whether keep screen on */
184     bool isKeepScreenOn;
185     /** Whether make window in privacy mode or not */
186     bool isPrivacyMode;
187     /** Whether is transparent or not */
188     bool isTransparent;
189     /** Window id */
190     uint32_t id;
191     /** Display id */
192     uint32_t displayId;
193 } WindowManager_WindowProperties;
194 
195 /**
196  * @brief Defines the avoid area data structure.
197  *
198  * @since 15
199  */
200 typedef struct {
201     /** Top rect of the avoid area. */
202     WindowManager_Rect topRect;
203     /** Left rect of the avoid area. */
204     WindowManager_Rect leftRect;
205     /** Right rect of the avoid area. */
206     WindowManager_Rect rightRect;
207     /** Bottom rect of the avoid area. */
208     WindowManager_Rect bottomRect;
209 } WindowManager_AvoidArea;
210 
211 #ifdef __cplusplus
212 }
213 #endif
214 
215 #endif // OH_WINDOW_COMM_H