Subversion Repositories Kolibri OS

Rev

Rev 1859 | Rev 1929 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1859 Rev 1899
Line 4... Line 4...
4
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa      ;;
4
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa      ;;
5
;; Distributed under terms of the GNU General Public License    ;;
5
;; Distributed under terms of the GNU General Public License    ;;
6
;;                                                              ;;
6
;;                                                              ;;
7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 8... Line 8...
8
 
8
 
Line 9... Line 9...
9
$Revision: 1859 $
9
$Revision: 1899 $
10
 
10
 
11
;==============================================================================
11
;==============================================================================
Line 12... Line 12...
12
;///// public functions ///////////////////////////////////////////////////////
12
;///// public functions ///////////////////////////////////////////////////////
Line 13... Line 13...
13
;==============================================================================
13
;==============================================================================
14
 
14
 
15
window.BORDER_SIZE = 5
15
window.BORDER_SIZE = 4
16
 
16
 
Line 334... Line 334...
334
	mov	ecx, [edi + WDATA.box.top]
334
	mov	ecx, [edi + WDATA.box.top]
335
	and	cl, 0xFE
335
	and	cl, 0xFE
336
    @@: cmp	edx, -1
336
    @@: cmp	edx, -1
337
	jne	@f
337
	jne	@f
338
	mov	edx, [edi + WDATA.box.width]
338
	mov	edx, [edi + WDATA.box.width]
339
	and	dl, 0xFC
339
;	and	dl, 0xFC
340
    @@: cmp	esi, -1
340
    @@: cmp	esi, -1
341
	jne	@f
341
	jne	@f
342
	mov	esi, [edi + WDATA.box.height]
342
	mov	esi, [edi + WDATA.box.height]
343
	and	esi, 0xFFFFFFFE
343
;	and	esi, 0xFFFFFFFE
Line 344... Line 344...
344
 
344
 
345
    @@: push	esi edx ecx ebx
345
    @@: push	esi edx ecx ebx
346
	mov	eax, esp
346
	mov	eax, esp
347
	mov	bl, [edi + WDATA.fl_wstate]
347
	mov	bl, [edi + WDATA.fl_wstate]
Line 513... Line 513...
513
	cmp	eax, ebx
513
	cmp	eax, ebx
514
	jle	.fix_vertical
514
	jle	.fix_vertical
515
	mov	eax, [edi + WDATA.box.width]
515
	mov	eax, [edi + WDATA.box.width]
516
	sub	eax, ebx
516
	sub	eax, ebx
517
	jle	@f
517
	jle	@f
518
	and	bl, 0xFC			; <<<<<<<
518
;	and	bl, 0xFC			; <<<<<<<
519
	mov	[edi + WDATA.box.width], ebx
519
	mov	[edi + WDATA.box.width], ebx
520
    @@: sub	ebx, [edi + WDATA.box.width]
520
    @@: sub	ebx, [edi + WDATA.box.width]
521
	and	bl, 0xFC			; <<<<<<<
521
;	and	bl, 0xFC			; <<<<<<<
522
	mov	[edi + WDATA.box.left], ebx
522
	mov	[edi + WDATA.box.left], ebx
Line 523... Line 523...
523
 
523
 
524
  .fix_vertical:
524
  .fix_vertical:
525
	mov	eax, [edi + WDATA.box.top]
525
	mov	eax, [edi + WDATA.box.top]
Line 528... Line 528...
528
	cmp	eax, ebx
528
	cmp	eax, ebx
529
	jle	.fix_client_box
529
	jle	.fix_client_box
530
	mov	eax, [edi + WDATA.box.height]
530
	mov	eax, [edi + WDATA.box.height]
531
	sub	eax, ebx
531
	sub	eax, ebx
532
	jle	@f
532
	jle	@f
533
	and	bl, 0xFE			; <<<<<<<
533
;	and	bl, 0xFE			; <<<<<<<
534
	mov	[edi + WDATA.box.height], ebx
