• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 DISPLAY_INFO_H
17 #define DISPLAY_INFO_H
18 
19 #include <vector>
20 #include <string>
21 
22 namespace OHOS {
23 namespace MMI {
24 enum Direction {
25     /**
26      * Rotating the display clockwise by 0 degree
27      *
28      * @since 9
29      */
30     Direction0,
31 
32     /**
33      * Rotating the display clockwise by 90 degrees
34      *
35      * @since 9
36      */
37     Direction90,
38 
39     /**
40      * Rotating the display clockwise by 180 degrees
41      *
42      * @since 9
43      */
44     Direction180,
45 
46     /**
47      * Rotating the display clockwise by 270 degrees
48      *
49      * @since 9
50      */
51     Direction270
52 };
53 
54 struct Rect {
55     /**
56      * X coordinate of the upper left corner
57      *
58      * @since 9
59      */
60     int32_t x;
61 
62     /**
63      * Y coordinate of the upper left corner
64      *
65      * @since 9
66      */
67     int32_t y;
68 
69     /**
70      * Width
71      *
72      * @since 9
73      */
74     int32_t width;
75 
76     /**
77      * Height
78      *
79      * @since 9
80      */
81     int32_t height;
82 };
83 
84 
85 struct WindowInfo {
86     /**
87      * Maximum number of hot areas
88      *
89      * @since 9
90      */
91     static constexpr int32_t MAX_HOTAREA_COUNT = 10;
92 
93     /**
94      * Untouchable window
95      *
96      * @since 9
97      */
98     static constexpr uint32_t FLAG_BIT_UNTOUCHABLE = 1;
99 
100     /**
101      * Globally unique identifier of the window
102      *
103      * @since 9
104      */
105     int32_t id;
106 
107     /**
108      * ID of the process where the window is located
109      *
110      * @since 9
111      */
112     int32_t pid;
113 
114     /**
115      * UID of the process where the window is located
116      *
117      * @since 9
118      */
119     int32_t uid;
120 
121     /**
122      * Window display area
123      *
124      * @since 9
125      */
126     Rect area;
127 
128     /**
129      * Number of touch response areas (excluding the mouse response areas) in the window.
130      * The value cannot exceed the value of MAX_HOTAREA_COUNT.
131      *
132      * @since 9
133      */
134     std::vector<Rect> defaultHotAreas;
135 
136     /**
137      * Number of mouse response areas in the window. The value cannot exceed the value of MAX_HOTAREA_COUNT.
138      *
139      * @since 9
140      */
141     std::vector<Rect> pointerHotAreas;
142 
143     /**
144      * Agent window ID
145      *
146      * @since 9
147      */
148     int32_t agentWindowId;
149 
150     /**
151      * A 32-bit flag that represents the window status. If the 0th bit is 1,
152      * the window is untouchable; if the 0th bit is 0, the window is touchable.
153      *
154      * @since 9
155      */
156     uint32_t flags;
157 };
158 
159 /**
160  * Physical screen information
161  *
162  * @since 9
163  */
164 struct DisplayInfo {
165     /**
166      * Unique ID of the physical display
167      *
168      * @since 9
169      */
170     int32_t id;
171 
172     /**
173      * X coordinate of the upper left corner on the logical screen
174      *
175      * @since 9
176      */
177     int32_t x;
178 
179     /**
180      * Y coordinate of the upper left corner on the logical screen
181      *
182      * @since 9
183      */
184     int32_t y;
185 
186     /**
187      * Display width, which is the logical width of the original screen when the rotation angle is 0.
188      * The value remains unchanged even if the display screen is rotated.
189      *
190      * @since 9
191      */
192     int32_t width;
193 
194     /**
195      * Display height, which is the logical height of the original screen when the rotation angle is 0.
196      * The value remains unchanged even if the display screen is rotated.
197      *
198      * @since 9
199      */
200     int32_t height;
201 
202     /**
203      * Name of the physical display, which is used for debugging
204      *
205      * @since 9
206      */
207     std::string name;
208 
209     /**
210      * Unique screen ID, which is used to associate the corresponding touchscreen. The default value is default0.
211      *
212      * @since 9
213      */
214     std::string uniq;
215 
216     /**
217      * Orientation of the physical display
218      *
219      * @since 9
220      */
221     Direction direction;
222 };
223 
224 /**
225  * Logical screen information
226  *
227  * @since 9
228  */
229 struct DisplayGroupInfo {
230     /**
231      * Width of the logical display
232      *
233      * @since 9
234      */
235     int32_t width;
236 
237     /**
238      * Height of the logical display
239      *
240      * @since 9
241      */
242     int32_t height;
243 
244     /**
245      * ID of the focus window
246      *
247      * @since 9
248      */
249     int32_t focusWindowId;
250 
251     /**
252      * List of window information of the logical display arranged in Z order, with the top window at the top
253      *
254      * @since 9
255      */
256     std::vector<WindowInfo> windowsInfo;
257 
258     /**
259      * Physical screen information list
260      *
261      * @since 9
262      */
263     std::vector<DisplayInfo> displaysInfo;
264 };
265 } // namespace MMI
266 } // namespace OHOS
267 #endif // DISPLAY_INFO_H