Subversion Repositories Kolibri OS

Rev

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

Rev 1899 Rev 1929
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: 1899 $
9
$Revision: 1929 $
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 = 4
15
window.BORDER_SIZE = 5
16
 
16
 
Line 326... Line 326...
326
	jnz	.exit
326
	jnz	.exit
Line 327... Line 327...
327
 
327
 
328
	cmp	ebx, -1
328
	cmp	ebx, -1
329
	jne	@f
329
	jne	@f
330
	mov	ebx, [edi + WDATA.box.left]
-
 
331
	and	bl, 0xFC
330
	mov	ebx, [edi + WDATA.box.left]
332
    @@: cmp	ecx, -1
331
    @@: cmp	ecx, -1
333
	jne	@f
332
	jne	@f
334
	mov	ecx, [edi + WDATA.box.top]
-
 
335
	and	cl, 0xFE
333
	mov	ecx, [edi + WDATA.box.top]
336
    @@: cmp	edx, -1
334
    @@: cmp	edx, -1
337
	jne	@f
335
	jne	@f
338
	mov	edx, [edi + WDATA.box.width]
-
 
339
;	and	dl, 0xFC
336
	mov	edx, [edi + WDATA.box.width]
340
    @@: cmp	esi, -1
337
    @@: cmp	esi, -1
341
	jne	@f
338
	jne	@f
342
	mov	esi, [edi + WDATA.box.height]
-
 
Line 343... Line 339...
343
;	and	esi, 0xFFFFFFFE
339
	mov	esi, [edi + WDATA.box.height]
344
 
340
 
345
    @@: push	esi edx ecx ebx
341
    @@: push	esi edx ecx ebx
346
	mov	eax, esp
342
	mov	eax, esp
Line 513... Line 509...
513
	cmp	eax, ebx
509
	cmp	eax, ebx
514
	jle	.fix_vertical
510
	jle	.fix_vertical
515
	mov	eax, [edi + WDATA.box.width]
511
	mov	eax, [edi + WDATA.box.width]
516
	sub	eax, ebx
512
	sub	eax, ebx
517
	jle	@f
513
	jle	@f
518
;	and	bl, 0xFC			; <<<<<<<
-
 
519
	mov	[edi + WDATA.box.width], ebx
514
	mov	[edi + WDATA.box.width], ebx
520
    @@: sub	ebx, [edi + WDATA.box.width]
515
    @@: sub	ebx, [edi + WDATA.box.width]
521
;	and	bl, 0xFC			; <<<<<<<
-
 
522
	mov	[edi + WDATA.box.left], ebx
516
	mov	[edi + WDATA.box.left], ebx
Line 523... Line 517...
523
 
517
 
524
  .fix_vertical:
518
  .fix_vertical:
525
	mov	eax, [edi + WDATA.box.top]
519
	mov	eax, [edi + WDATA.box.top]
Line 528... Line 522...
528
	cmp	eax, ebx
522
	cmp	eax, ebx
529
	jle	.fix_client_box
523
	jle	.fix_client_box
530
	mov	eax, [edi + WDATA.box.height]
524
	mov	eax, [edi + WDATA.box.height]
531
	sub	eax, ebx
525
	sub	eax, ebx
532
	jle	@f
526
	jle	@f
533
;	and	bl, 0xFE			; <<<<<<<
-
 
534
	mov	[edi + WDATA.box.height], ebx
527
	mov	[edi + WDATA.box.height], ebx
535
    @@: sub	ebx, [edi + WDATA.box.height]
528
    @@: sub	ebx, [edi + WDATA.box.height]
536
;	and	bl, 0xFE			; <<<<<<<
-
 
537
	mov	[edi + WDATA.box.top], ebx
529
	mov	[edi + WDATA.box.top], ebx
538
	jmp	.fix_client_box
530
	jmp	.fix_client_box
Line 539... Line 531...
539
 
531
 
540
  .fix_maximized:
532
  .fix_maximized:
Line 554... Line 546...
554
  .fix_client_box:
546
  .fix_client_box:
555
	call	window._.set_window_clientbox
547
	call	window._.set_window_clientbox
Line 556... Line 548...
556
 
548
 
557
	add	edi, WDATA.sizeof
549
	add	edi, WDATA.sizeof
558
	dec	ecx
550
	dec	ecx
Line 559... Line 551...
559
	jne    .next_window	; <<<<<<<<<<<
551
	jne    .next_window
560
 
552
 
