1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
10 |
|
|
**************************************************************************/ |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/**************************************************************************/ |
15 |
|
|
/** */ |
16 |
|
|
/** GUIX Component */ |
17 |
|
|
/** */ |
18 |
|
|
/** System Management (System) */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
|
22 |
|
|
#define GX_SOURCE_CODE |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
/* Include necessary system files. */ |
26 |
|
|
|
27 |
|
|
#include "gx_api.h" |
28 |
|
|
#include "gx_system.h" |
29 |
|
|
#include "gx_utility.h" |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
/**************************************************************************/ |
33 |
|
|
/* */ |
34 |
|
|
/* FUNCTION RELEASE */ |
35 |
|
|
/* */ |
36 |
|
|
/* _gx_system_view_split PORTABLE C */ |
37 |
|
|
/* 6.1 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* This splits a rectangle into over and under views */ |
45 |
|
|
/* */ |
46 |
|
|
/* INPUT */ |
47 |
|
|
/* */ |
48 |
|
|
/* over Pointer to window on top */ |
49 |
|
|
/* root Pointer to root window */ |
50 |
|
|
/* original Rectangle to split into */ |
51 |
|
|
/* smaller chunks */ |
52 |
|
|
/* */ |
53 |
|
|
/* OUTPUT */ |
54 |
|
|
/* */ |
55 |
|
|
/* None */ |
56 |
|
|
/* */ |
57 |
|
|
/* CALLS */ |
58 |
|
|
/* */ |
59 |
|
|
/* gx_system_root_view_add Add viewport to root window */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLED BY */ |
62 |
|
|
/* */ |
63 |
|
|
/* _gx_system_root_view_add Add view to a root window */ |
64 |
|
|
/* */ |
65 |
|
|
/**************************************************************************/ |
66 |
|
|
|
67 |
|
2149 |
VOID _gx_system_view_split(GX_WINDOW *over, GX_WINDOW_ROOT *root, GX_RECTANGLE *original) |
68 |
|
|
{ |
69 |
|
|
GX_RECTANGLE split; |
70 |
|
2149 |
GX_RECTANGLE oversize = over -> gx_widget_size; |
71 |
|
|
|
72 |
|
|
/* check to see if any area on top is exposed */ |
73 |
✓✓ |
2149 |
if (oversize.gx_rectangle_top > original -> gx_rectangle_top) |
74 |
|
|
{ |
75 |
|
1228 |
split.gx_rectangle_left = original -> gx_rectangle_left; |
76 |
|
1228 |
split.gx_rectangle_right = original -> gx_rectangle_right; |
77 |
|
1228 |
split.gx_rectangle_top = original -> gx_rectangle_top; |
78 |
|
1228 |
split.gx_rectangle_bottom = (GX_VALUE)(oversize.gx_rectangle_top - 1); |
79 |
|
|
|
80 |
|
|
/* try to add this piece to the 'under' window's viewports */ |
81 |
|
1228 |
_gx_system_root_view_add(root, &split); |
82 |
|
|
} |
83 |
|
|
|
84 |
|
|
/* check to see if any area on bottom is exposed */ |
85 |
✓✓ |
2149 |
if (oversize.gx_rectangle_bottom < original -> gx_rectangle_bottom) |
86 |
|
|
{ |
87 |
|
1307 |
split.gx_rectangle_left = original -> gx_rectangle_left; |
88 |
|
1307 |
split.gx_rectangle_right = original -> gx_rectangle_right; |
89 |
|
1307 |
split.gx_rectangle_top = (GX_VALUE)(oversize.gx_rectangle_bottom + 1); |
90 |
|
1307 |
split.gx_rectangle_bottom = original -> gx_rectangle_bottom; |
91 |
|
|
|
92 |
|
|
/* try to add this piece to the 'under' window's viewports */ |
93 |
|
1307 |
_gx_system_root_view_add(root, &split); |
94 |
|
|
} |
95 |
|
|
|
96 |
|
|
/* check to see if any area on left is exposed */ |
97 |
✓✓ |
2149 |
if (oversize.gx_rectangle_left > original -> gx_rectangle_left) |
98 |
|
|
{ |
99 |
|
1313 |
split.gx_rectangle_left = original -> gx_rectangle_left; |
100 |
|
1313 |
split.gx_rectangle_right = (GX_VALUE)(oversize.gx_rectangle_left - 1); |
101 |
|
|
|
102 |
✓✓ |
1313 |
if (original -> gx_rectangle_top > oversize.gx_rectangle_top) |
103 |
|
|
{ |
104 |
|
135 |
split.gx_rectangle_top = original -> gx_rectangle_top; |
105 |
|
|
} |
106 |
|
|
else |
107 |
|
|
{ |
108 |
|
1178 |
split.gx_rectangle_top = oversize.gx_rectangle_top; |
109 |
|
|
} |
110 |
|
|
|
111 |
✓✓ |
1313 |
if (original -> gx_rectangle_bottom < oversize.gx_rectangle_bottom) |
112 |
|
|
{ |
113 |
|
148 |
split.gx_rectangle_bottom = original -> gx_rectangle_bottom; |
114 |
|
|
} |
115 |
|
|
else |
116 |
|
|
{ |
117 |
|
1165 |
split.gx_rectangle_bottom = oversize.gx_rectangle_bottom; |
118 |
|
|
} |
119 |
|
|
|
120 |
|
|
/* try to add this piece to the 'under' window's viewports */ |
121 |
|
1313 |
_gx_system_root_view_add(root, &split); |
122 |
|
|
} |
123 |
|
|
|
124 |
|
|
/* check to see if any area on right is exposed */ |
125 |
✓✓ |
2149 |
if (oversize.gx_rectangle_right < original -> gx_rectangle_right) |
126 |
|
|
{ |
127 |
|
1412 |
split.gx_rectangle_left = (GX_VALUE)(oversize.gx_rectangle_right + 1); |
128 |
|
1412 |
split.gx_rectangle_right = original -> gx_rectangle_right; |
129 |
|
|
|
130 |
✓✓ |
1412 |
if (original -> gx_rectangle_top > oversize.gx_rectangle_top) |
131 |
|
|
{ |
132 |
|
147 |
split.gx_rectangle_top = original -> gx_rectangle_top; |
133 |
|
|
} |
134 |
|
|
else |
135 |
|
|
{ |
136 |
|
1265 |
split.gx_rectangle_top = oversize.gx_rectangle_top; |
137 |
|
|
} |
138 |
|
|
|
139 |
✓✓ |
1412 |
if (original -> gx_rectangle_bottom < oversize.gx_rectangle_bottom) |
140 |
|
|
{ |
141 |
|
151 |
split.gx_rectangle_bottom = original -> gx_rectangle_bottom; |
142 |
|
|
} |
143 |
|
|
else |
144 |
|
|
{ |
145 |
|
1261 |
split.gx_rectangle_bottom = oversize.gx_rectangle_bottom; |
146 |
|
|
} |
147 |
|
|
/* try to add this piece to the 'under' window's viewports */ |
148 |
|
1412 |
_gx_system_root_view_add(root, &split); |
149 |
|
|
} |
150 |
|
2149 |
} |
151 |
|
|
|