Added two flags to 0th function (edx = 0xXYRRGGBB, X = DCBAb)

A - window has a caption; if Y=3, then caption scting address could be passed in
      edi, otherwise use function 71/1
  B - treat all drawing performed to be relative to window client area
  D - use gradient fill for client area
Added function 71:
  subfunction 1 - set window caption string address (in ecx)
  subfunction 2 - get window caption into buffer (not implemented yet)
Updated sysfuncr.txt, added sysfuncs.txt

git-svn-id: svn://kolibrios.org@114 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Mihail Semenyako (mike.dld) 2006-08-03 19:30:32 +00:00
parent 7a1e29cbc9
commit 9a27b206b3
10 changed files with 5125 additions and 465 deletions

View File

@ -797,20 +797,20 @@ terminate: ; terminate application
cld
shl esi,5
add esi,window_data
mov eax,[esi+WDATA.left]
mov eax,[esi+WDATA.box.left]
mov [dlx],eax
add eax,[esi+WDATA.width]
add eax,[esi+WDATA.box.width]
mov [dlxe],eax
mov eax,[esi+WDATA.top]
mov eax,[esi+WDATA.box.top]
mov [dly],eax
add eax,[esi+WDATA.height]
add eax,[esi+WDATA.box.height]
mov [dlye],eax
mov [esi+WDATA.left], 0
mov [esi+WDATA.width], 5
mov [esi+WDATA.box.left], 0
mov [esi+WDATA.box.width], 5
mov eax,[0xFE04]
mov [esi+WDATA.top],eax
mov [esi+WDATA.height], 5
mov [esi+WDATA.box.top],eax
mov [esi+WDATA.box.height], 5
xor eax, eax
mov [esi+16],eax
mov [esi+20],eax

View File

@ -143,6 +143,7 @@ iglobal
dd sys_internal_services ; 68-Some internal services
dd sys_debug_services ; 69-Debug
dd file_system_lfn ; 70-Common file system interface, version 2
dd syscall_windowsettings ; 71-Window settings
times 255 - ( ($-servetable) /4 ) dd undefined_syscall

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -163,14 +163,26 @@ button_dececx:
sys_button:
push edi
mov edi,[0x3000]
shl edi,8
rol eax,16
add ax,word[edi+0x80000+APPDATA.wnd_clientbox.left]
rol eax,16
rol ebx,16
add bx,word[edi+0x80000+APPDATA.wnd_clientbox.top]
rol ebx,16
pop edi
.forced:
test ecx,0x80000000
jnz remove_button
push esi
push edi
push eax
push ebx
push ecx
push eax ; <x,xs>
push ebx ; <y,ys>
push ecx ; <id>
push edx
or ax,ax

View File

