Rev 523 | Rev 593 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
425 | victor | 1 | $Revision: 549 $ |
431 | serge | 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
3 | ;; ;; |
||
4 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
||
5 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
||
6 | ;; Distributed under terms of the GNU General Public License ;; |
||
7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
8 | |||
41 | mikedld | 9 | get_titlebar_height: ; edi = window draw_data pointer |
415 | heavyiron | 10 | mov al,[edi+WDATA.fl_wstyle] |
11 | and al,0x0F |
||
12 | cmp al,0x03 |
||
13 | jne @f |
||
14 | mov eax,[_skinh] |
||
15 | ret |
||
16 | @@: mov eax,21 |
||
17 | ret |
||
41 | mikedld | 18 | |
19 | get_rolledup_height: ; edi = window draw_data pointer |
||
415 | heavyiron | 20 | mov al,[edi+WDATA.fl_wstyle] |
21 | and al,0x0F |
||
22 | cmp al,0x03 |
||
23 | jne @f |
||
24 | mov eax,[_skinh] |
||
25 | add eax,3 |
||
26 | ret |
||
27 | @@: or al,al |
||
28 | jnz @f |
||
29 | mov eax,21 |
||
30 | ret |
||
31 | @@: mov eax,21+2 |
||
32 | ret |
||
41 | mikedld | 33 | |
34 | |||
1 | ha | 35 | setwindowdefaults: |
415 | heavyiron | 36 | pushad |
1 | ha | 37 | |
415 | heavyiron | 38 | xor eax,eax |
39 | mov ecx,WIN_STACK |
||
1 | ha | 40 | @@: |
415 | heavyiron | 41 | inc eax |
42 | add ecx,2 |
||
43 | mov [ecx+0x000],ax ; process no |
||
44 | mov [ecx+0x400],ax ; positions in stack |
||
45 | cmp ecx,WIN_POS-2 ; the more high, the more surface |
||
46 | jnz @b |
||
1 | ha | 47 | |
415 | heavyiron | 48 | popad |
49 | ret |
||
1 | ha | 50 | |
51 | |||
52 | |||
53 | ; eax = cx |
||
54 | ; ebx = cy |
||
55 | ; ecx = ex |
||
56 | ; edx = ey |
||
57 | ; идея: перебрать все окна, начиная с самого нижнего, |
||
112 | poddubny | 58 | ; и для попавших в заданную область |
59 | ; частей окон вызвать setscreen |
||
1 | ha | 60 | align 4 |
61 | calculatescreen: |
||
415 | heavyiron | 62 | pushad |
63 | pushfd |
||
64 | cli |
||
1 | ha | 65 | |
415 | heavyiron | 66 | push edx ecx ebx eax |
1 | ha | 67 | |
415 | heavyiron | 68 | mov esi, 1 |
69 | call setscreen |
||
112 | poddubny | 70 | |
415 | heavyiron | 71 | mov ebp, [TASK_COUNT] ; number of processes |
72 | cmp ebp, 1 |
||
73 | jbe .finish |
||
74 | align 4 |
||
1 | ha | 75 | .new_wnd: |
415 | heavyiron | 76 | movzx edi, word [WIN_POS + esi * 2] |
77 | shl edi, 5 |
||
102 | poddubny | 78 | |
415 | heavyiron | 79 | cmp [CURRENT_TASK+edi+TASKDATA.state], byte 9 |
80 | je .not_wnd |
||
102 | poddubny | 81 | |
415 | heavyiron | 82 | add edi, window_data |
83 | test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
||
84 | jnz .not_wnd |
||
112 | poddubny | 85 | |
415 | heavyiron | 86 | mov eax,[edi+WDATA.box.left] |
87 | cmp eax, [esp+RECT.right] |
||
88 | ja .out_of_bounds |
||
89 | mov ebx,[edi+WDATA.box.top] |
||
90 | cmp ebx, [esp+RECT.bottom] |
||
91 | ja .out_of_bounds |
||
92 | mov ecx,[edi+WDATA.box.width] |
||
93 | add ecx, eax |
||
94 | cmp ecx, [esp+RECT.left] |
||
95 | jb .out_of_bounds |
||
96 | mov edx,[edi+WDATA.box.height] |
||
97 | add edx, ebx |
||
98 | cmp edx, [esp+RECT.top] |
||
99 | jb .out_of_bounds |
||
112 | poddubny | 100 | |
117 | mario79 | 101 | cmp eax, [esp+RECT.left] |
415 | heavyiron | 102 | jae @f |
103 | mov eax, [esp+RECT.left] |
||
112 | poddubny | 104 | @@: |
117 | mario79 | 105 | cmp ebx, [esp+RECT.top] |
415 | heavyiron | 106 | jae @f |
107 | mov ebx, [esp+RECT.top] |
||
112 | poddubny | 108 | @@: |
117 | mario79 | 109 | cmp ecx, [esp+RECT.right] |
415 | heavyiron | 110 | jbe @f |
111 | mov ecx, [esp+RECT.right] |
||
112 | poddubny | 112 | @@: |
117 | mario79 | 113 | cmp edx, [esp+RECT.bottom] |
415 | heavyiron | 114 | jbe @f |
115 | mov edx, [esp+RECT.bottom] |
||
112 | poddubny | 116 | @@: |
117 | |||
415 | heavyiron | 118 | push esi |
119 | movzx esi, word [WIN_POS + esi * 2] |
||
120 | call setscreen |
||
121 | pop esi |
||
112 | poddubny | 122 | |
1 | ha | 123 | .not_wnd: |
112 | poddubny | 124 | .out_of_bounds: |
415 | heavyiron | 125 | inc esi |
126 | dec ebp |
||
127 | jnz .new_wnd |
||
1 | ha | 128 | .finish: |
112 | poddubny | 129 | |
117 | mario79 | 130 | pop eax ebx ecx edx |
112 | poddubny | 131 | |
415 | heavyiron | 132 | popfd |
133 | popad |
||
1 | ha | 134 | ret |
135 | |||
136 | |||
137 | |||
138 | virtual at esp |
||
415 | heavyiron | 139 | ff_x dd ? |
140 | ff_y dd ? |
||
112 | poddubny | 141 | ff_width dd ? |
1 | ha | 142 | ff_xsz dd ? |
143 | ff_ysz dd ? |
||
144 | ff_scale dd ? |
||
145 | end virtual |
||
146 | |||
147 | align 4 |
||
148 | ; резервирует место под окно заданного процесса |
||
149 | setscreen: |
||
150 | ; eax x start |
||
151 | ; ebx y start |
||
152 | ; ecx x end |
||
153 | ; edx y end |
||
154 | ; esi process number |
||
155 | pushad |
||
142 | diamond | 156 | ; \begin{diamond}[29.08.2006] |
415 | heavyiron | 157 | cmp esi, 1 |
158 | jz @f |
||
159 | mov edi, esi |
||
160 | shl edi, 5 |
||
161 | cmp [edi+window_data+WDATA.box.width], 0 |
||
162 | jnz @f |
||
163 | cmp [edi+window_data+WDATA.box.height], 0 |
||
164 | jz .ret |
||
142 | diamond | 165 | @@: |
166 | ; \end{diamond}[29.08.2006] |
||
415 | heavyiron | 167 | mov edi, esi ;;;word [esi*2+WIN_POS] |
168 | shl edi, 8 |
||
169 | add edi, SLOT_BASE ; address of random shaped window area |
||
170 | cmp [edi+APPDATA.wnd_shape], dword 0 |
||
171 | jne .free_form |
||
1 | ha | 172 | |
415 | heavyiron | 173 | ; get x&y size |
174 | sub ecx, eax |
||
175 | sub edx, ebx |
||
176 | inc ecx |
||
177 | inc edx |
||
1 | ha | 178 | |
415 | heavyiron | 179 | ; get WinMap start |
180 | mov edi, [ScreenWidth] ; screen_sx |
||
181 | inc edi |
||
182 | imul edi, ebx |
||
183 | add edi, eax |
||
184 | add edi, WinMapAddress |
||
1 | ha | 185 | |
186 | .new_y: |
||
415 | heavyiron | 187 | push ecx ; sx |
188 | push edx |
||
1 | ha | 189 | |
415 | heavyiron | 190 | mov edx, esi |
191 | align 4 |
||
1 | ha | 192 | .new_x: |
415 | heavyiron | 193 | mov byte [edi], dl |
194 | inc edi |
||
195 | dec ecx |
||
196 | jnz .new_x |
||
1 | ha | 197 | |
415 | heavyiron | 198 | pop edx |
199 | pop ecx |
||
200 | add edi, [ScreenWidth] |
||
201 | inc edi |
||
202 | sub edi, ecx |
||
203 | dec edx |
||
204 | jnz .new_y |
||
142 | diamond | 205 | .ret: |
1 | ha | 206 | popad |
207 | ret |
||
208 | .read_byte: |
||
209 | ;eax - address |
||
210 | ;esi - slot |
||
415 | heavyiron | 211 | push eax |
212 | push ebx |
||
213 | push ecx |
||
214 | push edx |
||
215 | mov edx,eax |
||
216 | mov eax,esi |
||
217 | lea ebx,[esp+12] |
||
218 | mov ecx,1 |
||
219 | call read_process_memory |
||
220 | pop edx |
||
221 | pop ecx |
||
222 | pop ebx |
||
223 | pop eax |
||
224 | ret |
||
1 | ha | 225 | .free_form: |
226 | |||
415 | heavyiron | 227 | ; for (y=0; y <= x_size; y++) |
228 | ; for (x=0; x <= x_size; x++) |
||
229 | ; if (shape[coord(x,y,scale)]==1) |
||
230 | ; set_pixel(x, y, process_number); |
||
1 | ha | 231 | |
415 | heavyiron | 232 | sub ecx, eax |
233 | sub edx, ebx |
||
234 | inc ecx |
||
235 | inc edx |
||
1 | ha | 236 | |
415 | heavyiron | 237 | push dword [edi+APPDATA.wnd_shape_scale] ; push scale first -> for loop |
1 | ha | 238 | |
415 | heavyiron | 239 | ; get WinMap start -> ebp |
240 | push eax |
||
241 | mov eax, [ScreenWidth] ; screen_sx |
||
242 | inc eax |
||
243 | imul eax, ebx |
||
244 | add eax, [esp] |
||
245 | add eax, WinMapAddress |
||
246 | mov ebp, eax |
||
1 | ha | 247 | |
415 | heavyiron | 248 | mov edi, [edi+APPDATA.wnd_shape] |
249 | pop eax |
||
1 | ha | 250 | |
415 | heavyiron | 251 | ; eax = x_start |
252 | ; ebx = y_start |
||
253 | ; ecx = x_size |
||
254 | ; edx = y_size |
||
255 | ; esi = process_number |
||
256 | ; edi = &shape |
||
257 | ; [scale] |
||
258 | push edx ecx ; for loop - x,y size |
||
112 | poddubny | 259 | |
415 | heavyiron | 260 | mov ecx, esi |
261 | shl ecx, 5 |
||
262 | mov edx, [window_data+ecx+WDATA.box.top] |
||
263 | push [window_data+ecx+WDATA.box.width] ; for loop - width |
||
264 | mov ecx, [window_data+ecx+WDATA.box.left] |
||
265 | sub ebx, edx |
||
266 | sub eax, ecx |
||
267 | push ebx eax ; for loop - x,y |
||
112 | poddubny | 268 | |
415 | heavyiron | 269 | add [ff_xsz], eax |
270 | add [ff_ysz], ebx |
||
112 | poddubny | 271 | |
415 | heavyiron | 272 | mov ebx, [ff_y] |
112 | poddubny | 273 | |
1 | ha | 274 | .ff_new_y: |
415 | heavyiron | 275 | mov edx, [ff_x] |
112 | poddubny | 276 | |
1 | ha | 277 | .ff_new_x: |
415 | heavyiron | 278 | ; -- body -- |
279 | mov ecx, [ff_scale] |
||
280 | mov eax, [ff_width] |
||
281 | inc eax |
||
282 | shr eax, cl |
||
283 | push ebx edx |
||
284 | shr ebx, cl |
||
285 | shr edx, cl |
||
286 | imul eax, ebx |
||
287 | add eax, edx |
||
288 | pop edx ebx |
||
289 | add eax, edi |
||
290 | call .read_byte |
||
291 | test al,al |
||
292 | jz @f |
||
293 | mov eax, esi |
||
294 | mov [ebp], al |
||
1 | ha | 295 | @@: |
415 | heavyiron | 296 | ; -- end body -- |
297 | inc ebp |
||
298 | inc edx |
||
299 | cmp edx, [ff_xsz] |
||
300 | jb .ff_new_x |
||
301 | sub ebp, [ff_xsz] |
||
302 | add ebp, [ff_x] |
||
303 | add ebp, [ScreenWidth] ; screen.x |
||
304 | inc ebp |
||
305 | inc ebx |
||
306 | cmp ebx, [ff_ysz] |
||
307 | jb .ff_new_y |
||
1 | ha | 308 | |
415 | heavyiron | 309 | add esp, 24 |
1 | ha | 310 | popad |
311 | ret |
||
312 | |||
313 | |||
314 | display_settings: |
||
315 | |||
316 | ; eax = 0 ; DISPLAY redraw |
||
317 | ; ebx = 0 ; all |
||
318 | ; |
||
319 | ; eax = 1 ; BUTTON type |
||
320 | ; ebx = 0 ; flat |
||
321 | ; ebx = 1 ; 3D |
||
322 | ; eax = 2 ; set WINDOW colours |
||
323 | ; ebx = pointer to table |
||
324 | ; ecx = number of bytes define |
||
325 | ; eax = 3 ; get WINDOW colours |
||
326 | ; ebx = pointer to table |
||
327 | ; ecx = number of bytes wanted |
||
328 | ; eax = 4 ; get skin height |
||
329 | ; input : nothing |
||
330 | ; output : eax = skin height in pixel |
||
41 | mikedld | 331 | ; eax = 5 ; get screen workarea |
332 | ; input : nothing |
||
333 | ; output : eax = [left]*65536+[right] |
||
334 | ; ebx = [top]*65536+[bottom] |
||
335 | ; eax = 6 ; set screen workarea |
||
336 | ; input : ecx = [left]*65536+[right] |
||
337 | ; edx = [top]*65536+[bottom] |
||
338 | ; output : nothing |
||
52 | mikedld | 339 | ; eax = 7 ; get skin margins |
340 | ; input : nothing |
||
341 | ; output : eax = [left]*65536+[right] |
||
342 | ; ebx = [top]*65536+[bottom] |
||
343 | ; eax = 8 ; set window skin |
||
344 | ; input : ecx = pointer to file info block |
||
345 | ; output : eax = FS error code |
||
1 | ha | 346 | |
347 | |||
348 | pushad |
||
349 | |||
415 | heavyiron | 350 | test eax, eax ; redraw display |
1 | ha | 351 | jnz dspl0 |
352 | test ebx, ebx |
||
353 | jnz dspl0 |
||
354 | cmp [windowtypechanged],dword 1 |
||
355 | jne dspl00 |
||
356 | mov [windowtypechanged],dword 0 |
||
41 | mikedld | 357 | redraw_screen_direct: |
1 | ha | 358 | mov [dlx],dword 0 |
359 | mov [dly],dword 0 |
||
381 | serge | 360 | mov eax,[ScreenWidth] |
1 | ha | 361 | mov [dlxe],eax |
381 | serge | 362 | mov eax,[ScreenHeight] |
1 | ha | 363 | mov [dlye],eax |
364 | mov eax,window_data |
||
365 | call redrawscreen |
||
366 | dspl00: |
||
367 | popad |
||
368 | ret |
||
369 | dspl0: |
||
370 | |||
371 | cmp eax,1 ; button type |
||
372 | jne dspl1 |
||
373 | and ebx,1 |
||
374 | cmp ebx,[buttontype] |
||
375 | je dspl9 |
||
376 | mov [buttontype],ebx |
||
377 | mov [windowtypechanged],dword 1 |
||
378 | dspl9: |
||
379 | popad |
||
380 | ret |
||
381 | dspl1: |
||
382 | |||
383 | cmp eax,2 ; set common window colours |
||
384 | jne no_com_colours |
||
385 | mov [windowtypechanged],dword 1 |
||
379 | serge | 386 | mov esi,[TASK_BASE] |
115 | poddubny | 387 | add esi,TASKDATA.mem_start |
54 | mikedld | 388 | add ebx,[esi] |
389 | mov esi,ebx |
||
1 | ha | 390 | mov edi,common_colours |
391 | and ecx,127 |
||
392 | cld |
||
393 | rep movsb |
||
394 | popad |
||
395 | ret |
||
396 | no_com_colours: |
||
397 | |||
398 | cmp eax,3 ; get common window colours |
||
399 | jne no_get_com |
||
379 | serge | 400 | mov esi,[TASK_BASE] |
115 | poddubny | 401 | add esi,TASKDATA.mem_start |
1 | ha | 402 | add ebx,[esi] |
403 | mov edi,ebx |
||
404 | mov esi,common_colours |
||
405 | and ecx,127 |
||
406 | cld |
||
407 | rep movsb |
||
408 | popad |
||
409 | ret |
||
410 | no_get_com: |
||
411 | |||
412 | cmp eax,4 ; get skin height |
||
413 | jne no_skin_height |
||
414 | popad |
||
415 | mov eax,[_skinh] |
||
416 | mov [esp+36],eax |
||
417 | ret |
||
418 | no_skin_height: |
||
419 | |||
415 | heavyiron | 420 | cmp eax,5 ; get screen workarea |
421 | jne no_get_workarea |
||
422 | popad |
||
423 | mov eax,[screen_workarea.left-2] |
||
424 | mov ax,word[screen_workarea.right] |
||
425 | mov [esp+36],eax |
||
426 | mov eax,[screen_workarea.top-2] |
||
427 | mov ax,word[screen_workarea.bottom] |
||
428 | mov [esp+24],eax |
||
429 | ret |
||
41 | mikedld | 430 | no_get_workarea: |
431 | |||
415 | heavyiron | 432 | cmp eax,6 ; set screen workarea |
433 | jne no_set_workarea |
||
434 | movsx eax,word[esp+16+2] |
||
435 | movsx ebx,word[esp+16] |
||
436 | cmp eax,ebx |
||
437 | jge .lp1 |
||
438 | or eax,eax;[ScreenWidth] |
||
439 | jl @f |
||
440 | mov [screen_workarea.left],eax |
||
441 | @@: cmp ebx,[ScreenWidth] |
||
442 | jg .lp1 |
||
443 | mov [screen_workarea.right],ebx |
||
444 | .lp1: movsx eax,word[esp+24+2] |
||
445 | movsx ebx,word[esp+24] |
||
446 | cmp eax,ebx |
||
447 | jge .lp2 |
||
448 | or eax,eax;[0xFE04] |
||
449 | jl @f |
||
450 | mov [screen_workarea.top],eax |
||
451 | @@: cmp ebx,[ScreenHeight] |
||
452 | jg .lp2 |
||
453 | mov [screen_workarea.bottom],ebx |
||
454 | .lp2: call repos_windows |
||
455 | mov eax, 0 |
||
456 | mov ebx, 0 |
||
457 | mov ecx, [ScreenWidth] |
||
458 | mov edx, [ScreenHeight] |
||
117 | mario79 | 459 | call calculatescreen |
460 | ; jmp redraw_screen_direct |
||
49 | mikedld | 461 | .exit: |
415 | heavyiron | 462 | popad |
463 | ret |
||
49 | mikedld | 464 | no_set_workarea: |
41 | mikedld | 465 | |
415 | heavyiron | 466 | cmp eax,7 ; get skin margins |
467 | jne no_get_skinmargins |
||
468 | popad |
||
469 | mov eax,dword[_skinmargins+0] |
||
470 | mov [esp+36],eax |
||
471 | mov eax,dword[_skinmargins+4] |
||
472 | mov [esp+24],eax |
||
473 | ret |
||
52 | mikedld | 474 | no_get_skinmargins: |
475 | |||
415 | heavyiron | 476 | cmp eax,8 ; set window skin |
477 | jne no_set_skin |
||
523 | diamond | 478 | call read_skin_file |
479 | mov [esp+32+36], eax |
||
480 | test eax, eax |
||
481 | jnz .ret |
||
482 | xor eax, eax |
||
483 | xor ebx, ebx |
||
484 | mov ecx, [ScreenWidth] |
||
485 | mov edx, [ScreenHeight] |
||
486 | call calculatescreen |
||
415 | heavyiron | 487 | jmp redraw_screen_direct |
523 | diamond | 488 | .ret: |
489 | popad |
||
490 | ret |
||
52 | mikedld | 491 | no_set_skin: |
492 | |||
49 | mikedld | 493 | popad |
494 | ret |
||
495 | |||
496 | |||
497 | repos_windows: |
||
415 | heavyiron | 498 | mov ecx,[TASK_COUNT] |
499 | mov edi, OS_BASE+0x20*2 |
||
381 | serge | 500 | mov byte[REDRAW_BACKGROUND],1 |
415 | heavyiron | 501 | dec ecx |
502 | jge @f |
||
503 | ret |
||
504 | @@: mov [edi+WDATA.fl_redraw],1 |
||
505 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
||
506 | jz .lp2 |
||
507 | mov eax,[screen_workarea.left] |
||
508 | mov [edi+WDATA.box.left],eax |
||
509 | sub eax,[screen_workarea.right] |
||
510 | neg eax |
||
511 | mov [edi+WDATA.box.width],eax |
||
512 | mov eax,[screen_workarea.top] |
||
513 | mov [edi+WDATA.box.top],eax |
||
514 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
||
515 | jnz .lp1 |
||
516 | sub eax,[screen_workarea.bottom] |
||
517 | neg eax |
||
518 | mov [edi+WDATA.box.height],eax |
||
150 | diamond | 519 | .lp1: |
389 | serge | 520 | |
415 | heavyiron | 521 | call set_window_clientbox |
522 | add edi,0x20 |
||
523 | loop @b |
||
524 | ret |
||
525 | .lp2: mov eax,[edi+WDATA.box.left] |
||
526 | add eax,[edi+WDATA.box.width] |
||
381 | serge | 527 | mov ebx,[ScreenWidth] |
117 | mario79 | 528 | ; inc ebx |
529 | cmp eax,ebx |
||
530 | jle .lp4 |
||
415 | heavyiron | 531 | mov eax,[edi+WDATA.box.width] |
117 | mario79 | 532 | sub eax,ebx |
533 | jle .lp3 |
||
415 | heavyiron | 534 | mov [edi+WDATA.box.width],ebx |
535 | .lp3: sub ebx,[edi+WDATA.box.width] |
||
536 | mov [edi+WDATA.box.left],ebx |
||
537 | .lp4: mov eax,[edi+WDATA.box.top] |
||
538 | add eax,[edi+WDATA.box.height] |
||
381 | serge | 539 | mov ebx,[ScreenHeight] |
117 | mario79 | 540 | ; inc ebx |
541 | cmp eax,ebx |
||
542 | jle .lp6 |
||
415 | heavyiron | 543 | mov eax,[edi+WDATA.box.height] |
117 | mario79 | 544 | sub eax,ebx |
545 | jle .lp5 |
||
415 | heavyiron | 546 | mov [edi+WDATA.box.height],ebx |
547 | .lp5: sub ebx,[edi+WDATA.box.height] |
||
548 | mov [edi+WDATA.box.top],ebx |
||
549 | .lp6: jmp .lp1 |
||
41 | mikedld | 550 | |
1 | ha | 551 | uglobal |
552 | common_colours: |
||
553 | times 128 db 0x0 |
||
554 | endg |
||
555 | |||
556 | |||
557 | |||
558 | |||
559 | check_window_position: |
||
560 | |||
415 | heavyiron | 561 | pushad ; window inside screen ? |
1 | ha | 562 | |
115 | poddubny | 563 | movzx eax,word [edi+WDATA.box.left] |
564 | movzx ebx,word [edi+WDATA.box.top] |
||
565 | movzx ecx,word [edi+WDATA.box.width] |
||
566 | movzx edx,word [edi+WDATA.box.height] |
||
1 | ha | 567 | |
415 | heavyiron | 568 | mov esi,ecx ; check x pos |
1 | ha | 569 | add esi,eax |
381 | serge | 570 | cmp esi,[ScreenWidth] |
1 | ha | 571 | jbe x_pos_ok |
115 | poddubny | 572 | mov [edi+WDATA.box.left],dword 0 |
1 | ha | 573 | xor eax, eax |
574 | x_pos_ok: |
||
575 | |||
415 | heavyiron | 576 | mov esi,edx ; check y pos |
1 | ha | 577 | add esi,ebx |
381 | serge | 578 | cmp esi,[ScreenHeight] |
1 | ha | 579 | jbe y_pos_ok |
115 | poddubny | 580 | mov [edi+WDATA.box.top],dword 0 |
1 | ha | 581 | mov ebx,0 |
582 | y_pos_ok: |
||
583 | |||
415 | heavyiron | 584 | mov esi,ecx ; check x size |
1 | ha | 585 | add esi,eax |
381 | serge | 586 | cmp esi,[ScreenWidth] |
1 | ha | 587 | jbe x_size_ok |
381 | serge | 588 | mov ecx,[ScreenWidth] |
115 | poddubny | 589 | mov [edi+WDATA.box.width],ecx |
1 | ha | 590 | x_size_ok: |
591 | |||
415 | heavyiron | 592 | mov esi,edx ; check y size |
1 | ha | 593 | add esi,ebx |
381 | serge | 594 | cmp esi,[ScreenHeight] |
1 | ha | 595 | jbe y_size_ok |
381 | serge | 596 | mov edx,[ScreenHeight] |
115 | poddubny | 597 | mov [edi+WDATA.box.height],edx |
1 | ha | 598 | y_size_ok: |
599 | |||
600 | popad |
||
601 | |||
602 | ret |
||
603 | |||
604 | |||
605 | uglobal |
||
606 | new_window_starting dd 0 |
||
607 | endg |
||
608 | |||
609 | |||
610 | sys_window_mouse: |
||
611 | |||
612 | push eax |
||
613 | |||
115 | poddubny | 614 | mov eax,[timer_ticks] |
1 | ha | 615 | cmp [new_window_starting],eax |
415 | heavyiron | 616 | jb swml1 |
1 | ha | 617 | |
381 | serge | 618 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
619 | mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
||
1 | ha | 620 | |
621 | mov [new_window_starting],eax |
||
622 | |||
623 | swml1: |
||
624 | |||
625 | pop eax |
||
626 | |||
627 | ret |
||
628 | |||
629 | |||
630 | |||
631 | |||
114 | mikedld | 632 | drawwindow_I_caption: |
633 | |||
415 | heavyiron | 634 | mov ecx,[edx+WDATA.cl_titlebar] ; grab bar |
635 | push ecx |
||
636 | mov esi,edx |
||
637 | mov edx,[esi+WDATA.box.top] |
||
638 | add edx,1 |
||
639 | mov ebx,[esi+WDATA.box.top] |
||
640 | add ebx,21 |
||
641 | mov eax,[esi+WDATA.box.top] |
||
642 | add eax,[esi+WDATA.box.height] |
||
643 | cmp ebx,eax |
||
644 | jb .wdsizeok |
||
645 | mov ebx,eax |
||
114 | mikedld | 646 | .wdsizeok: |
415 | heavyiron | 647 | push ebx |
114 | mikedld | 648 | .drwi: |
415 | heavyiron | 649 | mov ebx,edx |
650 | shl ebx,16 |
||
651 | add ebx,edx |
||
652 | mov eax,[esi+WDATA.box.left] |
||
653 | inc eax |
||
654 | shl eax,16 |
||
655 | add eax,[esi+WDATA.box.left] |
||
656 | add eax,[esi+WDATA.box.width] |
||
657 | sub eax,1 |
||
658 | push edx |
||
659 | mov edx,0x80000000 |
||
660 | mov ecx,[esi+WDATA.cl_titlebar] |
||
661 | and ecx,edx |
||
662 | cmp ecx,edx |
||
663 | jnz .nofa |
||
664 | mov ecx,[esi+WDATA.cl_titlebar] |
||
665 | sub ecx,0x00040404 |
||
666 | mov [esi+WDATA.cl_titlebar],ecx |
||
667 | and ecx,0x00ffffff |
||
668 | jmp .faj |
||
114 | mikedld | 669 | .nofa: |
415 | heavyiron | 670 | mov ecx,[esi+WDATA.cl_titlebar] |
671 | and ecx,0x00ffffff |
||
114 | mikedld | 672 | .faj: |
415 | heavyiron | 673 | pop edx |
674 | mov edi,0 |
||
675 | call [draw_line] |
||
676 | inc edx |
||
677 | cmp edx,[esp] |
||
678 | jb .drwi |
||
679 | add esp,4 |
||
680 | pop ecx |
||
681 | mov [esi+WDATA.cl_titlebar],ecx |
||
1 | ha | 682 | |
415 | heavyiron | 683 | ret |
114 | mikedld | 684 | |
685 | |||
686 | drawwindow_I: |
||
687 | |||
415 | heavyiron | 688 | pushad |
689 | or [edx+WDATA.fl_wdrawn], 4 |
||
114 | mikedld | 690 | |
415 | heavyiron | 691 | mov esi,[edx+WDATA.cl_frames] ; rectangle |
692 | mov eax,[edx+WDATA.box.left] |
||
693 | shl eax,16 |
||
694 | add eax,[edx+WDATA.box.left] |
||
695 | add eax,[edx+WDATA.box.width] |
||
696 | mov ebx,[edx+WDATA.box.top] |
||
697 | shl ebx,16 |
||
698 | add ebx,[edx+WDATA.box.top] |
||
699 | add ebx,[edx+WDATA.box.height] |
||
700 | call draw_rectangle |
||
114 | mikedld | 701 | |
415 | heavyiron | 702 | and [edx+WDATA.fl_wdrawn], not 4 |
703 | test [edx+WDATA.fl_wdrawn], 2 |
||
704 | jz @f |
||
705 | call drawwindowframes2 |
||
186 | diamond | 706 | @@: |
707 | |||
415 | heavyiron | 708 | call drawwindow_I_caption |
114 | mikedld | 709 | |
415 | heavyiron | 710 | mov edx,[esi+WDATA.box.top] ; inside work area |
711 | add edx,21+5 |
||
712 | mov ebx,[esi+WDATA.box.top] |
||
713 | add ebx,[esi+WDATA.box.height] |
||
714 | cmp edx,ebx |
||
715 | jg noinside |
||
716 | mov eax,1 |
||
717 | mov ebx,21 |
||
718 | mov ecx,[esi+WDATA.box.width] |
||
719 | mov edx,[esi+WDATA.box.height] |
||
720 | mov edi,[esi+WDATA.cl_workarea] |
||
303 | mikedld | 721 | test edi,0x40000000 |
722 | jnz noinside |
||
415 | heavyiron | 723 | call [drawbar] |
1 | ha | 724 | noinside: |
725 | |||
415 | heavyiron | 726 | popad |
1 | ha | 727 | |
415 | heavyiron | 728 | ret |
1 | ha | 729 | |
730 | |||
731 | draw_rectangle: |
||
732 | |||
733 | r_eax equ [esp+28] ; x start |
||
734 | r_ax equ [esp+30] ; x end |
||
735 | r_ebx equ [esp+16] ; y start |
||
736 | r_bx equ [esp+18] ; y end |
||
737 | ;esi ; color |
||
738 | |||
415 | heavyiron | 739 | pushad |
1 | ha | 740 | |
415 | heavyiron | 741 | mov ecx,esi ; yb,xb -> yb,xe |
742 | mov eax, r_eax |
||
743 | rol eax, 16 |
||
744 | mov ebx,r_ebx |
||
745 | shl ebx,16 |
||
746 | mov bx,r_ebx |
||
747 | xor edi, edi |
||
748 | call [draw_line] |
||
1 | ha | 749 | |
415 | heavyiron | 750 | mov ebx,r_bx ; ye,xb -> ye,xe |
751 | shl ebx,16 |
||
752 | mov bx,r_bx |
||
753 | call [draw_line] |
||
1 | ha | 754 | |
415 | heavyiron | 755 | mov ecx,esi ; ya,xa -> ye,xa |
756 | mov eax,r_eax |
||
757 | shl eax,16 |
||
758 | mov ax,r_eax |
||
759 | mov ebx,r_ebx |
||
760 | shl ebx,16 |
||
761 | mov bx,r_bx |
||
762 | mov edi,0 |
||
763 | call [draw_line] |
||
1 | ha | 764 | |
415 | heavyiron | 765 | mov eax,r_ax ; ya,xe -> ye,xe |
766 | shl eax,16 |
||
767 | mov ax,r_ax |
||
768 | call [draw_line] |
||
1 | ha | 769 | |
415 | heavyiron | 770 | popad |
771 | ret |
||
1 | ha | 772 | |
773 | |||
114 | mikedld | 774 | drawwindow_III_caption: |
1 | ha | 775 | |
415 | heavyiron | 776 | mov ecx,[edx+WDATA.cl_titlebar] ; GRAB BAR |
777 | push ecx |
||
778 | mov esi,edx |
||
779 | mov edx,[esi+WDATA.box.top] |
||
780 | add edx,4 |
||
781 | mov ebx,[esi+WDATA.box.top] |
||
782 | add ebx,20 |
||
783 | mov eax,[esi+WDATA.box.top] |
||
784 | add eax,[esi+WDATA.box.height] |
||
785 | cmp ebx,eax |
||
786 | jb .wdsizeok |
||
787 | mov ebx,eax |
||
114 | mikedld | 788 | .wdsizeok: |
415 | heavyiron | 789 | push ebx |
114 | mikedld | 790 | .drwi: |
415 | heavyiron | 791 | mov ebx,edx |
792 | shl ebx,16 |
||
793 | add ebx,edx |
||
794 | mov eax,[esi+WDATA.box.left] |
||
795 | shl eax,16 |
||
796 | add eax,[esi+WDATA.box.left] |
||
797 | add eax,[esi+WDATA.box.width] |
||
798 | add eax,4*65536-4 |
||
799 | mov ecx,[esi+WDATA.cl_titlebar] |
||
800 | test ecx,0x40000000 |
||
801 | jz .nofa |
||
802 | add ecx,0x040404 |
||
114 | mikedld | 803 | .nofa: |
415 | heavyiron | 804 | test ecx,0x80000000 |
805 | jz .nofa2 |
||
806 | sub ecx,0x040404 |
||
114 | mikedld | 807 | .nofa2: |
415 | heavyiron | 808 | mov [esi+WDATA.cl_titlebar],ecx |
809 | and ecx,0xffffff |
||
810 | xor edi, edi |
||
811 | call [draw_line] |
||
812 | inc edx |
||
813 | cmp edx,[esp] |
||
814 | jb .drwi |
||
815 | add esp,4 |
||
816 | pop ecx |
||
817 | mov [esi+WDATA.cl_titlebar],ecx |
||
1 | ha | 818 | |
415 | heavyiron | 819 | ret |
114 | mikedld | 820 | |
821 | |||
822 | drawwindow_III: |
||
823 | |||
415 | heavyiron | 824 | pushad |
114 | mikedld | 825 | |
415 | heavyiron | 826 | mov edi,edx ; RECTANGLE |
827 | mov eax,[edi+WDATA.box.left] |
||
828 | shl eax,16 |
||
117 | mario79 | 829 | mov ax, word [edi+WDATA.box.left] |
830 | add ax, word [edi+WDATA.box.width] |
||
415 | heavyiron | 831 | mov ebx,[edi+WDATA.box.top] |
832 | shl ebx,16 |
||
117 | mario79 | 833 | mov bx, word [edi+WDATA.box.top] |
834 | add bx, word [edi+WDATA.box.height] |
||
415 | heavyiron | 835 | mov esi,[edi+WDATA.cl_frames] |
836 | shr esi,1 |
||
837 | and esi,0x007f7f7f |
||
838 | push esi |
||
839 | or [edi+WDATA.fl_wdrawn], 4 |
||
840 | call draw_rectangle |
||
841 | and [edi+WDATA.fl_wdrawn], not 4 |
||
842 | test [edi+WDATA.fl_wdrawn], 2 |
||
843 | jz @f |
||
844 | call drawwindowframes2 |
||
186 | diamond | 845 | @@: |
415 | heavyiron | 846 | mov ecx,3 |
114 | mikedld | 847 | dw3l: |
415 | heavyiron | 848 | add eax,1*65536-1 |
849 | add ebx,1*65536-1 |
||
850 | mov esi,[edi+WDATA.cl_frames] |
||
851 | call draw_rectangle |
||
852 | dec ecx |
||
853 | jnz dw3l |
||
854 | pop esi |
||
855 | add eax,1*65536-1 |
||
856 | add ebx,1*65536-1 |
||
857 | call draw_rectangle |
||
114 | mikedld | 858 | |
415 | heavyiron | 859 | call drawwindow_III_caption |
114 | mikedld | 860 | |
415 | heavyiron | 861 | mov edx,[esi+WDATA.box.top] ; WORK AREA |
862 | add edx,21+5 |
||
863 | mov ebx,[esi+WDATA.box.top] |
||
864 | add ebx,[esi+WDATA.box.height] |
||
865 | cmp edx,ebx |
||
866 | jg noinside2 |
||
867 | mov eax,5 |
||
868 | mov ebx,20 |
||
869 | mov ecx,[esi+WDATA.box.width] |
||
870 | mov edx,[esi+WDATA.box.height] |
||
871 | sub ecx,4 |
||
872 | sub edx,4 |
||
873 | mov edi,[esi+WDATA.cl_workarea] |
||
303 | mikedld | 874 | test edi,0x40000000 |
875 | jnz noinside2 |
||
415 | heavyiron | 876 | call [drawbar] |
1 | ha | 877 | noinside2: |
878 | |||
415 | heavyiron | 879 | popad |
1 | ha | 880 | |
415 | heavyiron | 881 | ret |
1 | ha | 882 | |
883 | |||
884 | |||
885 | ; activate window |
||
886 | align 4 |
||
887 | windowactivate: |
||
888 | |||
415 | heavyiron | 889 | ; esi = abs mem position in stack 0xC400+ |
1 | ha | 890 | |
415 | heavyiron | 891 | pushad |
102 | poddubny | 892 | |
893 | ; if type of current active window is 3, |
||
894 | ; it must be redrawn |
||
415 | heavyiron | 895 | mov eax, [TASK_COUNT] |
896 | movzx eax, word [WIN_POS + eax*2] |
||
897 | shl eax, 5 |
||
898 | add eax, window_data |
||
899 | mov ebx, [eax + WDATA.cl_workarea] |
||
900 | and ebx, 0x0f000000 |
||
901 | cmp ebx, 0x03000000 |
||
549 | spraid | 902 | je .set_WDATA_fl_redraw ; for 3 and 4 style |
903 | cmp ebx, 0x04000000 |
||
904 | je .set_WDATA_fl_redraw |
||
905 | jmp @f |
||
906 | .set_WDATA_fl_redraw: |
||
415 | heavyiron | 907 | mov [eax + WDATA.fl_redraw], byte 1 |
102 | poddubny | 908 | @@: |
909 | |||
415 | heavyiron | 910 | push esi |
1 | ha | 911 | movzx eax, word [esi] ; ax <- process no |
380 | serge | 912 | movzx eax, word [WIN_STACK+eax*2] ; ax <- position in window stack |
1 | ha | 913 | |
415 | heavyiron | 914 | xor esi, esi ; drop others |
1 | ha | 915 | waloop: |
415 | heavyiron | 916 | cmp esi, dword [TASK_COUNT] |
917 | jae wacont |
||
918 | inc esi |
||
919 | lea edi, [WIN_STACK + esi*2] |
||
920 | mov bx, [edi] ; position of the current process |
||
921 | cmp bx, ax |
||
922 | jbe @f |
||
923 | dec bx ; upper? => drop! |
||
924 | mov [edi], bx |
||
1 | ha | 925 | @@: |
415 | heavyiron | 926 | jmp waloop |
1 | ha | 927 | wacont: |
415 | heavyiron | 928 | ; set to no 1 |
929 | pop esi ; esi = pointer at 0xC400 |
||
1 | ha | 930 | |
931 | movzx eax, word [esi] |
||
415 | heavyiron | 932 | mov bx, [TASK_COUNT] ; number of processes |
933 | mov [WIN_STACK+eax*2], bx ; this is the last (and the upper) |
||
1 | ha | 934 | |
415 | heavyiron | 935 | ; update on screen -window stack |
936 | xor esi, esi |
||
1 | ha | 937 | waloop2: |
415 | heavyiron | 938 | mov edi, [TASK_COUNT] |
939 | cmp esi, edi |
||
940 | jae wacont2 |
||
941 | inc esi |
||
942 | movzx ebx, word [esi*2 + WIN_STACK] |
||
943 | mov [ebx*2 + WIN_POS], si |
||
944 | jmp waloop2 |
||
1 | ha | 945 | wacont2: |
479 | kastigar | 946 | mov [KEY_COUNT], byte 0 ; empty keyboard buffer |
947 | mov [BTN_COUNT], byte 0 ; empty button buffer |
||
948 | mov [MOUSE_SCROLL_H], word 0 ; zero mouse z-index |
||
949 | mov [MOUSE_SCROLL_V], word 0 ; zero mouse z-index |
||
415 | heavyiron | 950 | popad |
951 | ret |
||
1 | ha | 952 | |
953 | |||
954 | ; check if window is necessary to draw |
||
955 | |||
956 | checkwindowdraw: |
||
957 | |||
415 | heavyiron | 958 | ; edi = position in window_data+ |
1 | ha | 959 | |
415 | heavyiron | 960 | mov eax, [edi + WDATA.cl_workarea] |
961 | and eax, 0x0f000000 |
||
962 | cmp eax, 0x03000000 |
||
963 | je .return_yes ; window type 3 |
||
549 | spraid | 964 | cmp eax, 0x04000000 |
965 | je .return_yes ; window type 4 |
||
102 | poddubny | 966 | |
415 | heavyiron | 967 | mov esi, edi |
968 | sub esi, window_data |
||
969 | shr esi, 5 |
||
1 | ha | 970 | |
415 | heavyiron | 971 | ; esi = process number |
1 | ha | 972 | |
415 | heavyiron | 973 | movzx eax, word [WIN_STACK + esi * 2] ; get value of the curr process |
974 | lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 |
||
1 | ha | 975 | |
415 | heavyiron | 976 | push esi |
1 | ha | 977 | |
978 | .new_check: |
||
979 | |||
415 | heavyiron | 980 | pop esi |
981 | add esi, 2 |
||
982 | push esi |
||
1 | ha | 983 | |
415 | heavyiron | 984 | mov eax, [TASK_COUNT] |
985 | lea eax, word [WIN_POS + eax * 2] ; number of the upper window |
||
1 | ha | 986 | |
415 | heavyiron | 987 | cmp esi, eax |
988 | ja .all_wnds_to_top |
||
1 | ha | 989 | |
415 | heavyiron | 990 | movzx eax, word [esi] |
991 | shl eax, 5 |
||
992 | cmp [CURRENT_TASK + eax + TASKDATA.state], byte 9 |
||
993 | je .new_check ; skip dead windows |
||
1 | ha | 994 | |
415 | heavyiron | 995 | lea esi, [eax+window_data] |
102 | poddubny | 996 | |
415 | heavyiron | 997 | mov ebx, [edi+WDATA.box.top] ; y0 |
998 | mov edx, [edi+WDATA.box.height] |
||
999 | add edx, ebx ; y0e |
||
1 | ha | 1000 | |
415 | heavyiron | 1001 | mov ecx, [esi+WDATA.box.top] ; y ; y check |
1002 | cmp ecx, edx |
||
1003 | jae .new_check ; y < y0e |
||
1004 | mov eax, [esi+WDATA.box.height] |
||
1005 | add ecx, eax ; ye |
||
1006 | cmp ebx, ecx ; y0 >= ye |
||
1007 | ja .new_check |
||
1 | ha | 1008 | |
415 | heavyiron | 1009 | mov eax, [edi+WDATA.box.left] ; x0 |
1010 | mov ecx, [edi+WDATA.box.width] |
||
1011 | add ecx, eax ; x0e |
||
1 | ha | 1012 | |
415 | heavyiron | 1013 | mov edx, [esi+WDATA.box.left] ; x ; x check |
1014 | cmp edx, ecx |
||
1015 | jae .new_check ; x < x0e |
||
1016 | mov ecx, [esi+WDATA.box.width] |
||
1017 | add edx, ecx |
||
1018 | cmp eax, edx |
||
1019 | ja .new_check |
||
1 | ha | 1020 | |
415 | heavyiron | 1021 | pop esi |
102 | poddubny | 1022 | .return_yes: |
415 | heavyiron | 1023 | mov ecx,1 ; overlap some window |
1024 | ret |
||
1 | ha | 1025 | |
1026 | .all_wnds_to_top: |
||
1027 | |||
415 | heavyiron | 1028 | pop esi |
1 | ha | 1029 | |
415 | heavyiron | 1030 | xor ecx, ecx ; passed all windows to top |
1031 | ret |
||
1 | ha | 1032 | |
1033 | |||
1034 | |||
1035 | |||
1036 | waredraw: ; if redraw necessary at activate |
||
1037 | |||
415 | heavyiron | 1038 | pushad |
1 | ha | 1039 | |
415 | heavyiron | 1040 | call checkwindowdraw ; draw window on activation ? |
1041 | test ecx, ecx |
||
1042 | jz .do_not_draw |
||
1 | ha | 1043 | |
415 | heavyiron | 1044 | popad |
1045 | mov [MOUSE_DOWN], byte 1 ; do draw mouse |
||
1046 | call windowactivate |
||
1 | ha | 1047 | |
415 | heavyiron | 1048 | ; update screen info |
1049 | pushad |
||
1050 | mov edi, [TASK_COUNT] ; the last process (number) |
||
1051 | movzx esi, word [WIN_POS + edi * 2] |
||
1052 | shl esi, 5 |
||
1053 | add esi, window_data |
||
1 | ha | 1054 | |
415 | heavyiron | 1055 | ; coordinates of the upper window |
1056 | mov eax, [esi + WDATA.box.left] ; cx |
||
1057 | mov ebx, [esi + WDATA.box.top] ; cy |
||
1058 | mov ecx, [esi + WDATA.box.width] ; sx |
||
117 | mario79 | 1059 | mov edx, [esi + WDATA.box.height] ; sy |
1 | ha | 1060 | |
415 | heavyiron | 1061 | add ecx, eax ; ecx = x_end |
1062 | add edx, ebx ; edx = y_end |
||
1 | ha | 1063 | |
415 | heavyiron | 1064 | mov edi, [TASK_COUNT] |
1065 | movzx esi, word [WIN_POS + edi * 2] |
||
1066 | call setscreen |
||
1067 | popad |
||
1 | ha | 1068 | |
117 | mario79 | 1069 | mov [edi + WDATA.fl_redraw], 1 ; redraw flag for app |
415 | heavyiron | 1070 | mov [MOUSE_DOWN],byte 0 ; mouse down checks |
1 | ha | 1071 | |
415 | heavyiron | 1072 | ret |
1 | ha | 1073 | |
1074 | .do_not_draw: |
||
1075 | |||
415 | heavyiron | 1076 | popad |
1 | ha | 1077 | |
415 | heavyiron | 1078 | call windowactivate |
1079 | mov [MOUSE_DOWN],byte 0 ; mouse down checks |
||
1080 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
||
1081 | mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
||
1082 | ret |
||
1 | ha | 1083 | |
1084 | |||
105 | poddubny | 1085 | ; eax = window number on screen |
1086 | ; corrupts registers and [dl*] |
||
1087 | minimize_window: |
||
415 | heavyiron | 1088 | movzx eax, word [WIN_POS+eax*2] |
1089 | shl eax, 5 |
||
1090 | add eax, window_data |
||
1091 | test [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
||
1092 | jnz .skip_redrawings |
||
1093 | pushfd |
||
1094 | cli |
||
1095 | or [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
||
1096 | mov edi, eax |
||
1097 | ;call calculatescreen |
||
1098 | mov eax, [edi+WDATA.box.left] |
||
1099 | mov [dlx], eax |
||
1100 | mov ecx, eax |
||
1101 | add ecx, [edi+WDATA.box.width] |
||
1102 | mov [dlxe], ecx |
||
1103 | mov ebx, [edi+WDATA.box.top] |
||
1104 | mov [dly], ebx |
||
1105 | mov edx, ebx |
||
1106 | add edx, [edi+WDATA.box.height] |
||
1107 | mov [dlye], edx |
||
1108 | call calculatescreen |
||
1109 | xor esi, esi |
||
1110 | xor eax, eax |
||
1111 | call redrawscreen |
||
1112 | popfd |
||
105 | poddubny | 1113 | .skip_redrawings: |
415 | heavyiron | 1114 | ret |
105 | poddubny | 1115 | |
1116 | ; eax = window number on screen |
||
1117 | ; corrupts registers and [dl*] |
||
1118 | restore_minimized_window: |
||
415 | heavyiron | 1119 | pushfd |
1120 | cli |
||
1121 | movzx esi, word [WIN_POS+eax*2] |
||
1122 | mov edi, esi |
||
1123 | shl edi, 5 |
||
1124 | add edi, window_data |
||
1125 | test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
||
1126 | jz .skip_redrawings |
||
1127 | mov [edi+WDATA.fl_redraw], 1 |
||
1128 | and [edi+WDATA.fl_wstate], not WSTATE_MINIMIZED |
||
1129 | cmp eax, [TASK_COUNT] ; the uppermost window |
||
1130 | jnz .no_uppermost |
||
1131 | mov eax, [edi+WDATA.box.left] |
||
1132 | mov ebx, [edi+WDATA.box.top] |
||
1133 | mov ecx, eax |
||
1134 | mov edx, ebx |
||
1135 | add ecx, [edi+WDATA.box.width] |
||
1136 | add edx, [edi+WDATA.box.height] |
||
1137 | call setscreen |
||
1138 | jmp .done |
||
105 | poddubny | 1139 | .no_uppermost: |
415 | heavyiron | 1140 | mov eax, [edi+WDATA.box.left] |
1141 | mov ebx, [edi+WDATA.box.top] |
||
1142 | mov ecx, eax |
||
1143 | mov edx, ebx |
||
1144 | add ecx, [edi+WDATA.box.width] |
||
1145 | add edx, [edi+WDATA.box.height] |
||
1146 | call calculatescreen |
||
105 | poddubny | 1147 | .done: |
415 | heavyiron | 1148 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
105 | poddubny | 1149 | .skip_redrawings: |
415 | heavyiron | 1150 | popfd |
1151 | ret |
||
105 | poddubny | 1152 | |
1153 | |||
1 | ha | 1154 | iglobal |
1155 | window_moving db 'K : Window - move/resize',13,10,0 |
||
415 | heavyiron | 1156 | window_moved db 'K : Window - done',13,10,0 |
1 | ha | 1157 | endg |
1158 | |||
1159 | ; check window touch |
||
1160 | align 4 |
||
1161 | checkwindows: |
||
415 | heavyiron | 1162 | pushad |
1 | ha | 1163 | |
415 | heavyiron | 1164 | cmp [window_minimize], 0 |
1165 | je .no_minimizing |
||
1166 | mov eax, [TASK_COUNT] ; the uppermost window |
||
1167 | mov bl, 0 |
||
1168 | xchg [window_minimize], bl |
||
1169 | cmp bl, 1 |
||
1170 | jne .restore |
||
1171 | call minimize_window |
||
1172 | jmp .continue |
||
105 | poddubny | 1173 | .restore: |
415 | heavyiron | 1174 | call restore_minimized_window |
105 | poddubny | 1175 | .continue: |
1176 | .no_minimizing: |
||
1 | ha | 1177 | |
415 | heavyiron | 1178 | cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? |
1179 | jne .mouse_buttons_pressed |
||
1180 | ;..................................... start 1/4 : modified by vhanla ................. |
||
1181 | mov [bPressedMouseXY_W],0 |
||
1182 | ;..................................... end 1/4 : modified by vhanla ................... |
||
1183 | popad |
||
1184 | ret |
||
1 | ha | 1185 | .mouse_buttons_pressed: |
415 | heavyiron | 1186 | ;..................................... start 2/4 : modified by vhanla ................. |
1187 | jmp @f |
||
1188 | bPressedMouseXY_W db 0x0 |
||
1189 | @@: |
||
1190 | ;..................................... end 2/4 : modified by vhanla ................... |
||
1191 | mov esi,[TASK_COUNT] |
||
1192 | inc esi |
||
1 | ha | 1193 | |
415 | heavyiron | 1194 | ;..................................... start 3/4 : modified by vhanla ................. |
1195 | push ax |
||
1196 | cmp [bPressedMouseXY_W],0 |
||
1197 | jnz @f |
||
1198 | mov [bPressedMouseXY_W],1 |
||
1199 | mov ax,[MOUSE_X] |
||
1200 | mov [mx],ax |
||
1201 | mov ax,[MOUSE_Y] |
||
1202 | mov [my],ax |
||
1203 | @@: |
||
1204 | pop ax |
||
1205 | ;..................................... end 3/4 : modified by vhanla ................... |
||
1 | ha | 1206 | |
1207 | cwloop: |
||
415 | heavyiron | 1208 | cmp esi,2 |
1209 | jb .exit |
||
105 | poddubny | 1210 | |
415 | heavyiron | 1211 | dec esi |
1212 | movzx edi, word [WIN_POS + esi * 2] ; ebx |
||
1213 | shl edi, 5 |
||
1214 | add edi, window_data |
||
1 | ha | 1215 | ; mov edi, ebx |
117 | mario79 | 1216 | mov ecx, [edi + WDATA.box.left] |
1217 | mov edx, [edi + WDATA.box.top] |
||
1 | ha | 1218 | |
415 | heavyiron | 1219 | mov eax,ecx |
1220 | mov ebx,edx |
||
1221 | test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED |
||
1222 | jnz cwloop |
||
1 | ha | 1223 | |
415 | heavyiron | 1224 | ;..................................... start 4/4 : modified by vhanla ................. |
1225 | movzx eax, word [mx]; movzx eax,word[MOUSE_X] |
||
1226 | movzx ebx, word [my]; movzx ebx,word[MOUSE_Y] |
||
1227 | ;..................................... endt 4/4 : modified by vhanla .................. |
||
1228 | cmp ecx, eax |
||
1229 | jae cwloop |
||
1230 | cmp edx, ebx |
||
1231 | jae cwloop |
||
117 | mario79 | 1232 | add ecx, [edi + WDATA.box.width] |
1233 | add edx, [edi + WDATA.box.height] |
||
415 | heavyiron | 1234 | cmp eax, ecx |
1235 | jae cwloop |
||
1236 | cmp ebx, edx |
||
1237 | jae cwloop |
||
1 | ha | 1238 | |
415 | heavyiron | 1239 | pushad |
1240 | mov eax, esi |
||
1241 | mov ebx, [TASK_COUNT] |
||
1242 | cmp eax, ebx ; is this window active? |
||
1243 | jz .move_resize_window |
||
1 | ha | 1244 | |
415 | heavyiron | 1245 | ; eax = position in windowing stack |
1246 | ; redraw must ? |
||
1247 | lea esi, [WIN_POS + esi * 2] |
||
1248 | call waredraw |
||
1249 | add esp, 32 |
||
1 | ha | 1250 | |
1251 | .exit: |
||
415 | heavyiron | 1252 | popad |
1253 | ret |
||
1 | ha | 1254 | |
1255 | .move_resize_window: ; MOVE OR RESIZE WINDOW |
||
415 | heavyiron | 1256 | popad |
1 | ha | 1257 | |
415 | heavyiron | 1258 | ; Check for user enabled fixed window |
117 | mario79 | 1259 | mov edx, [edi + WDATA.cl_titlebar] |
415 | heavyiron | 1260 | and edx, 0x0f000000 |
1261 | cmp edx, 0x01000000 |
||
1262 | jne .window_move_enabled_for_user |
||
1263 | popad |
||
1264 | ret |
||
1 | ha | 1265 | .window_move_enabled_for_user: |
1266 | |||
117 | mario79 | 1267 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
415 | heavyiron | 1268 | jnz .no_resize_2 |
41 | mikedld | 1269 | |
415 | heavyiron | 1270 | mov [do_resize_from_corner],byte 0 ; resize for skinned window |
117 | mario79 | 1271 | mov edx, [edi + WDATA.cl_workarea] |
415 | heavyiron | 1272 | and edx, 0x0f000000 |
549 | spraid | 1273 | cmp edx, 0x00000000 ;{test for resized} |
1274 | je .no_resize_2 |
||
1275 | cmp edx, 0x01000000 ;{test for resized} |
||
1276 | je .no_resize_2 |
||
1277 | cmp edx, 0x04000000 ;{test for resized} |
||
1278 | je .no_resize_2 |
||
1279 | ; jb .no_resize_2 ; not type 2 wnd |
||
1 | ha | 1280 | |
117 | mario79 | 1281 | mov edx, [edi + WDATA.box.top] |
1282 | add edx, [edi + WDATA.box.height] |
||
415 | heavyiron | 1283 | sub edx, 6 ; edx = y_end - 6 |
1284 | cmp ebx, edx ; ebx = mouse_y |
||
1285 | jb .no_resize_2 |
||
1286 | mov [do_resize_from_corner],byte 1 |
||
1287 | jmp .continue |
||
1 | ha | 1288 | .no_resize_2: |
1289 | |||
415 | heavyiron | 1290 | push eax |
1291 | call get_titlebar_height |
||
117 | mario79 | 1292 | add eax,[edi + WDATA.box.top] |
415 | heavyiron | 1293 | cmp ebx,eax |
1294 | pop eax |
||
1295 | jae .exit |
||
1 | ha | 1296 | |
1297 | .continue: |
||
1298 | |||
415 | heavyiron | 1299 | push esi |
1300 | mov esi, window_moving |
||
1301 | call sys_msg_board_str |
||
1302 | pop esi |
||
1 | ha | 1303 | |
415 | heavyiron | 1304 | mov ecx, [timer_ticks] ; double-click ? |
1305 | mov edx, ecx |
||
1306 | sub edx, [latest_window_touch] |
||
1307 | mov [latest_window_touch], ecx |
||
1308 | mov [latest_window_touch_delta], edx |
||
1 | ha | 1309 | |
415 | heavyiron | 1310 | mov cl, [BTN_DOWN] ; save for shade check |
1311 | mov [do_resize], cl |
||
1 | ha | 1312 | no_emulation_righ_button: |
117 | mario79 | 1313 | mov ecx, [edi + WDATA.box.left] |
1314 | mov edx, [edi + WDATA.box.top] |
||
1 | ha | 1315 | |
415 | heavyiron | 1316 | push eax ecx edx |
1317 | mov [dlx], ecx ; save for drawlimits |
||
1318 | mov [dly], edx |
||
117 | mario79 | 1319 | mov eax, [edi + WDATA.box.width] |
415 | heavyiron | 1320 | add ecx, eax |
117 | mario79 | 1321 | mov eax, [edi + WDATA.box.height] |
415 | heavyiron | 1322 | add edx, eax |
1323 | mov [dlxe], ecx |
||
1324 | mov [dlye], edx |
||
1325 | pop edx ecx eax |
||
1 | ha | 1326 | |
415 | heavyiron | 1327 | sub eax, ecx |
1328 | sub ebx, edx |
||
1 | ha | 1329 | |
415 | heavyiron | 1330 | mov esi, [MOUSE_X] |
1331 | mov [WIN_TEMP_XY], esi |
||
1 | ha | 1332 | |
415 | heavyiron | 1333 | pushad ; wait for putimages to finish |
1 | ha | 1334 | ; mov eax,5 |
1335 | ; call delay_hs |
||
117 | mario79 | 1336 | mov eax,[edi + WDATA.box.left] |
415 | heavyiron | 1337 | mov [npx],eax |
117 | mario79 | 1338 | mov eax,[edi + WDATA.box.top] |
415 | heavyiron | 1339 | mov [npy],eax |
1340 | popad |
||
1 | ha | 1341 | |
415 | heavyiron | 1342 | push eax ; save old coordinates |
117 | mario79 | 1343 | mov ax, word [edi + WDATA.box.left] |
415 | heavyiron | 1344 | mov word [oldc+BOX.left],ax |
117 | mario79 | 1345 | mov ax, word [edi + WDATA.box.top] |
415 | heavyiron | 1346 | mov word [oldc+BOX.top],ax |
117 | mario79 | 1347 | mov ax, word [edi + WDATA.box.width] |
415 | heavyiron | 1348 | mov word [oldc+BOX.width],ax |
1349 | mov word [npxe],ax |
||
117 | mario79 | 1350 | mov ax, word [edi + WDATA.box.height] |
415 | heavyiron | 1351 | mov word [oldc+BOX.height],ax |
1352 | mov word [npye],ax |
||
1353 | pop eax |
||
1 | ha | 1354 | |
415 | heavyiron | 1355 | call drawwindowframes |
1 | ha | 1356 | |
415 | heavyiron | 1357 | mov [reposition],0 |
1358 | mov [MOUSE_DOWN],byte 1 ; no reaction to mouse up/down |
||
1 | ha | 1359 | |
415 | heavyiron | 1360 | ; move window |
1 | ha | 1361 | |
1362 | newchm: |
||
1363 | |||
415 | heavyiron | 1364 | mov [DONT_DRAW_MOUSE],byte 1 |
1 | ha | 1365 | |
415 | heavyiron | 1366 | call checkidle |
1 | ha | 1367 | |
415 | heavyiron | 1368 | call checkVga_N13 |
1 | ha | 1369 | |
415 | heavyiron | 1370 | mov [MOUSE_BACKGROUND],byte 0 |
1 | ha | 1371 | |
415 | heavyiron | 1372 | call [draw_pointer] |
1 | ha | 1373 | |
415 | heavyiron | 1374 | pushad |
1375 | call stack_handler |
||
1376 | popad |
||
1 | ha | 1377 | |
415 | heavyiron | 1378 | mov esi,[WIN_TEMP_XY] |
1379 | cmp esi,[MOUSE_X] |
||
1380 | je cwb |
||
1 | ha | 1381 | |
415 | heavyiron | 1382 | mov cx,[MOUSE_X] |
1383 | mov dx,[MOUSE_Y] |
||
1384 | sub cx,ax |
||
1385 | sub dx,bx |
||
1 | ha | 1386 | |
415 | heavyiron | 1387 | push ax |
1388 | push bx |
||
1 | ha | 1389 | |
415 | heavyiron | 1390 | call drawwindowframes |
1 | ha | 1391 | |
415 | heavyiron | 1392 | mov ax,[ScreenWidth] |
1393 | mov bx,[ScreenHeight] |
||
1 | ha | 1394 | |
415 | heavyiron | 1395 | cmp [do_resize_from_corner],1 |
1396 | je no_new_position |
||
1 | ha | 1397 | |
415 | heavyiron | 1398 | mov word [npx],word 0 ; x repos ? |
1399 | cmp ax,cx |
||
1400 | jb noreposx |
||
1401 | mov [reposition],1 |
||
1402 | sub ax,word [npxe] |
||
1403 | mov word [npx],ax |
||
1404 | cmp ax,cx |
||
1405 | jb noreposx |
||
1406 | mov word [npx],cx |
||
1 | ha | 1407 | noreposx: |
1408 | |||
415 | heavyiron | 1409 | mov word [npy],word 0 ; y repos ? |
1410 | cmp bx,dx |
||
1411 | jb noreposy |
||
1412 | mov [reposition],1 |
||
1413 | sub bx,word [npye] |
||
1414 | mov word [npy],bx |
||
1415 | cmp bx,dx |
||
1416 | jb noreposy |
||
1417 | mov word [npy],dx |
||
1 | ha | 1418 | noreposy: |
1419 | |||
1420 | no_new_position: |
||
1421 | |||
415 | heavyiron | 1422 | cmp [do_resize_from_corner],0 ; resize from right corner |
1423 | je norepos_size |
||
1424 | pushad |
||
1 | ha | 1425 | |
415 | heavyiron | 1426 | mov edx,edi |
1427 | sub edx,window_data |
||
1428 | ;shr edx,5 |
||
1429 | ;shl edx,8 |
||
1430 | ;add edx,0x80000 ; process base at 0x80000+ |
||
380 | serge | 1431 | lea edx, [SLOT_BASE + edx*8] |
1 | ha | 1432 | |
415 | heavyiron | 1433 | movzx eax,word [MOUSE_X] |
117 | mario79 | 1434 | cmp eax,[edi + WDATA.box.left] |
415 | heavyiron | 1435 | jb nnepx |
117 | mario79 | 1436 | sub eax,[edi + WDATA.box.left] |
415 | heavyiron | 1437 | cmp eax,32 ; [edx+0x90+8] |
1438 | jge nnepx2 |
||
1439 | mov eax,32 ; [edx+0x90+8] |
||
1 | ha | 1440 | nnepx2: |
415 | heavyiron | 1441 | mov [npxe],eax |
1 | ha | 1442 | nnepx: |
1443 | |||
415 | heavyiron | 1444 | call get_rolledup_height |
1445 | mov ebx,eax |
||
1446 | movzx eax,word [MOUSE_Y] |
||
117 | mario79 | 1447 | cmp eax,[edi + WDATA.box.top] |
415 | heavyiron | 1448 | jb nnepy |
117 | mario79 | 1449 | sub eax,[edi + WDATA.box.top] |
415 | heavyiron | 1450 | cmp eax,ebx ; [edx+0x90+12] |
1451 | jge nnepy2 |
||
1452 | mov eax,ebx ; [edx+0x90+12] |
||
1 | ha | 1453 | nnepy2: |
415 | heavyiron | 1454 | mov [npye],eax |
1 | ha | 1455 | nnepy: |
1456 | |||
415 | heavyiron | 1457 | mov [reposition],1 |
1 | ha | 1458 | |
415 | heavyiron | 1459 | popad |
1 | ha | 1460 | norepos_size: |
1461 | |||
415 | heavyiron | 1462 | pop bx |
1463 | pop ax |
||
1464 | call drawwindowframes |
||
1 | ha | 1465 | |
415 | heavyiron | 1466 | mov esi,[MOUSE_X] |
1467 | mov [WIN_TEMP_XY],esi |
||
1 | ha | 1468 | |
1469 | cwb: |
||
415 | heavyiron | 1470 | cmp [BTN_DOWN],byte 0 |
1471 | jne newchm |
||
1472 | ; new position done |
||
1473 | mov [DONT_DRAW_MOUSE],byte 1 |
||
1474 | mov cl,0 |
||
1475 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
||
1476 | jnz @f |
||
1477 | mov cl,[reposition] |
||
1478 | call drawwindowframes |
||
1 | ha | 1479 | |
415 | heavyiron | 1480 | mov eax,[npx] |
117 | mario79 | 1481 | mov [edi + WDATA.box.left],eax |
415 | heavyiron | 1482 | mov eax,[npy] |
117 | mario79 | 1483 | mov [edi + WDATA.box.top],eax |
415 | heavyiron | 1484 | mov eax,[npxe] |
117 | mario79 | 1485 | mov [edi + WDATA.box.width],eax |
415 | heavyiron | 1486 | mov eax,[npye] |
117 | mario79 | 1487 | mov [edi + WDATA.box.height],eax |
415 | heavyiron | 1488 | call set_window_clientbox |
1 | ha | 1489 | |
415 | heavyiron | 1490 | @@: mov [reposition],cl |
41 | mikedld | 1491 | |
415 | heavyiron | 1492 | cmp [reposition],1 ; save new position and size |
1493 | jne no_bounds_save |
||
1494 | push esi edi ecx |
||
1495 | mov esi,edi |
||
1496 | mov ecx,2 |
||
1497 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP or WSTATE_MAXIMIZED |
||
1498 | jnz @f |
||
1499 | add ecx,2 |
||
57 | mikedld | 1500 | @@: sub edi,window_data |
415 | heavyiron | 1501 | shr edi,5 |
1502 | shl edi,8 |
||
1503 | add edi,SLOT_BASE+APPDATA.saved_box |
||
1504 | cld |
||
1505 | rep movsd |
||
1506 | pop ecx edi esi |
||
52 | mikedld | 1507 | no_bounds_save: |
1 | ha | 1508 | |
415 | heavyiron | 1509 | pushad ; WINDOW SHADE/FULLSCREEN |
1 | ha | 1510 | |
549 | spraid | 1511 | ;{doule click not worked for 4 type window} |
1512 | mov edx, [edi + WDATA.cl_workarea] |
||
1513 | and edx, 0x0f000000 |
||
1514 | cmp edx, 0x00000000 |
||
1515 | je no_fullscreen_restore |
||
1516 | cmp edx, 0x01000000 |
||
1517 | je no_fullscreen_restore |
||
1518 | cmp edx, 0x04000000 |
||
1519 | je no_fullscreen_restore |
||
1520 | |||
415 | heavyiron | 1521 | cmp [reposition],1 |
1522 | je no_window_sizing |
||
1523 | mov edx,edi |
||
1524 | sub edx,window_data |
||
1525 | shr edx,5 |
||
1526 | shl edx,8 |
||
1527 | add edx,SLOT_BASE ; process base at 0x80000+ |
||
1 | ha | 1528 | |
415 | heavyiron | 1529 | cmp [do_resize],2 ; window shade ? |
1530 | jne no_window_shade |
||
1531 | mov [reposition],1 |
||
1 | ha | 1532 | |
415 | heavyiron | 1533 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
1534 | jnz wnd_rolldown |
||
41 | mikedld | 1535 | wnd_rollup: |
415 | heavyiron | 1536 | or [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
1537 | call get_rolledup_height |
||
1538 | jmp @f |
||
41 | mikedld | 1539 | wnd_rolldown: |
415 | heavyiron | 1540 | and [edi+WDATA.fl_wstate],not WSTATE_ROLLEDUP |
117 | mario79 | 1541 | mov eax,[edx + APPDATA.saved_box.height] ; 0x90+BOX.height |
415 | heavyiron | 1542 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
1543 | jz @f |
||
1544 | mov eax,[screen_workarea.bottom] |
||
1545 | sub eax,[screen_workarea.top] |
||
1546 | @@: mov [edi+WDATA.box.height],eax |
||
1547 | call set_window_clientbox |
||
1 | ha | 1548 | |
1549 | no_window_shade: |
||
1550 | |||
415 | heavyiron | 1551 | cmp [do_resize],1 ; fullscreen/restore ? |
1552 | jne no_fullscreen_restore |
||
1553 | cmp [latest_window_touch_delta],dword 50 |
||
1554 | jg no_fullscreen_restore |
||
1555 | mov [reposition],1 |
||
1556 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
||
1557 | jnz restore_from_fullscreen |
||
1558 | or [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
||
1559 | mov eax,[screen_workarea.left] |
||
1560 | mov [edi+WDATA.box.left],eax |
||
1561 | sub eax,[screen_workarea.right] |
||
1562 | neg eax |
||
1563 | mov [edi+WDATA.box.width],eax |
||
1564 | mov eax,[screen_workarea.top] |
||
1565 | mov [edi+WDATA.box.top],eax |
||
1566 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
||
1567 | jnz @f |
||
1568 | sub eax,[screen_workarea.bottom] |
||
1569 | neg eax |
||
1570 | mov [edi+WDATA.box.height],eax |
||
41 | mikedld | 1571 | @@: |
415 | heavyiron | 1572 | jmp restore_from_fullscreen.clientbox |
1 | ha | 1573 | restore_from_fullscreen: |
415 | heavyiron | 1574 | and [edi+WDATA.fl_wstate],not WSTATE_MAXIMIZED |
1575 | push [edi+WDATA.box.height] |
||
1576 | push edi ; restore |
||
1577 | lea esi, [edx + APPDATA.saved_box] |
||
1578 | mov ecx,4 |
||
1579 | cld |
||
1580 | rep movsd |
||
1581 | pop edi |
||
1582 | pop eax |
||
1583 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
||
1584 | jz @f |
||
1585 | mov [edi+WDATA.box.height],eax |
||
41 | mikedld | 1586 | @@: |
150 | diamond | 1587 | .clientbox: |
415 | heavyiron | 1588 | call set_window_clientbox |
1 | ha | 1589 | |
1590 | no_fullscreen_restore: |
||
1591 | |||
415 | heavyiron | 1592 | mov eax,[edi+WDATA.box.top] ; check Y inside screen |
1593 | add eax,[edi+WDATA.box.height] |
||
1594 | cmp eax,[ScreenHeight] |
||
1595 | jbe no_window_sizing |
||
1596 | mov eax,[edi+WDATA.box.left] ; check X inside screen |
||
1597 | add eax,[edi+WDATA.box.width] |
||
1598 | cmp eax,[ScreenWidth] |
||
1599 | jbe no_window_sizing |
||
1600 | mov eax,[ScreenWidth] |
||
1601 | sub eax,[edi+WDATA.box.width] |
||
1602 | mov [edi+WDATA.box.left],eax |
||
1603 | mov eax,[ScreenHeight] |
||
1604 | sub eax,[edi+WDATA.box.height] |
||
1605 | mov [edi+WDATA.box.top],eax |
||
1606 | call set_window_clientbox |
||
1 | ha | 1607 | no_window_sizing: |
1608 | |||
415 | heavyiron | 1609 | popad |
1 | ha | 1610 | |
415 | heavyiron | 1611 | cmp [reposition],0 |
1612 | je retwm |
||
1 | ha | 1613 | |
415 | heavyiron | 1614 | mov [DONT_DRAW_MOUSE],byte 1 ; no mouse |
1 | ha | 1615 | |
112 | poddubny | 1616 | |
415 | heavyiron | 1617 | push eax ebx ecx edx |
1618 | mov eax,[edi+WDATA.box.left] |
||
1619 | mov ebx,[edi+WDATA.box.top] |
||
1620 | mov ecx,[edi+WDATA.box.width] |
||
1621 | mov edx,[edi+WDATA.box.height] |
||
1622 | add ecx,eax |
||
1623 | add edx,ebx |
||
1624 | call calculatescreen |
||
112 | poddubny | 1625 | |
415 | heavyiron | 1626 | mov eax,[oldc+BOX.left] |
1627 | mov ebx,[oldc+BOX.top] |
||
1628 | mov ecx,[oldc+BOX.width] |
||
1629 | mov edx,[oldc+BOX.height] |
||
1630 | add ecx,eax |
||
1631 | add edx,ebx |
||
1632 | call calculatescreen |
||
1633 | pop edx ecx ebx eax |
||
1 | ha | 1634 | |
415 | heavyiron | 1635 | mov eax,edi |
1636 | call redrawscreen |
||
1 | ha | 1637 | |
112 | poddubny | 1638 | |
415 | heavyiron | 1639 | mov [edi+WDATA.fl_redraw],1 |
112 | poddubny | 1640 | |
415 | heavyiron | 1641 | mov ecx,100 ; wait to avoid mouse residuals |
1 | ha | 1642 | waitre2: |
415 | heavyiron | 1643 | mov [DONT_DRAW_MOUSE],byte 1 |
1644 | call checkidle |
||
1645 | cmp [edi+WDATA.fl_redraw],0 |
||
1646 | jz retwm |
||
1647 | loop waitre2 |
||
1 | ha | 1648 | |
1649 | retwm: |
||
1650 | |||
415 | heavyiron | 1651 | mov [DONT_DRAW_MOUSE],byte 0 ; mouse pointer |
1652 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
||
1653 | mov [MOUSE_DOWN],byte 0 ; react to mouse up/down |
||
1 | ha | 1654 | |
415 | heavyiron | 1655 | mov esi,window_moved |
1656 | call sys_msg_board_str |
||
1 | ha | 1657 | |
415 | heavyiron | 1658 | popad |
1 | ha | 1659 | |
415 | heavyiron | 1660 | ret |
1 | ha | 1661 | |
1662 | |||
1663 | uglobal |
||
415 | heavyiron | 1664 | add_window_data dd 0 |
1 | ha | 1665 | do_resize_from_corner db 0x0 |
415 | heavyiron | 1666 | reposition db 0x0 |
1667 | latest_window_touch dd 0x0 |
||
1 | ha | 1668 | latest_window_touch_delta dd 0x0 |
1669 | |||
1670 | do_resize db 0x0 |
||
1671 | |||
415 | heavyiron | 1672 | oldc dd 0x0,0x0,0x0,0x0 |
1 | ha | 1673 | |
415 | heavyiron | 1674 | dlx dd 0x0 |
1675 | dly dd 0x0 |
||
1676 | dlxe dd 0x0 |
||
1677 | dlye dd 0x0 |
||
1 | ha | 1678 | |
415 | heavyiron | 1679 | npx dd 0x0 |
1680 | npy dd 0x0 |
||
1681 | npxe dd 0x0 |
||
1682 | npye dd 0x0 |
||
1 | ha | 1683 | |
415 | heavyiron | 1684 | mpx dd 0x0 |
1685 | mpy dd 0x0 |
||
1 | ha | 1686 | endg |
1687 | |||
1688 | |||
1689 | ; draw negative window frames |
||
186 | diamond | 1690 | drawwindowframes2: |
415 | heavyiron | 1691 | pushad |
1692 | cli |
||
1693 | jmp drawwindowframes.do |
||
1 | ha | 1694 | drawwindowframes: |
415 | heavyiron | 1695 | pushad |
1696 | cli |
||
1 | ha | 1697 | |
415 | heavyiron | 1698 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
1699 | jnz .ret |
||
1700 | mov eax, [npx] |
||
1701 | cmp eax, [edi+WDATA.box.left] |
||
1702 | jnz .nowndframe |
||
1703 | mov eax, [npxe] |
||
1704 | cmp eax, [edi+WDATA.box.width] |
||
1705 | jnz .nowndframe |
||
1706 | mov eax, [npy] |
||
1707 | cmp eax, [edi+WDATA.box.top] |
||
1708 | jnz .nowndframe |
||
1709 | mov eax, [npye] |
||
1710 | cmp eax, [edi+WDATA.box.height] |
||
1711 | jnz .nowndframe |
||
1712 | xor [edi+WDATA.fl_wdrawn], 2 |
||
1713 | test [edi+WDATA.fl_wdrawn], 4 |
||
1714 | jnz .ret |
||
163 | diamond | 1715 | |
186 | diamond | 1716 | .nowndframe: |
1717 | .do: |
||
415 | heavyiron | 1718 | mov edi, 1 |
1719 | mov ecx, 0x01000000 |
||
1720 | mov eax,[npx] |
||
1721 | shl eax,16 |
||
1722 | add eax,[npx] |
||
1723 | add eax,[npxe] |
||
1724 | add eax,65536*1-1 |
||
1725 | mov ebx,[npy] |
||
1726 | shl ebx,16 |
||
1727 | add ebx,[npy] |
||
1728 | call [draw_line] |
||
1 | ha | 1729 | |
415 | heavyiron | 1730 | mov eax,[npx] |
1731 | shl eax,16 |
||
1732 | add eax,[npx] |
||
1733 | add eax,[npxe] |
||
1734 | add eax,65536*1-1 |
||
1735 | mov ebx,[npy] |
||
1736 | add ebx,[npye] |
||
1737 | shl ebx,16 |
||
1738 | add ebx,[npy] |
||
1739 | add ebx,[npye] |
||
1740 | call [draw_line] |
||
1 | ha | 1741 | |
415 | heavyiron | 1742 | mov eax,[npx] |
1743 | shl eax,16 |
||
1744 | add eax,[npx] |
||
1745 | mov ebx,[npy] |
||
1746 | shl ebx,16 |
||
1747 | add ebx,[npy] |
||
1748 | add ebx,[npye] |
||
1749 | call [draw_line] |
||
1 | ha | 1750 | |
415 | heavyiron | 1751 | mov eax,[npx] |
1752 | add eax,[npxe] |
||
1753 | shl eax,16 |
||
1754 | add eax,[npx] |
||
1755 | add eax,[npxe] |
||
1756 | mov ebx,[npy] |
||
1757 | shl ebx,16 |
||
1758 | add ebx,[npy] |
||
1759 | add ebx,[npye] |
||
1760 | call [draw_line] |
||
1 | ha | 1761 | |
186 | diamond | 1762 | .ret: |
415 | heavyiron | 1763 | sti |
1764 | popad |
||
1765 | ret |
||
1 | ha | 1766 | |
1767 | |||
1768 | |||
1769 | random_shaped_window: |
||
1770 | |||
1771 | ; |
||
1772 | ; eax = 0 giving address of data area |
||
1773 | ; ebx address |
||
115 | poddubny | 1774 | ; eax = 1 shape area scale |
1 | ha | 1775 | ; ebx 2^ebx scale |
1776 | |||
1777 | test eax, eax |
||
1778 | jne rsw_no_address |
||
465 | serge | 1779 | mov eax,[current_slot] |
1780 | mov [eax+APPDATA.wnd_shape],ebx |
||
1781 | rsw_no_address: |
||
1 | ha | 1782 | |
1783 | cmp eax,1 |
||
1784 | jne rsw_no_scale |
||
465 | serge | 1785 | mov eax,[current_slot] |
1786 | mov byte [eax+APPDATA.wnd_shape_scale], bl |
||
1787 | rsw_no_scale: |
||
1 | ha | 1788 | |
1789 | ret>>->->=>=> |
||
1790 |