Line 561... Line 553...
561
  .exit:
553
  .exit:
562
	ret
554
	ret
563
 
555
 
564
align 4
556
align 4
565
;------------------------------------------------------------------------------
557
;------------------------------------------------------------------------------
566
sys_window_mouse: ;////////////////////////////////////////////////////////////
558
sys_window_mouse: ;////////////////////////////////////////////////////////////
567
;------------------------------------------------------------------------------
-
 
568
;? 
-
 
569
;------------------------------------------------------------------------------
-
 
570
	; NOTE: commented out since doesn't provide necessary functionality
-
 
571
	;       anyway, to be reworked
-
 
572
;       push    eax
-
 
573
;
-
 
574
;       mov     eax, [timer_ticks]
-
 
575
;       cmp     [new_window_starting], eax
-
 
576
;       jb      .exit
-
 
577
;
-
 
578
;       mov     byte[MOUSE_BACKGROUND], 0
-
 
579
;       mov     byte[DONT_DRAW_MOUSE], 0
-
 
580
;
-
 
581
;       mov     [new_window_starting], eax
-
 
582
;
559
;------------------------------------------------------------------------------
Line 583... Line 560...
583
; .exit:
560
;?   (not used)
584
;       pop     eax
561
;------------------------------------------------------------------------------
585
	ret
562
	ret
Line 664... Line 641...
664
	mov	ebx, edx
641
	mov	ebx, edx
665
	shl	ebx, 16
642
	shl	ebx, 16
666
	add	ebx, edx
643
	add	ebx, edx
667
	mov	eax, [esi + WDATA.box.left]
644
	mov	eax, [esi + WDATA.box.left]
668
	inc	eax
645
	inc	eax
669
 
-
 
670
	shl	eax, 16
646
	shl	eax, 16
671
	add	eax, [esi + WDATA.box.left]
647
	add	eax, [esi + WDATA.box.left]
672
	add	eax, [esi + WDATA.box.width]
648
	add	eax, [esi + WDATA.box.width]
673
	dec	eax
649
	dec	eax
674
	mov	ecx, [esi + WDATA.cl_titlebar]
650
	mov	ecx, [esi + WDATA.cl_titlebar]
Line 1207... Line 1183...
1207
    5, 20, \ ;type 2
1183
    5, 20, \ ;type 2
1208
    5,	?, \ ;type 3 {set by skin}
1184
    5,	?, \ ;type 3 {set by skin}
1209
    5,	?    ;type 4 {set by skin}
1185
    5,	?    ;type 4 {set by skin}
1210
endg
1186
endg
Line 1211... Line -...
1211
 
-
 
1212
;uglobal
-
 
1213
  ; NOTE: commented out since doesn't provide necessary functionality anyway,
-
 
1214
  ;       to be reworked
-
 
1215
; new_window_starting       dd ?
-
 
Line 1216... Line 1187...
1216
;endg
1187
 
1217
 
1188
 
1218
align 4
1189
align 4
1219
;------------------------------------------------------------------------------
1190
;------------------------------------------------------------------------------
Line 1442... Line 1413...
1442
	; was it already defined before?
1413
	; was it already defined before?
1443
	test	[edi + WDATA.fl_wdrawn], 1
1414
	test	[edi + WDATA.fl_wdrawn], 1
1444
	jnz	.set_client_box
1415
	jnz	.set_client_box
1445
	or	[edi + WDATA.fl_wdrawn], 1
1416
	or	[edi + WDATA.fl_wdrawn], 1
Line 1446... Line -...
1446
 
-
 
1447
	; NOTE: commented out since doesn't provide necessary functionality
-
 
1448
	;       anyway, to be reworked
-
 
1449
;       mov     eax, [timer_ticks] ; [0xfdf0]
-
 
1450
;       add     eax, 100
-
 
1451
;       mov     [new_window_starting], eax
-
 
1452
 
1417
 
1453
	; no it wasn't, performing initial window definition
1418
; performing initial window definition
1454
	movzx	eax, bx
1419
	movzx	eax, bx
1455
	mov	[edi + WDATA.box.width], eax
1420
	mov	[edi + WDATA.box.width], eax
1456
	movzx	eax, cx
1421
	movzx	eax, cx
1457
	mov	[edi + WDATA.box.height], eax
1422
	mov	[edi + WDATA.box.height], eax
1458
	sar	ebx, 16
-
 
1459
;	and	bl, 0xFC		; <<<<<<<<
1423
	sar	ebx, 16