@ -191,9 +191,78 @@ parse_skin_data:
sys_putimage_with_check:
or ebx,ebx
jz @f
call sys_putimage
call sys_putimage.forced
@@: ret
drawwindow_IV_caption:
mov ebp,skin_active
or al,al
jnz @f
mov ebp,skin_inactive
@@:
mov esi,[esp+4]
mov eax,[esi+8] ; window width
mov edx,[ebp+SKIN_DATA.left.left]
shl edx,16
mov ecx,[ebp+SKIN_DATA.left.width]
shl ecx,16
add ecx,[_skinh]
mov ebx, [ebp+SKIN_DATA.left.data]
call sys_putimage_with_check
mov esi,[esp+4]
mov eax,[esi+8]
sub eax,[ebp+SKIN_DATA.left.width]
sub eax,[ebp+SKIN_DATA.oper.width]
cmp eax,[ebp+SKIN_DATA.base.left]
jng .non_base
xor edx,edx
mov ecx,[ebp+SKIN_DATA.base.width]
jecxz .non_base
div ecx
inc eax
mov ebx,[ebp+SKIN_DATA.base.data]
mov ecx,[ebp+SKIN_DATA.base.width]
shl ecx,16
add ecx,[_skinh]
mov edx,[ebp+SKIN_DATA.base.left]
sub edx,[ebp+SKIN_DATA.base.width]
shl edx,16
.baseskinloop:
shr edx,16
add edx,[ebp+SKIN_DATA.base.width]
shl edx,16
push eax ebx ecx edx
call sys_putimage_with_check
pop edx ecx ebx eax
dec eax
jnz .baseskinloop
.non_base:
mov esi,[esp+4]
mov edx,[esi+8]
sub edx,[ebp+SKIN_DATA.oper.width]
inc edx
shl edx,16
mov ebx,[ebp+SKIN_DATA.oper.data]
mov ecx,[ebp+SKIN_DATA.oper.width]
shl ecx,16
add ecx,[_skinh]
call sys_putimage_with_check
ret
;//mike.dld, 2006-08-02 ]
drawwindow_IV:
;param1 - aw_yes
@ -256,61 +325,8 @@ drawwindow_IV:
jmp draw_clientbar
@@:
mov esi,[esp]
mov eax,[esi+8] ; window width
mov edx,[ebp+SKIN_DATA.left.left]
shl edx,16
mov ecx,[ebp+SKIN_DATA.left.width]
shl ecx,16
add ecx,[_skinh]
mov ebx, [ebp+SKIN_DATA.left.data]
call sys_putimage_with_check
mov esi,[esp]
mov eax,[esi+8]
sub eax,[ebp+SKIN_DATA.left.width]
sub eax,[ebp+SKIN_DATA.oper.width]
cmp eax,[ebp+SKIN_DATA.base.left]
jng non_base
xor edx,edx
mov ecx,[ebp+SKIN_DATA.base.width]
jecxz non_base
div ecx
inc eax
mov ebx,[ebp+SKIN_DATA.base.data]
mov ecx,[ebp+SKIN_DATA.base.width]
shl ecx,16
add ecx,[_skinh]
mov edx,[ebp+SKIN_DATA.base.left]
sub edx,[ebp+SKIN_DATA.base.width]
shl edx,16
baseskinloop:
shr edx,16
add edx,[ebp+SKIN_DATA.base.width]
shl edx,16
push eax ebx ecx edx
call sys_putimage_with_check
pop edx ecx ebx eax
dec eax
jnz baseskinloop
non_base:
mov esi,[esp]
mov edx,[esi+8]
sub edx,[ebp+SKIN_DATA.oper.width]
inc edx
shl edx,16
mov ebx,[ebp+SKIN_DATA.oper.data]
mov ecx,[ebp+SKIN_DATA.oper.width]
shl ecx,16
add ecx,[_skinh]
call sys_putimage_with_check
mov al,[esp+32+4+4]
call drawwindow_IV_caption
draw_clientbar:

View File

@ -35,7 +35,11 @@ align 4
skin_udata:
_skinh dd ?
_skinmargins rw 4
_skinmargins: ; rw 4
.right dw ?
.left dw ?
.bottom dw ?
.top dw ?
skin_btn_close SKIN_BUTTON
skin_btn_minimize SKIN_BUTTON

View File

