Rev 5565 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5565 | Rev 5984 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
4 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
4 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
6 | ;; ;; |
6 | ;; ;; |
7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
8 | 8 | ||
9 | $Revision: 5565 $ |
9 | $Revision: 5984 $ |
10 | 10 | ||
11 | ;============================================================================== |
11 | ;============================================================================== |
12 | ;///// public functions /////////////////////////////////////////////////////// |
12 | ;///// public functions /////////////////////////////////////////////////////// |
13 | ;============================================================================== |
13 | ;============================================================================== |
14 | 14 | ||
15 | window.BORDER_SIZE = 5 |
15 | window.BORDER_SIZE = 5 |
16 | 16 | ||
17 | macro FuncTable name, table_name, [label] |
17 | macro FuncTable name, table_name, [label] |
18 | { |
18 | { |
19 | common |
19 | common |
20 | align 4 |
20 | align 4 |
21 | \label name#.#table_name dword |
21 | \label name#.#table_name dword |
22 | forward |
22 | forward |
23 | dd name#.#label |
23 | dd name#.#label |
24 | common |
24 | common |
25 | name#.sizeof.#table_name = $ - name#.#table_name |
25 | name#.sizeof.#table_name = $ - name#.#table_name |
26 | } |
26 | } |
27 | 27 | ||
28 | uglobal |
28 | uglobal |
29 | common_colours rd 48 |
29 | common_colours rd 48 |
30 | draw_limits RECT |
30 | draw_limits RECT |
31 | endg |
31 | endg |
32 | - | ||
33 | align 4 |
32 | |
34 | ;------------------------------------------------------------------------------ |
33 | ;------------------------------------------------------------------------------ |
35 | syscall_draw_window: ;///// system function 0 ///////////////////////////////// |
34 | syscall_draw_window: ;///// system function 0 ///////////////////////////////// |
36 | ;------------------------------------------------------------------------------ |
35 | ;------------------------------------------------------------------------------ |
37 | ;? |
- | |
38 | ;------------------------------------------------------------------------------ |
- | |
39 | mov eax, edx |
36 | mov eax, edx |
40 | shr eax, 24 |
37 | shr eax, 24 |
41 | and al, 0x0f |
38 | and al, 0x0f |
42 | cmp al, 5 |
39 | cmp al, 5 |
43 | jae .exit |
40 | jae .exit |
44 | 41 | ||
45 | push eax |
42 | push eax |
46 | call window._.sys_set_window |
43 | call window._.sys_set_window |
47 | pop eax |
44 | pop eax |
48 | 45 | ||
49 | or al, al |
46 | or al, al |
50 | jnz @f |
47 | jnz @f |
51 | 48 | ||
52 | ; type I - original style |
49 | ; type I - original style |
53 | call drawwindow_I |
50 | call drawwindow_I |
54 | jmp window._.draw_window_caption.2 |
51 | jmp window._.draw_window_caption.2 |
55 | ;-------------------------------------- |
52 | ;-------------------------------------- |
56 | align 4 |
- | |
57 | @@: |
53 | @@: |
58 | dec al |
54 | dec al |
59 | jnz @f |
55 | jnz @f |
60 | 56 | ||
61 | ; type II - only reserve area, no draw |
57 | ; type II - only reserve area, no draw |
62 | ; call sys_window_mouse |
- | |
63 | ; call [draw_pointer] |
- | |
64 | call __sys_draw_pointer |
58 | call __sys_draw_pointer |
65 | jmp .exit |
59 | jmp .exit |
66 | ;-------------------------------------- |
60 | ;-------------------------------------- |
67 | align 4 |
- | |
68 | @@: |
61 | @@: |
69 | dec al |
62 | dec al |
70 | jnz @f |
63 | jnz @f |
71 | 64 | ||
72 | ; type III - new style |
65 | ; type III - new style |
73 | call drawwindow_III |
66 | call drawwindow_III |
74 | jmp window._.draw_window_caption.2 |
67 | jmp window._.draw_window_caption.2 |
75 | - | ||
76 | ; type IV & V - skinned window (resizable & not) |
- | |
77 | ;-------------------------------------- |
68 | ;-------------------------------------- |
78 | align 4 |
- | |
79 | @@: |
69 | @@: |
- | 70 | ; type IV & V - skinned window (resizable & not) |
|
80 | mov eax, [TASK_COUNT] |
71 | mov eax, [TASK_COUNT] |
81 | movzx eax, word[WIN_POS + eax * 2] |
72 | movzx eax, word[WIN_POS + eax * 2] |
82 | cmp eax, [CURRENT_TASK] |
73 | cmp eax, [CURRENT_TASK] |
83 | setz al |
74 | setz al |
84 | movzx eax, al |
75 | movzx eax, al |
85 | push eax |
76 | push eax |
86 | call drawwindow_IV |
77 | call drawwindow_IV |
87 | jmp window._.draw_window_caption.2 |
78 | jmp window._.draw_window_caption.2 |
88 | ;-------------------------------------- |
79 | ;-------------------------------------- |
89 | align 4 |
- | |
90 | .exit: |
80 | .exit: |
91 | ret |
81 | ret |
92 | ;------------------------------------------------------------------------------ |
82 | ;------------------------------------------------------------------------------ |
93 | align 4 |
- | |
94 | ;------------------------------------------------------------------------------ |
- | |
95 | syscall_display_settings: ;///// system function 48 /////////////////////////// |
83 | syscall_display_settings: ;///// system function 48 /////////////////////////// |
96 | ;------------------------------------------------------------------------------ |
84 | ;------------------------------------------------------------------------------ |
97 | ;; Redraw screen: |
85 | ;; Redraw screen: |
98 | ;< ebx = 0 |
86 | ;< ebx = 0 |
99 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
87 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
100 | ;; Set button style: |
88 | ;; Set button style: |
101 | ;< ebx = 1 |
89 | ;< ebx = 1 |
102 | ;< ecx = 0 (flat) or 1 (with gradient) |
90 | ;< ecx = 0 (flat) or 1 (with gradient) |
103 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
91 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
104 | ;; Set system color palette: |
92 | ;; Set system color palette: |
105 | ;< ebx = 2 |
93 | ;< ebx = 2 |
106 | ;< ecx = pointer to color table |
94 | ;< ecx = pointer to color table |
107 | ;< edx = size of color table |
95 | ;< edx = size of color table |
108 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
96 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
109 | ;; Get system color palette: |
97 | ;; Get system color palette: |
110 | ;< ebx = 3 |
98 | ;< ebx = 3 |
111 | ;< ecx = pointer to color table buffer |
99 | ;< ecx = pointer to color table buffer |
112 | ;< edx = size of color table buffer |
100 | ;< edx = size of color table buffer |
113 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
101 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
114 | ;; Get skinned caption height: |
102 | ;; Get skinned caption height: |
115 | ;< ebx = 4 |
103 | ;< ebx = 4 |
116 | ;> eax = height in pixels |
104 | ;> eax = height in pixels |
117 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
105 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
118 | ;; Get screen working area: |
106 | ;; Get screen working area: |
119 | ;< ebx = 5 |
107 | ;< ebx = 5 |
120 | ;> eax = pack[16(left), 16(right)] |
108 | ;> eax = pack[16(left), 16(right)] |
121 | ;> ebx = pack[16(top), 16(bottom)] |
109 | ;> ebx = pack[16(top), 16(bottom)] |
122 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
110 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
123 | ;; Set screen working area: |
111 | ;; Set screen working area: |
124 | ;< ebx = 6 |
112 | ;< ebx = 6 |
125 | ;< ecx = pack[16(left), 16(right)] |
113 | ;< ecx = pack[16(left), 16(right)] |
126 | ;< edx = pack[16(top), 16(bottom)] |
114 | ;< edx = pack[16(top), 16(bottom)] |
127 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
115 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
128 | ;; Get skin margins: |
116 | ;; Get skin margins: |
129 | ;< ebx = 7 |
117 | ;< ebx = 7 |
130 | ;> eax = pack[16(left), 16(right)] |
118 | ;> eax = pack[16(left), 16(right)] |
131 | ;> ebx = pack[16(top), 16(bottom)] |
119 | ;> ebx = pack[16(top), 16(bottom)] |
132 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
120 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
133 | ;; Set skin: |
121 | ;; Set skin: |
134 | ;< ebx = 8 |
122 | ;< ebx = 8 |
135 | ;< ecx = pointer to FileInfoBlock struct |
123 | ;< ecx = pointer to FileInfoBlock struct |
136 | ;> eax = FS error code |
124 | ;> eax = FS error code |
- | 125 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
- | 126 | ;; Get font smoothing: |
|
- | 127 | ;< ebx = 9 |
|
- | 128 | ;> eax = 0 — off, 1 — on, 2 — subpixel |
|
- | 129 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
- | 130 | ;; Set font smoothing: |
|
- | 131 | ;< ebx = 10 |
|
- | 132 | ;< ecx = 0 — off, 1 — on, 2 — subpixel |
|
- | 133 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
- | 134 | ;; Get font size: |
|
- | 135 | ;< ebx = 11 |
|
- | 136 | ;> eax = height in pixels |
|
- | 137 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
- | 138 | ;; Set font size: |
|
- | 139 | ;< ebx = 12 |
|
- | 140 | ;< ecx = height in pixels |
|
137 | ;------------------------------------------------------------------------------ |
141 | ;------------------------------------------------------------------------------ |
138 | cmp ebx, .sizeof.ftable / 4 |
142 | cmp ebx, .sizeof.ftable / 4 |
139 | ja @f |
143 | ja @f |
140 | jmp [.ftable + ebx * 4] |
144 | jmp [.ftable + ebx * 4] |
141 | ;-------------------------------------- |
- | |
142 | align 4 |
- | |
143 | @@: |
- | |
144 | ret |
- | |
145 | ;------------------------------------------------------------------------------ |
145 | ;------------------------------------------------------------------------------ |
146 | align 4 |
- | |
147 | syscall_display_settings.00: |
146 | syscall_display_settings.00: |
148 | xor eax, eax |
147 | xor eax, eax |
149 | inc ebx |
148 | inc ebx |
150 | cmp [windowtypechanged], ebx |
149 | cmp [windowtypechanged], ebx |
151 | jne .exit |
150 | jne @f |
152 | mov [windowtypechanged], eax |
151 | mov [windowtypechanged], eax |
153 | - | ||
154 | jmp syscall_display_settings._.redraw_whole_screen |
152 | jmp syscall_display_settings._.redraw_whole_screen |
155 | ;-------------------------------------- |
- | |
156 | align 4 |
- | |
157 | .exit: |
- | |
158 | ret |
- | |
159 | ;------------------------------------------------------------------------------ |
153 | ;------------------------------------------------------------------------------ |
160 | align 4 |
- | |
161 | syscall_display_settings.01: |
154 | syscall_display_settings.01: |
162 | and ecx, 1 |
155 | and ecx, 1 |
163 | cmp ecx, [buttontype] |
156 | cmp ecx, [buttontype] |
164 | je .exit |
157 | je @f |
165 | mov [buttontype], ecx |
158 | mov [buttontype], ecx |
166 | mov [windowtypechanged], ebx |
159 | mov [windowtypechanged], ebx |
167 | ;-------------------------------------- |
- | |
168 | align 4 |
- | |
169 | .exit: |
160 | @@: |
170 | ret |
161 | ret |
171 | ;------------------------------------------------------------------------------ |
162 | ;------------------------------------------------------------------------------ |
172 | align 4 |
- | |
173 | syscall_display_settings.02: |
163 | syscall_display_settings.02: |
174 | dec ebx |
164 | dec ebx |
175 | mov esi, ecx |
165 | mov esi, ecx |
176 | cmp edx, 192 |
166 | cmp edx, 192 |
177 | jnae @f |
167 | jnae @f |
178 | mov edx, 192 ; max size |
168 | mov edx, 192 ; max size |
179 | @@: |
169 | @@: |
180 | mov edi, common_colours |
170 | mov edi, common_colours |
181 | mov ecx, edx |
171 | mov ecx, edx |
182 | rep movsb |
172 | rep movsb |
183 | mov [windowtypechanged], ebx |
173 | mov [windowtypechanged], ebx |
184 | ret |
174 | ret |
185 | ;------------------------------------------------------------------------------ |
175 | ;------------------------------------------------------------------------------ |
186 | align 4 |
- | |
187 | syscall_display_settings.03: |
176 | syscall_display_settings.03: |
188 | mov edi, ecx |
177 | mov edi, ecx |
189 | cmp edx, 192 |
178 | cmp edx, 192 |
190 | jnae @f |
179 | jnae @f |
191 | mov edx, 192 ; max size |
180 | mov edx, 192 ; max size |
192 | @@: |
181 | @@: |
193 | mov esi, common_colours |
182 | mov esi, common_colours |
194 | mov ecx, edx |
183 | mov ecx, edx |
195 | rep movsb |
184 | rep movsb |
196 | ret |
185 | ret |
197 | ;------------------------------------------------------------------------------ |
186 | ;------------------------------------------------------------------------------ |
198 | align 4 |
- | |
199 | syscall_display_settings.04: |
187 | syscall_display_settings.04: |
200 | mov eax, [_skinh] |
188 | mov eax, [_skinh] |
201 | mov [esp + 32], eax |
189 | mov [esp + 32], eax |
202 | ret |
190 | ret |
203 | ;------------------------------------------------------------------------------ |
191 | ;------------------------------------------------------------------------------ |
204 | align 4 |
- | |
205 | syscall_display_settings.05: |
192 | syscall_display_settings.05: |
206 | mov eax, [screen_workarea.left - 2] |
193 | mov eax, [screen_workarea.left - 2] |
207 | mov ax, word[screen_workarea.right] |
194 | mov ax, word[screen_workarea.right] |
208 | mov [esp + 32], eax |
195 | mov [esp + 32], eax |
209 | mov eax, [screen_workarea.top - 2] |
196 | mov eax, [screen_workarea.top - 2] |
210 | mov ax, word[screen_workarea.bottom] |
197 | mov ax, word[screen_workarea.bottom] |
211 | mov [esp + 20], eax |
198 | mov [esp + 20], eax |
212 | ret |
199 | ret |
213 | ;------------------------------------------------------------------------------ |
200 | ;------------------------------------------------------------------------------ |
214 | align 4 |
- | |
215 | syscall_display_settings.06: |
201 | syscall_display_settings.06: |
216 | xor esi, esi |
202 | xor esi, esi |
217 | - | ||
218 | mov edi, [_display.width] |
203 | mov edi, [_display.width] |
219 | dec edi |
204 | dec edi |
220 | mov eax, ecx |
205 | mov eax, ecx |
221 | movsx ebx, ax |
206 | movsx ebx, ax |
222 | sar eax, 16 |
207 | sar eax, 16 |
223 | cmp eax, ebx |
208 | cmp eax, ebx |
224 | jge .check_horizontal |
209 | jge .check_horizontal |
225 | inc esi |
210 | inc esi |
226 | or eax, eax |
211 | or eax, eax |
227 | jge @f |
212 | jge @f |
228 | xor eax, eax |
213 | xor eax, eax |
229 | ;-------------------------------------- |
- | |
230 | align 4 |
- | |
231 | @@: |
214 | @@: |
232 | mov [screen_workarea.left], eax |
215 | mov [screen_workarea.left], eax |
233 | cmp ebx, edi |
216 | cmp ebx, edi |
234 | jle @f |
217 | jle @f |
235 | mov ebx, edi |
218 | mov ebx, edi |
236 | ;-------------------------------------- |
- | |
237 | align 4 |
- | |
238 | @@: |
219 | @@: |
239 | mov [screen_workarea.right], ebx |
220 | mov [screen_workarea.right], ebx |
240 | ;-------------------------------------- |
- | |
241 | align 4 |
- | |
242 | .check_horizontal: |
221 | .check_horizontal: |
243 | mov edi, [_display.height] |
222 | mov edi, [_display.height] |
244 | dec edi |
223 | dec edi |
245 | mov eax, edx |
224 | mov eax, edx |
246 | movsx ebx, ax |
225 | movsx ebx, ax |
247 | sar eax, 16 |
226 | sar eax, 16 |
248 | cmp eax, ebx |
227 | cmp eax, ebx |
249 | jge .check_if_redraw_needed |
228 | jge .check_if_redraw_needed |
250 | inc esi |
229 | inc esi |
251 | or eax, eax |
230 | or eax, eax |
252 | jge @f |
231 | jge @f |
253 | xor eax, eax |
232 | xor eax, eax |
254 | ;-------------------------------------- |
- | |
255 | align 4 |
- | |
256 | @@: |
233 | @@: |
257 | mov [screen_workarea.top], eax |
234 | mov [screen_workarea.top], eax |
258 | cmp ebx, edi |
235 | cmp ebx, edi |
259 | jle @f |
236 | jle @f |
260 | mov ebx, edi |
237 | mov ebx, edi |
261 | ;-------------------------------------- |
- | |
262 | align 4 |
- | |
263 | @@: |
238 | @@: |
264 | mov [screen_workarea.bottom], ebx |
239 | mov [screen_workarea.bottom], ebx |
265 | ;-------------------------------------- |
- | |
266 | align 4 |
- | |
267 | .check_if_redraw_needed: |
240 | .check_if_redraw_needed: |
268 | or esi, esi |
241 | or esi, esi |
269 | jz .exit |
242 | jz @f |
270 | 243 | ||
271 | call repos_windows |
244 | call repos_windows |
272 | jmp syscall_display_settings._.calculate_whole_screen |
245 | jmp syscall_display_settings._.calculate_whole_screen |
273 | ;-------------------------------------- |
- | |
274 | align 4 |
- | |
275 | .exit: |
- | |
276 | ret |
- | |
277 | ;------------------------------------------------------------------------------ |
246 | ;------------------------------------------------------------------------------ |
278 | align 4 |
- | |
279 | syscall_display_settings.07: |
247 | syscall_display_settings.07: |
280 | mov eax, [_skinmargins + 0] |
248 | mov eax, [_skinmargins + 0] |
281 | mov [esp + 32], eax |
249 | mov [esp + 32], eax |
282 | mov eax, [_skinmargins + 4] |
250 | mov eax, [_skinmargins + 4] |
283 | mov [esp + 20], eax |
251 | mov [esp + 20], eax |
- | 252 | @@: |
|
284 | ret |
253 | ret |
285 | ;------------------------------------------------------------------------------ |
254 | ;------------------------------------------------------------------------------ |
286 | align 4 |
- | |
287 | syscall_display_settings.08: |
255 | syscall_display_settings.08: |
288 | mov ebx, ecx |
256 | mov ebx, ecx |
289 | call read_skin_file |
257 | call read_skin_file |
290 | mov [esp + 32], eax |
258 | mov [esp + 32], eax |
291 | test eax, eax |
259 | test eax, eax |
292 | jnz .exit |
260 | jnz @b |
293 | 261 | ||
294 | call syscall_display_settings._.calculate_whole_screen |
262 | call syscall_display_settings._.calculate_whole_screen |
295 | jmp syscall_display_settings._.redraw_whole_screen |
263 | jmp syscall_display_settings._.redraw_whole_screen |
- | 264 | ;------------------------------------------------------------------------------ |
|
- | 265 | syscall_display_settings.09: |
|
- | 266 | xor eax, eax |
|
- | 267 | mov al, [fontSmoothing] |
|
- | 268 | mov [esp + 32], eax |
|
- | 269 | ret |
|
296 | ;-------------------------------------- |
270 | ;------------------------------------------------------------------------------ |
- | 271 | syscall_display_settings.10: |
|
- | 272 | mov [fontSmoothing], cl |
|
297 | align 4 |
273 | ret |
- | 274 | ;------------------------------------------------------------------------------ |
|
- | 275 | syscall_display_settings.11: |
|
- | 276 | xor eax, eax |
|
- | 277 | mov al, [fontSize] |
|
- | 278 | mov [esp + 32], eax |
|
298 | .exit: |
279 | ret |
- | 280 | ;------------------------------------------------------------------------------ |
|
- | 281 | syscall_display_settings.12: |
|
- | 282 | mov [fontSize], cl |
|
299 | ret |
283 | ret |
300 | ;------------------------------------------------------------------------------ |
284 | ;------------------------------------------------------------------------------ |
301 | align 4 |
- | |
302 | syscall_display_settings._.calculate_whole_screen: |
285 | syscall_display_settings._.calculate_whole_screen: |
303 | xor eax, eax |
286 | xor eax, eax |
304 | xor ebx, ebx |
287 | xor ebx, ebx |
305 | mov ecx, [_display.width] |
288 | mov ecx, [_display.width] |
306 | mov edx, [_display.height] |
289 | mov edx, [_display.height] |
307 | dec ecx |
290 | dec ecx |
308 | dec edx |
291 | dec edx |
309 | jmp calculatescreen |
292 | jmp calculatescreen |
310 | ;------------------------------------------------------------------------------ |
293 | ;------------------------------------------------------------------------------ |
311 | align 4 |
- | |
312 | syscall_display_settings._.redraw_whole_screen: |
294 | syscall_display_settings._.redraw_whole_screen: |
313 | xor eax, eax |
295 | xor eax, eax |
314 | mov [draw_limits.left], eax |
296 | mov [draw_limits.left], eax |
315 | mov [draw_limits.top], eax |
297 | mov [draw_limits.top], eax |
316 | mov eax, [_display.width] |
298 | mov eax, [_display.width] |
317 | dec eax |
299 | dec eax |
318 | mov [draw_limits.right], eax |
300 | mov [draw_limits.right], eax |
319 | mov eax, [_display.height] |
301 | mov eax, [_display.height] |
320 | dec eax |
302 | dec eax |
321 | mov [draw_limits.bottom], eax |
303 | mov [draw_limits.bottom], eax |
322 | mov eax, window_data |
304 | mov eax, window_data |
323 | jmp redrawscreen |
305 | jmp redrawscreen |
324 | ;------------------------------------------------------------------------------ |
306 | ;------------------------------------------------------------------------------ |
325 | align 4 |
- | |
326 | ;------------------------------------------------------------------------------ |
- | |
327 | syscall_set_window_shape: ;///// system function 50 /////////////////////////// |
307 | syscall_set_window_shape: ;///// system function 50 /////////////////////////// |
328 | ;------------------------------------------------------------------------------ |
308 | ;------------------------------------------------------------------------------ |
329 | ;; Set window shape address: |
309 | ;; Set window shape address: |
330 | ;> ebx = 0 |
310 | ;> ebx = 0 |
331 | ;> ecx = shape data address |
311 | ;> ecx = shape data address |
332 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
312 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
333 | ;; Set window shape scale: |
313 | ;; Set window shape scale: |
334 | ;> ebx = 1 |
314 | ;> ebx = 1 |
335 | ;> ecx = scale power (resulting scale is 2^ebx) |
315 | ;> ecx = scale power (resulting scale is 2^ebx) |
336 | ;------------------------------------------------------------------------------ |
316 | ;------------------------------------------------------------------------------ |
337 | mov edi, [current_slot] |
317 | mov edi, [current_slot] |
338 | 318 | ||
339 | test ebx, ebx |
319 | test ebx, ebx |
340 | jne .shape_scale |
320 | jne .shape_scale |
341 | mov [edi + APPDATA.wnd_shape], ecx |
321 | mov [edi + APPDATA.wnd_shape], ecx |
342 | ;-------------------------------------- |
322 | ;-------------------------------------- |
343 | align 4 |
323 | align 4 |
344 | .shape_scale: |
324 | .shape_scale: |
345 | dec ebx |
325 | dec ebx |
346 | jnz .exit |
326 | jnz .exit |
347 | mov [edi + APPDATA.wnd_shape_scale], ecx |
327 | mov [edi + APPDATA.wnd_shape_scale], ecx |
348 | ;-------------------------------------- |
328 | ;-------------------------------------- |
349 | align 4 |
329 | align 4 |
350 | .exit: |
330 | .exit: |
351 | ret |
331 | ret |
352 | ;------------------------------------------------------------------------------ |
332 | ;------------------------------------------------------------------------------ |
353 | align 4 |
333 | align 4 |
354 | ;------------------------------------------------------------------------------ |
334 | ;------------------------------------------------------------------------------ |
355 | syscall_move_window: ;///// system function 67 //////////////////////////////// |
335 | syscall_move_window: ;///// system function 67 //////////////////////////////// |
356 | ;------------------------------------------------------------------------------ |
336 | ;------------------------------------------------------------------------------ |
357 | ;? |
337 | ;? |
358 | ;------------------------------------------------------------------------------ |
338 | ;------------------------------------------------------------------------------ |
359 | mov edi, [CURRENT_TASK] |
339 | mov edi, [CURRENT_TASK] |
360 | shl edi, 5 |
340 | shl edi, 5 |
361 | add edi, window_data |
341 | add edi, window_data |
362 | 342 | ||
363 | test [edi + WDATA.fl_wdrawn], 1 |
343 | test [edi + WDATA.fl_wdrawn], 1 |
364 | jz .exit |
344 | jz .exit |
365 | 345 | ||
366 | test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED |
346 | test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED |
367 | jnz .exit |
347 | jnz .exit |
368 | 348 | ||
369 | cmp ebx, -1 |
349 | cmp ebx, -1 |
370 | jne @f |
350 | jne @f |
371 | mov ebx, [edi + WDATA.box.left] |
351 | mov ebx, [edi + WDATA.box.left] |
372 | ;-------------------------------------- |
352 | ;-------------------------------------- |
373 | align 4 |
353 | align 4 |
374 | @@: |
354 | @@: |
375 | cmp ecx, -1 |
355 | cmp ecx, -1 |
376 | jne @f |
356 | jne @f |
377 | mov ecx, [edi + WDATA.box.top] |
357 | mov ecx, [edi + WDATA.box.top] |
378 | ;-------------------------------------- |
358 | ;-------------------------------------- |
379 | align 4 |
359 | align 4 |
380 | @@: |
360 | @@: |
381 | cmp edx, -1 |
361 | cmp edx, -1 |
382 | jne @f |
362 | jne @f |
383 | mov edx, [edi + WDATA.box.width] |
363 | mov edx, [edi + WDATA.box.width] |
384 | ;-------------------------------------- |
364 | ;-------------------------------------- |
385 | align 4 |
365 | align 4 |
386 | @@: |
366 | @@: |
387 | cmp esi, -1 |
367 | cmp esi, -1 |
388 | jne @f |
368 | jne @f |
389 | mov esi, [edi + WDATA.box.height] |
369 | mov esi, [edi + WDATA.box.height] |
390 | ;-------------------------------------- |
370 | ;-------------------------------------- |
391 | align 4 |
371 | align 4 |
392 | @@: |
372 | @@: |
393 | push esi edx ecx ebx |
373 | push esi edx ecx ebx |
394 | mov eax, esp |
374 | mov eax, esp |
395 | mov bl, [edi + WDATA.fl_wstate] |
375 | mov bl, [edi + WDATA.fl_wstate] |
396 | ;-------------------------------------- |
376 | ;-------------------------------------- |
397 | align 4 |
377 | align 4 |
398 | @@: |
378 | @@: |
399 | cmp [REDRAW_BACKGROUND], byte 0 |
379 | cmp [REDRAW_BACKGROUND], byte 0 |
400 | jz @f |
380 | jz @f |
401 | call change_task |
381 | call change_task |
402 | jmp @b |
382 | jmp @b |
403 | ;-------------------------------------- |
383 | ;-------------------------------------- |
404 | align 4 |
384 | align 4 |
405 | @@: |
385 | @@: |
406 | call window._.set_window_box |
386 | call window._.set_window_box |
407 | add esp, sizeof.BOX |
387 | add esp, sizeof.BOX |
408 | - | ||
409 | ; NOTE: do we really need this? to be reworked |
- | |
410 | ; mov byte[DONT_DRAW_MOUSE], 0 ; mouse pointer |
- | |
411 | ; mov byte[MOUSE_BACKGROUND], 0 ; no mouse under |
- | |
412 | ; mov byte[MOUSE_DOWN], 0 ; react to mouse up/down |
- | |
413 | - | ||
414 | ; NOTE: do we really need this? to be reworked |
- | |
415 | ; call [draw_pointer] |
- | |
416 | ;-------------------------------------- |
- | |
417 | align 4 |
388 | |
418 | .exit: |
389 | .exit: |
419 | ret |
390 | ret |
420 | ;------------------------------------------------------------------------------ |
391 | ;------------------------------------------------------------------------------ |
421 | align 4 |
- | |
422 | ;------------------------------------------------------------------------------ |
- | |
423 | syscall_window_settings: ;///// system function 71 ///////////////////////////// |
392 | syscall_window_settings: ;///// system function 71 //////////////////////////// |
424 | ;------------------------------------------------------------------------------ |
393 | ;------------------------------------------------------------------------------ |
425 | ;? |
- | |
426 | ;------------------------------------------------------------------------------ |
- | |
427 | dec ebx ; subfunction #1 - set window caption |
- | |
428 | jnz .exit_fail |
- | |
429 | - | ||
430 | ; NOTE: only window owner thread can set its caption, |
- | |
431 | ; so there's no parameter for PID/TID |
- | |
432 | - | ||
433 | mov edi, [CURRENT_TASK] |
394 | mov edi, [CURRENT_TASK] |
434 | shl edi, 5 |
395 | shl edi, 5 |
435 | - | ||
436 | mov [edi * 8 + SLOT_BASE + APPDATA.wnd_caption], ecx |
396 | mov [edi * 8 + SLOT_BASE + APPDATA.wnd_caption], ecx |
437 | or [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION |
397 | or [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION |
438 | - | ||
439 | call window._.draw_window_caption |
398 | jmp window._.draw_window_caption |
440 | - | ||
441 | xor eax, eax ; eax = 0 (success) |
- | |
442 | ret |
- | |
443 | - | ||
444 | ; .get_window_caption: |
- | |
445 | ; dec eax ; subfunction #2 - get window caption |
- | |
446 | ; jnz .exit_fail |
- | |
447 | - | ||
448 | ; not implemented yet |
- | |
449 | ;-------------------------------------- |
- | |
450 | align 4 |
- | |
451 | .exit_fail: |
- | |
452 | xor eax, eax |
- | |
453 | inc eax ; eax = 1 (fail) |
- | |
454 | ret |
- | |
455 | ;------------------------------------------------------------------------------ |
399 | ;------------------------------------------------------------------------------ |
456 | align 4 |
400 | align 4 |
457 | ;------------------------------------------------------------------------------ |
- | |
458 | set_window_defaults: ;///////////////////////////////////////////////////////// |
401 | set_window_defaults: ;///////////////////////////////////////////////////////// |
459 | ;------------------------------------------------------------------------------ |
402 | ;------------------------------------------------------------------------------ |
460 | ;? |
- | |
461 | ;------------------------------------------------------------------------------ |
- | |
462 | mov byte [window_data + 0x20 + WDATA.cl_titlebar + 3], 1 ; desktop is not movable |
403 | mov byte [window_data + 0x20 + WDATA.cl_titlebar + 3], 1 ; desktop is not movable |
463 | push eax ecx |
404 | push eax ecx |
464 | xor eax, eax |
405 | xor eax, eax |
465 | mov ecx, WIN_STACK |
406 | mov ecx, WIN_STACK |
466 | ;-------------------------------------- |
407 | ;-------------------------------------- |
467 | align 4 |
408 | align 4 |
468 | @@: |
409 | @@: |
469 | inc eax |
410 | inc eax |
470 | add ecx, 2 |
411 | add ecx, 2 |
471 | ; process no |
412 | ; process no |
472 | mov [ecx + 0x000], ax |
413 | mov [ecx + 0x000], ax |
473 | ; positions in stack |
414 | ; positions in stack |
474 | mov [ecx + 0x400], ax |
415 | mov [ecx + 0x400], ax |
475 | cmp ecx, WIN_POS - 2 |
416 | cmp ecx, WIN_POS - 2 |
476 | jne @b |
417 | jne @b |
477 | pop ecx eax |
418 | pop ecx eax |
478 | ret |
419 | ret |
479 | ;------------------------------------------------------------------------------ |
420 | ;------------------------------------------------------------------------------ |
- | 421 | ||
480 | align 4 |
422 | align 4 |
481 | ;------------------------------------------------------------------------------ |
423 | ;------------------------------------------------------------------------------ |
482 | calculatescreen: ;///////////////////////////////////////////////////////////// |
424 | calculatescreen: ;///////////////////////////////////////////////////////////// |
483 | ;------------------------------------------------------------------------------ |
425 | ;------------------------------------------------------------------------------ |
484 | ;? Scan all windows from bottom to top, calling `setscreen` for each one |
426 | ;? Scan all windows from bottom to top, calling `setscreen` for each one |
485 | ;? intersecting given screen area |
427 | ;? intersecting given screen area |
486 | ;------------------------------------------------------------------------------ |
428 | ;------------------------------------------------------------------------------ |
487 | ;> eax = left |
429 | ;> eax = left |
488 | ;> ebx = top |
430 | ;> ebx = top |
489 | ;> ecx = right |
431 | ;> ecx = right |
490 | ;> edx = bottom |
432 | ;> edx = bottom |
491 | ;------------------------------------------------------------------------------ |
433 | ;------------------------------------------------------------------------------ |
492 | push esi |
434 | push esi |
493 | pushfd |
435 | pushfd |
494 | cli |
436 | cli |
495 | 437 | ||
496 | mov esi, 1 |
438 | mov esi, 1 |
497 | call window._.set_screen |
439 | call window._.set_screen |
498 | 440 | ||
499 | push ebp |
441 | push ebp |
500 | 442 | ||
501 | mov ebp, [TASK_COUNT] |
443 | mov ebp, [TASK_COUNT] |
502 | cmp ebp, 1 |
444 | cmp ebp, 1 |
503 | jbe .exit |
445 | jbe .exit |
- | 446 | ||
- | 447 | push eax ;for num layout |
|
504 | 448 | ||
- | 449 | push edx ecx ebx eax |
|
- | 450 | ||
- | 451 | mov dword[esp+10h], ZPOS_DESKTOP |
|
- | 452 | ;-------------------------------------- |
|
- | 453 | align 4 |
|
- | 454 | .layout: |
|
- | 455 | mov esi, 1 ; = num in window stack |
|
505 | push edx ecx ebx eax |
456 | mov ebp, [TASK_COUNT] |
506 | ;-------------------------------------- |
457 | ;-------------------------------------- |
507 | align 4 |
458 | align 4 |
508 | .next_window: |
459 | .next_window: |
509 | movzx edi, word[WIN_POS + esi * 2] |
460 | movzx edi, word[WIN_POS + esi * 2] |
510 | shl edi, 5 |
461 | shl edi, 5 ;size of TASKDATA and WDATA = 32 bytes |
511 | 462 | ||
512 | cmp [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE |
463 | cmp [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE |
513 | je .skip_window |
464 | je .skip_window |
514 | 465 | ||
515 | add edi, window_data |
466 | add edi, window_data |
516 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
467 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
517 | jnz .skip_window |
468 | jnz .skip_window |
- | 469 | ||
- | 470 | mov eax, [esp+10h] |
|
- | 471 | cmp [edi + WDATA.z_modif], al |
|
- | 472 | jne .skip_window |
|
518 | 473 | ||
519 | mov eax, [edi + WDATA.box.left] |
474 | mov eax, [edi + WDATA.box.left] |
520 | cmp eax, [esp + RECT.right] |
475 | cmp eax, [esp + RECT.right] |
521 | jg .skip_window |
476 | jg .skip_window |
522 | mov ebx, [edi + WDATA.box.top] |
477 | mov ebx, [edi + WDATA.box.top] |
523 | cmp ebx, [esp + RECT.bottom] |
478 | cmp ebx, [esp + RECT.bottom] |
524 | jg .skip_window |
479 | jg .skip_window |
525 | mov ecx, [edi + WDATA.box.width] |
480 | mov ecx, [edi + WDATA.box.width] |
526 | add ecx, eax |
481 | add ecx, eax |
527 | cmp ecx, [esp + RECT.left] |
482 | cmp ecx, [esp + RECT.left] |
528 | jl .skip_window |
483 | jl .skip_window |
529 | mov edx, [edi + WDATA.box.height] |
484 | mov edx, [edi + WDATA.box.height] |
530 | add edx, ebx |
485 | add edx, ebx |
531 | cmp edx, [esp + RECT.top] |
486 | cmp edx, [esp + RECT.top] |
532 | jl .skip_window |
487 | jl .skip_window |
533 | 488 | ||
534 | cmp eax, [esp + RECT.left] |
489 | cmp eax, [esp + RECT.left] |
535 | jae @f |
490 | jae @f |
536 | mov eax, [esp + RECT.left] |
491 | mov eax, [esp + RECT.left] |
537 | ;-------------------------------------- |
492 | ;-------------------------------------- |
538 | align 4 |
493 | align 4 |
539 | @@: |
494 | @@: |
540 | cmp ebx, [esp + RECT.top] |
495 | cmp ebx, [esp + RECT.top] |
541 | jae @f |
496 | jae @f |
542 | mov ebx, [esp + RECT.top] |
497 | mov ebx, [esp + RECT.top] |
543 | ;-------------------------------------- |
498 | ;-------------------------------------- |
544 | align 4 |
499 | align 4 |
545 | @@: |
500 | @@: |
546 | cmp ecx, [esp + RECT.right] |
501 | cmp ecx, [esp + RECT.right] |
547 | jbe @f |
502 | jbe @f |
548 | mov ecx, [esp + RECT.right] |
503 | mov ecx, [esp + RECT.right] |
549 | ;-------------------------------------- |
504 | ;-------------------------------------- |
550 | align 4 |
505 | align 4 |
551 | @@: |
506 | @@: |
552 | cmp edx, [esp + RECT.bottom] |
507 | cmp edx, [esp + RECT.bottom] |
553 | jbe @f |
508 | jbe @f |
554 | mov edx, [esp + RECT.bottom] |
509 | mov edx, [esp + RECT.bottom] |
555 | ;-------------------------------------- |
510 | ;-------------------------------------- |
556 | align 4 |
511 | align 4 |
557 | @@: |
512 | @@: |
558 | push esi |
513 | push esi |
559 | movzx esi, word[WIN_POS + esi * 2] |
514 | movzx esi, word[WIN_POS + esi * 2] |
560 | call window._.set_screen |
515 | call window._.set_screen |
561 | pop esi |
516 | pop esi |
562 | ;-------------------------------------- |
517 | ;-------------------------------------- |
563 | align 4 |
518 | align 4 |
564 | .skip_window: |
519 | .skip_window: |
565 | inc esi |
520 | inc esi |
566 | dec ebp |
521 | dec ebp |
567 | jnz .next_window |
522 | jnz .next_window |
- | 523 | ;--------------------------------------------- |
|
- | 524 | inc dword[esp+10h] |
|
- | 525 | cmp dword[esp+10h], ZPOS_ALWAYS_TOP |
|
- | 526 | jle .layout |
|
- | 527 | ;--------------------------------------------- |
|
- | 528 | mov esi, [TASK_COUNT] |
|
- | 529 | movzx edi, word[WIN_POS + esi * 2] |
|
- | 530 | shl edi, 5 |
|
- | 531 | add edi, window_data |
|
568 | 532 | ||
- | 533 | pop eax ebx ecx edx |
|
569 | pop eax ebx ecx edx |
534 | pop ebp ;del num layout |
570 | ;-------------------------------------- |
535 | ;-------------------------------------- |
571 | align 4 |
536 | align 4 |
572 | .exit: |
537 | .exit: |
573 | pop ebp |
538 | pop ebp |
574 | inc [_display.mask_seqno] |
539 | inc [_display.mask_seqno] |
575 | popfd |
540 | popfd |
576 | pop esi |
541 | pop esi |
577 | ret |
542 | ret |
578 | ;------------------------------------------------------------------------------ |
543 | ;------------------------------------------------------------------------------ |
579 | align 4 |
544 | align 4 |
580 | ;------------------------------------------------------------------------------ |
545 | ;------------------------------------------------------------------------------ |
581 | repos_windows: ;/////////////////////////////////////////////////////////////// |
546 | repos_windows: ;/////////////////////////////////////////////////////////////// |
582 | ;------------------------------------------------------------------------------ |
547 | ;------------------------------------------------------------------------------ |
583 | ;? |
548 | ;? |
584 | ;------------------------------------------------------------------------------ |
549 | ;------------------------------------------------------------------------------ |
585 | mov ecx, [TASK_COUNT] |
550 | mov ecx, [TASK_COUNT] |
586 | mov edi, window_data + sizeof.WDATA * 2 |
551 | mov edi, window_data + sizeof.WDATA * 2 |
587 | call force_redraw_background |
552 | call force_redraw_background |
588 | dec ecx |
553 | dec ecx |
589 | jle .exit |
554 | jle .exit |
590 | ;-------------------------------------- |
555 | ;-------------------------------------- |
591 | align 4 |
556 | align 4 |
592 | .next_window: |
557 | .next_window: |
593 | mov [edi + WDATA.fl_redraw], 1 |
558 | mov [edi + WDATA.fl_redraw], 1 |
594 | test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED |
559 | test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED |
595 | jnz .fix_maximized |
560 | jnz .fix_maximized |
596 | 561 | ||
597 | mov eax, [edi + WDATA.box.left] |
562 | mov eax, [edi + WDATA.box.left] |
598 | add eax, [edi + WDATA.box.width] |
563 | add eax, [edi + WDATA.box.width] |
599 | mov ebx, [_display.width] |
564 | mov ebx, [_display.width] |
600 | cmp eax, ebx |
565 | cmp eax, ebx |
601 | jl .fix_vertical |
566 | jl .fix_vertical |
602 | mov eax, [edi + WDATA.box.width] |
567 | mov eax, [edi + WDATA.box.width] |
603 | sub eax, ebx |
568 | sub eax, ebx |
604 | jl @f |
569 | jl @f |
605 | mov [edi + WDATA.box.width], ebx |
570 | mov [edi + WDATA.box.width], ebx |
606 | ;-------------------------------------- |
571 | ;-------------------------------------- |
607 | align 4 |
572 | align 4 |
608 | @@: |
573 | @@: |
609 | sub ebx, [edi + WDATA.box.width] |
574 | sub ebx, [edi + WDATA.box.width] |
610 | mov [edi + WDATA.box.left], ebx |
575 | mov [edi + WDATA.box.left], ebx |
611 | ;-------------------------------------- |
576 | ;-------------------------------------- |
612 | align 4 |
577 | align 4 |
613 | .fix_vertical: |
578 | .fix_vertical: |
614 | mov eax, [edi + WDATA.box.top] |
579 | mov eax, [edi + WDATA.box.top] |
615 | add eax, [edi + WDATA.box.height] |
580 | add eax, [edi + WDATA.box.height] |
616 | mov ebx, [_display.height] |
581 | mov ebx, [_display.height] |
617 | cmp eax, ebx |
582 | cmp eax, ebx |
618 | jl .fix_client_box |
583 | jl .fix_client_box |
619 | mov eax, [edi + WDATA.box.height] |
584 | mov eax, [edi + WDATA.box.height] |
620 | sub eax, ebx |
585 | sub eax, ebx |
621 | jl @f |
586 | jl @f |
622 | mov [edi + WDATA.box.height], ebx |
587 | mov [edi + WDATA.box.height], ebx |
623 | ;-------------------------------------- |
588 | ;-------------------------------------- |
624 | align 4 |
589 | align 4 |
625 | @@: |
590 | @@: |
626 | sub ebx, [edi + WDATA.box.height] |
591 | sub ebx, [edi + WDATA.box.height] |
627 | mov [edi + WDATA.box.top], ebx |
592 | mov [edi + WDATA.box.top], ebx |
628 | ;-------------------------------------- |
593 | ;-------------------------------------- |
629 | align 4 |
594 | align 4 |
630 | .fix_client_box: |
595 | .fix_client_box: |
631 | call window._.set_window_clientbox |
596 | call window._.set_window_clientbox |
632 | add edi, sizeof.WDATA |
597 | add edi, sizeof.WDATA |
633 | loop .next_window |
598 | loop .next_window |
634 | ;-------------------------------------- |
599 | ;-------------------------------------- |
635 | align 4 |
600 | align 4 |
636 | .exit: |
601 | .exit: |
637 | ret |
602 | ret |
638 | ;-------------------------------------- |
603 | ;-------------------------------------- |
639 | align 4 |
604 | align 4 |
640 | .fix_maximized: |
605 | .fix_maximized: |
641 | mov eax, [screen_workarea.left] |
606 | mov eax, [screen_workarea.left] |
642 | mov [edi + WDATA.box.left], eax |
607 | mov [edi + WDATA.box.left], eax |
643 | sub eax, [screen_workarea.right] |
608 | sub eax, [screen_workarea.right] |
644 | neg eax |
609 | neg eax |
645 | mov [edi + WDATA.box.width], eax |
610 | mov [edi + WDATA.box.width], eax |
646 | mov eax, [screen_workarea.top] |
611 | mov eax, [screen_workarea.top] |
647 | mov [edi + WDATA.box.top], eax |
612 | mov [edi + WDATA.box.top], eax |
648 | test [edi + WDATA.fl_wstate], WSTATE_ROLLEDUP |
613 | test [edi + WDATA.fl_wstate], WSTATE_ROLLEDUP |
649 | jnz .fix_client_box |
614 | jnz .fix_client_box |
650 | sub eax, [screen_workarea.bottom] |
615 | sub eax, [screen_workarea.bottom] |
651 | neg eax |
616 | neg eax |
652 | mov [edi + WDATA.box.height], eax |
617 | mov [edi + WDATA.box.height], eax |
653 | jmp .fix_client_box |
618 | jmp .fix_client_box |
654 | ;------------------------------------------------------------------------------ |
619 | ;------------------------------------------------------------------------------ |
655 | ;align 4 |
620 | ;align 4 |
656 | ;------------------------------------------------------------------------------ |
621 | ;------------------------------------------------------------------------------ |
657 | ;sys_window_mouse: ;//////////////////////////////////////////////////////////// |
622 | ;sys_window_mouse: ;//////////////////////////////////////////////////////////// |
658 | ;------------------------------------------------------------------------------ |
623 | ;------------------------------------------------------------------------------ |
659 | ;? |
624 | ;? |
660 | ;------------------------------------------------------------------------------ |
625 | ;------------------------------------------------------------------------------ |
661 | ; NOTE: commented out since doesn't provide necessary functionality |
626 | ; NOTE: commented out since doesn't provide necessary functionality |
662 | ; anyway, to be reworked |
627 | ; anyway, to be reworked |
663 | ; push eax |
628 | ; push eax |
664 | ; |
629 | ; |
665 | ; mov eax, [timer_ticks] |
630 | ; mov eax, [timer_ticks] |
666 | ; cmp [new_window_starting], eax |
631 | ; cmp [new_window_starting], eax |
667 | ; jb .exit |
632 | ; jb .exit |
668 | ; |
633 | ; |
669 | ; mov byte[MOUSE_BACKGROUND], 0 |
634 | ; mov byte[MOUSE_BACKGROUND], 0 |
670 | ; mov byte[DONT_DRAW_MOUSE], 0 |
635 | ; mov byte[DONT_DRAW_MOUSE], 0 |
671 | ; |
636 | ; |
672 | ; mov [new_window_starting], eax |
637 | ; mov [new_window_starting], eax |
673 | ; |
638 | ; |
674 | ; .exit: |
639 | ; .exit: |
675 | ; pop eax |
640 | ; pop eax |
676 | ; ret |
641 | ; ret |
677 | ;------------------------------------------------------------------------------ |
642 | ;------------------------------------------------------------------------------ |
678 | align 4 |
643 | align 4 |
679 | ;------------------------------------------------------------------------------ |
644 | ;------------------------------------------------------------------------------ |
680 | draw_rectangle: ;////////////////////////////////////////////////////////////// |
645 | draw_rectangle: ;////////////////////////////////////////////////////////////// |
681 | ;------------------------------------------------------------------------------ |
646 | ;------------------------------------------------------------------------------ |
682 | ;> eax = pack[16(left), 16(right)] |
647 | ;> eax = pack[16(left), 16(right)] |
683 | ;> ebx = pack[16(top), 16(bottom)] |
648 | ;> ebx = pack[16(top), 16(bottom)] |
684 | ;> esi = color |
649 | ;> esi = color |
685 | ; ?? RR GG BB ; 0x01000000 negation |
650 | ; ?? RR GG BB ; 0x01000000 negation |
686 | ; ; 0x02000000 used for draw_rectangle without top line |
651 | ; ; 0x02000000 used for draw_rectangle without top line |
687 | ; ; for example drawwindow_III and drawwindow_IV |
652 | ; ; for example drawwindow_III and drawwindow_IV |
688 | ;------------------------------------------------------------------------------ |
653 | ;------------------------------------------------------------------------------ |
689 | push eax ebx ecx edi |
654 | push eax ebx ecx edi |
690 | 655 | ||
691 | xor edi, edi |
656 | xor edi, edi |
692 | ;-------------------------------------- |
657 | ;-------------------------------------- |
693 | align 4 |
658 | align 4 |
694 | .flags_set: |
659 | .flags_set: |
695 | push ebx |
660 | push ebx |
696 | 661 | ||
697 | ; set line color |
662 | ; set line color |
698 | mov ecx, esi |
663 | mov ecx, esi |
699 | ; draw top border |
664 | ; draw top border |
700 | rol ebx, 16 |
665 | rol ebx, 16 |
701 | push ebx |
666 | push ebx |
702 | rol ebx, 16 |
667 | rol ebx, 16 |
703 | pop bx |
668 | pop bx |
704 | test ecx, 1 shl 25 |
669 | test ecx, 1 shl 25 |
705 | jnz @f |
670 | jnz @f |
706 | sub ecx, 1 shl 25 |
671 | sub ecx, 1 shl 25 |
707 | ; call [draw_line] |
672 | ; call [draw_line] |
708 | call __sys_draw_line |
673 | call __sys_draw_line |
709 | ;-------------------------------------- |
674 | ;-------------------------------------- |
710 | align 4 |
675 | align 4 |
711 | @@: |
676 | @@: |
712 | ; draw bottom border |
677 | ; draw bottom border |
713 | mov ebx, [esp - 2] |
678 | mov ebx, [esp - 2] |
714 | pop bx |
679 | pop bx |
715 | ; call [draw_line] |
680 | ; call [draw_line] |
716 | call __sys_draw_line |
681 | call __sys_draw_line |
717 | 682 | ||
718 | pop ebx |
683 | pop ebx |
719 | add ebx, 1 * 65536 - 1 |
684 | add ebx, 1 * 65536 - 1 |
720 | 685 | ||
721 | ; draw left border |
686 | ; draw left border |
722 | rol eax, 16 |
687 | rol eax, 16 |
723 | push eax |
688 | push eax |
724 | rol eax, 16 |
689 | rol eax, 16 |
725 | pop ax |
690 | pop ax |
726 | ; call [draw_line] |
691 | ; call [draw_line] |
727 | call __sys_draw_line |
692 | call __sys_draw_line |
728 | 693 | ||
729 | ; draw right border |
694 | ; draw right border |
730 | mov eax, [esp - 2] |
695 | mov eax, [esp - 2] |
731 | pop ax |
696 | pop ax |
732 | ; call [draw_line] |
697 | ; call [draw_line] |
733 | call __sys_draw_line |
698 | call __sys_draw_line |
734 | 699 | ||
735 | pop edi ecx ebx eax |
700 | pop edi ecx ebx eax |
736 | ret |
701 | ret |
737 | ;-------------------------------------- |
702 | ;-------------------------------------- |
738 | align 4 |
703 | align 4 |
739 | .forced: |
704 | .forced: |
740 | push eax ebx ecx edi |
705 | push eax ebx ecx edi |
741 | xor edi, edi |
706 | xor edi, edi |
742 | inc edi |
707 | inc edi |
743 | jmp .flags_set |
708 | jmp .flags_set |
744 | ;------------------------------------------------------------------------------ |
709 | ;------------------------------------------------------------------------------ |
745 | align 4 |
710 | align 4 |
746 | ;------------------------------------------------------------------------------ |
711 | ;------------------------------------------------------------------------------ |
747 | drawwindow_I_caption: ;//////////////////////////////////////////////////////// |
712 | drawwindow_I_caption: ;//////////////////////////////////////////////////////// |
748 | ;------------------------------------------------------------------------------ |
713 | ;------------------------------------------------------------------------------ |
749 | ;? |
714 | ;? |
750 | ;------------------------------------------------------------------------------ |
715 | ;------------------------------------------------------------------------------ |
751 | push [edx + WDATA.cl_titlebar] |
716 | push [edx + WDATA.cl_titlebar] |
752 | mov esi, edx |
717 | mov esi, edx |
753 | 718 | ||
754 | mov edx, [esi + WDATA.box.top] |
719 | mov edx, [esi + WDATA.box.top] |
755 | mov eax, edx |
720 | mov eax, edx |
756 | lea ebx, [edx + 21] |
721 | lea ebx, [edx + 21] |
757 | inc edx |
722 | inc edx |
758 | add eax, [esi + WDATA.box.height] |
723 | add eax, [esi + WDATA.box.height] |
759 | 724 | ||
760 | cmp ebx, eax |
725 | cmp ebx, eax |
761 | jbe @f |
726 | jbe @f |
762 | mov ebx, eax |
727 | mov ebx, eax |
763 | ;-------------------------------------- |
728 | ;-------------------------------------- |
764 | align 4 |
729 | align 4 |
765 | @@: |
730 | @@: |
766 | push ebx |
731 | push ebx |
767 | 732 | ||
768 | xor edi, edi |
733 | xor edi, edi |
769 | ;-------------------------------------- |
734 | ;-------------------------------------- |
770 | align 4 |
735 | align 4 |
771 | .next_line: |
736 | .next_line: |
772 | mov ebx, edx |
737 | mov ebx, edx |
773 | shl ebx, 16 |
738 | shl ebx, 16 |
774 | add ebx, edx |
739 | add ebx, edx |
775 | mov eax, [esi + WDATA.box.left] |
740 | mov eax, [esi + WDATA.box.left] |
776 | inc eax |
741 | inc eax |
777 | shl eax, 16 |
742 | shl eax, 16 |
778 | add eax, [esi + WDATA.box.left] |
743 | add eax, [esi + WDATA.box.left] |
779 | add eax, [esi + WDATA.box.width] |
744 | add eax, [esi + WDATA.box.width] |
780 | dec eax |
745 | dec eax |
781 | mov ecx, [esi + WDATA.cl_titlebar] |
746 | mov ecx, [esi + WDATA.cl_titlebar] |
782 | test ecx, 0x80000000 |
747 | test ecx, 0x80000000 |
783 | jz @f |
748 | jz @f |
784 | sub ecx, 0x00040404 |
749 | sub ecx, 0x00040404 |
785 | mov [esi + WDATA.cl_titlebar], ecx |
750 | mov [esi + WDATA.cl_titlebar], ecx |
786 | ;-------------------------------------- |
751 | ;-------------------------------------- |
787 | align 4 |
752 | align 4 |
788 | @@: |
753 | @@: |
789 | and ecx, 0x00ffffff |
754 | and ecx, 0x00ffffff |
790 | ; call [draw_line] |
755 | ; call [draw_line] |
791 | call __sys_draw_line |
756 | call __sys_draw_line |
792 | inc edx |
757 | inc edx |
793 | cmp edx, [esp] |
758 | cmp edx, [esp] |
794 | jb .next_line |
759 | jb .next_line |
795 | 760 | ||
796 | add esp, 4 |
761 | add esp, 4 |
797 | pop [esi + WDATA.cl_titlebar] |
762 | pop [esi + WDATA.cl_titlebar] |
798 | ret |
763 | ret |
799 | ;------------------------------------------------------------------------------ |
764 | ;------------------------------------------------------------------------------ |
800 | align 4 |
765 | align 4 |
801 | ;------------------------------------------------------------------------------ |
766 | ;------------------------------------------------------------------------------ |
802 | drawwindow_I: ;//////////////////////////////////////////////////////////////// |
767 | drawwindow_I: ;//////////////////////////////////////////////////////////////// |
803 | ;------------------------------------------------------------------------------ |
768 | ;------------------------------------------------------------------------------ |
804 | ;? |
769 | ;? |
805 | ;------------------------------------------------------------------------------ |
770 | ;------------------------------------------------------------------------------ |
806 | pushad |
771 | pushad |
807 | 772 | ||
808 | ; window border |
773 | ; window border |
809 | 774 | ||
810 | mov eax, [edx + WDATA.box.left - 2] |
775 | mov eax, [edx + WDATA.box.left - 2] |
811 | mov ax, word[edx + WDATA.box.left] |
776 | mov ax, word[edx + WDATA.box.left] |
812 | add ax, word[edx + WDATA.box.width] |
777 | add ax, word[edx + WDATA.box.width] |
813 | mov ebx, [edx + WDATA.box.top - 2] |
778 | mov ebx, [edx + WDATA.box.top - 2] |
814 | mov bx, word[edx + WDATA.box.top] |
779 | mov bx, word[edx + WDATA.box.top] |
815 | add bx, word[edx + WDATA.box.height] |
780 | add bx, word[edx + WDATA.box.height] |
816 | 781 | ||
817 | mov esi, [edx + WDATA.cl_frames] |
782 | mov esi, [edx + WDATA.cl_frames] |
818 | call draw_rectangle |
783 | call draw_rectangle |
819 | 784 | ||
820 | ; window caption |
785 | ; window caption |
821 | 786 | ||
822 | call drawwindow_I_caption |
787 | call drawwindow_I_caption |
823 | 788 | ||
824 | ; window client area |
789 | ; window client area |
825 | 790 | ||
826 | ; do we need to draw it? |
791 | ; do we need to draw it? |
827 | mov edi, [esi + WDATA.cl_workarea] |
792 | mov edi, [esi + WDATA.cl_workarea] |
828 | test edi, 0x40000000 |
793 | test edi, 0x40000000 |
829 | jnz .exit |
794 | jnz .exit |
830 | 795 | ||
831 | ; does client area have a positive size on screen? |
796 | ; does client area have a positive size on screen? |
832 | cmp [esi + WDATA.box.height], 21 |
797 | cmp [esi + WDATA.box.height], 21 |
833 | jle .exit |
798 | jle .exit |
834 | 799 | ||
835 | ; okay, let's draw it |
800 | ; okay, let's draw it |
836 | mov eax, 1 |
801 | mov eax, 1 |
837 | mov ebx, 21 |
802 | mov ebx, 21 |
838 | mov ecx, [esi + WDATA.box.width] |
803 | mov ecx, [esi + WDATA.box.width] |
839 | mov edx, [esi + WDATA.box.height] |
804 | mov edx, [esi + WDATA.box.height] |
840 | ; call [drawbar] |
805 | ; call [drawbar] |
841 | call vesa20_drawbar |
806 | call vesa20_drawbar |
842 | ;-------------------------------------- |
807 | ;-------------------------------------- |
843 | align 4 |
808 | align 4 |
844 | .exit: |
809 | .exit: |
845 | popad |
810 | popad |
846 | ret |
811 | ret |
847 | ;------------------------------------------------------------------------------ |
812 | ;------------------------------------------------------------------------------ |
848 | align 4 |
813 | align 4 |
849 | ;------------------------------------------------------------------------------ |
814 | ;------------------------------------------------------------------------------ |
850 | drawwindow_III_caption: ;///////////////////////////////////////////////////// |
815 | drawwindow_III_caption: ;///////////////////////////////////////////////////// |
851 | ;------------------------------------------------------------------------------ |
816 | ;------------------------------------------------------------------------------ |
852 | ;? |
817 | ;? |
853 | ;------------------------------------------------------------------------------ |
818 | ;------------------------------------------------------------------------------ |
854 | mov ecx, [edx + WDATA.cl_titlebar] |
819 | mov ecx, [edx + WDATA.cl_titlebar] |
855 | push ecx |
820 | push ecx |
856 | mov esi, edx |
821 | mov esi, edx |
857 | mov edx, [esi + WDATA.box.top] |
822 | mov edx, [esi + WDATA.box.top] |
858 | add edx, 4 |
823 | add edx, 4 |
859 | mov ebx, [esi + WDATA.box.top] |
824 | mov ebx, [esi + WDATA.box.top] |
860 | add ebx, 20 |
825 | add ebx, 20 |
861 | mov eax, [esi + WDATA.box.top] |
826 | mov eax, [esi + WDATA.box.top] |
862 | add eax, [esi + WDATA.box.height] |
827 | add eax, [esi + WDATA.box.height] |
863 | 828 | ||
864 | cmp ebx, eax |
829 | cmp ebx, eax |
865 | jb @f |
830 | jb @f |
866 | mov ebx, eax |
831 | mov ebx, eax |
867 | ;-------------------------------------- |
832 | ;-------------------------------------- |
868 | align 4 |
833 | align 4 |
869 | @@: |
834 | @@: |
870 | push ebx |
835 | push ebx |
871 | 836 | ||
872 | xor edi, edi |
837 | xor edi, edi |
873 | ;-------------------------------------- |
838 | ;-------------------------------------- |
874 | align 4 |
839 | align 4 |
875 | .next_line: |
840 | .next_line: |
876 | mov ebx, edx |
841 | mov ebx, edx |
877 | shl ebx, 16 |
842 | shl ebx, 16 |
878 | add ebx, edx |
843 | add ebx, edx |
879 | mov eax, [esi + WDATA.box.left] |
844 | mov eax, [esi + WDATA.box.left] |
880 | shl eax, 16 |
845 | shl eax, 16 |
881 | add eax, [esi + WDATA.box.left] |
846 | add eax, [esi + WDATA.box.left] |
882 | add eax, [esi + WDATA.box.width] |
847 | add eax, [esi + WDATA.box.width] |
883 | add eax, 4 * 65536 - 4 |
848 | add eax, 4 * 65536 - 4 |
884 | mov ecx, [esi + WDATA.cl_titlebar] |
849 | mov ecx, [esi + WDATA.cl_titlebar] |
885 | test ecx, 0x40000000 |
850 | test ecx, 0x40000000 |
886 | jz @f |
851 | jz @f |
887 | add ecx, 0x00040404 |
852 | add ecx, 0x00040404 |
888 | ;-------------------------------------- |
853 | ;-------------------------------------- |
889 | align 4 |
854 | align 4 |
890 | @@: |
855 | @@: |
891 | test ecx, 0x80000000 |
856 | test ecx, 0x80000000 |
892 | jz @f |
857 | jz @f |
893 | sub ecx, 0x00040404 |
858 | sub ecx, 0x00040404 |
894 | ;-------------------------------------- |
859 | ;-------------------------------------- |
895 | align 4 |
860 | align 4 |
896 | @@: |
861 | @@: |
897 | mov [esi + WDATA.cl_titlebar], ecx |
862 | mov [esi + WDATA.cl_titlebar], ecx |
898 | and ecx, 0x00ffffff |
863 | and ecx, 0x00ffffff |
899 | ; call [draw_line] |
864 | ; call [draw_line] |
900 | call __sys_draw_line |
865 | call __sys_draw_line |
901 | inc edx |
866 | inc edx |
902 | cmp edx, [esp] |
867 | cmp edx, [esp] |
903 | jb .next_line |
868 | jb .next_line |
904 | 869 | ||
905 | add esp, 4 |
870 | add esp, 4 |
906 | pop [esi + WDATA.cl_titlebar] |
871 | pop [esi + WDATA.cl_titlebar] |
907 | ret |
872 | ret |
908 | ;------------------------------------------------------------------------------ |
873 | ;------------------------------------------------------------------------------ |
909 | align 4 |
874 | align 4 |
910 | ;------------------------------------------------------------------------------ |
875 | ;------------------------------------------------------------------------------ |
911 | drawwindow_III: ;////////////////////////////////////////////////////////////// |
876 | drawwindow_III: ;////////////////////////////////////////////////////////////// |
912 | ;------------------------------------------------------------------------------ |
877 | ;------------------------------------------------------------------------------ |
913 | ;? |
878 | ;? |
914 | ;------------------------------------------------------------------------------ |
879 | ;------------------------------------------------------------------------------ |
915 | pushad |
880 | pushad |
916 | 881 | ||
917 | ; window border |
882 | ; window border |
918 | 883 | ||
919 | mov eax, [edx + WDATA.box.left - 2] |
884 | mov eax, [edx + WDATA.box.left - 2] |
920 | mov ax, word[edx + WDATA.box.left] |
885 | mov ax, word[edx + WDATA.box.left] |
921 | add ax, word[edx + WDATA.box.width] |
886 | add ax, word[edx + WDATA.box.width] |
922 | mov ebx, [edx + WDATA.box.top - 2] |
887 | mov ebx, [edx + WDATA.box.top - 2] |
923 | mov bx, word[edx + WDATA.box.top] |
888 | mov bx, word[edx + WDATA.box.top] |
924 | add bx, word[edx + WDATA.box.height] |
889 | add bx, word[edx + WDATA.box.height] |
925 | 890 | ||
926 | mov esi, [edx + WDATA.cl_frames] |
891 | mov esi, [edx + WDATA.cl_frames] |
927 | shr esi, 1 |
892 | shr esi, 1 |
928 | and esi, 0x007f7f7f |
893 | and esi, 0x007f7f7f |
929 | call draw_rectangle |
894 | call draw_rectangle |
930 | 895 | ||
931 | push esi |
896 | push esi |
932 | mov ecx, 3 |
897 | mov ecx, 3 |
933 | mov esi, [edx + WDATA.cl_frames] |
898 | mov esi, [edx + WDATA.cl_frames] |
934 | ;-------------------------------------- |
899 | ;-------------------------------------- |
935 | align 4 |
900 | align 4 |
936 | .next_frame: |
901 | .next_frame: |
937 | add eax, 1 * 65536 - 1 |
902 | add eax, 1 * 65536 - 1 |
938 | add ebx, 1 * 65536 - 1 |
903 | add ebx, 1 * 65536 - 1 |
939 | call draw_rectangle |
904 | call draw_rectangle |
940 | dec ecx |
905 | dec ecx |
941 | jnz .next_frame |
906 | jnz .next_frame |
942 | 907 | ||
943 | pop esi |
908 | pop esi |
944 | add eax, 1 * 65536 - 1 |
909 | add eax, 1 * 65536 - 1 |
945 | add ebx, 1 * 65536 - 1 |
910 | add ebx, 1 * 65536 - 1 |
946 | call draw_rectangle |
911 | call draw_rectangle |
947 | 912 | ||
948 | ; window caption |
913 | ; window caption |
949 | 914 | ||
950 | call drawwindow_III_caption |
915 | call drawwindow_III_caption |
951 | 916 | ||
952 | ; window client area |
917 | ; window client area |
953 | 918 | ||
954 | ; do we need to draw it? |
919 | ; do we need to draw it? |
955 | mov edi, [esi + WDATA.cl_workarea] |
920 | mov edi, [esi + WDATA.cl_workarea] |
956 | test edi, 0x40000000 |
921 | test edi, 0x40000000 |
957 | jnz .exit |
922 | jnz .exit |
958 | 923 | ||
959 | ; does client area have a positive size on screen? |
924 | ; does client area have a positive size on screen? |
960 | mov edx, [esi + WDATA.box.top] |
925 | mov edx, [esi + WDATA.box.top] |
961 | add edx, 21 + 5 |
926 | add edx, 21 + 5 |
962 | mov ebx, [esi + WDATA.box.top] |
927 | mov ebx, [esi + WDATA.box.top] |
963 | add ebx, [esi + WDATA.box.height] |
928 | add ebx, [esi + WDATA.box.height] |
964 | cmp edx, ebx |
929 | cmp edx, ebx |
965 | jg .exit |
930 | jg .exit |
966 | 931 | ||
967 | ; okay, let's draw it |
932 | ; okay, let's draw it |
968 | mov eax, 5 |
933 | mov eax, 5 |
969 | mov ebx, 20 |
934 | mov ebx, 20 |
970 | mov ecx, [esi + WDATA.box.width] |
935 | mov ecx, [esi + WDATA.box.width] |
971 | mov edx, [esi + WDATA.box.height] |
936 | mov edx, [esi + WDATA.box.height] |
972 | sub ecx, 4 |
937 | sub ecx, 4 |
973 | sub edx, 4 |
938 | sub edx, 4 |
974 | ; call [drawbar] |
939 | ; call [drawbar] |
975 | call vesa20_drawbar |
940 | call vesa20_drawbar |
976 | ;-------------------------------------- |
941 | ;-------------------------------------- |
977 | align 4 |
942 | align 4 |
978 | .exit: |
943 | .exit: |
979 | popad |
944 | popad |
980 | ret |
945 | ret |
981 | ;------------------------------------------------------------------------------ |
946 | ;------------------------------------------------------------------------------ |
982 | align 4 |
947 | align 4 |
983 | ;------------------------------------------------------------------------------ |
948 | ;------------------------------------------------------------------------------ |
984 | waredraw: ;//////////////////////////////////////////////////////////////////// |
949 | waredraw: ;//////////////////////////////////////////////////////////////////// |
985 | ;------------------------------------------------------------------------------ |
950 | ;------------------------------------------------------------------------------ |
986 | ;? Activate window, redrawing if necessary |
951 | ;? Activate window, redrawing if necessary |
987 | ;------------------------------------------------------------------------------ |
952 | ;------------------------------------------------------------------------------ |
988 | push -1 |
953 | push -1 |
989 | mov eax, [TASK_COUNT] |
954 | mov eax, [TASK_COUNT] |
990 | lea eax, [WIN_POS + eax * 2] |
955 | lea eax, [WIN_POS + eax * 2] |
991 | cmp eax, esi |
956 | cmp eax, esi |
992 | pop eax |
957 | pop eax |
993 | je .exit |
958 | je .exit |
994 | 959 | ||
995 | ; is it overlapped by another window now? |
960 | ; is it overlapped by another window now? |
996 | push ecx |
961 | push ecx |
997 | call window._.check_window_draw |
962 | call window._.check_window_draw |
998 | test ecx, ecx |
963 | test ecx, ecx |
999 | pop ecx |
964 | pop ecx |
1000 | jz .do_not_draw |
965 | jz .do_not_draw |
1001 | 966 | ||
1002 | ; yes it is, activate and update screen buffer |
967 | ; yes it is, activate and update screen buffer |
1003 | call window._.window_activate |
968 | call window._.window_activate |
1004 | 969 | ||
1005 | pushad |
970 | pushad |
1006 | mov edi, [TASK_COUNT] |
971 | mov edi, [TASK_COUNT] |
1007 | movzx esi, word[WIN_POS + edi * 2] |
972 | movzx esi, word[WIN_POS + edi * 2] |
1008 | shl esi, 5 |
973 | shl esi, 5 |
1009 | add esi, window_data |
974 | add esi, window_data |
1010 | 975 | ||
1011 | mov eax, [esi + WDATA.box.left] |
976 | mov eax, [esi + WDATA.box.left] |
1012 | mov ebx, [esi + WDATA.box.top] |
977 | mov ebx, [esi + WDATA.box.top] |
1013 | mov ecx, [esi + WDATA.box.width] |
978 | mov ecx, [esi + WDATA.box.width] |
1014 | mov edx, [esi + WDATA.box.height] |
979 | mov edx, [esi + WDATA.box.height] |
1015 | 980 | ||
1016 | add ecx, eax |
981 | add ecx, eax |
1017 | add edx, ebx |
982 | add edx, ebx |
1018 | 983 | ||
1019 | mov edi, [TASK_COUNT] |
984 | mov edi, [TASK_COUNT] |
1020 | movzx esi, word[WIN_POS + edi * 2] |
985 | movzx esi, word[WIN_POS + edi * 2] |
1021 | call window._.set_screen |
986 | call window._.set_screen |
- | 987 | ||
- | 988 | call window._.set_top_wnd |
|
- | 989 | ||
1022 | inc [_display.mask_seqno] |
990 | inc [_display.mask_seqno] |
1023 | popad |
991 | popad |
1024 | 992 | ||
1025 | ; tell application to redraw itself |
993 | ; tell application to redraw itself |
1026 | mov [edi + WDATA.fl_redraw], 1 |
994 | mov [edi + WDATA.fl_redraw], 1 |
1027 | xor eax, eax |
995 | xor eax, eax |
1028 | jmp .exit |
996 | jmp .exit |
1029 | ;-------------------------------------- |
997 | ;-------------------------------------- |
1030 | align 4 |
998 | align 4 |
1031 | .do_not_draw: |
999 | .do_not_draw: |
1032 | ; no it's not, just activate the window |
1000 | ; no it's not, just activate the window |
1033 | call window._.window_activate |
1001 | call window._.window_activate |
1034 | xor eax, eax |
1002 | xor eax, eax |
1035 | ret |
1003 | ret |
1036 | 1004 | ||
1037 | ;-------------------------------------- |
1005 | ;-------------------------------------- |
1038 | align 4 |
1006 | align 4 |
1039 | .exit: |
1007 | .exit: |
1040 | inc eax |
1008 | inc eax |
1041 | ret |
1009 | ret |
1042 | ;------------------------------------------------------------------------------ |
1010 | ;------------------------------------------------------------------------------ |
1043 | align 4 |
1011 | align 4 |
1044 | ;------------------------------------------------------------------------------ |
1012 | ;------------------------------------------------------------------------------ |
1045 | minimize_all_window: |
1013 | minimize_all_window: |
1046 | push ebx ecx edx esi edi |
1014 | push ebx ecx edx esi edi |
1047 | pushfd |
1015 | pushfd |
1048 | cli |
1016 | cli |
1049 | xor edx, edx |
1017 | xor edx, edx |
1050 | mov eax, 2 ; we do not minimize the kernel thread N1 |
1018 | mov eax, 2 ; we do not minimize the kernel thread N1 |
1051 | mov ebx, [TASK_COUNT] |
1019 | mov ebx, [TASK_COUNT] |
1052 | ;-------------------------------------- |
1020 | ;-------------------------------------- |
1053 | align 4 |
1021 | align 4 |
1054 | .loop: |
1022 | .loop: |
1055 | movzx edi, word[WIN_POS + eax * 2] |
1023 | movzx edi, word[WIN_POS + eax * 2] |
1056 | shl edi, 5 |
1024 | shl edi, 5 |
1057 | ; it is a unused slot? |
1025 | ; it is a unused slot? |
1058 | cmp dword [edi+CURRENT_TASK+TASKDATA.state], 9 |
1026 | cmp dword [edi+CURRENT_TASK+TASKDATA.state], 9 |
1059 | je @f |
1027 | je @f |
1060 | ; it is a hidden thread? |
1028 | ; it is a hidden thread? |
1061 | lea esi, [edi*8+SLOT_BASE+APPDATA.app_name] |
1029 | lea esi, [edi*8+SLOT_BASE+APPDATA.app_name] |
1062 | cmp [esi], byte '@' |
1030 | cmp [esi], byte '@' |
1063 | je @f |
1031 | je @f |
1064 | ; is it already minimized? |
1032 | ; is it already minimized? |
1065 | test [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED |
1033 | test [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED |
1066 | jnz @f |
1034 | jnz @f |
1067 | ; no it's not, let's do that |
1035 | ; no it's not, let's do that |
1068 | or [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED |
1036 | or [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED |
1069 | inc edx |
1037 | inc edx |
1070 | ;-------------------------------------- |
1038 | ;-------------------------------------- |
1071 | align 4 |
1039 | align 4 |
1072 | @@: |
1040 | @@: |
1073 | inc eax |
1041 | inc eax |
1074 | cmp eax, ebx |
1042 | cmp eax, ebx |
1075 | jbe .loop |
1043 | jbe .loop |
1076 | ; If nothing has changed |
1044 | ; If nothing has changed |
1077 | test edx, edx |
1045 | test edx, edx |
1078 | jz @f |
1046 | jz @f |
1079 | 1047 | ||
1080 | push edx |
1048 | push edx |
1081 | call syscall_display_settings._.calculate_whole_screen |
1049 | call syscall_display_settings._.calculate_whole_screen |
1082 | call syscall_display_settings._.redraw_whole_screen |
1050 | call syscall_display_settings._.redraw_whole_screen |
1083 | pop edx |
1051 | pop edx |
1084 | ;-------------------------------------- |
1052 | ;-------------------------------------- |
1085 | align 4 |
1053 | align 4 |
1086 | @@: |
1054 | @@: |
1087 | mov eax, edx |
1055 | mov eax, edx |
1088 | popfd |
1056 | popfd |
1089 | pop edi esi edx ecx ebx |
1057 | pop edi esi edx ecx ebx |
1090 | ret |
1058 | ret |
1091 | ;------------------------------------------------------------------------------ |
1059 | ;------------------------------------------------------------------------------ |
1092 | align 4 |
1060 | align 4 |
1093 | ;------------------------------------------------------------------------------ |
1061 | ;------------------------------------------------------------------------------ |
1094 | minimize_window: ;///////////////////////////////////////////////////////////// |
1062 | minimize_window: ;///////////////////////////////////////////////////////////// |
1095 | ;------------------------------------------------------------------------------ |
1063 | ;------------------------------------------------------------------------------ |
1096 | ;> eax = window number on screen |
1064 | ;> eax = window number on screen |
1097 | ;------------------------------------------------------------------------------ |
1065 | ;------------------------------------------------------------------------------ |
1098 | ;# corrupts [dl*] |
1066 | ;# corrupts [dl*] |
1099 | ;------------------------------------------------------------------------------ |
1067 | ;------------------------------------------------------------------------------ |
1100 | push edi |
1068 | push edi |
1101 | pushfd |
1069 | pushfd |
1102 | cli |
1070 | cli |
1103 | 1071 | ||
1104 | ; is it already minimized? |
1072 | ; is it already minimized? |
1105 | movzx edi, word[WIN_POS + eax * 2] |
1073 | movzx edi, word[WIN_POS + eax * 2] |
1106 | shl edi, 5 |
1074 | shl edi, 5 |
1107 | add edi, window_data |
1075 | add edi, window_data |
1108 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
1076 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
1109 | jnz .exit |
1077 | jnz .exit |
1110 | 1078 | ||
1111 | push eax ebx ecx edx esi |
1079 | push eax ebx ecx edx esi |
1112 | 1080 | ||
1113 | ; no it's not, let's do that |
1081 | ; no it's not, let's do that |
1114 | or [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
1082 | or [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
1115 | ; If the window width is 0, then the action is not needed. |
1083 | ; If the window width is 0, then the action is not needed. |
1116 | cmp [edi + WDATA.box.width], dword 0 |
1084 | cmp [edi + WDATA.box.width], dword 0 |
1117 | je @f |
1085 | je @f |
1118 | ; If the window height is 0, then the action is not needed. |
1086 | ; If the window height is 0, then the action is not needed. |
1119 | cmp [edi + WDATA.box.height], dword 0 |
1087 | cmp [edi + WDATA.box.height], dword 0 |
1120 | je @f |
1088 | je @f |
1121 | 1089 | ||
1122 | mov eax, [edi + WDATA.box.left] |
1090 | mov eax, [edi + WDATA.box.left] |
1123 | mov [draw_limits.left], eax |
1091 | mov [draw_limits.left], eax |
1124 | mov ecx, eax |
1092 | mov ecx, eax |
1125 | add ecx, [edi + WDATA.box.width] |
1093 | add ecx, [edi + WDATA.box.width] |
1126 | mov [draw_limits.right], ecx |
1094 | mov [draw_limits.right], ecx |
1127 | mov ebx, [edi + WDATA.box.top] |
1095 | mov ebx, [edi + WDATA.box.top] |
1128 | mov [draw_limits.top], ebx |
1096 | mov [draw_limits.top], ebx |
1129 | mov edx, ebx |
1097 | mov edx, ebx |
1130 | add edx, [edi + WDATA.box.height] |
1098 | add edx, [edi + WDATA.box.height] |
1131 | mov [draw_limits.bottom], edx |
1099 | mov [draw_limits.bottom], edx |
1132 | 1100 | ||
1133 | ; DEBUGF 1, "K : minimize_window\n" |
1101 | ; DEBUGF 1, "K : minimize_window\n" |
1134 | ; DEBUGF 1, "K : dl_left %x\n",[draw_limits.left] |
1102 | ; DEBUGF 1, "K : dl_left %x\n",[draw_limits.left] |
1135 | ; DEBUGF 1, "K : dl_right %x\n",[draw_limits.right] |
1103 | ; DEBUGF 1, "K : dl_right %x\n",[draw_limits.right] |
1136 | ; DEBUGF 1, "K : dl_top %x\n",[draw_limits.top] |
1104 | ; DEBUGF 1, "K : dl_top %x\n",[draw_limits.top] |
1137 | ; DEBUGF 1, "K : dl_bottom %x\n",[draw_limits.bottom] |
1105 | ; DEBUGF 1, "K : dl_bottom %x\n",[draw_limits.bottom] |
1138 | call calculatescreen |
1106 | call calculatescreen |
1139 | ; xor esi, esi |
1107 | ; xor esi, esi |
1140 | ; xor eax, eax |
1108 | ; xor eax, eax |
1141 | mov eax, edi |
1109 | mov eax, edi |
1142 | call redrawscreen |
1110 | call redrawscreen |
1143 | ;-------------------------------------- |
1111 | ;-------------------------------------- |
1144 | align 4 |
1112 | align 4 |
1145 | @@: |
1113 | @@: |
1146 | pop esi edx ecx ebx eax |
1114 | pop esi edx ecx ebx eax |
1147 | ;-------------------------------------- |
1115 | ;-------------------------------------- |
1148 | align 4 |
1116 | align 4 |
1149 | .exit: |
1117 | .exit: |
1150 | popfd |
1118 | popfd |
1151 | pop edi |
1119 | pop edi |
1152 | ret |
1120 | ret |
1153 | ;------------------------------------------------------------------------------ |
1121 | ;------------------------------------------------------------------------------ |
1154 | align 4 |
1122 | align 4 |
1155 | ;------------------------------------------------------------------------------ |
1123 | ;------------------------------------------------------------------------------ |
1156 | restore_minimized_window: ;//////////////////////////////////////////////////// |
1124 | restore_minimized_window: ;//////////////////////////////////////////////////// |
1157 | ;------------------------------------------------------------------------------ |
1125 | ;------------------------------------------------------------------------------ |
1158 | ;> eax = window number on screen |
1126 | ;> eax = window number on screen |
1159 | ;------------------------------------------------------------------------------ |
1127 | ;------------------------------------------------------------------------------ |
1160 | ;# corrupts [dl*] |
1128 | ;# corrupts [dl*] |
1161 | ;------------------------------------------------------------------------------ |
1129 | ;------------------------------------------------------------------------------ |
1162 | pushad |
1130 | pushad |
1163 | pushfd |
1131 | pushfd |
1164 | cli |
1132 | cli |
1165 | 1133 | ||
1166 | ; is it already restored? |
1134 | ; is it already restored? |
1167 | movzx esi, word[WIN_POS + eax * 2] |
1135 | movzx esi, word[WIN_POS + eax * 2] |
1168 | mov edi, esi |
1136 | mov edi, esi |
1169 | shl edi, 5 |
1137 | shl edi, 5 |
1170 | add edi, window_data |
1138 | add edi, window_data |
1171 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
1139 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
1172 | jz .exit |
1140 | jz .exit |
1173 | 1141 | ||
1174 | ; no it's not, let's do that |
1142 | ; no it's not, let's do that |
1175 | mov [edi + WDATA.fl_redraw], 1 |
1143 | mov [edi + WDATA.fl_redraw], 1 |
1176 | and [edi + WDATA.fl_wstate], not WSTATE_MINIMIZED |
1144 | and [edi + WDATA.fl_wstate], not WSTATE_MINIMIZED |
1177 | mov ebp, window._.set_screen |
1145 | mov ebp, window._.set_screen |
1178 | cmp eax, [TASK_COUNT] |
1146 | cmp eax, [TASK_COUNT] |
1179 | jz @f |
1147 | jz @f |
1180 | mov ebp, calculatescreen |
1148 | mov ebp, calculatescreen |
1181 | ;-------------------------------------- |
1149 | ;-------------------------------------- |
1182 | align 4 |
1150 | align 4 |
1183 | @@: |
1151 | @@: |
1184 | mov eax, [edi + WDATA.box.left] |
1152 | mov eax, [edi + WDATA.box.left] |
1185 | mov ebx, [edi + WDATA.box.top] |
1153 | mov ebx, [edi + WDATA.box.top] |
1186 | mov ecx, [edi + WDATA.box.width] |
1154 | mov ecx, [edi + WDATA.box.width] |
1187 | mov edx, [edi + WDATA.box.height] |
1155 | mov edx, [edi + WDATA.box.height] |
1188 | add ecx, eax |
1156 | add ecx, eax |
1189 | add edx, ebx |
1157 | add edx, ebx |
1190 | call ebp |
1158 | call ebp |
- | 1159 | ||
- | 1160 | cmp ebp, window._.set_screen |
|
- | 1161 | jne @f |
|
- | 1162 | call window._.set_top_wnd |
|
- | 1163 | @@: |
|
1191 | inc [_display.mask_seqno] |
1164 | inc [_display.mask_seqno] |
1192 | ;-------------------------------------- |
1165 | ;-------------------------------------- |
1193 | align 4 |
1166 | align 4 |
1194 | .exit: |
1167 | .exit: |
1195 | popfd |
1168 | popfd |
1196 | popad |
1169 | popad |
1197 | ret |
1170 | ret |
1198 | ;------------------------------------------------------------------------------ |
1171 | ;------------------------------------------------------------------------------ |
1199 | align 4 |
1172 | align 4 |
1200 | ; TODO: remove this proc |
1173 | ; TODO: remove this proc |
1201 | ;------------------------------------------------------------------------------ |
1174 | ;------------------------------------------------------------------------------ |
1202 | window_check_events: ;///////////////////////////////////////////////////////// |
1175 | window_check_events: ;///////////////////////////////////////////////////////// |
1203 | ;------------------------------------------------------------------------------ |
1176 | ;------------------------------------------------------------------------------ |
1204 | ;? |
1177 | ;? |
1205 | ;------------------------------------------------------------------------------ |
1178 | ;------------------------------------------------------------------------------ |
1206 | ; do we have window minimize/restore request? |
1179 | ; do we have window minimize/restore request? |
1207 | cmp [window_minimize], 0 |
1180 | cmp [window_minimize], 0 |
1208 | je .exit |
1181 | je .exit |
1209 | 1182 | ||
1210 | ; okay, minimize or restore top-most window and exit |
1183 | ; okay, minimize or restore top-most window and exit |
1211 | mov eax, [TASK_COUNT] |
1184 | mov eax, [TASK_COUNT] |
1212 | mov bl, 0 |
1185 | mov bl, 0 |
1213 | xchg [window_minimize], bl |
1186 | xchg [window_minimize], bl |
1214 | dec bl |
1187 | dec bl |
1215 | jnz @f |
1188 | jnz @f |
1216 | call minimize_window |
1189 | call minimize_window |
1217 | jmp .exit |
1190 | jmp .exit |
1218 | ;-------------------------------------- |
1191 | ;-------------------------------------- |
1219 | align 4 |
1192 | align 4 |
1220 | @@: |
1193 | @@: |
1221 | call restore_minimized_window |
1194 | call restore_minimized_window |
1222 | ;-------------------------------------- |
1195 | ;-------------------------------------- |
1223 | align 4 |
1196 | align 4 |
1224 | .exit: |
1197 | .exit: |
1225 | ret |
1198 | ret |
1226 | ;------------------------------------------------------------------------------ |
1199 | ;------------------------------------------------------------------------------ |
1227 | align 4 |
1200 | align 4 |
1228 | ;------------------------------------------------------------------------------ |
1201 | ;------------------------------------------------------------------------------ |
1229 | sys_window_maximize_handler: ;///////////////////////////////////////////////// |
1202 | sys_window_maximize_handler: ;///////////////////////////////////////////////// |
1230 | ;------------------------------------------------------------------------------ |
1203 | ;------------------------------------------------------------------------------ |
1231 | ;? |
1204 | ;? |
1232 | ;------------------------------------------------------------------------------ |
1205 | ;------------------------------------------------------------------------------ |
1233 | ;> esi = process slot |
1206 | ;> esi = process slot |
1234 | ;------------------------------------------------------------------------------ |
1207 | ;------------------------------------------------------------------------------ |
1235 | mov edi, esi |
1208 | mov edi, esi |
1236 | shl edi, 5 |
1209 | shl edi, 5 |
1237 | add edi, window_data |
1210 | add edi, window_data |
1238 | 1211 | ||
1239 | ; can window change its height? |
1212 | ; can window change its height? |
1240 | ; only types 2 and 3 can be resized |
1213 | ; only types 2 and 3 can be resized |
1241 | mov dl, [edi + WDATA.fl_wstyle] |
1214 | mov dl, [edi + WDATA.fl_wstyle] |
1242 | test dl, 2 |
1215 | test dl, 2 |
1243 | jz .exit |
1216 | jz .exit |
1244 | 1217 | ||
1245 | ; toggle normal/maximized window state |
1218 | ; toggle normal/maximized window state |
1246 | mov bl, [edi + WDATA.fl_wstate] |
1219 | mov bl, [edi + WDATA.fl_wstate] |
1247 | xor bl, WSTATE_MAXIMIZED |
1220 | xor bl, WSTATE_MAXIMIZED |
1248 | 1221 | ||
1249 | ; calculate and set appropriate window bounds |
1222 | ; calculate and set appropriate window bounds |
1250 | test bl, WSTATE_MAXIMIZED |
1223 | test bl, WSTATE_MAXIMIZED |
1251 | jz .restore_size |
1224 | jz .restore_size |
1252 | 1225 | ||
1253 | mov eax, [screen_workarea.left] |
1226 | mov eax, [screen_workarea.left] |
1254 | mov ecx, [screen_workarea.top] |
1227 | mov ecx, [screen_workarea.top] |
1255 | push [screen_workarea.bottom] \ |
1228 | push [screen_workarea.bottom] \ |
1256 | [screen_workarea.right] \ |
1229 | [screen_workarea.right] \ |
1257 | ecx \ |
1230 | ecx \ |
1258 | eax |
1231 | eax |
1259 | sub [esp + BOX.width], eax |
1232 | sub [esp + BOX.width], eax |
1260 | sub [esp + BOX.height], ecx |
1233 | sub [esp + BOX.height], ecx |
1261 | mov eax, esp |
1234 | mov eax, esp |
1262 | jmp .set_box |
1235 | jmp .set_box |
1263 | ;-------------------------------------- |
1236 | ;-------------------------------------- |
1264 | align 4 |
1237 | align 4 |
1265 | .restore_size: |
1238 | .restore_size: |
1266 | mov eax, esi |
1239 | mov eax, esi |
1267 | shl eax, 8 |
1240 | shl eax, 8 |
1268 | add eax, SLOT_BASE + APPDATA.saved_box |
1241 | add eax, SLOT_BASE + APPDATA.saved_box |
1269 | push [eax + BOX.height] \ |
1242 | push [eax + BOX.height] \ |
1270 | [eax + BOX.width] \ |
1243 | [eax + BOX.width] \ |
1271 | [eax + BOX.top] \ |
1244 | [eax + BOX.top] \ |
1272 | [eax + BOX.left] |
1245 | [eax + BOX.left] |
1273 | mov eax, esp |
1246 | mov eax, esp |
1274 | ;-------------------------------------- |
1247 | ;-------------------------------------- |
1275 | align 4 |
1248 | align 4 |
1276 | .set_box: |
1249 | .set_box: |
1277 | test bl, WSTATE_ROLLEDUP |
1250 | test bl, WSTATE_ROLLEDUP |
1278 | jz @f |
1251 | jz @f |
1279 | 1252 | ||
1280 | xchg eax, ecx |
1253 | xchg eax, ecx |
1281 | call window._.get_rolledup_height |
1254 | call window._.get_rolledup_height |
1282 | mov [ecx + BOX.height], eax |
1255 | mov [ecx + BOX.height], eax |
1283 | xchg eax, ecx |
1256 | xchg eax, ecx |
1284 | ;-------------------------------------- |
1257 | ;-------------------------------------- |
1285 | align 4 |
1258 | align 4 |
1286 | @@: |
1259 | @@: |
1287 | call window._.set_window_box |
1260 | call window._.set_window_box |
1288 | add esp, sizeof.BOX |
1261 | add esp, sizeof.BOX |
1289 | ;-------------------------------------- |
1262 | ;-------------------------------------- |
1290 | align 4 |
1263 | align 4 |
1291 | .exit: |
1264 | .exit: |
1292 | inc [_display.mask_seqno] |
1265 | inc [_display.mask_seqno] |
1293 | ret |
1266 | ret |
1294 | ;------------------------------------------------------------------------------ |
1267 | ;------------------------------------------------------------------------------ |
1295 | align 4 |
1268 | align 4 |
1296 | ;------------------------------------------------------------------------------ |
1269 | ;------------------------------------------------------------------------------ |
1297 | sys_window_rollup_handler: ;/////////////////////////////////////////////////// |
1270 | sys_window_rollup_handler: ;/////////////////////////////////////////////////// |
1298 | ;------------------------------------------------------------------------------ |
1271 | ;------------------------------------------------------------------------------ |
1299 | ;? |
1272 | ;? |
1300 | ;------------------------------------------------------------------------------ |
1273 | ;------------------------------------------------------------------------------ |
1301 | ;> esi = process slot |
1274 | ;> esi = process slot |
1302 | ;------------------------------------------------------------------------------ |
1275 | ;------------------------------------------------------------------------------ |
1303 | mov edx, esi |
1276 | mov edx, esi |
1304 | shl edx, 8 |
1277 | shl edx, 8 |
1305 | add edx, SLOT_BASE |
1278 | add edx, SLOT_BASE |
1306 | 1279 | ||
1307 | ; toggle normal/rolled up window state |
1280 | ; toggle normal/rolled up window state |
1308 | mov bl, [edi + WDATA.fl_wstate] |
1281 | mov bl, [edi + WDATA.fl_wstate] |
1309 | xor bl, WSTATE_ROLLEDUP |
1282 | xor bl, WSTATE_ROLLEDUP |
1310 | 1283 | ||
1311 | ; calculate and set appropriate window bounds |
1284 | ; calculate and set appropriate window bounds |
1312 | test bl, WSTATE_ROLLEDUP |
1285 | test bl, WSTATE_ROLLEDUP |
1313 | jz .restore_size |
1286 | jz .restore_size |
1314 | 1287 | ||
1315 | call window._.get_rolledup_height |
1288 | call window._.get_rolledup_height |
1316 | push eax \ |
1289 | push eax \ |
1317 | [edi + WDATA.box.width] \ |
1290 | [edi + WDATA.box.width] \ |
1318 | [edi + WDATA.box.top] \ |
1291 | [edi + WDATA.box.top] \ |
1319 | [edi + WDATA.box.left] |
1292 | [edi + WDATA.box.left] |
1320 | mov eax, esp |
1293 | mov eax, esp |
1321 | jmp .set_box |
1294 | jmp .set_box |
1322 | ;-------------------------------------- |
1295 | ;-------------------------------------- |
1323 | align 4 |
1296 | align 4 |
1324 | .restore_size: |
1297 | .restore_size: |
1325 | test bl, WSTATE_MAXIMIZED |
1298 | test bl, WSTATE_MAXIMIZED |
1326 | jnz @f |
1299 | jnz @f |
1327 | add esp, -sizeof.BOX |
1300 | add esp, -sizeof.BOX |
1328 | lea eax, [edx + APPDATA.saved_box] |
1301 | lea eax, [edx + APPDATA.saved_box] |
1329 | jmp .set_box |
1302 | jmp .set_box |
1330 | ;-------------------------------------- |
1303 | ;-------------------------------------- |
1331 | align 4 |
1304 | align 4 |
1332 | @@: |
1305 | @@: |
1333 | mov eax, [screen_workarea.top] |
1306 | mov eax, [screen_workarea.top] |
1334 | push [screen_workarea.bottom] \ |
1307 | push [screen_workarea.bottom] \ |
1335 | [edi + WDATA.box.width] \ |
1308 | [edi + WDATA.box.width] \ |
1336 | eax \ |
1309 | eax \ |
1337 | [edi + WDATA.box.left] |
1310 | [edi + WDATA.box.left] |
1338 | sub [esp + BOX.height], eax |
1311 | sub [esp + BOX.height], eax |
1339 | mov eax, esp |
1312 | mov eax, esp |
1340 | ;-------------------------------------- |
1313 | ;-------------------------------------- |
1341 | align 4 |
1314 | align 4 |
1342 | .set_box: |
1315 | .set_box: |
1343 | call window._.set_window_box |
1316 | call window._.set_window_box |
1344 | add esp, sizeof.BOX |
1317 | add esp, sizeof.BOX |
1345 | ret |
1318 | ret |
1346 | ;------------------------------------------------------------------------------ |
1319 | ;------------------------------------------------------------------------------ |
1347 | align 4 |
1320 | align 4 |
1348 | ;------------------------------------------------------------------------------ |
1321 | ;------------------------------------------------------------------------------ |
1349 | ;sys_window_start_moving_handler: ;///////////////////////////////////////////// |
1322 | ;sys_window_start_moving_handler: ;///////////////////////////////////////////// |
1350 | ;------------------------------------------------------------------------------ |
1323 | ;------------------------------------------------------------------------------ |
1351 | ;? |
1324 | ;? |
1352 | ;------------------------------------------------------------------------------ |
1325 | ;------------------------------------------------------------------------------ |
1353 | ;> eax = old (original) window box |
1326 | ;> eax = old (original) window box |
1354 | ;> esi = process slot |
1327 | ;> esi = process slot |
1355 | ;------------------------------------------------------------------------------ |
1328 | ;------------------------------------------------------------------------------ |
1356 | ; mov edi, eax |
1329 | ; mov edi, eax |
1357 | ; call window._.draw_negative_box |
1330 | ; call window._.draw_negative_box |
1358 | ; ret |
1331 | ; ret |
1359 | ;------------------------------------------------------------------------------ |
1332 | ;------------------------------------------------------------------------------ |
1360 | align 4 |
1333 | align 4 |
1361 | ;------------------------------------------------------------------------------ |
1334 | ;------------------------------------------------------------------------------ |
1362 | sys_window_end_moving_handler: ;/////////////////////////////////////////////// |
1335 | sys_window_end_moving_handler: ;/////////////////////////////////////////////// |
1363 | ;------------------------------------------------------------------------------ |
1336 | ;------------------------------------------------------------------------------ |
1364 | ;? |
1337 | ;? |
1365 | ;------------------------------------------------------------------------------ |
1338 | ;------------------------------------------------------------------------------ |
1366 | ;> eax = old (original) window box |
1339 | ;> eax = old (original) window box |
1367 | ;> ebx = new (final) window box |
1340 | ;> ebx = new (final) window box |
1368 | ;> esi = process slot |
1341 | ;> esi = process slot |
1369 | ;------------------------------------------------------------------------------ |
1342 | ;------------------------------------------------------------------------------ |
1370 | ; mov edi, ebx |
1343 | ; mov edi, ebx |
1371 | ; call window._.end_moving__box |
1344 | ; call window._.end_moving__box |
1372 | 1345 | ||
1373 | mov edi, esi |
1346 | mov edi, esi |
1374 | shl edi, 5 |
1347 | shl edi, 5 |
1375 | add edi, window_data |
1348 | add edi, window_data |
- | 1349 | ||
- | 1350 | test [fl_moving], 1 |
|
- | 1351 | jz @f |
|
- | 1352 | ||
- | 1353 | push edi |
|
- | 1354 | mov edi, ebx |
|
- | 1355 | call window._.draw_negative_box |
|
- | 1356 | pop edi |
|
- | 1357 | @@: |
|
1376 | 1358 | ||
1377 | mov eax, ebx |
1359 | mov eax, ebx |
1378 | mov bl, [edi + WDATA.fl_wstate] |
1360 | mov bl, [edi + WDATA.fl_wstate] |
1379 | call window._.set_window_box |
1361 | call window._.set_window_box |
1380 | ret |
1362 | ret |
1381 | ;------------------------------------------------------------------------------ |
1363 | ;------------------------------------------------------------------------------ |
1382 | align 4 |
1364 | align 4 |
1383 | ;------------------------------------------------------------------------------ |
1365 | ;------------------------------------------------------------------------------ |
1384 | sys_window_moving_handler: ;/////////////////////////////////////////////////// |
1366 | sys_window_moving_handler: ;/////////////////////////////////////////////////// |
1385 | ;------------------------------------------------------------------------------ |
1367 | ;------------------------------------------------------------------------------ |
1386 | ;? |
1368 | ;? |
1387 | ;------------------------------------------------------------------------------ |
1369 | ;------------------------------------------------------------------------------ |
1388 | ;> eax = old (from previous call) window box |
1370 | ;> eax = old (from previous call) window box |
1389 | ;> ebx = new (current) window box |
1371 | ;> ebx = new (current) window box |
1390 | ;> esi = process_slot |
1372 | ;> esi = process_slot |
1391 | ;------------------------------------------------------------------------------ |
1373 | ;------------------------------------------------------------------------------ |
1392 | mov edi, eax |
1374 | mov edi, eax |
1393 | call window._.draw_negative_box |
1375 | call window._.draw_negative_box |
1394 | mov edi, ebx |
1376 | mov edi, ebx |
1395 | call window._.draw_negative_box |
1377 | call window._.draw_negative_box |
1396 | ret |
1378 | ret |
1397 | ;============================================================================== |
1379 | ;============================================================================== |
1398 | ;///// private functions ////////////////////////////////////////////////////// |
1380 | ;///// private functions ////////////////////////////////////////////////////// |
1399 | ;============================================================================== |
1381 | ;============================================================================== |
1400 | 1382 | ||
1401 | iglobal |
1383 | iglobal |
1402 | FuncTable syscall_display_settings, ftable, \ |
1384 | FuncTable syscall_display_settings, ftable, \ |
1403 | 00, 01, 02, 03, 04, 05, 06, 07, 08 |
1385 | 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12 |
1404 | 1386 | ||
1405 | align 4 |
1387 | align 4 |
1406 | window_topleft dd \ |
1388 | window_topleft dd \ |
1407 | 1, 21, \ ;type 0 |
1389 | 1, 21, \ ;type 0 |
1408 | 0, 0, \ ;type 1 |
1390 | 0, 0, \ ;type 1 |
1409 | 5, 20, \ ;type 2 |
1391 | 5, 20, \ ;type 2 |
1410 | 5, ?, \ ;type 3 {set by skin} |
1392 | 5, ?, \ ;type 3 {set by skin} |
1411 | 5, ? ;type 4 {set by skin} |
1393 | 5, ? ;type 4 {set by skin} |
1412 | endg |
1394 | endg |
1413 | 1395 | ||
1414 | ;uglobal |
1396 | ;uglobal |
1415 | ; NOTE: commented out since doesn't provide necessary functionality anyway, |
1397 | ; NOTE: commented out since doesn't provide necessary functionality anyway, |
1416 | ; to be reworked |
1398 | ; to be reworked |
1417 | ; new_window_starting dd ? |
1399 | ; new_window_starting dd ? |
1418 | ;endg |
1400 | ;endg |
1419 | ;------------------------------------------------------------------------------ |
1401 | ;------------------------------------------------------------------------------ |
1420 | align 4 |
1402 | align 4 |
1421 | ;------------------------------------------------------------------------------ |
1403 | ;------------------------------------------------------------------------------ |
1422 | window._.invalidate_screen: ;////////////////////////////////////////////////// |
1404 | window._.invalidate_screen: ;////////////////////////////////////////////////// |
1423 | ;------------------------------------------------------------------------------ |
1405 | ;------------------------------------------------------------------------------ |
1424 | ;? |
1406 | ;? |
1425 | ;------------------------------------------------------------------------------ |
1407 | ;------------------------------------------------------------------------------ |
1426 | ;> eax = old (original) window box |
1408 | ;> eax = old (original) window box |
1427 | ;> ebx = new (final) window box |
1409 | ;> ebx = new (final) window box |
1428 | ;> edi = pointer to WDATA struct |
1410 | ;> edi = pointer to WDATA struct |
1429 | ;------------------------------------------------------------------------------ |
1411 | ;------------------------------------------------------------------------------ |
1430 | push eax ebx |
1412 | push eax ebx |
1431 | 1413 | ||
1432 | ; TODO: do we really need `draw_limits`? |
1414 | ; TODO: do we really need `draw_limits`? |
1433 | ; Yes, they are used by background drawing code. |
1415 | ; Yes, they are used by background drawing code. |
1434 | 1416 | ||
1435 | ; we need only to restore the background windows at the old place! |
1417 | ; we need only to restore the background windows at the old place! |
1436 | mov ecx, [ebx + BOX.left] |
1418 | mov ecx, [ebx + BOX.left] |
1437 | mov [draw_limits.left], ecx |
1419 | mov [draw_limits.left], ecx |
1438 | add ecx, [ebx + BOX.width] |
1420 | add ecx, [ebx + BOX.width] |
1439 | mov [draw_limits.right], ecx |
1421 | mov [draw_limits.right], ecx |
1440 | mov ecx, [ebx + BOX.top] |
1422 | mov ecx, [ebx + BOX.top] |
1441 | mov [draw_limits.top], ecx |
1423 | mov [draw_limits.top], ecx |
1442 | add ecx, [ebx + BOX.height] |
1424 | add ecx, [ebx + BOX.height] |
1443 | mov [draw_limits.bottom], ecx |
1425 | mov [draw_limits.bottom], ecx |
1444 | ; recalculate screen buffer at old position |
1426 | ; recalculate screen buffer at old position |
1445 | push ebx |
1427 | push ebx |
1446 | mov edx, [eax + BOX.height] |
1428 | mov edx, [eax + BOX.height] |
1447 | mov ecx, [eax + BOX.width] |
1429 | mov ecx, [eax + BOX.width] |
1448 | mov ebx, [eax + BOX.top] |
1430 | mov ebx, [eax + BOX.top] |
1449 | mov eax, [eax + BOX.left] |
1431 | mov eax, [eax + BOX.left] |
1450 | add ecx, eax |
1432 | add ecx, eax |
1451 | add edx, ebx |
1433 | add edx, ebx |
1452 | call calculatescreen |
1434 | call calculatescreen |
1453 | pop eax |
1435 | pop eax |
1454 | ; recalculate screen buffer at new position |
1436 | ; recalculate screen buffer at new position |
1455 | mov edx, [eax + BOX.height] |
1437 | mov edx, [eax + BOX.height] |
1456 | mov ecx, [eax + BOX.width] |
1438 | mov ecx, [eax + BOX.width] |
1457 | mov ebx, [eax + BOX.top] |
1439 | mov ebx, [eax + BOX.top] |
1458 | mov eax, [eax + BOX.left] |
1440 | mov eax, [eax + BOX.left] |
1459 | add ecx, eax |
1441 | add ecx, eax |
1460 | add edx, ebx |
1442 | add edx, ebx |
1461 | call calculatescreen |
1443 | call calculatescreen |
1462 | 1444 | ||
1463 | mov eax, edi |
1445 | mov eax, edi |
1464 | call redrawscreen |
1446 | call redrawscreen |
1465 | 1447 | ||
1466 | ; tell window to redraw itself |
1448 | ; tell window to redraw itself |
1467 | mov [edi + WDATA.fl_redraw], 1 |
1449 | mov [edi + WDATA.fl_redraw], 1 |
1468 | 1450 | ||
1469 | pop ebx eax |
1451 | pop ebx eax |
1470 | ret |
1452 | ret |
1471 | ;------------------------------------------------------------------------------ |
1453 | ;------------------------------------------------------------------------------ |
1472 | align 4 |
1454 | align 4 |
1473 | ;------------------------------------------------------------------------------ |
1455 | ;------------------------------------------------------------------------------ |
1474 | window._.set_window_box: ;///////////////////////////////////////////////////// |
1456 | window._.set_window_box: ;///////////////////////////////////////////////////// |
1475 | ;------------------------------------------------------------------------------ |
1457 | ;------------------------------------------------------------------------------ |
1476 | ;? |
1458 | ;? |
1477 | ;------------------------------------------------------------------------------ |
1459 | ;------------------------------------------------------------------------------ |
1478 | ;> eax = pointer to BOX struct |
1460 | ;> eax = pointer to BOX struct |
1479 | ;> bl = new window state flags |
1461 | ;> bl = new window state flags |
1480 | ;> edi = pointer to WDATA struct |
1462 | ;> edi = pointer to WDATA struct |
1481 | ;------------------------------------------------------------------------------ |
1463 | ;------------------------------------------------------------------------------ |
1482 | push eax ebx esi |
1464 | push eax ebx esi |
1483 | 1465 | ||
1484 | ; don't do anything if the new box is identical to the old |
1466 | ; don't do anything if the new box is identical to the old |
1485 | cmp bl, [edi + WDATA.fl_wstate] |
1467 | cmp bl, [edi + WDATA.fl_wstate] |
1486 | jnz @f |
1468 | jnz @f |
1487 | mov esi, eax |
1469 | mov esi, eax |
1488 | push edi |
1470 | push edi |
1489 | if WDATA.box |
1471 | if WDATA.box |
1490 | add edi, WDATA.box |
1472 | add edi, WDATA.box |
1491 | end if |
1473 | end if |
1492 | mov ecx, 4 |
1474 | mov ecx, 4 |
1493 | repz cmpsd |
1475 | repz cmpsd |
1494 | pop edi |
1476 | pop edi |
1495 | jz .exit |
1477 | jz .exit |
1496 | ;-------------------------------------- |
1478 | ;-------------------------------------- |
1497 | align 4 |
1479 | align 4 |
1498 | @@: |
1480 | @@: |
1499 | add esp, -sizeof.BOX |
1481 | add esp, -sizeof.BOX |
1500 | mov ebx, esp |
1482 | mov ebx, esp |
1501 | if WDATA.box |
1483 | if WDATA.box |
1502 | lea esi, [edi + WDATA.box] |
1484 | lea esi, [edi + WDATA.box] |
1503 | else |
1485 | else |
1504 | mov esi, edi ; optimization for WDATA.box = 0 |
1486 | mov esi, edi ; optimization for WDATA.box = 0 |
1505 | end if |
1487 | end if |
1506 | xchg eax, esi |
1488 | xchg eax, esi |
1507 | mov ecx, sizeof.BOX |
1489 | mov ecx, sizeof.BOX |
1508 | call memmove |
1490 | call memmove |
1509 | xchg eax, esi |
1491 | xchg eax, esi |
1510 | xchg ebx, esi |
1492 | xchg ebx, esi |
1511 | call memmove |
1493 | call memmove |
1512 | mov eax, ebx |
1494 | mov eax, ebx |
1513 | mov ebx, esi |
1495 | mov ebx, esi |
1514 | - | ||
1515 | call window._.check_window_position |
1496 | call window._.check_window_position |
1516 | call window._.set_window_clientbox |
1497 | call window._.set_window_clientbox |
1517 | call window._.invalidate_screen |
1498 | call window._.invalidate_screen |
1518 | 1499 | ||
1519 | add esp, sizeof.BOX |
1500 | add esp, sizeof.BOX |
1520 | 1501 | ||
1521 | mov cl, [esp + 4] |
1502 | mov cl, [esp + 4] |
1522 | mov ch, cl |
1503 | mov ch, cl |
1523 | xchg cl, [edi + WDATA.fl_wstate] |
1504 | xchg cl, [edi + WDATA.fl_wstate] |
1524 | 1505 | ||
1525 | or cl, ch |
1506 | or cl, ch |
1526 | test cl, WSTATE_MAXIMIZED |
1507 | test cl, WSTATE_MAXIMIZED |
1527 | jnz .exit |
1508 | jnz .exit |
1528 | 1509 | ||
1529 | mov eax, edi |
1510 | mov eax, edi |
1530 | sub eax, window_data |
1511 | sub eax, window_data |
1531 | shl eax, 3 |
1512 | shl eax, 3 |
1532 | add eax, SLOT_BASE |
1513 | add eax, SLOT_BASE |
1533 | 1514 | ||
1534 | lea ebx, [edi + WDATA.box] |
1515 | lea ebx, [edi + WDATA.box] |
1535 | xchg esp, ebx |
1516 | xchg esp, ebx |
1536 | 1517 | ||
1537 | pop [eax + APPDATA.saved_box.left] \ |
1518 | pop [eax + APPDATA.saved_box.left] \ |
1538 | [eax + APPDATA.saved_box.top] \ |
1519 | [eax + APPDATA.saved_box.top] \ |
1539 | [eax + APPDATA.saved_box.width] \ |
1520 | [eax + APPDATA.saved_box.width] \ |
1540 | edx |
1521 | edx |
1541 | 1522 | ||
1542 | xchg esp, ebx |
1523 | xchg esp, ebx |
1543 | 1524 | ||
1544 | test ch, WSTATE_ROLLEDUP |
1525 | test ch, WSTATE_ROLLEDUP |
1545 | jnz .exit |
1526 | jnz .exit |
1546 | 1527 | ||
1547 | mov [eax + APPDATA.saved_box.height], edx |
1528 | mov [eax + APPDATA.saved_box.height], edx |
1548 | ;-------------------------------------- |
1529 | ;-------------------------------------- |
1549 | align 4 |
1530 | align 4 |
1550 | .exit: |
1531 | .exit: |
1551 | pop esi ebx eax |
1532 | pop esi ebx eax |
1552 | ret |
1533 | ret |
1553 | ;------------------------------------------------------------------------------ |
1534 | ;------------------------------------------------------------------------------ |
1554 | align 4 |
1535 | align 4 |
1555 | ;------------------------------------------------------------------------------ |
1536 | ;------------------------------------------------------------------------------ |
1556 | window._.set_window_clientbox: ;/////////////////////////////////////////////// |
1537 | window._.set_window_clientbox: ;/////////////////////////////////////////////// |
1557 | ;------------------------------------------------------------------------------ |
1538 | ;------------------------------------------------------------------------------ |
1558 | ;? |
1539 | ;? |
1559 | ;------------------------------------------------------------------------------ |
1540 | ;------------------------------------------------------------------------------ |
1560 | ;> edi = pointer to WDATA struct |
1541 | ;> edi = pointer to WDATA struct |
1561 | ;------------------------------------------------------------------------------ |
1542 | ;------------------------------------------------------------------------------ |
1562 | push eax ecx edi |
1543 | push eax ecx edi |
1563 | 1544 | ||
1564 | mov eax, [_skinh] |
1545 | mov eax, [_skinh] |
1565 | mov [window_topleft + 8 * 3 + 4], eax |
1546 | mov [window_topleft + 8 * 3 + 4], eax |
1566 | mov [window_topleft + 8 * 4 + 4], eax |
1547 | mov [window_topleft + 8 * 4 + 4], eax |
1567 | 1548 | ||
1568 | mov ecx, edi |
1549 | mov ecx, edi |
1569 | sub edi, window_data |
1550 | sub edi, window_data |
1570 | shl edi, 3 |
1551 | shl edi, 3 |
1571 | test [ecx + WDATA.fl_wstyle], WSTYLE_CLIENTRELATIVE |
1552 | test [ecx + WDATA.fl_wstyle], WSTYLE_CLIENTRELATIVE |
1572 | jz .whole_window |
1553 | jz .whole_window |
1573 | 1554 | ||
1574 | movzx eax, [ecx + WDATA.fl_wstyle] |
1555 | movzx eax, [ecx + WDATA.fl_wstyle] |
1575 | and eax, 0x0F |
1556 | and eax, 0x0F |
1576 | mov eax, [eax * 8 + window_topleft + 0] |
1557 | mov eax, [eax * 8 + window_topleft + 0] |
1577 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax |
1558 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax |
1578 | shl eax, 1 |
1559 | shl eax, 1 |
1579 | neg eax |
1560 | neg eax |
1580 | add eax, [ecx + WDATA.box.width] |
1561 | add eax, [ecx + WDATA.box.width] |
1581 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax |
1562 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax |
1582 | 1563 | ||
1583 | movzx eax, [ecx + WDATA.fl_wstyle] |
1564 | movzx eax, [ecx + WDATA.fl_wstyle] |
1584 | and eax, 0x0F |
1565 | and eax, 0x0F |
1585 | push [eax * 8 + window_topleft + 0] |
1566 | push [eax * 8 + window_topleft + 0] |
1586 | mov eax, [eax * 8 + window_topleft + 4] |
1567 | mov eax, [eax * 8 + window_topleft + 4] |
1587 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax |
1568 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax |
1588 | neg eax |
1569 | neg eax |
1589 | sub eax, [esp] |
1570 | sub eax, [esp] |
1590 | add eax, [ecx + WDATA.box.height] |
1571 | add eax, [ecx + WDATA.box.height] |
1591 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax |
1572 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax |
1592 | add esp, 4 |
1573 | add esp, 4 |
1593 | jmp .exit |
1574 | jmp .exit |
1594 | ;-------------------------------------- |
1575 | ;-------------------------------------- |
1595 | align 4 |
1576 | align 4 |
1596 | .whole_window: |
1577 | .whole_window: |
1597 | xor eax, eax |
1578 | xor eax, eax |
1598 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax |
1579 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax |
1599 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax |
1580 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax |
1600 | mov eax, [ecx + WDATA.box.width] |
1581 | mov eax, [ecx + WDATA.box.width] |
1601 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax |
1582 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax |
1602 | mov eax, [ecx + WDATA.box.height] |
1583 | mov eax, [ecx + WDATA.box.height] |
1603 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax |
1584 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax |
1604 | ;-------------------------------------- |
1585 | ;-------------------------------------- |
1605 | align 4 |
1586 | align 4 |
1606 | .exit: |
1587 | .exit: |
1607 | pop edi ecx eax |
1588 | pop edi ecx eax |
1608 | ret |
1589 | ret |
1609 | ;------------------------------------------------------------------------------ |
1590 | ;------------------------------------------------------------------------------ |
1610 | align 4 |
1591 | align 4 |
1611 | ;------------------------------------------------------------------------------ |
1592 | ;------------------------------------------------------------------------------ |
1612 | window._.sys_set_window: ;///////////////////////////////////////////////////// |
1593 | window._.sys_set_window: ;///////////////////////////////////////////////////// |
1613 | ;------------------------------------------------------------------------------ |
1594 | ;------------------------------------------------------------------------------ |
1614 | ;? |
1595 | ;? |
1615 | ;------------------------------------------------------------------------------ |
1596 | ;------------------------------------------------------------------------------ |
1616 | ;< edx = pointer to WDATA struct |
1597 | ;< edx = pointer to WDATA struct |
1617 | ;------------------------------------------------------------------------------ |
1598 | ;------------------------------------------------------------------------------ |
1618 | mov eax, [CURRENT_TASK] |
1599 | mov eax, [CURRENT_TASK] |
1619 | shl eax, 5 |
1600 | shl eax, 5 |
1620 | add eax, window_data |
1601 | add eax, window_data |
1621 | - | ||
1622 | ; save window colors |
1602 | ; save window colors |
1623 | mov [eax + WDATA.cl_workarea], edx |
1603 | mov [eax + WDATA.cl_workarea], edx |
1624 | mov [eax + WDATA.cl_titlebar], esi |
1604 | mov [eax + WDATA.cl_titlebar], esi |
1625 | mov [eax + WDATA.cl_frames], edi |
1605 | mov [eax + WDATA.cl_frames], edi |
1626 | - | ||
1627 | mov edi, eax |
1606 | mov edi, eax |
1628 | - | ||
1629 | ; was it already defined before? |
1607 | ; Was it already defined before? |
1630 | test [edi + WDATA.fl_wdrawn], 1 |
1608 | test [edi + WDATA.fl_wdrawn], 1 |
1631 | jnz .set_client_box |
1609 | jnz .set_client_box |
1632 | or [edi + WDATA.fl_wdrawn], 1 |
- | |
1633 | ; After first draw_window we need redraw mouse necessarily! |
1610 | ; No, it wasn't. After first draw_window we need redraw mouse necessarily! |
1634 | ; Otherwise the user can see cursor specified by f.37.5 from another window. |
1611 | ; Otherwise the user can see cursor specified by f.37.5 from another window. |
1635 | ; He will be really unhappy! He is terrible in rage - usually he throws stones! |
1612 | ; He will be really unhappy! Usually, he will be enraged! |
- | 1613 | or [edi + WDATA.fl_wdrawn], 1 |
|
1636 | mov [redrawmouse_unconditional], 1 |
1614 | mov [redrawmouse_unconditional], 1 |
1637 | call wakeup_osloop |
1615 | call wakeup_osloop |
1638 | ; NOTE: commented out since doesn't provide necessary functionality |
- | |
1639 | ; anyway, to be reworked |
- | |
1640 | ; mov eax, [timer_ticks] ; [0xfdf0] |
- | |
1641 | ; add eax, 100 |
- | |
1642 | ; mov [new_window_starting], eax |
- | |
1643 | - | ||
1644 | ; no it wasn't, performing initial window definition |
1616 | ; performing initial window definition |
1645 | movzx eax, bx |
1617 | movzx eax, bx |
1646 | mov [edi + WDATA.box.width], eax |
1618 | mov [edi + WDATA.box.width], eax |
1647 | movzx eax, cx |
1619 | movzx eax, cx |
1648 | mov [edi + WDATA.box.height], eax |
1620 | mov [edi + WDATA.box.height], eax |
1649 | sar ebx, 16 |
1621 | sar ebx, 16 |
1650 | sar ecx, 16 |
1622 | sar ecx, 16 |
1651 | mov [edi + WDATA.box.left], ebx |
1623 | mov [edi + WDATA.box.left], ebx |
1652 | mov [edi + WDATA.box.top], ecx |
1624 | mov [edi + WDATA.box.top], ecx |
1653 | 1625 | ||
1654 | call window._.check_window_position |
1626 | call window._.check_window_position |
1655 | 1627 | ||
1656 | push ecx edi |
1628 | push ecx edi |
1657 | 1629 | ||
1658 | mov cl, [edi + WDATA.fl_wstyle] |
1630 | mov cl, [edi + WDATA.fl_wstyle] |
1659 | mov eax, [edi + WDATA.cl_frames] |
1631 | mov eax, [edi + WDATA.cl_frames] |
1660 | 1632 | ||
1661 | sub edi, window_data |
1633 | sub edi, window_data |
1662 | shl edi, 3 |
1634 | shl edi, 3 |
1663 | add edi, SLOT_BASE |
1635 | add edi, SLOT_BASE |
1664 | 1636 | ||
1665 | and cl, 0x0F |
1637 | and cl, 0x0F |
1666 | cmp cl, 3 |
1638 | cmp cl, 3 |
1667 | je @f |
1639 | je @f |
1668 | cmp cl, 4 |
1640 | cmp cl, 4 |
1669 | je @f |
1641 | je @f |
1670 | 1642 | ||
1671 | xor eax, eax |
1643 | xor eax, eax |
1672 | ;-------------------------------------- |
1644 | ;-------------------------------------- |
1673 | align 4 |
1645 | align 4 |
1674 | @@: |
1646 | @@: |
1675 | mov [edi + APPDATA.wnd_caption], eax |
1647 | mov [edi + APPDATA.wnd_caption], eax |
1676 | 1648 | ||
1677 | mov esi, [esp] |
1649 | mov esi, [esp] |
1678 | add edi, APPDATA.saved_box |
1650 | add edi, APPDATA.saved_box |
1679 | movsd |
1651 | movsd |
1680 | movsd |
1652 | movsd |
1681 | movsd |
1653 | movsd |
1682 | movsd |
1654 | movsd |
1683 | 1655 | ||
1684 | pop edi ecx |
1656 | pop edi ecx |
1685 | 1657 | ||
1686 | mov esi, [CURRENT_TASK] |
1658 | mov esi, [CURRENT_TASK] |
1687 | movzx esi, word[WIN_STACK + esi * 2] |
1659 | movzx esi, word[WIN_STACK + esi * 2] |
1688 | lea esi, [WIN_POS + esi * 2] |
1660 | lea esi, [WIN_POS + esi * 2] |
1689 | call waredraw |
1661 | call waredraw |
1690 | 1662 | ||
1691 | mov eax, [edi + WDATA.box.left] |
1663 | mov eax, [edi + WDATA.box.left] |
1692 | mov ebx, [edi + WDATA.box.top] |
1664 | mov ebx, [edi + WDATA.box.top] |
1693 | mov ecx, [edi + WDATA.box.width] |
1665 | mov ecx, [edi + WDATA.box.width] |
1694 | mov edx, [edi + WDATA.box.height] |
1666 | mov edx, [edi + WDATA.box.height] |
1695 | add ecx, eax |
1667 | add ecx, eax |
1696 | add edx, ebx |
1668 | add edx, ebx |
1697 | call calculatescreen |
1669 | call calculatescreen |
1698 | 1670 | ||
1699 | mov byte[KEY_COUNT], 0 ; empty keyboard buffer |
1671 | mov byte[KEY_COUNT], 0 ; empty keyboard buffer |
1700 | mov byte[BTN_COUNT], 0 ; empty button buffer |
1672 | mov byte[BTN_COUNT], 0 ; empty button buffer |
1701 | ;-------------------------------------- |
1673 | ;-------------------------------------- |
1702 | align 4 |
1674 | align 4 |
1703 | .set_client_box: |
1675 | .set_client_box: |
1704 | ; update window client box coordinates |
1676 | ; update window client box coordinates |
1705 | call window._.set_window_clientbox |
1677 | call window._.set_window_clientbox |
1706 | 1678 | ||
1707 | ; reset window redraw flag and exit |
1679 | ; reset window redraw flag and exit |
1708 | mov [edi + WDATA.fl_redraw], 0 |
1680 | mov [edi + WDATA.fl_redraw], 0 |
1709 | mov edx, edi |
1681 | mov edx, edi |
1710 | ret |
1682 | ret |
1711 | ;------------------------------------------------------------------------------ |
1683 | ;------------------------------------------------------------------------------ |
1712 | align 4 |
1684 | align 4 |
1713 | ;------------------------------------------------------------------------------ |
1685 | ;------------------------------------------------------------------------------ |
1714 | window._.check_window_position: ;////////////////////////////////////////////// |
1686 | window._.check_window_position: ;////////////////////////////////////////////// |
1715 | ;------------------------------------------------------------------------------ |
1687 | ;------------------------------------------------------------------------------ |
1716 | ;? Check if window is inside screen area |
1688 | ;? Check if window is inside screen area |
1717 | ;------------------------------------------------------------------------------ |
1689 | ;------------------------------------------------------------------------------ |
1718 | ;> edi = pointer to WDATA |
1690 | ;> edi = pointer to WDATA |
1719 | ;------------------------------------------------------------------------------ |
1691 | ;------------------------------------------------------------------------------ |
1720 | push eax ebx ecx edx esi |
1692 | push eax ebx ecx edx esi |
1721 | 1693 | ||
1722 | mov eax, [edi + WDATA.box.left] |
1694 | mov eax, [edi + WDATA.box.left] |
1723 | mov ebx, [edi + WDATA.box.top] |
1695 | mov ebx, [edi + WDATA.box.top] |
1724 | mov ecx, [edi + WDATA.box.width] |
1696 | mov ecx, [edi + WDATA.box.width] |
1725 | mov edx, [edi + WDATA.box.height] |
1697 | mov edx, [edi + WDATA.box.height] |
1726 | 1698 | ||
1727 | mov esi, [_display.width] |
1699 | mov esi, [_display.width] |
1728 | cmp ecx, esi |
1700 | cmp ecx, esi |
1729 | jae .fix_width_high |
1701 | jae .fix_width_high |
1730 | ;-------------------------------------- |
1702 | ;-------------------------------------- |
1731 | align 4 |
1703 | align 4 |
1732 | .check_left: |
1704 | .check_left: |
1733 | or eax, eax |
1705 | or eax, eax |
1734 | jl .fix_left_low |
1706 | jl .fix_left_low |
1735 | add eax, ecx |
1707 | add eax, ecx |
1736 | cmp eax, esi |
1708 | cmp eax, esi |
1737 | jge .fix_left_high |
1709 | jge .fix_left_high |
1738 | ;-------------------------------------- |
1710 | ;-------------------------------------- |
1739 | align 4 |
1711 | align 4 |
1740 | .check_height: |
1712 | .check_height: |
1741 | mov esi, [_display.height] |
1713 | mov esi, [_display.height] |
1742 | cmp edx, esi |
1714 | cmp edx, esi |
1743 | jae .fix_height_high |
1715 | jae .fix_height_high |
1744 | ;-------------------------------------- |
1716 | ;-------------------------------------- |
1745 | align 4 |
1717 | align 4 |
1746 | .check_top: |
1718 | .check_top: |
1747 | or ebx, ebx |
1719 | or ebx, ebx |
1748 | jl .fix_top_low |
1720 | jl .fix_top_low |
1749 | add ebx, edx |
1721 | add ebx, edx |
1750 | cmp ebx, esi |
1722 | cmp ebx, esi |
1751 | jge .fix_top_high |
1723 | jge .fix_top_high |
1752 | ;-------------------------------------- |
1724 | ;-------------------------------------- |
1753 | align 4 |
1725 | align 4 |
1754 | .exit: |
1726 | .exit: |
1755 | pop esi edx ecx ebx eax |
1727 | pop esi edx ecx ebx eax |
1756 | ret |
1728 | ret |
1757 | ;-------------------------------------- |
1729 | ;-------------------------------------- |
1758 | align 4 |
1730 | align 4 |
1759 | .fix_width_high: |
1731 | .fix_width_high: |
1760 | mov ecx, esi |
1732 | mov ecx, esi |
1761 | mov [edi + WDATA.box.width], esi |
1733 | mov [edi + WDATA.box.width], esi |
1762 | jmp .check_left |
1734 | jmp .check_left |
1763 | ;-------------------------------------- |
1735 | ;-------------------------------------- |
1764 | align 4 |
1736 | align 4 |
1765 | .fix_left_low: |
1737 | .fix_left_low: |
1766 | xor eax, eax |
1738 | xor eax, eax |
1767 | mov [edi + WDATA.box.left], eax |
1739 | mov [edi + WDATA.box.left], eax |
1768 | jmp .check_height |
1740 | jmp .check_height |
1769 | ;-------------------------------------- |
1741 | ;-------------------------------------- |
1770 | align 4 |
1742 | align 4 |
1771 | .fix_left_high: |
1743 | .fix_left_high: |
1772 | mov eax, esi |
1744 | mov eax, esi |
1773 | sub eax, ecx |
1745 | sub eax, ecx |
1774 | mov [edi + WDATA.box.left], eax |
1746 | mov [edi + WDATA.box.left], eax |
1775 | jmp .check_height |
1747 | jmp .check_height |
1776 | ;-------------------------------------- |
1748 | ;-------------------------------------- |
1777 | align 4 |
1749 | align 4 |
1778 | .fix_height_high: |
1750 | .fix_height_high: |
1779 | mov edx, esi |
1751 | mov edx, esi |
1780 | mov [edi + WDATA.box.height], esi |
1752 | mov [edi + WDATA.box.height], esi |
1781 | jmp .check_top |
1753 | jmp .check_top |
1782 | ;-------------------------------------- |
1754 | ;-------------------------------------- |
1783 | align 4 |
1755 | align 4 |
1784 | .fix_top_low: |
1756 | .fix_top_low: |
1785 | xor ebx, ebx |
1757 | xor ebx, ebx |
1786 | mov [edi + WDATA.box.top], ebx |
1758 | mov [edi + WDATA.box.top], ebx |
1787 | jmp .exit |
1759 | jmp .exit |
1788 | ;-------------------------------------- |
1760 | ;-------------------------------------- |
1789 | align 4 |
1761 | align 4 |
1790 | .fix_top_high: |
1762 | .fix_top_high: |
1791 | mov ebx, esi |
1763 | mov ebx, esi |
1792 | sub ebx, edx |
1764 | sub ebx, edx |
1793 | mov [edi + WDATA.box.top], ebx |
1765 | mov [edi + WDATA.box.top], ebx |
1794 | jmp .exit |
1766 | jmp .exit |
1795 | ;------------------------------------------------------------------------------ |
1767 | ;------------------------------------------------------------------------------ |
1796 | align 4 |
1768 | align 4 |
1797 | ;------------------------------------------------------------------------------ |
1769 | ;------------------------------------------------------------------------------ |
1798 | window._.get_titlebar_height: ;//////////////////////////////////////////////// |
1770 | window._.get_titlebar_height: ;//////////////////////////////////////////////// |
1799 | ;------------------------------------------------------------------------------ |
1771 | ;------------------------------------------------------------------------------ |
1800 | ;? |
1772 | ;? |
1801 | ;------------------------------------------------------------------------------ |
1773 | ;------------------------------------------------------------------------------ |
1802 | ;> edi = pointer to WDATA |
1774 | ;> edi = pointer to WDATA |
1803 | ;------------------------------------------------------------------------------ |
1775 | ;------------------------------------------------------------------------------ |
1804 | mov al, [edi + WDATA.fl_wstyle] |
1776 | mov al, [edi + WDATA.fl_wstyle] |
1805 | and al, 0x0f |
1777 | and al, 0x0f |
1806 | cmp al, 0x03 |
1778 | cmp al, 0x03 |
1807 | jne @f |
1779 | jne @f |
1808 | mov eax, [_skinh] |
1780 | mov eax, [_skinh] |
1809 | ret |
1781 | ret |
1810 | ;-------------------------------------- |
1782 | ;-------------------------------------- |
1811 | align 4 |
1783 | align 4 |
1812 | @@: |
1784 | @@: |
1813 | mov eax, 21 |
1785 | mov eax, 21 |
1814 | ret |
1786 | ret |
1815 | ;------------------------------------------------------------------------------ |
1787 | ;------------------------------------------------------------------------------ |
1816 | align 4 |
1788 | align 4 |
1817 | ;------------------------------------------------------------------------------ |
1789 | ;------------------------------------------------------------------------------ |
1818 | window._.get_rolledup_height: ;//////////////////////////////////////////////// |
1790 | window._.get_rolledup_height: ;//////////////////////////////////////////////// |
1819 | ;------------------------------------------------------------------------------ |
1791 | ;------------------------------------------------------------------------------ |
1820 | ;? |
1792 | ;? |
1821 | ;------------------------------------------------------------------------------ |
1793 | ;------------------------------------------------------------------------------ |
1822 | ;> edi = pointer to WDATA |
1794 | ;> edi = pointer to WDATA |
1823 | ;------------------------------------------------------------------------------ |
1795 | ;------------------------------------------------------------------------------ |
1824 | mov al, [edi + WDATA.fl_wstyle] |
1796 | mov al, [edi + WDATA.fl_wstyle] |
1825 | and al, 0x0f |
1797 | and al, 0x0f |
1826 | cmp al, 0x03 |
1798 | cmp al, 0x03 |
1827 | jb @f |
1799 | jb @f |
1828 | mov eax, [_skinh] |
1800 | mov eax, [_skinh] |
1829 | add eax, 3 |
1801 | add eax, 3 |
1830 | ret |
1802 | ret |
1831 | ;-------------------------------------- |
1803 | ;-------------------------------------- |
1832 | align 4 |
1804 | align 4 |
1833 | @@: |
1805 | @@: |
1834 | or al, al |
1806 | or al, al |
1835 | jnz @f |
1807 | jnz @f |
1836 | mov eax, 21 |
1808 | mov eax, 21 |
1837 | ret |
1809 | ret |
1838 | ;-------------------------------------- |
1810 | ;-------------------------------------- |
1839 | align 4 |
1811 | align 4 |
1840 | @@: |
1812 | @@: |
1841 | mov eax, 21 + 2 |
1813 | mov eax, 21 + 2 |
1842 | ret |
1814 | ret |
1843 | ;------------------------------------------------------------------------------ |
1815 | ;------------------------------------------------------------------------------ |
1844 | align 4 |
1816 | align 4 |
1845 | ;------------------------------------------------------------------------------ |
1817 | ;------------------------------------------------------------------------------ |
1846 | window._.set_screen: ;///////////////////////////////////////////////////////// |
1818 | window._.set_screen: ;///////////////////////////////////////////////////////// |
1847 | ;------------------------------------------------------------------------------ |
1819 | ;------------------------------------------------------------------------------ |
1848 | ;? Reserve window area in screen buffer |
1820 | ;? Reserve window area in screen buffer |
1849 | ;------------------------------------------------------------------------------ |
1821 | ;------------------------------------------------------------------------------ |
1850 | ;> eax = left |
1822 | ;> eax = left |
1851 | ;> ebx = top |
1823 | ;> ebx = top |
1852 | ;> ecx = right |
1824 | ;> ecx = right |
1853 | ;> edx = bottom |
1825 | ;> edx = bottom |
1854 | ;> esi = process number |
1826 | ;> esi = process number |
1855 | ;------------------------------------------------------------------------------ |
1827 | ;------------------------------------------------------------------------------ |
1856 | virtual at esp |
1828 | virtual at esp |
1857 | ff_x dd ? |
1829 | ff_x dd ? |
1858 | ff_y dd ? |
1830 | ff_y dd ? |
1859 | ff_width dd ? |
1831 | ff_width dd ? |
1860 | ff_xsz dd ? |
1832 | ff_xsz dd ? |
1861 | ff_ysz dd ? |
1833 | ff_ysz dd ? |
1862 | ff_scale dd ? |
1834 | ff_scale dd ? |
1863 | end virtual |
1835 | end virtual |
1864 | 1836 | ||
1865 | pushad |
1837 | pushad |
1866 | 1838 | ||
1867 | cmp esi, 1 |
1839 | cmp esi, 1 |
1868 | jz .check_for_shaped_window |
1840 | jz .check_for_shaped_window |
1869 | mov edi, esi |
1841 | mov edi, esi |
1870 | shl edi, 5 |
1842 | shl edi, 5 |
1871 | cmp [window_data + edi + WDATA.box.width], 0 |
1843 | cmp [window_data + edi + WDATA.box.width], 0 |
1872 | jnz .check_for_shaped_window |
1844 | jnz .check_for_shaped_window |
1873 | cmp [window_data + edi + WDATA.box.height], 0 |
1845 | cmp [window_data + edi + WDATA.box.height], 0 |
1874 | jz .exit |
1846 | jz .exit |
1875 | ;-------------------------------------- |
1847 | ;-------------------------------------- |
1876 | align 4 |
1848 | align 4 |
1877 | .check_for_shaped_window: |
1849 | .check_for_shaped_window: |
1878 | mov edi, esi |
1850 | mov edi, esi |
1879 | shl edi, 8 |
1851 | shl edi, 8 |
1880 | add edi, SLOT_BASE |
1852 | add edi, SLOT_BASE |
1881 | cmp [edi + APPDATA.wnd_shape], 0 |
1853 | cmp [edi + APPDATA.wnd_shape], 0 |
1882 | jne .shaped_window |
1854 | jne .shaped_window |
1883 | 1855 | ||
1884 | ; get x&y size |
1856 | ; get x&y size |
1885 | sub ecx, eax |
1857 | sub ecx, eax |
1886 | sub edx, ebx |
1858 | sub edx, ebx |
1887 | inc ecx |
1859 | inc ecx |
1888 | inc edx |
1860 | inc edx |
1889 | 1861 | ||
1890 | ; get WinMap start |
1862 | ; get WinMap start |
1891 | push esi |
1863 | push esi |
1892 | mov esi, [_display.width] |
1864 | mov esi, [_display.width] |
1893 | mov edi, [d_width_calc_area + ebx*4] |
1865 | mov edi, [d_width_calc_area + ebx*4] |
1894 | 1866 | ||
1895 | add edi, eax |
1867 | add edi, eax |
1896 | add edi, [_display.win_map] |
1868 | add edi, [_display.win_map] |
1897 | pop eax |
1869 | pop eax |
1898 | mov ah, al |
1870 | mov ah, al |
1899 | push ax |
1871 | push ax |
1900 | shl eax, 16 |
1872 | shl eax, 16 |
1901 | pop ax |
1873 | pop ax |
1902 | ;-------------------------------------- |
1874 | ;-------------------------------------- |
1903 | align 4 |
1875 | align 4 |
1904 | .next_line: |
1876 | .next_line: |
1905 | push ecx |
1877 | push ecx |
1906 | shr ecx, 2 |
1878 | shr ecx, 2 |
1907 | rep stosd |
1879 | rep stosd |
1908 | mov ecx, [esp] |
1880 | mov ecx, [esp] |
1909 | and ecx, 3 |
1881 | and ecx, 3 |
1910 | rep stosb |
1882 | rep stosb |
1911 | pop ecx |
1883 | pop ecx |
1912 | add edi, esi |
1884 | add edi, esi |
1913 | sub edi, ecx |
1885 | sub edi, ecx |
1914 | dec edx |
1886 | dec edx |
1915 | jnz .next_line |
1887 | jnz .next_line |
1916 | 1888 | ||
1917 | jmp .exit |
1889 | jmp .exit |
1918 | ;-------------------------------------- |
1890 | ;-------------------------------------- |
1919 | align 4 |
1891 | align 4 |
1920 | .shaped_window: |
1892 | .shaped_window: |
1921 | ; for (y=0; y <= x_size; y++) |
1893 | ; for (y=0; y <= x_size; y++) |
1922 | ; for (x=0; x <= x_size; x++) |
1894 | ; for (x=0; x <= x_size; x++) |
1923 | ; if (shape[coord(x,y,scale)]==1) |
1895 | ; if (shape[coord(x,y,scale)]==1) |
1924 | ; set_pixel(x, y, process_number); |
1896 | ; set_pixel(x, y, process_number); |
1925 | 1897 | ||
1926 | sub ecx, eax |
1898 | sub ecx, eax |
1927 | sub edx, ebx |
1899 | sub edx, ebx |
1928 | inc ecx |
1900 | inc ecx |
1929 | inc edx |
1901 | inc edx |
1930 | 1902 | ||
1931 | push [edi + APPDATA.wnd_shape_scale] ; push scale first -> for loop |
1903 | push [edi + APPDATA.wnd_shape_scale] ; push scale first -> for loop |
1932 | 1904 | ||
1933 | ; get WinMap start -> ebp |
1905 | ; get WinMap start -> ebp |
1934 | push eax |
1906 | push eax |
1935 | mov eax, [d_width_calc_area + ebx*4] |
1907 | mov eax, [d_width_calc_area + ebx*4] |
1936 | 1908 | ||
1937 | add eax, [esp] |
1909 | add eax, [esp] |
1938 | add eax, [_display.win_map] |
1910 | add eax, [_display.win_map] |
1939 | mov ebp, eax |
1911 | mov ebp, eax |
1940 | 1912 | ||
1941 | mov edi, [edi + APPDATA.wnd_shape] |
1913 | mov edi, [edi + APPDATA.wnd_shape] |
1942 | pop eax |
1914 | pop eax |
1943 | 1915 | ||
1944 | ; eax = x_start |
1916 | ; eax = x_start |
1945 | ; ebx = y_start |
1917 | ; ebx = y_start |
1946 | ; ecx = x_size |
1918 | ; ecx = x_size |
1947 | ; edx = y_size |
1919 | ; edx = y_size |
1948 | ; esi = process_number |
1920 | ; esi = process_number |
1949 | ; edi = &shape |
1921 | ; edi = &shape |
1950 | ; [scale] |
1922 | ; [scale] |
1951 | push edx ecx ; for loop - x,y size |
1923 | push edx ecx ; for loop - x,y size |
1952 | 1924 | ||
1953 | mov ecx, esi |
1925 | mov ecx, esi |
1954 | shl ecx, 5 |
1926 | shl ecx, 5 |
1955 | mov edx, [window_data + ecx + WDATA.box.top] |
1927 | mov edx, [window_data + ecx + WDATA.box.top] |
1956 | push [window_data + ecx + WDATA.box.width] ; for loop - width |
1928 | push [window_data + ecx + WDATA.box.width] ; for loop - width |
1957 | mov ecx, [window_data + ecx + WDATA.box.left] |
1929 | mov ecx, [window_data + ecx + WDATA.box.left] |
1958 | sub ebx, edx |
1930 | sub ebx, edx |
1959 | sub eax, ecx |
1931 | sub eax, ecx |
1960 | push ebx eax ; for loop - x,y |
1932 | push ebx eax ; for loop - x,y |
1961 | 1933 | ||
1962 | add [ff_xsz], eax |
1934 | add [ff_xsz], eax |
1963 | add [ff_ysz], ebx |
1935 | add [ff_ysz], ebx |
1964 | 1936 | ||
1965 | mov ebx, [ff_y] |
1937 | mov ebx, [ff_y] |
1966 | ;-------------------------------------- |
1938 | ;-------------------------------------- |
1967 | align 4 |
1939 | align 4 |
1968 | .ff_new_y: |
1940 | .ff_new_y: |
1969 | mov edx, [ff_x] |
1941 | mov edx, [ff_x] |
1970 | ;-------------------------------------- |
1942 | ;-------------------------------------- |
1971 | align 4 |
1943 | align 4 |
1972 | .ff_new_x: |
1944 | .ff_new_x: |
1973 | ; -- body -- |
1945 | ; -- body -- |
1974 | mov ecx, [ff_scale] |
1946 | mov ecx, [ff_scale] |
1975 | mov eax, [ff_width] |
1947 | mov eax, [ff_width] |
1976 | inc eax |
1948 | inc eax |
1977 | shr eax, cl |
1949 | shr eax, cl |
1978 | push ebx edx |
1950 | push ebx edx |
1979 | shr ebx, cl |
1951 | shr ebx, cl |
1980 | shr edx, cl |
1952 | shr edx, cl |
1981 | imul eax, ebx |
1953 | imul eax, ebx |
1982 | add eax, edx |
1954 | add eax, edx |
1983 | pop edx ebx |
1955 | pop edx ebx |
1984 | add eax, edi |
1956 | add eax, edi |
1985 | call .read_byte |
1957 | call .read_byte |
1986 | test al, al |
1958 | test al, al |
1987 | jz @f |
1959 | jz @f |
1988 | mov eax, esi |
1960 | mov eax, esi |
1989 | mov [ebp], al |
1961 | mov [ebp], al |
1990 | ; -- end body -- |
1962 | ; -- end body -- |
1991 | ;-------------------------------------- |
1963 | ;-------------------------------------- |
1992 | align 4 |
1964 | align 4 |
1993 | @@: |
1965 | @@: |
1994 | inc ebp |
1966 | inc ebp |
1995 | inc edx |
1967 | inc edx |
1996 | cmp edx, [ff_xsz] |
1968 | cmp edx, [ff_xsz] |
1997 | jb .ff_new_x |
1969 | jb .ff_new_x |
1998 | 1970 | ||
1999 | sub ebp, [ff_xsz] |
1971 | sub ebp, [ff_xsz] |
2000 | add ebp, [ff_x] |
1972 | add ebp, [ff_x] |
2001 | add ebp, [_display.width] ; screen.x |
1973 | add ebp, [_display.width] ; screen.x |
2002 | inc ebx |
1974 | inc ebx |
2003 | cmp ebx, [ff_ysz] |
1975 | cmp ebx, [ff_ysz] |
2004 | jb .ff_new_y |
1976 | jb .ff_new_y |
2005 | 1977 | ||
2006 | add esp, 24 |
1978 | add esp, 24 |
2007 | ;-------------------------------------- |
1979 | ;-------------------------------------- |
2008 | align 4 |
1980 | align 4 |
2009 | .exit: |
1981 | .exit: |
2010 | popad |
1982 | popad |
2011 | inc [_display.mask_seqno] |
1983 | inc [_display.mask_seqno] |
2012 | ret |
1984 | ret |
2013 | ;-------------------------------------- |
1985 | ;-------------------------------------- |
2014 | align 4 |
1986 | align 4 |
2015 | .read_byte: |
1987 | .read_byte: |
2016 | ; eax - address |
1988 | ; eax - address |
2017 | ; esi - slot |
1989 | ; esi - slot |
2018 | push eax ecx edx esi |
1990 | push eax ecx edx esi |
2019 | xchg eax, esi |
1991 | xchg eax, esi |
2020 | lea ecx, [esp + 12] |
1992 | lea ecx, [esp + 12] |
2021 | mov edx, 1 |
1993 | mov edx, 1 |
2022 | call read_process_memory |
1994 | call read_process_memory |
2023 | pop esi edx ecx eax |
1995 | pop esi edx ecx eax |
2024 | ret |
1996 | ret |
2025 | ;------------------------------------------------------------------------------ |
1997 | ;------------------------------------------------------------------------------ |
2026 | align 4 |
1998 | align 4 |
2027 | ;------------------------------------------------------------------------------ |
1999 | ;------------------------------------------------------------------------------ |
2028 | window._.window_activate: ;//////////////////////////////////////////////////// |
2000 | window._.window_activate: ;//////////////////////////////////////////////////// |
2029 | ;------------------------------------------------------------------------------ |
2001 | ;------------------------------------------------------------------------------ |
2030 | ;? Activate window |
2002 | ;? Activate window |
2031 | ;------------------------------------------------------------------------------ |
2003 | ;------------------------------------------------------------------------------ |
2032 | ;> esi = pointer to WIN_POS+ window data |
2004 | ;> esi = pointer to WIN_POS+ window data |
2033 | ;------------------------------------------------------------------------------ |
2005 | ;------------------------------------------------------------------------------ |
2034 | push eax ebx |
2006 | push eax ebx |
2035 | 2007 | ||
2036 | ; if type of current active window is 3 or 4, it must be redrawn |
2008 | ; if type of current active window is 3 or 4, it must be redrawn |
2037 | mov ebx, [TASK_COUNT] |
2009 | mov ebx, [TASK_COUNT] |
2038 | 2010 | ||
2039 | ; DEBUGF 1, "K : TASK_COUNT (0x%x)\n", ebx |
2011 | ; DEBUGF 1, "K : TASK_COUNT (0x%x)\n", ebx |
2040 | 2012 | ||
2041 | movzx ebx, word[WIN_POS + ebx * 2] |
2013 | movzx ebx, word[WIN_POS + ebx * 2] |
2042 | shl ebx, 5 |
2014 | shl ebx, 5 |
2043 | add eax, window_data |
2015 | add eax, window_data |
2044 | mov al, [window_data + ebx + WDATA.fl_wstyle] |
2016 | mov al, [window_data + ebx + WDATA.fl_wstyle] |
2045 | and al, 0x0f |
2017 | and al, 0x0f |
2046 | cmp al, 0x03 |
2018 | cmp al, 0x03 |
2047 | je .set_window_redraw_flag |
2019 | je .set_window_redraw_flag |
2048 | cmp al, 0x04 |
2020 | cmp al, 0x04 |
2049 | jne .move_others_down |
2021 | jne .move_others_down |
2050 | ;-------------------------------------- |
2022 | ;-------------------------------------- |
2051 | align 4 |
2023 | align 4 |
2052 | .set_window_redraw_flag: |
2024 | .set_window_redraw_flag: |
2053 | mov [window_data + ebx + WDATA.fl_redraw], 1 |
2025 | mov [window_data + ebx + WDATA.fl_redraw], 1 |
2054 | ;-------------------------------------- |
2026 | ;-------------------------------------- |
2055 | align 4 |
2027 | align 4 |
2056 | .move_others_down: |
2028 | .move_others_down: |
2057 | ; ax <- process no |
2029 | ; ax <- process no |
2058 | movzx ebx, word[esi] |
2030 | movzx ebx, word[esi] |
2059 | ; ax <- position in window stack |
2031 | ; ax <- position in window stack |
2060 | movzx ebx, word[WIN_STACK + ebx * 2] |
2032 | movzx ebx, word[WIN_STACK + ebx * 2] |
2061 | 2033 | ||
2062 | ; drop others |
2034 | ; drop others |
2063 | xor eax, eax |
2035 | xor eax, eax |
2064 | ;-------------------------------------- |
2036 | ;-------------------------------------- |
2065 | align 4 |
2037 | align 4 |
2066 | .next_stack_window: |
2038 | .next_stack_window: |
2067 | cmp eax, [TASK_COUNT] |
2039 | cmp eax, [TASK_COUNT] |
2068 | jae .move_self_up |
2040 | jae .move_self_up |
2069 | inc eax |
2041 | inc eax |
2070 | 2042 | ||
2071 | ; push ebx |
2043 | ; push ebx |
2072 | ; xor ebx,ebx |
2044 | ; xor ebx,ebx |
2073 | ; mov bx,[WIN_STACK + eax * 2] |
2045 | ; mov bx,[WIN_STACK + eax * 2] |
2074 | ; DEBUGF 1, "K : DEC WIN_STACK (0x%x)\n",ebx |
2046 | ; DEBUGF 1, "K : DEC WIN_STACK (0x%x)\n",ebx |
2075 | ; pop ebx |
2047 | ; pop ebx |
2076 | 2048 | ||
2077 | cmp [WIN_STACK + eax * 2], bx |
2049 | cmp [WIN_STACK + eax * 2], bx |
2078 | jbe .next_stack_window |
2050 | jbe .next_stack_window |
2079 | dec word[WIN_STACK + eax * 2] |
2051 | dec word[WIN_STACK + eax * 2] |
2080 | jmp .next_stack_window |
2052 | jmp .next_stack_window |
2081 | ;-------------------------------------- |
2053 | ;-------------------------------------- |
2082 | align 4 |
2054 | align 4 |
2083 | .move_self_up: |
2055 | .move_self_up: |
2084 | movzx ebx, word[esi] |
2056 | movzx ebx, word[esi] |
2085 | ; number of processes |
2057 | ; number of processes |
2086 | mov ax, [TASK_COUNT] |
2058 | mov ax, [TASK_COUNT] |
2087 | ; this is the last (and the upper) |
2059 | ; this is the last (and the upper) |
2088 | mov [WIN_STACK + ebx * 2], ax |
2060 | mov [WIN_STACK + ebx * 2], ax |
2089 | 2061 | ||
2090 | ; update on screen - window stack |
2062 | ; update on screen - window stack |
2091 | xor eax, eax |
2063 | xor eax, eax |
2092 | ;-------------------------------------- |
2064 | ;-------------------------------------- |
2093 | align 4 |
2065 | align 4 |
2094 | .next_window_pos: |
2066 | .next_window_pos: |
2095 | cmp eax, [TASK_COUNT] |
2067 | cmp eax, [TASK_COUNT] |
2096 | jae .reset_vars |
2068 | jae .reset_vars |
2097 | inc eax |
2069 | inc eax |
2098 | movzx ebx, word[WIN_STACK + eax * 2] |
2070 | movzx ebx, word[WIN_STACK + eax * 2] |
2099 | mov [WIN_POS + ebx * 2], ax |
2071 | mov [WIN_POS + ebx * 2], ax |
2100 | jmp .next_window_pos |
2072 | jmp .next_window_pos |
2101 | ;-------------------------------------- |
2073 | ;-------------------------------------- |
2102 | align 4 |
2074 | align 4 |
2103 | .reset_vars: |
2075 | .reset_vars: |
2104 | mov byte[KEY_COUNT], 0 |
2076 | mov byte[KEY_COUNT], 0 |
2105 | mov byte[BTN_COUNT], 0 |
2077 | mov byte[BTN_COUNT], 0 |
2106 | mov word[MOUSE_SCROLL_H], 0 |
2078 | mov word[MOUSE_SCROLL_H], 0 |
2107 | mov word[MOUSE_SCROLL_V], 0 |
2079 | mov word[MOUSE_SCROLL_V], 0 |
2108 | 2080 | ||
2109 | pop ebx eax |
2081 | pop ebx eax |
2110 | ret |
2082 | ret |
2111 | ;------------------------------------------------------------------------------ |
2083 | ;------------------------------------------------------------------------------ |
2112 | window._.window_deactivate: ;//////////////////////////////////////////////////// |
2084 | window._.window_deactivate: ;//////////////////////////////////////////////////// |
2113 | ;------------------------------------------------------------------------------ |
2085 | ;------------------------------------------------------------------------------ |
2114 | ;? Deactivate window |
2086 | ;? Deactivate window |
2115 | ;------------------------------------------------------------------------------ |
2087 | ;------------------------------------------------------------------------------ |
2116 | ;> esi = pointer to WIN_POS+ window data |
2088 | ;> esi = pointer to WIN_POS+ window data |
2117 | ;------------------------------------------------------------------------------ |
2089 | ;------------------------------------------------------------------------------ |
2118 | push eax ebx |
2090 | push eax ebx |
2119 | ;-------------------------------------- |
2091 | ;-------------------------------------- |
2120 | align 4 |
2092 | align 4 |
2121 | .move_others_up: |
2093 | .move_others_up: |
2122 | ; ax <- process no |
2094 | ; ax <- process no |
2123 | movzx ebx, word[esi] |
2095 | movzx ebx, word[esi] |
2124 | ; ax <- position in window stack |
2096 | ; ax <- position in window stack |
2125 | movzx ebx, word[WIN_STACK + ebx * 2] |
2097 | movzx ebx, word[WIN_STACK + ebx * 2] |
2126 | ; up others |
2098 | ; up others |
2127 | xor eax, eax |
2099 | xor eax, eax |
2128 | ;-------------------------------------- |
2100 | ;-------------------------------------- |
2129 | align 4 |
2101 | align 4 |
2130 | .next_stack_window: |
2102 | .next_stack_window: |
2131 | cmp eax, [TASK_COUNT] |
2103 | cmp eax, [TASK_COUNT] |
2132 | jae .move_self_down |
2104 | jae .move_self_down |
2133 | inc eax |
2105 | inc eax |
2134 | cmp [WIN_STACK + eax * 2], bx |
2106 | cmp [WIN_STACK + eax * 2], bx |
2135 | jae .next_stack_window |
2107 | jae .next_stack_window |
2136 | inc word[WIN_STACK + eax * 2] |
2108 | inc word[WIN_STACK + eax * 2] |
2137 | jmp .next_stack_window |
2109 | jmp .next_stack_window |
2138 | ;-------------------------------------- |
2110 | ;-------------------------------------- |
2139 | align 4 |
2111 | align 4 |
2140 | .move_self_down: |
2112 | .move_self_down: |
2141 | movzx ebx, word[esi] |
2113 | movzx ebx, word[esi] |
2142 | ; this is the last (and the low) |
2114 | ; this is the last (and the low) |
2143 | mov [WIN_STACK + ebx * 2], word 1 |
2115 | mov [WIN_STACK + ebx * 2], word 1 |
2144 | ; update on screen - window stack |
2116 | ; update on screen - window stack |
2145 | xor eax, eax |
2117 | xor eax, eax |
2146 | ;-------------------------------------- |
2118 | ;-------------------------------------- |
2147 | align 4 |
2119 | align 4 |
2148 | .next_window_pos: |
2120 | .next_window_pos: |
2149 | cmp eax, [TASK_COUNT] |
2121 | cmp eax, [TASK_COUNT] |
2150 | jae .reset_vars |
2122 | jae .reset_vars |
2151 | inc eax |
2123 | inc eax |
2152 | movzx ebx, word[WIN_STACK + eax * 2] |
2124 | movzx ebx, word[WIN_STACK + eax * 2] |
2153 | mov [WIN_POS + ebx * 2], ax |
2125 | mov [WIN_POS + ebx * 2], ax |
2154 | jmp .next_window_pos |
2126 | jmp .next_window_pos |
2155 | ;-------------------------------------- |
2127 | ;-------------------------------------- |
2156 | align 4 |
2128 | align 4 |
2157 | .reset_vars: |
2129 | .reset_vars: |
2158 | mov byte[KEY_COUNT], 0 |
2130 | mov byte[KEY_COUNT], 0 |
2159 | mov byte[BTN_COUNT], 0 |
2131 | mov byte[BTN_COUNT], 0 |
2160 | mov word[MOUSE_SCROLL_H], 0 |
2132 | mov word[MOUSE_SCROLL_H], 0 |
2161 | mov word[MOUSE_SCROLL_V], 0 |
2133 | mov word[MOUSE_SCROLL_V], 0 |
2162 | pop ebx eax |
2134 | pop ebx eax |
2163 | ret |
2135 | ret |
2164 | ;------------------------------------------------------------------------------ |
2136 | ;------------------------------------------------------------------------------ |
2165 | align 4 |
2137 | align 4 |
2166 | ;------------------------------------------------------------------------------ |
2138 | ;------------------------------------------------------------------------------ |
2167 | window._.check_window_draw: ;////////////////////////////////////////////////// |
2139 | window._.check_window_draw: ;////////////////////////////////////////////////// |
2168 | ;------------------------------------------------------------------------------ |
2140 | ;------------------------------------------------------------------------------ |
2169 | ;? Check if window is necessary to draw |
2141 | ;? Check if window is necessary to draw |
2170 | ;------------------------------------------------------------------------------ |
2142 | ;------------------------------------------------------------------------------ |
2171 | ;> edi = pointer to WDATA |
2143 | ;> edi = pointer to WDATA |
2172 | ;------------------------------------------------------------------------------ |
2144 | ;------------------------------------------------------------------------------ |
2173 | mov cl, [edi + WDATA.fl_wstyle] |
2145 | mov cl, [edi + WDATA.fl_wstyle] |
2174 | and cl, 0x0f |
2146 | and cl, 0x0f |
2175 | cmp cl, 3 |
2147 | cmp cl, 3 |
2176 | je .exit.redraw ; window type 3 |
2148 | je .exit.redraw ; window type 3 |
2177 | cmp cl, 4 |
2149 | cmp cl, 4 |
2178 | je .exit.redraw ; window type 4 |
2150 | je .exit.redraw ; window type 4 |
2179 | 2151 | ||
2180 | push eax ebx edx esi |
2152 | push eax ebx edx esi |
2181 | 2153 | ||
2182 | mov eax, edi |
2154 | mov eax, edi |
2183 | sub eax, window_data |
2155 | sub eax, window_data |
2184 | shr eax, 5 |
2156 | shr eax, 5 |
2185 | 2157 | ||
2186 | movzx eax, word[WIN_STACK + eax * 2] ; get value of the curr process |
2158 | movzx eax, word[WIN_STACK + eax * 2] ; get value of the curr process |
2187 | lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 |
2159 | lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 |
2188 | ;-------------------------------------- |
2160 | ;-------------------------------------- |
2189 | align 4 |
2161 | align 4 |
2190 | .next_window: |
2162 | .next_window: |
2191 | add esi, 2 |
2163 | add esi, 2 |
2192 | 2164 | ||
2193 | mov eax, [TASK_COUNT] |
2165 | mov eax, [TASK_COUNT] |
2194 | lea eax, word[WIN_POS + eax * 2] ; number of the upper window |
2166 | lea eax, word[WIN_POS + eax * 2] ; number of the upper window |
2195 | 2167 | ||
2196 | cmp esi, eax |
2168 | cmp esi, eax |
2197 | ja .exit.no_redraw |
2169 | ja .exit.no_redraw |
2198 | 2170 | ||
2199 | movzx edx, word[esi] |
2171 | movzx edx, word[esi] |
2200 | shl edx, 5 |
2172 | shl edx, 5 |
2201 | cmp [CURRENT_TASK + edx + TASKDATA.state], TSTATE_FREE |
2173 | cmp [CURRENT_TASK + edx + TASKDATA.state], TSTATE_FREE |
2202 | je .next_window |
2174 | je .next_window |
2203 | 2175 | ||
2204 | mov eax, [edi + WDATA.box.top] |
2176 | mov eax, [edi + WDATA.box.top] |
2205 | mov ebx, [edi + WDATA.box.height] |
2177 | mov ebx, [edi + WDATA.box.height] |
2206 | add ebx, eax |
2178 | add ebx, eax |
2207 | 2179 | ||
2208 | mov ecx, [window_data + edx + WDATA.box.top] |
2180 | mov ecx, [window_data + edx + WDATA.box.top] |
2209 | cmp ecx, ebx |
2181 | cmp ecx, ebx |
2210 | jge .next_window |
2182 | jge .next_window |
2211 | add ecx, [window_data + edx + WDATA.box.height] |
2183 | add ecx, [window_data + edx + WDATA.box.height] |
2212 | cmp eax, ecx |
2184 | cmp eax, ecx |
2213 | jge .next_window |
2185 | jge .next_window |
2214 | 2186 | ||
2215 | mov eax, [edi + WDATA.box.left] |
2187 | mov eax, [edi + WDATA.box.left] |
2216 | mov ebx, [edi + WDATA.box.width] |
2188 | mov ebx, [edi + WDATA.box.width] |
2217 | add ebx, eax |
2189 | add ebx, eax |
2218 | 2190 | ||
2219 | mov ecx, [window_data + edx + WDATA.box.left] |
2191 | mov ecx, [window_data + edx + WDATA.box.left] |
2220 | cmp ecx, ebx |
2192 | cmp ecx, ebx |
2221 | jge .next_window |
2193 | jge .next_window |
2222 | add ecx, [window_data + edx + WDATA.box.width] |
2194 | add ecx, [window_data + edx + WDATA.box.width] |
2223 | cmp eax, ecx |
2195 | cmp eax, ecx |
2224 | jge .next_window |
2196 | jge .next_window |
2225 | 2197 | ||
2226 | pop esi edx ebx eax |
2198 | pop esi edx ebx eax |
2227 | ;-------------------------------------- |
2199 | ;-------------------------------------- |
2228 | align 4 |
2200 | align 4 |
2229 | .exit.redraw: |
2201 | .exit.redraw: |
2230 | xor ecx, ecx |
2202 | xor ecx, ecx |
2231 | inc ecx |
2203 | inc ecx |
2232 | ret |
2204 | ret |
2233 | ;-------------------------------------- |
2205 | ;-------------------------------------- |
2234 | align 4 |
2206 | align 4 |
2235 | .exit.no_redraw: |
2207 | .exit.no_redraw: |
2236 | pop esi edx ebx eax |
2208 | pop esi edx ebx eax |
2237 | xor ecx, ecx |
2209 | xor ecx, ecx |
2238 | ret |
2210 | ret |
2239 | ;------------------------------------------------------------------------------ |
2211 | ;------------------------------------------------------------------------------ |
2240 | align 4 |
2212 | align 4 |
2241 | ;------------------------------------------------------------------------------ |
2213 | ;------------------------------------------------------------------------------ |
2242 | window._.draw_window_caption: ;//////////////////////////////////////////////// |
2214 | window._.draw_window_caption: ;//////////////////////////////////////////////// |
2243 | ;------------------------------------------------------------------------------ |
2215 | ;------------------------------------------------------------------------------ |
2244 | ;? |
2216 | ;? |
2245 | ;------------------------------------------------------------------------------ |
2217 | ;------------------------------------------------------------------------------ |
2246 | xor eax, eax |
2218 | xor eax, eax |
2247 | mov edx, [TASK_COUNT] |
2219 | mov edx, [TASK_COUNT] |
2248 | movzx edx, word[WIN_POS + edx * 2] |
2220 | movzx edx, word[WIN_POS + edx * 2] |
2249 | cmp edx, [CURRENT_TASK] |
2221 | cmp edx, [CURRENT_TASK] |
2250 | jne @f |
2222 | jne @f |
2251 | inc eax |
2223 | inc eax |
2252 | ;-------------------------------------- |
2224 | ;-------------------------------------- |
2253 | align 4 |
2225 | align 4 |
2254 | @@: |
2226 | @@: |
2255 | mov edx, [CURRENT_TASK] |
2227 | mov edx, [CURRENT_TASK] |
2256 | shl edx, 5 |
2228 | shl edx, 5 |
2257 | add edx, window_data |
2229 | add edx, window_data |
2258 | movzx ebx, [edx + WDATA.fl_wstyle] |
2230 | movzx ebx, [edx + WDATA.fl_wstyle] |
2259 | and bl, 0x0F |
2231 | and bl, 0x0F |
2260 | cmp bl, 3 |
2232 | cmp bl, 3 |
2261 | je .draw_caption_style_3 |
2233 | je .draw_caption_style_3 |
2262 | cmp bl, 4 |
2234 | cmp bl, 4 |
2263 | je .draw_caption_style_3 |
2235 | je .draw_caption_style_3 |
2264 | 2236 | ||
2265 | jmp .not_style_3 |
2237 | jmp .not_style_3 |
2266 | ;-------------------------------------- |
2238 | ;-------------------------------------- |
2267 | align 4 |
2239 | align 4 |
2268 | .draw_caption_style_3: |
2240 | .draw_caption_style_3: |
2269 | push edx |
2241 | push edx |
2270 | call drawwindow_IV_caption |
2242 | call drawwindow_IV_caption |
2271 | add esp, 4 |
2243 | add esp, 4 |
2272 | jmp .2 |
2244 | jmp .2 |
2273 | ;-------------------------------------- |
2245 | ;-------------------------------------- |
2274 | align 4 |
2246 | align 4 |
2275 | .not_style_3: |
2247 | .not_style_3: |
2276 | cmp bl, 2 |
2248 | cmp bl, 2 |
2277 | jne .not_style_2 |
2249 | jne .not_style_2 |
2278 | 2250 | ||
2279 | call drawwindow_III_caption |
2251 | call drawwindow_III_caption |
2280 | jmp .2 |
2252 | jmp .2 |
2281 | ;-------------------------------------- |
2253 | ;-------------------------------------- |
2282 | align 4 |
2254 | align 4 |
2283 | .not_style_2: |
2255 | .not_style_2: |
2284 | cmp bl, 0 |
2256 | cmp bl, 0 |
2285 | jne .2 |
2257 | jne .2 |
2286 | 2258 | ||
2287 | call drawwindow_I_caption |
2259 | call drawwindow_I_caption |
2288 | ;-------------------------------------- |
2260 | ;-------------------------------------- |
2289 | align 4 |
2261 | align 4 |
2290 | .2: |
2262 | .2: |
2291 | mov edi, [CURRENT_TASK] |
2263 | mov edi, [CURRENT_TASK] |
2292 | shl edi, 5 |
2264 | shl edi, 5 |
2293 | test [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION |
2265 | test [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION |
2294 | jz .exit |
2266 | jz .exit |
2295 | mov edx, [edi * 8 + SLOT_BASE + APPDATA.wnd_caption] |
2267 | mov edx, [edi * 8 + SLOT_BASE + APPDATA.wnd_caption] |
2296 | or edx, edx |
2268 | or edx, edx |
2297 | jz .exit |
2269 | jz .exit |
- | 2270 | ||
- | 2271 | mov ebp, [edi + window_data + WDATA.box.left - 2] |
|
2298 | 2272 | mov bp, word[edi + window_data + WDATA.box.top] |
|
2299 | movzx eax, [edi + window_data + WDATA.fl_wstyle] |
2273 | movzx eax, [edi + window_data + WDATA.fl_wstyle] |
2300 | and al, 0x0F |
2274 | and al, 0x0F |
2301 | cmp al, 3 |
2275 | cmp al, 3 |
2302 | je .skinned |
2276 | je .skinned |
2303 | cmp al, 4 |
2277 | cmp al, 4 |
2304 | je .skinned |
2278 | je .skinned |
2305 | 2279 | ||
2306 | jmp .not_skinned |
2280 | jmp .not_skinned |
2307 | ;-------------------------------------- |
2281 | ;-------------------------------------- |
2308 | align 4 |
2282 | align 4 |
2309 | .skinned: |
2283 | .skinned: |
2310 | mov ebp, [edi + window_data + WDATA.box.left - 2] |
- | |
2311 | mov bp, word[edi + window_data + WDATA.box.top] |
- | |
2312 | movzx eax, word[edi + window_data + WDATA.box.width] |
2284 | movzx eax, word[edi + window_data + WDATA.box.width] |
2313 | sub ax, [_skinmargins.left] |
2285 | sub ax, [_skinmargins.left] |
2314 | sub ax, [_skinmargins.right] |
2286 | sub ax, [_skinmargins.right] |
2315 | push edx |
- | |
2316 | cwde |
- | |
2317 | cdq |
- | |
2318 | mov ebx, 6 |
- | |
2319 | idiv ebx |
- | |
2320 | pop edx |
- | |
2321 | or eax, eax |
- | |
2322 | js .exit |
2287 | js .exit |
2323 | - | ||
2324 | mov esi, eax |
- | |
2325 | mov ebx, dword[_skinmargins.left - 2] |
2288 | mov ebx, dword[_skinmargins.left - 2] |
2326 | mov bx, word[_skinh] |
2289 | mov bx, word[_skinh] |
2327 | sub bx, [_skinmargins.bottom] |
2290 | sub bx, [_skinmargins.bottom] |
2328 | sub bx, [_skinmargins.top] |
2291 | sub bx, [_skinmargins.top] |
2329 | sar bx, 1 |
2292 | sar bx, 1 |
2330 | adc bx, 0 |
- | |
2331 | add bx, [_skinmargins.top] |
2293 | add bx, [_skinmargins.top] |
2332 | add bx, -3 |
2294 | sub bx, 8 |
2333 | add ebx, ebp |
- | |
2334 | jmp .dodraw |
2295 | jmp .dodraw |
2335 | ;-------------------------------------- |
2296 | ;-------------------------------------- |
2336 | align 4 |
2297 | align 4 |
2337 | .not_skinned: |
2298 | .not_skinned: |
2338 | cmp al, 1 |
2299 | cmp al, 1 |
2339 | je .exit |
2300 | je .exit |
2340 | - | ||
2341 | mov ebp, [edi + window_data + WDATA.box.left - 2] |
- | |
2342 | mov bp, word[edi + window_data + WDATA.box.top] |
- | |
2343 | movzx eax, word[edi + window_data + WDATA.box.width] |
2301 | movzx eax, word[edi + window_data + WDATA.box.width] |
2344 | sub eax, 16 |
2302 | sub eax, 16 |
2345 | push edx |
- | |
2346 | cwde |
- | |
2347 | cdq |
- | |
2348 | mov ebx, 6 |
- | |
2349 | idiv ebx |
- | |
2350 | pop edx |
- | |
2351 | or eax, eax |
- | |
2352 | js .exit |
2303 | js .exit |
- | 2304 | mov ebx, 80002h |
|
2353 | 2305 | .dodraw: |
|
- | 2306 | shr eax, 3 |
|
2354 | mov esi, eax |
2307 | mov esi, eax |
2355 | mov ebx, 0x00080007 |
- | |
2356 | add ebx, ebp |
2308 | add ebx, ebp |
2357 | ;-------------------------------------- |
- | |
2358 | align 4 |
- | |
2359 | .dodraw: |
- | |
2360 | mov ecx, [common_colours + 16] |
2309 | mov ecx, [common_colours + 16] |
- | 2310 | mov al, 1 |
|
- | 2311 | cmp byte [edx], 4 |
|
- | 2312 | jnc @f |
|
- | 2313 | mov al, [edx] |
|
- | 2314 | test al, al |
|
- | 2315 | jz .exit |
|
- | 2316 | inc edx |
|
- | 2317 | @@: |
|
- | 2318 | shl eax, 28 |
|
2361 | or ecx, 0x80000000 |
2319 | or ecx, eax |
2362 | xor edi, edi |
2320 | xor edi, edi |
2363 | call dtext_asciiz_esi |
2321 | call dtext |
2364 | ;-------------------------------------- |
- | |
2365 | align 4 |
- | |
2366 | .exit: |
2322 | .exit: |
2367 | ; call [draw_pointer] |
- | |
2368 | call __sys_draw_pointer |
2323 | jmp __sys_draw_pointer |
2369 | ret |
- | |
2370 | ;------------------------------------------------------------------------------ |
2324 | ;------------------------------------------------------------------------------ |
2371 | align 4 |
2325 | align 4 |
2372 | ;------------------------------------------------------------------------------ |
2326 | ;------------------------------------------------------------------------------ |
2373 | window._.draw_negative_box: ;////////////////////////////////////////////////// |
2327 | window._.draw_negative_box: ;////////////////////////////////////////////////// |
2374 | ;------------------------------------------------------------------------------ |
2328 | ;------------------------------------------------------------------------------ |
2375 | ;? Draw negative box |
2329 | ;? Draw negative box |
2376 | ;------------------------------------------------------------------------------ |
2330 | ;------------------------------------------------------------------------------ |
2377 | ;> edi = pointer to BOX struct |
2331 | ;> edi = pointer to BOX struct |
2378 | ;------------------------------------------------------------------------------ |
2332 | ;------------------------------------------------------------------------------ |
2379 | push eax ebx esi |
2333 | push eax ebx esi |
2380 | mov esi, 0x01000000 |
2334 | mov esi, 0x01000000 |
2381 | ;-------------------------------------- |
2335 | ;-------------------------------------- |
2382 | align 4 |
2336 | align 4 |
2383 | .1: |
2337 | .1: |
2384 | mov eax, [edi + BOX.left - 2] |
2338 | mov eax, [edi + BOX.left - 2] |
2385 | mov ax, word[edi + BOX.left] |
2339 | mov ax, word[edi + BOX.left] |
2386 | add ax, word[edi + BOX.width] |
2340 | add ax, word[edi + BOX.width] |
2387 | mov ebx, [edi + BOX.top - 2] |
2341 | mov ebx, [edi + BOX.top - 2] |
2388 | mov bx, word[edi + BOX.top] |
2342 | mov bx, word[edi + BOX.top] |
2389 | add bx, word[edi + BOX.height] |
2343 | add bx, word[edi + BOX.height] |
2390 | call draw_rectangle.forced |
2344 | call draw_rectangle.forced |
2391 | pop esi ebx eax |
2345 | pop esi ebx eax |
2392 | ret |
2346 | ret |
2393 | ;------------------------------------------------------------------------------ |
2347 | ;------------------------------------------------------------------------------ |
2394 | ;align 4 |
2348 | ;align 4 |
2395 | ;------------------------------------------------------------------------------ |
2349 | ;------------------------------------------------------------------------------ |
2396 | ;window._.end_moving__box: ;////////////////////////////////////////////////// |
2350 | ;window._.end_moving__box: ;////////////////////////////////////////////////// |
2397 | ;------------------------------------------------------------------------------ |
2351 | ;------------------------------------------------------------------------------ |
2398 | ;? Draw positive box |
2352 | ;? Draw positive box |
2399 | ;------------------------------------------------------------------------------ |
2353 | ;------------------------------------------------------------------------------ |
2400 | ;> edi = pointer to BOX struct |
2354 | ;> edi = pointer to BOX struct |
2401 | ;------------------------------------------------------------------------------ |
2355 | ;------------------------------------------------------------------------------ |
2402 | ; push eax ebx esi |
2356 | ; push eax ebx esi |
2403 | ; xor esi, esi |
2357 | ; xor esi, esi |
2404 | ; jmp window._.draw_negative_box.1 |
2358 | ; jmp window._.draw_negative_box.1 |
2405 | ;------------------------------------------------------------------------------ |
2359 | ;------------------------------------------------------------------------------ |
2406 | align 4 |
2360 | align 4 |
2407 | ;------------------------------------------------------------------------------ |
2361 | ;------------------------------------------------------------------------------ |
2408 | window._.get_rect: ;///////////////////////////////////////////////////// |
2362 | window._.get_rect: ;///////////////////////////////////////////////////// |
2409 | ;------------------------------------------------------------------------------ |
2363 | ;------------------------------------------------------------------------------ |
2410 | ;? |
2364 | ;? |
2411 | ;------------------------------------------------------------------------------ |
2365 | ;------------------------------------------------------------------------------ |
2412 | ;> ecx = pointer to RECT |
2366 | ;> ecx = pointer to RECT |
2413 | ;------------------------------------------------------------------------------ |
2367 | ;------------------------------------------------------------------------------ |
2414 | mov eax, [TASK_BASE] |
2368 | mov eax, [TASK_BASE] |
2415 | 2369 | ||
2416 | mov edx, [eax-twdw + WDATA.box.left] |
2370 | mov edx, [eax-twdw + WDATA.box.left] |
2417 | mov [ecx+RECT.left], edx |
2371 | mov [ecx+RECT.left], edx |
2418 | 2372 | ||
2419 | add edx, [eax-twdw + WDATA.box.width] |
2373 | add edx, [eax-twdw + WDATA.box.width] |
2420 | mov [ecx+RECT.right], edx |
2374 | mov [ecx+RECT.right], edx |
2421 | 2375 | ||
2422 | mov edx, [eax-twdw + WDATA.box.top] |
2376 | mov edx, [eax-twdw + WDATA.box.top] |
2423 | mov [ecx+RECT.top], edx |
2377 | mov [ecx+RECT.top], edx |
2424 | 2378 | ||
2425 | add edx, [eax-twdw + WDATA.box.height] |
2379 | add edx, [eax-twdw + WDATA.box.height] |
2426 | mov [ecx+RECT.bottom], edx |
2380 | mov [ecx+RECT.bottom], edx |
2427 | ret |
2381 | ret |
2428 | ;------------------------------------------------------------------------------->->->->=>=>>>>>>>>>>>>>>>>>>> |
2382 | ;------------------------------------------------------------------------------ |
- | 2383 | align 4 |
|
- | 2384 | ;------------------------------------------------------------------------------ |
|
- | 2385 | window._.redraw_top_wnd: ;//////////////////////////////////////////////////////// |
|
- | 2386 | ;------------------------------------------------------------------------------ |
|
- | 2387 | ;? redraw all windows one above the window |
|
- | 2388 | ;------------------------------------------------------------------------------ |
|
- | 2389 | ;> eax = left |
|
- | 2390 | ;> ebx = top |
|
- | 2391 | ;> ecx = right |
|
- | 2392 | ;> edx = bottom |
|
- | 2393 | ;> esi = process number |
|
- | 2394 | ;! corrupted edi |
|
- | 2395 | ;------------------------------------------------------------------------------ |
|
- | 2396 | push 0 |
|
- | 2397 | jmp window._.set_top_wnd.go |
|
- | 2398 | ||
- | 2399 | align 4 |
|
- | 2400 | ;------------------------------------------------------------------------------ |
|
- | 2401 | window._.set_top_wnd: ;//////////////////////////////////////////////////////// |
|
- | 2402 | ;------------------------------------------------------------------------------ |
|
- | 2403 | ;? call set_screen for all windows one above the window |
|
- | 2404 | ;------------------------------------------------------------------------------ |
|
- | 2405 | ;> eax = left |
|
- | 2406 | ;> ebx = top |
|
- | 2407 | ;> ecx = right |
|
- | 2408 | ;> edx = bottom |
|
- | 2409 | ;> esi = process number |
|
- | 2410 | ;! corrupted edi |
|
- | 2411 | ;------------------------------------------------------------------------------ |
|
- | 2412 | ||
- | 2413 | push 1 |
|
- | 2414 | .go: |
|
- | 2415 | push esi |
|
- | 2416 | pushfd |
|
- | 2417 | cli |
|
- | 2418 | ||
- | 2419 | push ebp |
|
- | 2420 | mov ebp, [TASK_COUNT] |
|
- | 2421 | cmp ebp, 1 |
|
- | 2422 | jbe .exit |
|
- | 2423 | ||
- | 2424 | shl esi, 5 |
|
- | 2425 | cmp [esi + window_data + WDATA.z_modif], ZPOS_ALWAYS_TOP |
|
- | 2426 | je .exit |
|
- | 2427 | ||
- | 2428 | push eax ;for num layout |
|
- | 2429 | push edx ecx ebx eax |
|
- | 2430 | ||
- | 2431 | movsx eax, byte [esi + window_data + WDATA.z_modif] |
|
- | 2432 | inc eax |
|
- | 2433 | mov dword[esp+10h], eax |
|
- | 2434 | ;-------------------------------------- |
|
- | 2435 | align 4 |
|
- | 2436 | .layout: |
|
- | 2437 | mov esi, 1 ; = num in window stack |
|
- | 2438 | mov ebp, [TASK_COUNT] |
|
- | 2439 | ;-------------------------------------- |
|
- | 2440 | align 4 |
|
- | 2441 | .next_window: |
|
- | 2442 | movzx edi, word[WIN_POS + esi * 2] |
|
- | 2443 | shl edi, 5 ;size of TASKDATA and WDATA = 32 bytes |
|
- | 2444 | ||
- | 2445 | cmp [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE |
|
- | 2446 | je .skip_window |
|
- | 2447 | ||
- | 2448 | add edi, window_data |
|
- | 2449 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
|
- | 2450 | jnz .skip_window |
|
- | 2451 | ||
- | 2452 | mov eax, [esp+10h] |
|
- | 2453 | cmp [edi + WDATA.z_modif], al |
|
- | 2454 | jne .skip_window |
|
- | 2455 | ||
- | 2456 | mov eax, [edi + WDATA.box.left] |
|
- | 2457 | cmp eax, [esp + RECT.right] |
|
- | 2458 | jg .skip_window |
|
- | 2459 | mov ebx, [edi + WDATA.box.top] |
|
- | 2460 | cmp ebx, [esp + RECT.bottom] |
|
- | 2461 | jg .skip_window |
|
- | 2462 | mov ecx, [edi + WDATA.box.width] |
|
- | 2463 | add ecx, eax |
|
- | 2464 | cmp ecx, [esp + RECT.left] |
|
- | 2465 | jl .skip_window |
|
- | 2466 | mov edx, [edi + WDATA.box.height] |
|
- | 2467 | add edx, ebx |
|
- | 2468 | cmp edx, [esp + RECT.top] |
|
- | 2469 | jl .skip_window |
|
- | 2470 | ||
- | 2471 | cmp eax, [esp + RECT.left] |
|
- | 2472 | jae @f |
|
- | 2473 | mov eax, [esp + RECT.left] |
|
- | 2474 | ;-------------------------------------- |
|
- | 2475 | align 4 |
|
- | 2476 | @@: |
|
- | 2477 | cmp ebx, [esp + RECT.top] |
|
- | 2478 | jae @f |
|
- | 2479 | mov ebx, [esp + RECT.top] |
|
- | 2480 | ;-------------------------------------- |
|
- | 2481 | align 4 |
|
- | 2482 | @@: |
|
- | 2483 | cmp ecx, [esp + RECT.right] |
|
- | 2484 | jbe @f |
|
- | 2485 | mov ecx, [esp + RECT.right] |
|
- | 2486 | ;-------------------------------------- |
|
- | 2487 | align 4 |
|
- | 2488 | @@: |
|
- | 2489 | cmp edx, [esp + RECT.bottom] |
|
- | 2490 | jbe @f |
|
- | 2491 | mov edx, [esp + RECT.bottom] |
|
- | 2492 | ;-------------------------------------- |
|
- | 2493 | align 4 |
|
- | 2494 | @@: |
|
- | 2495 | cmp dword[esp+32], 0 |
|
- | 2496 | je .set_fl_redraw |
|
- | 2497 | ||
- | 2498 | push esi |
|
- | 2499 | movzx esi, word[WIN_POS + esi * 2] |
|
- | 2500 | call window._.set_screen |
|
- | 2501 | pop esi |
|
- | 2502 | jmp @f |
|
- | 2503 | .set_fl_redraw: |
|
- | 2504 | mov [edi + WDATA.fl_redraw], 1 ;set redraw flag |
|
- | 2505 | @@: |
|
- | 2506 | ;-------------------------------------- |
|
- | 2507 | align 4 |
|
- | 2508 | .skip_window: |
|
- | 2509 | inc esi |
|
- | 2510 | dec ebp |
|
- | 2511 | jnz .next_window |
|
- | 2512 | ;-------------------------------------- |
|
- | 2513 | inc dword[esp+10h] |
|
- | 2514 | cmp byte[esp+10h], ZPOS_ALWAYS_TOP |
|
- | 2515 | jle .layout |
|
- | 2516 | ;------------------------------------- |
|
- | 2517 | ||
- | 2518 | pop eax ebx ecx edx |
|
- | 2519 | pop ebp ;del num layout |
|
- | 2520 | ;------------------------------------- |
|
- | 2521 | align 4 |
|
- | 2522 | .exit: |
|
- | 2523 | ||
- | 2524 | pop ebp |
|
- | 2525 | popfd |
|
- | 2526 | pop esi |
|
- | 2527 | ||
- | 2528 | add esp, 4 ;dword for 0/1 - set_screen/fl_redraw |
|
- | 2529 | ret->->->->=>=>>>>>>>>>>>>>>>>>>>>>>>>> |
|
- | 2530 | ||
- | 2531 | ||
- | 2532 |