534
	mov	[edi + WDATA.box.height], ebx
535
    @@: sub	ebx, [edi + WDATA.box.height]
535
    @@: sub	ebx, [edi + WDATA.box.height]
536
	and	bl, 0xFE			; <<<<<<<
536
;	and	bl, 0xFE			; <<<<<<<
537
	mov	[edi + WDATA.box.top], ebx
537
	mov	[edi + WDATA.box.top], ebx
538
	jmp	.fix_client_box
538
	jmp	.fix_client_box
Line 539... Line 539...
539
 
539
 
540
  .fix_maximized:
540
  .fix_maximized:
Line 664... Line 664...
664
	mov	ebx, edx
664
	mov	ebx, edx
665
	shl	ebx, 16
665
	shl	ebx, 16
666
	add	ebx, edx
666
	add	ebx, edx
667
	mov	eax, [esi + WDATA.box.left]
667
	mov	eax, [esi + WDATA.box.left]
668
	inc	eax
668
	inc	eax
-
 
669
 
669
	shl	eax, 16
670
	shl	eax, 16
670
	add	eax, [esi + WDATA.box.left]
671
	add	eax, [esi + WDATA.box.left]
671
	add	eax, [esi + WDATA.box.width]
672
	add	eax, [esi + WDATA.box.width]
672
	dec	eax
673
	dec	eax
673
	mov	ecx, [esi + WDATA.cl_titlebar]
674
	mov	ecx, [esi + WDATA.cl_titlebar]
Line 1453... Line 1454...
1453
	movzx	eax, bx
1454
	movzx	eax, bx
1454
	mov	[edi + WDATA.box.width], eax
1455
	mov	[edi + WDATA.box.width], eax
1455
	movzx	eax, cx
1456
	movzx	eax, cx
1456
	mov	[edi + WDATA.box.height], eax
1457
	mov	[edi + WDATA.box.height], eax
1457
	sar	ebx, 16
1458
	sar	ebx, 16
1458
	and	bl, 0xFC		; <<<<<<<<
1459
;	and	bl, 0xFC		; <<<<<<<<
1459
	sar	ecx, 16
1460
	sar	ecx, 16
1460
	and	cl, 0xFE		; <<<<<<<<
1461
;	and	cl, 0xFE		; <<<<<<<<
1461
	mov	[edi + WDATA.box.left], ebx
1462
	mov	[edi + WDATA.box.left], ebx
1462
	mov	[edi + WDATA.box.top], ecx
1463
	mov	[edi + WDATA.box.top], ecx
Line 1463... Line 1464...
1463
 
1464
 
Line 1645... Line 1646...
1645
  ff_x	   dd ?
1646
  ff_x	   dd ?
1646
  ff_y	   dd ?
1647
  ff_y	   dd ?
1647
  ff_width dd ?
1648
  ff_width dd ?
1648
  ff_xsz   dd ?
1649
  ff_xsz   dd ?
1649
  ff_ysz   dd ?
1650
  ff_ysz   dd ?
-
 
1651
  ff_map   dd ?
1650
  ff_scale dd ?
1652
  ff_scale dd ?
1651
end virtual
1653
end virtual
Line 1652... Line 1654...
1652
 
1654
 
Line 1671... Line 1673...
1671
	; get x&y size
1673
	; get x&y size
1672
	sub	ecx, eax
1674
	sub	ecx, eax
1673
	sub	edx, ebx
1675
	sub	edx, ebx
1674
	inc	ecx
1676
	inc	ecx
1675
	inc	edx
1677
	inc	edx
-
 
1678
	shr	ecx, 2          ; 1 tile = 4 pix
-
 
1679
        shr     edx, 1          ; 1 tile = 2 lines
Line 1676... Line 1680...
1676
 
1680
 
1677
	; get WinMap start
1681
	; get WinMap start
1678
	push	esi
1682
	push	esi
