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