1460
	sar	ecx, 16
-
 
1461
;	and	cl, 0xFE		; <<<<<<<<
1424
	sar	ecx, 16
1462
	mov	[edi + WDATA.box.left], ebx
1425
	mov	[edi + WDATA.box.left], ebx
Line 1463... Line 1426...
1463
	mov	[edi + WDATA.box.top], ecx
1426
	mov	[edi + WDATA.box.top], ecx
Line 1640... Line 1603...
1640
;> ebx = top
1603
;> ebx = top
1641
;> ecx = right
1604
;> ecx = right
1642
;> edx = bottom
1605
;> edx = bottom
1643
;> esi = process number
1606
;> esi = process number
1644
;------------------------------------------------------------------------------
1607
;------------------------------------------------------------------------------
1645
virtual at esp
-
 
1646
  ff_x	   dd ?
-
 
1647
  ff_y	   dd ?
-
 
1648
  ff_width dd ?
-
 
1649
  ff_xsz   dd ?
-
 
1650
  ff_ysz   dd ?
-
 
1651
  ff_map   dd ?
-
 
1652
  ff_scale dd ?
-
 
1653
end virtual
-
 
Line 1654... Line 1608...
1654
 
1608
 
Line 1655... Line 1609...
1655
	pushad
1609
	pushad
1656
 
1610
 
Line 1673... Line 1627...
1673
	; get x&y size
1627
	; get x&y size
1674
	sub	ecx, eax
1628
	sub	ecx, eax
1675
	sub	edx, ebx
1629
	sub	edx, ebx
1676
	inc	ecx
1630
	inc	ecx
1677
	inc	edx
1631
	inc	edx
1678
	shr	ecx, 2          ; 1 tile = 4 pix
-
 
1679
        shr     edx, 1          ; 1 tile = 2 lines
-
 
Line 1680... Line 1632...
1680
 
1632
 
1681
	; get WinMap start
1633
	; get WinMap start
1682
	push	esi
1634
	push	esi
1683
	mov	edi, [_WinMapWidth]
1635
	mov	edi, [Screen_Max_X]
1684
	mov	esi, edi
-
 
1685
        shr     ebx, 1
1636
	mov	esi, edi
1686
	imul	edi, ebx
-
 
1687
	shr	eax, 2
1637
	imul	edi, ebx
1688
	add	edi, eax
1638
	add	edi, eax
1689
	add	edi, [_WinMapAddress]
1639
	add	edi, [_WinMapAddress]
1690
	pop	eax             ; al = process#
1640
	pop	eax             ; al = process#
1691
;	mov	ah, al
1641
	mov	ah, al
1692
;	push	ax
1642
	push	ax
1693
;	shl	eax, 16
1643
	shl	eax, 16
Line 1694... Line -...
1694
;	pop	ax              ; eax = 4 dup PROCESS_NUM
-
 
1695
 
-
 
1696
        sub     esi, ecx        ; map line increment (bytes)
1644
	pop	ax              ; eax = 4 dup PROCESS_NUM
-
 
1645
 
1697
	mov	ebx, ecx        ; map line width 
1646
  .next_line:
1698
  .next_line:
1647
	push	ecx
1699
;        shr     ecx, 2          ; 1dword = 4 tiles
1648
        shr     ecx, 2          
1700
;	rep	stosd           ; filling the screen map
1649
	rep	stosd           ; filling the screen map
1701
;	mov	ecx, ebx      
1650
	mov	ecx,[esp]
1702
;	and	ecx, 3          ; 0 to 3 tiles remaining
1651
	and	ecx, 3          
1703
	rep	stosb
1652
	rep	stosb
-
 
1653
	pop	ecx
1704
	mov	ecx, ebx
1654
	add	edi, esi        
1705
	add	edi, esi        
1655
	sub	edi, ecx
1706
	dec	edx
1656
	dec	edx
Line 1707... Line 1657...
1707
        jnz	.next_line
1657
        jnz	.next_line
1708
	jmp	.exit
-
 
1709
 
-
 
1710
  .shaped_window:
-
 
1711
	;  for (y=0; y <= y_size; y++)
-
 
1712
	;      for (x=0; x <= x_size; x++)
-
 
1713
	;          if (shape[coord(x,y,scale)]==1)
-
 
1714
	;             set_pixel(x, y, process_number);
-
 
1715
 
-
 
1716
	sub	ecx, eax
-
 
1717
	sub	edx, ebx
-
 
1718
	inc	ecx
