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