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