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