1679
	mov	edi, [_WinMapWidth]
1683
	mov	edi, [_WinMapWidth]
-
 
1684
	mov	esi, edi
1680
	mov	esi, edi
1685
        shr     ebx, 1
1681
	imul	edi, ebx
1686
	imul	edi, ebx
1682
	shr	eax, 1
-
 
1683
     	shr	eax, 1
1687
	shr	eax, 2
1684
	add	edi, eax
1688
	add	edi, eax
1685
	add	edi, [_WinMapAddress]
1689
	add	edi, [_WinMapAddress]
1686
	pop	eax
1690
	pop	eax             ; al = process#
1687
	mov	ah, al
1691
;	mov	ah, al
1688
	push	ax
1692
;	push	ax
1689
	shl	eax, 16
1693
;	shl	eax, 16
Line -... Line 1694...
-
 
1694
;	pop	ax              ; eax = 4 dup PROCESS_NUM
-
 
1695
 
1690
	pop	ax
1696
        sub     esi, ecx        ; map line increment (bytes)
1691
 
-
 
1692
  .next_line:
1697
	mov	ebx, ecx        ; map line width 
1693
	push	ecx
1698
  .next_line:
1694
	shr	ecx, 2
1699
;        shr     ecx, 2          ; 1dword = 4 tiles
1695
	rep	stosd
1700
;	rep	stosd           ; filling the screen map
1696
	mov	ecx, [esp]
1701
;	mov	ecx, ebx      
1697
	and	ecx, 3
1702
;	and	ecx, 3          ; 0 to 3 tiles remaining
1698
	rep	stosb
1703
	rep	stosb
1699
	pop	ecx
-
 
1700
	add	edi, esi
1704
	mov	ecx, ebx
1701
	sub	edi, ecx
1705
	add	edi, esi        
1702
	dec	edx
-
 
1703
	jnz	.next_line
1706
	dec	edx
Line 1704... Line 1707...
1704
 
1707
        jnz	.next_line
1705
	jmp	.exit
1708
	jmp	.exit
1706
 
1709
 
1707
  .shaped_window:
1710
  .shaped_window:
1708
	;  for (y=0; y <= x_size; y++)
1711
	;  for (y=0; y <= y_size; y++)
Line 1709... Line 1712...
1709
	;      for (x=0; x <= x_size; x++)
1712
	;      for (x=0; x <= x_size; x++)
Line 1715... Line 1718...
1715
	inc	ecx
1718
	inc	ecx
1716
	inc	edx
1719
	inc	edx
Line 1717... Line 1720...
1717
 
1720
 
Line 1718... Line 1721...
1718
	push	[edi + APPDATA.wnd_shape_scale]  ; push scale first -> for loop
1721
	push	[edi + APPDATA.wnd_shape_scale]                 ; push scale first -> for loop
1719
 
1722
 
1720
	; get WinMap start  -> ebp
-
 
1721
	push	eax
-
 
1722
	mov	eax, [_WinMapWidth] ; <<<<
1723
	push	ebx
1723
	imul	eax, ebx
-
 
1724
	mov	ebp, [esp]
1724
	push	eax
1725
	shr	ebp, 1
-
 
1726
	shr	ebp, 1
1725
	mov	ebp, eax
-
 
1726
	shr	ebp, 2
-
 
1727
	add	ebp, [_WinMapAddress]
-
 
1728
	mov	eax, [_WinMapWidth] 
-
 
1729
        shr     ebx, 1
Line 1727... Line 1730...
1727
	add	ebp, eax
1730
	imul	eax, ebx
1728
	add	ebp, [_WinMapAddress]
1731
	add	ebp, eax	; ebp = map origin
-
 
1732
 
-
 
1733
	mov	edi, [edi + APPDATA.wnd_shape]
-
 
1734
	pop	eax
Line 1729... Line 1735...
1729
 
1735
	pop	ebx
1730
	mov	edi, [edi + APPDATA.wnd_shape]
