Subversion Repositories Kolibri OS

Rev

Rev 1225 | Rev 1324 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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