@ -75,17 +75,17 @@ calculatescreen:
test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED
jnz .not_wnd
mov eax, [edi+WDATA.left]
mov eax,[edi+WDATA.box.left]
cmp eax, [esp+RECT.right]
ja .out_of_bounds
mov ebx, [edi+WDATA.top]
mov ebx,[edi+WDATA.box.top]
cmp ebx, [esp+RECT.bottom]
ja .out_of_bounds
mov ecx, [edi+WDATA.width]
mov ecx,[edi+WDATA.box.width]
add ecx, eax
cmp ecx, [esp+RECT.left]
jb .out_of_bounds
mov edx, [edi+WDATA.height]
mov edx,[edi+WDATA.box.height]
add edx, ebx
cmp edx, [esp+RECT.top]
jb .out_of_bounds
@ -239,9 +239,9 @@ pushad
mov ecx, esi
shl ecx, 5
mov edx, [window_data+ecx+WDATA.top]
push [window_data+ecx+WDATA.width] ; for loop - width
mov ecx, [window_data+ecx+WDATA.left]
mov edx, [window_data+ecx+WDATA.box.top]
push [window_data+ecx+WDATA.box.width] ; for loop - width
mov ecx, [window_data+ecx+WDATA.box.left]
sub ebx, edx
sub eax, ecx
push ebx eax ; for loop - x,y
@ -513,44 +513,44 @@ repos_windows:
test [esi+WDATA.fl_wstate],WSTATE_MAXIMIZED
jz .lp2
mov eax,[screen_workarea.left]
mov [esi+WDATA.left],eax
mov [esi+WDATA.box.left],eax
sub eax,[screen_workarea.right]
neg eax
mov [esi+WDATA.width],eax
mov [esi+WDATA.box.width],eax
mov eax,[screen_workarea.top]
mov [esi+WDATA.top],eax
mov [esi+WDATA.box.top],eax
test [esi+WDATA.fl_wstate],WSTATE_ROLLEDUP
jnz .lp1
sub eax,[screen_workarea.bottom]
neg eax
mov [esi+WDATA.height],eax
mov [esi+WDATA.box.height],eax
.lp1: add esi,0x20
loop @b
ret
.lp2: mov eax,[esi+WDATA.left]
add eax,[esi+WDATA.width]
.lp2: mov eax,[esi+WDATA.box.left]
add eax,[esi+WDATA.box.width]
mov ebx,[0x0000fe00]
; inc ebx
cmp eax,ebx
jle .lp4
mov eax,[esi+WDATA.width]
mov eax,[esi+WDATA.box.width]
sub eax,ebx
jle .lp3
mov [esi+WDATA.width],ebx
.lp3: sub ebx,[esi+WDATA.width]
mov [esi+WDATA.left],ebx
.lp4: mov eax,[esi+WDATA.top]
add eax,[esi+WDATA.height]
mov [esi+WDATA.box.width],ebx
.lp3: sub ebx,[esi+WDATA.box.width]
mov [esi+WDATA.box.left],ebx
.lp4: mov eax,[esi+WDATA.box.top]
add eax,[esi+WDATA.box.height]
mov ebx,[0x0000fe04]
; inc ebx
cmp eax,ebx
jle .lp6
mov eax,[esi+WDATA.height]
mov eax,[esi+WDATA.box.height]
sub eax,ebx
jle .lp5
mov [esi+WDATA.height],ebx
.lp5: sub ebx,[esi+WDATA.height]
mov [esi+WDATA.top],ebx
mov [esi+WDATA.box.height],ebx
.lp5: sub ebx,[esi+WDATA.box.height]
mov [esi+WDATA.box.top],ebx
.lp6: add esi,0x20
loop @b
ret
@ -633,6 +633,63 @@ sys_window_mouse:
ret
drawwindow_I_caption:
mov ecx,[edx+20] ; grab bar
push ecx
mov esi,edx
mov edx,[esi+04]
add edx,1
mov ebx,[esi+04]
add ebx,21
mov eax,[esi+04]
add eax,[esi+12]
cmp ebx,eax
jb .wdsizeok
mov ebx,eax
.wdsizeok:
push ebx
.drwi:
mov ebx,edx
shl ebx,16
add ebx,edx
mov eax,[esi+00]
inc eax
shl eax,16
add eax,[esi+00]
add eax,[esi+8]
sub eax,1
push edx
mov edx,0x80000000
mov ecx,[esi+20]
and ecx,edx
cmp ecx,edx
jnz .nofa
mov ecx,[esi+20]
sub ecx,0x00040404
mov [esi+20],ecx
and ecx,0x00ffffff
jmp .faj
.nofa:
mov ecx,[esi+20]
and ecx,0x00ffffff
.faj:
pop edx
mov edi,0
call [draw_line]
inc edx
cmp edx,[esp]
jb .drwi
add esp,4
pop ecx
mov [esi+20],ecx
ret
drawwindow_I:
pushad
@ -648,54 +705,7 @@ drawwindow_I:
add ebx,[edx+12]
call draw_rectangle
mov ecx,[edx+20] ; grab bar
push ecx
mov esi,edx
mov edx,[esi+04]
add edx,1
mov ebx,[esi+04]
add ebx,25
mov eax,[esi+04]
add eax,[esi+12]
cmp ebx,eax
jb wdsizeok
mov ebx,eax
wdsizeok:
push ebx
drwi:
mov ebx,edx
shl ebx,16
add ebx,edx
mov eax,[esi+00]
inc eax
shl eax,16
add eax,[esi+00]
add eax,[esi+8]
sub eax,1
push edx
mov edx,0x80000000
mov ecx,[esi+20]
and ecx,edx
cmp ecx,edx
jnz nofa
mov ecx,[esi+20]
sub ecx,0x00040404
mov [esi+20],ecx
and ecx,0x00ffffff
jmp faj
nofa:
mov ecx,[esi+20]
and ecx,0x00ffffff
faj:
pop edx
mov edi,0
call [draw_line]
inc edx
cmp edx,[esp]
jb drwi
add esp,4
pop ecx
mov [esi+20],ecx
call drawwindow_I_caption
mov edx,[esi+04] ; inside work area
add edx,21+5
@ -759,6 +769,54 @@ r_bx equ [esp+18] ; y end
ret
drawwindow_III_caption:
mov ecx,[edx+20] ; GRAB BAR
push ecx
mov esi,edx
mov edx,[esi+04]
add edx,4
mov ebx,[esi+04]
add ebx,20
mov eax,[esi+04]
add eax,[esi+12]
cmp ebx,eax
jb .wdsizeok
mov ebx,eax
.wdsizeok:
push ebx
.drwi:
mov ebx,edx
shl ebx,16
add ebx,edx
mov eax,[esi+00]
shl eax,16
add eax,[esi+00]
add eax,[esi+8]
add eax,4*65536-4
mov ecx,[esi+20]
test ecx,0x40000000
jz .nofa
add ecx,0x040404
.nofa:
test ecx,0x80000000
jz .nofa2
sub ecx,0x040404
.nofa2:
mov [esi+20],ecx
and ecx,0xffffff
xor edi, edi
call [draw_line]
inc edx
cmp edx,[esp]
jb .drwi
add esp,4
pop ecx
mov [esi+20],ecx
ret
drawwindow_III:
pushad
@ -790,48 +848,7 @@ drawwindow_III:
add ebx,1*65536-1
call draw_rectangle
mov ecx,[edx+20] ; GRAB BAR
push ecx
mov esi,edx
mov edx,[esi+04]
add edx,4
mov ebx,[esi+04]
add ebx,20
mov eax,[esi+04]
add eax,[esi+12]
cmp ebx,eax
jb wdsizeok2
mov ebx,eax
wdsizeok2:
push ebx
drwi2:
mov ebx,edx
shl ebx,16
add ebx,edx
mov eax,[esi+00]
shl eax,16
add eax,[esi+00]
add eax,[esi+8]
add eax,4*65536-4
mov ecx,[esi+20]
test ecx,0x40000000
jz nofa3
add ecx,0x040404
nofa3:
test ecx,0x80000000
jz nofa2
sub ecx,0x040404
nofa2:
mov [esi+20],ecx
and ecx,0xffffff
xor edi, edi
call [draw_line]
inc edx
cmp edx,[esp]
jb drwi2
add esp,4
pop ecx
mov [esi+20],ecx
call drawwindow_III_caption
mov edx,[esi+04] ; WORK AREA
add edx,21+5
@ -1060,15 +1077,15 @@ minimize_window:
or [eax+WDATA.fl_wstate], WSTATE_MINIMIZED
mov edi, eax
;call calculatescreen
mov eax, [edi+WDATA.left]
mov eax, [edi+WDATA.box.left]
mov [dlx], eax
mov ecx, eax
add ecx, [edi+WDATA.width]
add ecx, [edi+WDATA.box.width]
mov [dlxe], ecx
mov ebx, [edi+WDATA.top]
mov ebx, [edi+WDATA.box.top]
mov [dly], ebx
mov edx, ebx
add edx, [edi+WDATA.height]
add edx, [edi+WDATA.box.height]
mov [dlye], edx
call calculatescreen
xor esi, esi
@ -1093,21 +1110,21 @@ restore_minimized_window:
and [edi+WDATA.fl_wstate], not WSTATE_MINIMIZED
cmp eax, [0x3004] ; the uppermost window
jnz .no_uppermost
mov eax, [edi+WDATA.left]
mov ebx, [edi+WDATA.top]
mov eax, [edi+WDATA.box.left]
mov ebx, [edi+WDATA.box.top]
mov ecx, eax
mov edx, ebx
add ecx, [edi+WDATA.width]
add edx, [edi+WDATA.height]
add ecx, [edi+WDATA.box.width]
add edx, [edi+WDATA.box.height]
call setscreen
jmp .done
.no_uppermost:
mov eax, [edi+WDATA.left]
mov ebx, [edi+WDATA.top]
mov eax, [edi+WDATA.box.left]
mov ebx, [edi+WDATA.box.top]
mov ecx, eax
mov edx, ebx
add ecx, [edi+WDATA.width]
add edx, [edi+WDATA.height]
add ecx, [edi+WDATA.box.width]
add edx, [edi+WDATA.box.height]
call calculatescreen
.done:
mov [0xfff4],byte 0 ; no mouse under
@ -1480,7 +1497,7 @@ checkwindows:
jz @f
mov eax,[screen_workarea.bottom]
sub eax,[screen_workarea.top]
@@: mov [edi+WDATA.height],eax
@@: mov [edi+WDATA.box.height],eax
no_window_shade:
@ -1493,22 +1510,22 @@ checkwindows:
jnz restore_from_fullscreen
or [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
mov eax,[screen_workarea.left]
mov [edi+WDATA.left],eax
mov [edi+WDATA.box.left],eax
sub eax,[screen_workarea.right]
neg eax
mov [edi+WDATA.width],eax
mov [edi+WDATA.box.width],eax
mov eax,[screen_workarea.top]
mov [edi+WDATA.top],eax
mov [edi+WDATA.box.top],eax
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
jnz @f
sub eax,[screen_workarea.bottom]
neg eax
mov [edi+WDATA.height],eax
mov [edi+WDATA.box.height],eax
@@:
jmp no_fullscreen_restore
restore_from_fullscreen:
and [edi+WDATA.fl_wstate],not WSTATE_MAXIMIZED
push [edi+WDATA.height]
push [edi+WDATA.box.height]
push edi ; restore
lea esi, [edx + 0x90]
mov ecx,4
@ -1518,7 +1535,7 @@ checkwindows:
pop eax
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
jz @f
mov [edi+WDATA.height],eax
mov [edi+WDATA.box.height],eax
@@:
no_fullscreen_restore:

View File

@ -69,7 +69,10 @@ dd servetable-0x10000
draw_line dd __sys_draw_line
disable_mouse dd __sys_disable_mouse
draw_pointer dd __sys_draw_pointer
drawbar dd __sys_drawbar
;//mike.dld, 2006-08-02 [
;drawbar dd __sys_drawbar
drawbar dd __sys_drawbar.forced
;//mike.dld, 2006-08-02 ]
putpixel dd __sys_putpixel
; } mike.dld
@ -2856,9 +2859,10 @@ sys_drawwindow:
call sys_set_window
call [disable_mouse]
call drawwindow_I
dec [mouse_pause]
call [draw_pointer]
ret
;dec [mouse_pause]
;call [draw_pointer]
;ret
jmp draw_window_caption.2
nosyswI:
cmp edi,1 ; type II - only reserve area, no draw
@ -2880,9 +2884,10 @@ sys_drawwindow:
call sys_set_window
call [disable_mouse]
call drawwindow_III
dec [mouse_pause]
call [draw_pointer]
ret
;dec [mouse_pause]
;call [draw_pointer]
;ret
jmp draw_window_caption.2
nosyswIII:
cmp edi,3 ; type IV - skinned window
@ -2902,14 +2907,176 @@ sys_drawwindow:
call sys_set_window
call [disable_mouse]
call drawwindow_IV
dec [mouse_pause]
call [draw_pointer]
ret
;dec [mouse_pause]
;call [draw_pointer]
;ret
jmp draw_window_caption.2
nosyswIV:
ret
draw_window_caption:
inc [mouse_pause]
call [disable_mouse]
xor eax,eax
mov edx,[0x3004]
movzx edx,word[0xC400+edx*2]
cmp edx,[0x3000]
jne @f
inc eax
@@: mov edx,[0x3000]
shl edx,5
add edx,window_data
movzx ebx,[edx+WDATA.fl_wstyle]
and bl,0x0F
cmp bl,3
jne .not_style_3
push edx
call drawwindow_IV_caption
add esp,4
jmp .2
.not_style_3:
cmp bl,2
jne .not_style_2
call drawwindow_III_caption
jmp .2
.not_style_2:
cmp bl,0
jne .2
call drawwindow_I_caption
;--------------------------------------------------------------
.2: ;jmp @f
mov edi,[0x3000]
shl edi,5
test [edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION
jz @f
mov ecx,[edi*8+0x80000+APPDATA.wnd_caption]
or ecx,ecx
jz @f
add ecx,[edi+twdw+0x10]
movzx eax,[edi+window_data+WDATA.fl_wstyle]
and al,0x0F
cmp al,3
jne .not_skinned
mov ebp,[edi+window_data+WDATA.box.left-2]
mov bp,word[edi+window_data+WDATA.box.top]
movzx eax,word[edi+window_data+WDATA.box.width]
sub ax,[_skinmargins.left]
sub ax,[_skinmargins.right]
cwde
cdq
mov ebx,6
idiv ebx
or eax,eax
js @f
mov edx,eax
mov eax,dword[_skinmargins.left-2]
mov ax,word[_skinh]
sub ax,[_skinmargins.bottom]
sub ax,[_skinmargins.top]
sar ax,1
adc ax,0
add ax,[_skinmargins.top]
add ax,-3
add eax,ebp
mov ebx,[common_colours+16];0x00FFFFFF
xor edi,edi
call dtext
jmp @f
.not_skinned:
cmp al,1
je @f
mov ebp,[edi+window_data+WDATA.box.left-2]
mov bp,word[edi+window_data+WDATA.box.top]
movzx eax,word[edi+window_data+WDATA.box.width]
sub eax,16
cwde
cdq
mov ebx,6
idiv ebx
or eax,eax
js @f
mov edx,eax
mov eax,0x00080007
add eax,ebp
mov ebx,[common_colours+16];0x00FFFFFF
xor edi,edi
call dtext
jmp @f
@@:
;--------------------------------------------------------------
dec [mouse_pause]
call [draw_pointer]
ret
iglobal
align 4
window_topleft dd \
1, 21,\
0, 0,\
5, 20,\
5, ?
endg
set_window_clientbox:
push eax ecx edi
mov eax,[_skinh]
mov [window_topleft+4*7],eax
mov ecx,edi
sub edi,window_data
shl edi,3
test [ecx+WDATA.fl_wstyle],WSTYLE_CLIENTRELATIVE
jz @f
movzx eax,[ecx+WDATA.fl_wstyle]
and eax,0x0F
mov eax,[eax*8+window_topleft+0]
mov [edi+0x80000+APPDATA.wnd_clientbox.left],eax
shl eax,1
neg eax
add eax,[ecx+WDATA.box.width]
mov [edi+0x80000+APPDATA.wnd_clientbox.width],eax
movzx eax,[ecx+WDATA.fl_wstyle]
and eax,0x0F
push [eax*8+window_topleft+0]
mov eax,[eax*8+window_topleft+4]
mov [edi+0x80000+APPDATA.wnd_clientbox.top],eax
neg eax
sub eax,[esp]
add eax,[ecx+WDATA.box.height]
mov [edi+0x80000+APPDATA.wnd_clientbox.height],eax
add esp,4
pop edi ecx eax
ret
@@:
xor eax,eax
mov [edi+0x80000+APPDATA.wnd_clientbox.left],eax
mov [edi+0x80000+APPDATA.wnd_clientbox.top],eax
mov eax,[ecx+WDATA.box.width]
mov [edi+0x80000+APPDATA.wnd_clientbox.width],eax
mov eax,[ecx+WDATA.box.height]
mov [edi+0x80000+APPDATA.wnd_clientbox.height],eax
pop edi ecx eax
ret
sys_set_window:
mov edi,[0x3000]
@ -2917,12 +3084,14 @@ sys_set_window:
add edi,window_data
; colors
mov [edi+16],ecx
mov [edi+20],edx
mov [edi+24],esi
mov [edi+WDATA.cl_workarea],ecx
mov [edi+WDATA.cl_titlebar],edx
mov [edi+WDATA.cl_frames],esi
call set_window_clientbox
; check flag (?)
cmp [edi+30],byte 1
cmp [edi+WDATA.fl_wdrawn],1
jz newd
push eax
@ -2931,23 +3100,33 @@ sys_set_window:
mov [new_window_starting],eax
pop eax
mov [edi+8],ax
mov [edi+12],bx
shr eax,16
shr ebx,16
mov [edi+00],ax
mov [edi+04],bx
mov word[edi+WDATA.box.width],ax
mov word[edi+WDATA.box.height],bx
sar eax,16
sar ebx,16
mov word[edi+WDATA.box.left],ax
mov word[edi+WDATA.box.top],bx
call check_window_position
push ecx esi edi ; save for window fullscreen/resize
mov esi,edi
;mov esi,edi
mov cl,[edi+WDATA.fl_wstyle]
sub edi,window_data
shr edi,5
shl edi,8
shl edi,3
add edi,0x80000+0x90
and cl,0x0F
mov [edi-0x90+APPDATA.wnd_caption],0
cmp cl,3
jne @f
mov [edi-0x90+APPDATA.wnd_caption],esi
@@: mov esi,[esp+0]
mov ecx,4
cld
rep movsd
@ -2974,6 +3153,45 @@ sys_set_window:
ret
syscall_windowsettings:
.set_window_caption:
dec eax ; subfunction #1 - set window caption
jnz .get_window_caption
; NOTE: only window owner thread can set its caption,
; so there's no parameter for PID/TID
mov edi,[0x3000]
shl edi,5
; have to check if caption is within application memory limit
; check is trivial, and if application resizes its memory,
; caption still can become over bounds
mov ecx,[edi*8+0x80000+APPDATA.mem_size]
add ecx,255 ; max caption length
cmp ebx,ecx
ja .exit_fail
mov [edi*8+0x80000+APPDATA.wnd_caption],ebx
or [edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION
call draw_window_caption
xor eax,eax ; eax = 0 (success)
ret
.get_window_caption:
dec eax ; subfunction #2 - get window caption
jnz .exit_fail
; not implemented yet
.exit_fail:
xor eax,eax
inc eax ; eax = 1 (fail)
ret
sys_window_move:
@ -3966,6 +4184,13 @@ sys_putimage:
.exit:
ret
@@:
mov edi,[0x3000]
shl edi,8
add dx,word[edi+0x80000+APPDATA.wnd_clientbox.top]
rol edx,16
add dx,word[edi+0x80000+APPDATA.wnd_clientbox.left]
rol edx,16
.forced:
mov eax, vga_putimage
cmp [0xfe0c], word 0x12
jz .doit
@ -3989,6 +4214,13 @@ sys_putimage:
; edi color
__sys_drawbar:
mov esi,[0x3000]
shl esi,8
add eax,[esi+0x80000+APPDATA.wnd_clientbox.left]
add ecx,[esi+0x80000+APPDATA.wnd_clientbox.left]
add ebx,[esi+0x80000+APPDATA.wnd_clientbox.top]
add edx,[esi+0x80000+APPDATA.wnd_clientbox.top]
.forced:
inc [mouse_pause]
cmp [0xfe0c],word 0x12
jne sdbv20
@ -4667,6 +4899,10 @@ syscall_setpixel: ; SetPixel
mov edx,[0x3010]
add eax,[edx-twdw]
add ebx,[edx-twdw+4]
mov edi,[0x3000]
shl edi,8
add eax,[edi+0x80000+APPDATA.wnd_clientbox.left]
add ebx,[edi+0x80000+APPDATA.wnd_clientbox.top]
xor edi,edi ; no force
; mov edi,1
call [disable_mouse]
@ -4678,8 +4914,12 @@ syscall_writetext: ; WriteText
mov edi,[0x3010]
mov ebp,[edi-twdw]
mov esi,[0x3000]
shl esi,8
add ebp,[esi+0x80000+APPDATA.wnd_clientbox.left]
shl ebp,16
add ebp,[edi-twdw+4]
add bp,word[esi+0x80000+APPDATA.wnd_clientbox.top]
add edi,0x10
add ecx,[edi]
add eax,ebp
@ -4714,6 +4954,10 @@ syscall_drawrect: ; DrawRect
shr eax,16
movzx edx,bx
shr ebx,16
mov esi,[0x3000]
shl esi,8
add eax,[esi+0x80000+APPDATA.wnd_clientbox.left]
add ebx,[esi+0x80000+APPDATA.wnd_clientbox.top]
add ecx,eax
add edx,ebx
jmp [drawbar]
@ -4838,11 +5082,17 @@ syscall_drawline: ; DrawLine
mov edi,[0x3010]
movzx edx,word[edi-twdw]
mov ebp,edx
mov esi,[0x3000]
shl esi,8
add ebp,[esi+0x80000+APPDATA.wnd_clientbox.left]
add dx,word[esi+0x80000+APPDATA.wnd_clientbox.left]
shl edx,16
add ebp,edx
movzx edx,word[edi-twdw+4]
add eax,ebp
mov ebp,edx
add ebp,[esi+0x80000+APPDATA.wnd_clientbox.top]
add dx,word[esi+0x80000+APPDATA.wnd_clientbox.top]
shl edx,16
xor edi,edi
add edx,ebp

View File

@ -75,31 +75,6 @@ struc dt [a] { common . dt a
display 'not used dt: ',`.,13,10
end if }
; constants definition
WSTATE_NORMAL = 00000000b
WSTATE_MAXIMIZED = 00000001b
WSTATE_MINIMIZED = 00000010b
WSTATE_ROLLEDUP = 00000100b
; structures definition
struc WDATA {
.left dd ?
.top dd ?
.width dd ?
.height dd ?
.cl_workarea dd ?
.cl_titlebar dd ?
.cl_frames dd ?
.reserved db ?
.fl_wstate db ?
.fl_wdrawn db ?
.fl_redraw db ?
}
virtual at 0
WDATA WDATA
end virtual
label WDATA.fl_wstyle byte at 0x13 ; WDATA.cl_workarea+3
struc RECT {
.left dd ?
.top dd ?
@ -120,18 +95,97 @@ virtual at 0
BOX BOX
end virtual
; constants definition
WSTATE_NORMAL = 00000000b
WSTATE_MAXIMIZED = 00000001b
WSTATE_MINIMIZED = 00000010b
WSTATE_ROLLEDUP = 00000100b
WSTATE_REDRAW = 00000001b
WSTATE_WNDDRAWN = 00000010b
WSTYLE_HASCAPTION = 00010000b
WSTYLE_CLIENTRELATIVE = 00100000b
struc TASKLIST
{
.event_mask dd ?
.pid dd ?
dw ?
.state dw ?
dw ?
.wnd_number db ?
db ?
.mem_start dd ?
.counter_sum dd ?
.counter_add dd ?
.cpu_usage dd ?
}
virtual at 0
TASKLIST TASKLIST
end virtual
; structures definition
struc WDATA {
.box BOX
.cl_workarea dd ?
.cl_titlebar dd ?
.cl_frames dd ?
.reserved db ?
.fl_wstate db ?
.fl_wdrawn db ?
.fl_redraw db ?
}
virtual at 0
WDATA WDATA
end virtual
label WDATA.fl_wstyle byte at 0x13
struc APPDATA
{
.app_name db 11 dup(?)
db 5 dup(?)
.fpu_save_area db 108 dup(?)
db 3 dup(?)
.is_fpu_saved db ?
.wnd_shape dd ?
.wnd_shape_scale dd ?
.gdt dd ?
.mem_size dd ?
.saved_box BOX
.ipc_start dd ?
.ipc_size dd ?
.event_mask dd ?
.debugger_slot dd ?
.int40_handler dd ?
.keyboard_mode db ?
db 3 dup(?)
.dir_table dd ?
.dbg_event_mem dd ?
.dbg_regs:
.dbg_regs.dr0 dd ?
.dbg_regs.dr1 dd ?
.dbg_regs.dr2 dd ?
.dbg_regs.dr3 dd ?
.dbg_regs.dr7 dd ?
.wnd_caption dd ?
.wnd_clientbox BOX
}
virtual at 0
APPDATA APPDATA
end virtual
;// mike.dld, 2006-29-01 ]
; Core functions
include "core/sync.inc"
include "core/sync.inc" ; macros for synhronization objects
include "core/sys32.inc" ; process management
include "core/sched.inc" ; process scheduling
include "core/syscall.inc" ; system call
include "core/mem.inc" ; high-level memory management
include "core/newproce.inc" ;new process management
include "core/physmem.inc" ; access to physical memory for applications
include "core/sync.inc" ; macros for synhronization objects
; GUI stuff
include "gui/window.inc"