1736
        
1731
	pop	eax
1737
        push    ebp                                             ; for loop - screen map origin
1732
 
1738
 
1733
	; eax = x_start
1739
	; eax = x_start
1734
	; ebx = y_start
1740
	; ebx = y_start
-
 
1741
	; ecx = x_size
1735
	; ecx = x_size
1742
	; edx = y_size
1736
	; edx = y_size
-
 
Line -... Line 1743...
-
 
1743
	; esi = process_number
1737
	; esi = process_number
1744
	; edi = &shape
1738
	; edi = &shape
1745
        ; ebp = [ff_map]
1739
	;       [scale]
1746
	;       [scale]
1740
	push	edx ecx ; for loop - x,y size
1747
 
1741
 
1748
        push	edx ecx                                         ; for loop - x,y size
Line 1767... Line 1774...
1767
	shr	edx, cl
1774
	shr	edx, cl
1768
	imul	eax, ebx
1775
	imul	eax, ebx
1769
	add	eax, edx
1776
	add	eax, edx
1770
	pop	edx ebx
1777
	pop	edx ebx
1771
	add	eax, edi
1778
	add	eax, edi
1772
	call	.read_byte
1779
	call	.read_byte		; al= shaped window pix-mask at a given point
1773
	test	al,al
1780
	test	al,al
1774
	jz	@f
1781
	jz	@f
1775
	mov	eax, esi
1782
	mov	eax, esi
1776
	mov	[ebp], al
1783
	mov	[ebp], al               ; a tile belongs to the window if the 1st pixel's mask = 1
1777
	; -- end body --
1784
	; -- end body --
1778
    @@: inc	ebp
1785
    @@: 
1779
	inc	edx
1786
	add	edx, 4
-
 
1787
        inc     ebp                     
1780
	cmp	edx, [ff_xsz]
1788
	cmp	edx, [ff_xsz]
1781
	jb	.ff_new_x
1789
	jb	.ff_new_x
Line 1782... Line -...
1782
 
-
 
1783
	sub	ebp, [ff_xsz]
-
 
1784
	add	ebp, [ff_x]
-
 
1785
	add	ebp, [Screen_Max_X]  ; screen.x
1790
 
1786
	inc	ebp
1791
	inc	ebx
1787
	inc	ebx
1792
	inc	ebx
-
 
1793
	cmp	ebx, [ff_ysz]
-
 
1794
	jnb	@f
-
 
1795
	mov	ebp, [ff_map]             
-
 
1796
	add	ebp, [_WinMapWidth]     ; even line: jump to next map row
1788
	cmp	ebx, [ff_ysz]
1797
	mov	[ff_map], ebp
1789
	jb	.ff_new_y
1798
	jmp	.ff_new_y
1790
 
1799
@@:
1791
	add	esp, 24
-
 
1792
 
1800
	add	esp, 7*4
1793
  .exit:
1801
  .exit:
1794
	popad
1802
	popad
Line 1795... Line 1803...
1795
	ret
1803
	ret
1796
 
1804
 
1797
  .read_byte:
1805
  .read_byte:
1798
	; eax - address
1806
	; eax - buffer address
1799
	; esi - slot
1807
	; esi - slot#
1800
	push	eax ecx edx esi
1808
	push	eax ecx edx esi
1801
	xchg	eax, esi
1809
	xchg	eax, esi                
1802
	lea	ecx, [esp + 12]
1810
	lea	ecx, [esp + 12]         ; buffer addr = stacked [eax] to return
1803
	mov	edx, 1
1811
	mov	edx, 1                  ; buffer size
1804
	call	read_process_memory
1812
	call	read_process_memory     ; (core/taskman.inc) returns #bytes read
Line 1805... Line 1813...
1805
	pop	esi edx ecx eax
1813
	pop	esi edx ecx eax         ; eax = PID
1806
	ret
1814
	ret
1807
 
1815