-
 
1719
	inc	edx
-
 
1720
 
-
 
1721
	push	[edi + APPDATA.wnd_shape_scale]                 ; push scale first -> for loop
-
 
1722
 
-
 
1723
	push	ebx
-
 
1724
	push	eax
-
 
1725
	mov	ebp, eax
-
 
1726
	shr	ebp, 2
-
 
1727
	add	ebp, [_WinMapAddress]
-
 
1728
	mov	eax, [_WinMapWidth] 
-
 
1729
        shr     ebx, 1
-
 
1730
	imul	eax, ebx
-
 
1731
	add	ebp, eax	; ebp = map origin
-
 
1732
 
-
 
1733
	mov	edi, [edi + APPDATA.wnd_shape]
-
 
1734
	pop	eax
-
 
1735
	pop	ebx
-
 
1736
        
-
 
1737
        push    ebp                                             ; for loop - screen map origin
-
 
1738
 
-
 
1739
	; eax = x_start
-
 
1740
	; ebx = y_start
1658
;	jmp	.exit
1741
	; ecx = x_size
-
 
1742
	; edx = y_size
-
 
1743
	; esi = process_number
-
 
1744
	; edi = &shape
-
 
1745
        ; ebp = [ff_map]
-
 
1746
	;       [scale]
-
 
1747
 
-
 
1748
        push	edx ecx                                         ; for loop - x,y size
-
 
1749
	mov	ecx, esi
-
 
1750
	shl	ecx, 5
-
 
1751
	mov	edx, [window_data + ecx + WDATA.box.top]
-
 
1752
	push	[window_data + ecx + WDATA.box.width]		; for loop - width
-
 
1753
	mov	ecx, [window_data + ecx + WDATA.box.left]
-
 
1754
	sub	ebx, edx
-
 
1755
	sub	eax, ecx
-
 
1756
	push	ebx eax                                         ; for loop - x,y
-
 
1757
 
-
 
1758
	add	[ff_xsz], eax
-
 
1759
	add	[ff_ysz], ebx
-
 
1760
 
-
 
1761
	mov	ebx, [ff_y]
-
 
1762
 
-
 
1763
  .ff_new_y:
-
 
1764
	mov	edx, [ff_x]
-
 
1765
 
-
 
1766
  .ff_new_x:
-
 
1767
	; -- body --
-
 
1768
	mov	ecx, [ff_scale]
-
 
1769
	mov	eax, [ff_width]
-
 
1770
	inc	eax
-
 
1771
	shr	eax, cl
-
 
1772
	push	ebx edx
-
 
1773
	shr	ebx, cl
-
 
1774
	shr	edx, cl
-
 
1775
	imul	eax, ebx
-
 
1776
	add	eax, edx
-
 
1777
	pop	edx ebx
-
 
1778
	add	eax, edi
-
 
1779
	call	.read_byte		; al= shaped window pix-mask at a given point
-
 
1780
	test	al,al
-
 
1781
	jz	@f
-
 
1782
	mov	eax, esi
-
 
1783
	mov	[ebp], al               ; a tile belongs to the window if the 1st pixel's mask = 1
-
 
1784
	; -- end body --
-
 
1785
    @@: 
-
 
1786
	add	edx, 4
-
 
1787
        inc     ebp                     
-
 
1788
	cmp	edx, [ff_xsz]
-
 
1789
	jb	.ff_new_x
-
 
1790
 
-
 
1791
	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
-
 
1797
	mov	[ff_map], ebp
-
 
1798
	jmp	.ff_new_y
1659
 
1799
@@:
1660
  .shaped_window:
1800
	add	esp, 7*4
1661
	;  (not supported any more)
Line 1801... Line -...
1801
  .exit:
-
 
1802
	popad
-
 
1803
	ret
-
 
1804
 
-
 
1805
  .read_byte:
-
 
1806
	; eax - buffer address
-
 
1807
	; esi - slot#
-
 
1808
	push	eax ecx edx esi
-
 
1809
	xchg	eax, esi                
-
 
1810
	lea	ecx, [esp + 12]         ; buffer addr = stacked [eax] to return
-
 
1811
	mov	edx, 1                  ; buffer size
-
 
1812
	call	read_process_memory     ; (core/taskman.inc) returns #bytes read
1662
  .exit:
1813
	pop	esi edx ecx eax         ; eax = PID
1663
	popad
1814
	ret
1664
	ret
1815
 
1665
 
1816
align 4
1666
align 4