* gui/window.inc refactoring

git-svn-id: svn://kolibrios.org@1362 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Mihail Semenyako (mike.dld) 2010-01-05 01:28:11 +00:00
parent 05c7a5c29f
commit 892d2df51e
7 changed files with 1904 additions and 1934 deletions

View File

@ -597,13 +597,13 @@ term9:
shl esi,5 shl esi,5
add esi,window_data add esi,window_data
mov eax,[esi+WDATA.box.left] mov eax,[esi+WDATA.box.left]
mov [dlx],eax mov [draw_limits.left],eax
add eax,[esi+WDATA.box.width] add eax,[esi+WDATA.box.width]
mov [dlxe],eax mov [draw_limits.right],eax
mov eax,[esi+WDATA.box.top] mov eax,[esi+WDATA.box.top]
mov [dly],eax mov [draw_limits.top],eax
add eax,[esi+WDATA.box.height] add eax,[esi+WDATA.box.height]
mov [dlye],eax mov [draw_limits.bottom],eax
xor eax, eax xor eax, eax
mov [esi+WDATA.box.left],eax mov [esi+WDATA.box.left],eax
@ -807,10 +807,10 @@ term9:
; call systest ; call systest
sti ; .. and life goes on sti ; .. and life goes on
mov eax, [dlx] mov eax, [draw_limits.left]
mov ebx, [dly] mov ebx, [draw_limits.top]
mov ecx, [dlxe] mov ecx, [draw_limits.right]
mov edx, [dlye] mov edx, [draw_limits.bottom]
call calculatescreen call calculatescreen
xor eax, eax xor eax, eax
xor esi, esi xor esi, esi

View File

@ -152,7 +152,7 @@ iglobal
dd display_number ; 47-WriteNum dd display_number ; 47-WriteNum
dd 0 ; 48-SetRedrawType and SetButtonType dd 0 ; 48-SetRedrawType and SetButtonType
dd 0 ; 49-Advanced Power Management (APM) dd 0 ; 49-Advanced Power Management (APM)
dd random_shaped_window ; 50-Window shape & scale dd syscall_set_window_shape ; 50-Window shape & scale
dd syscall_threads ; 51-Threads dd syscall_threads ; 51-Threads
dd stack_driver_stat ; 52-Stack driver status dd stack_driver_stat ; 52-Stack driver status
dd socket ; 53-Socket interface dd socket ; 53-Socket interface
@ -229,7 +229,7 @@ iglobal
dd reserve_free_irq ; 45-ReserveIrq and FreeIrq dd reserve_free_irq ; 45-ReserveIrq and FreeIrq
dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea
dd cross_order ; 47-WriteNum dd cross_order ; 47-WriteNum
dd display_settings ; 48-SetRedrawType and SetButtonType dd syscall_display_settings ; 48-SetRedrawType and SetButtonType
dd sys_apm ; 49-Advanced Power Management (APM) dd sys_apm ; 49-Advanced Power Management (APM)
dd cross_order ; 50-Window shape & scale dd cross_order ; 50-Window shape & scale
dd cross_order ; 51-Threads dd cross_order ; 51-Threads

View File

@ -42,22 +42,22 @@ align 4
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
syscall_button: ;///// system function 8 ////////////////////////////////////// syscall_button: ;///// system function 8 //////////////////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; Define/undefine GUI button object ;? Define/undefine GUI button object
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; Define button arguments: ;; Define button:
; ebx = pack[16(x), 16(width)] ;> ebx = pack[16(x), 16(width)]
; ecx = pack[16(y), 16(height)] ;> ecx = pack[16(y), 16(height)]
; edx = pack[8(flags), 24(button identifier)] ;> edx = pack[8(flags), 24(button identifier)]
; flags bits: ;> flags bits:
; 7 (31) = 0 ;> 7 (31) = 0
; 6 (30) = don't draw button ;> 6 (30) = don't draw button
; 5 (29) = don't draw button frame when pressed ;> 5 (29) = don't draw button frame when pressed
; esi = button color ;> esi = button color
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Undefine button arguments: ;; Undefine button:
; edx = pack[8(flags), 24(button identifier)] ;> edx = pack[8(flags), 24(button identifier)]
; flags bits: ;> flags bits:
; 7 (31) = 1 ;> 7 (31) = 1
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; do we actually need to undefine the button? ; do we actually need to undefine the button?
test edx, 0x80000000 test edx, 0x80000000
@ -264,7 +264,7 @@ align 4
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
check_buttons: ;/////////////////////////////////////////////////////////////// check_buttons: ;///////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; <description> ;? <description>
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
cmp byte[BTN_DOWN], 0 ; mouse buttons pressed cmp byte[BTN_DOWN], 0 ; mouse buttons pressed
jnz @f jnz @f
@ -460,7 +460,7 @@ check_buttons: ;///////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
button._.dececx: ;///////////////////////////////////////////////////////////// button._.dececx: ;/////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; <description> ;? <description>
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
sub cl, 0x20 sub cl, 0x20
jnc @f jnc @f
@ -478,7 +478,7 @@ button._.dececx: ;/////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
button._.incecx: ;///////////////////////////////////////////////////////////// button._.incecx: ;/////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; <description> ;? <description>
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
add cl, 0x20 add cl, 0x20
jnc @f jnc @f
@ -496,7 +496,7 @@ button._.incecx: ;/////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
button._.incecx2: ;//////////////////////////////////////////////////////////// button._.incecx2: ;////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; <description> ;? <description>
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
add cl, 0x14 add cl, 0x14
jnc @f jnc @f
@ -514,7 +514,7 @@ button._.incecx2: ;////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
button._.button_dececx: ;////////////////////////////////////////////////////// button._.button_dececx: ;//////////////////////////////////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; <description> ;? <description>
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
cmp [buttontype], 1 cmp [buttontype], 1
jne .finish jne .finish
@ -545,76 +545,35 @@ button._.button_dececx: ;//////////////////////////////////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
button._.negative_button: ;//////////////////////////////////////////////////// button._.negative_button: ;////////////////////////////////////////////////////
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; <description> ;? <description>
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; If requested, do not display button border on press. ; if requested, do not display button border on press.
test ebx, 0x20000000 test ebx, 0x20000000
jz .draw_negative_button jnz .exit
ret
.draw_negative_button:
pushad pushad
mov ebx, dword[eax + SYS_BUTTON.left] xchg esi, eax
mov ecx, dword[eax + SYS_BUTTON.top]
movzx ecx, [esi + SYS_BUTTON.pslot]
shl ecx, 5
add ecx, window_data
mov eax, dword[esi + SYS_BUTTON.left]
mov ebx, dword[esi + SYS_BUTTON.top]
add eax, [ecx + WDATA.box.left]
add ebx, [ecx + WDATA.box.top]
push eax ebx
pop edx ecx
rol eax, 16
rol ebx, 16 rol ebx, 16
rol ecx, 16 add ax, cx
push ebx ecx add bx, dx
; calculate window-relative coordinates mov esi, 0x01000000
shr ebx, 16 call draw_rectangle.forced
shr ecx, 16
movzx eax, word[eax + SYS_BUTTON.pslot]
shl eax, 5
add eax, window_data
add ebx, [eax + WDATA.box.left]
add ecx, [eax + WDATA.box.top]
xor edi, edi
inc edi
; top border
mov eax, ebx
shl eax, 16
mov ax, bx
add ax, [esp + 4]
mov ebx, ecx
shl ebx, 16
mov bx, cx
push ebx
mov ecx, 0x01000000
call [draw_line]
; bottom border
movzx edx, word[esp + 4 + 0]
add ebx, edx
shl edx, 16
add ebx, edx
call [draw_line]
; left border
pop ebx
push edx
mov edx, eax
shr edx, 16
mov ax, dx
mov edx, ebx
shr edx, 16
mov bx, dx
add bx, [esp + 4 + 0]
pop edx
add ebx, 0x00010000
dec bx
call [draw_line]
; right border
mov dx, [esp + 4]
add ax, dx
shl edx, 16
add eax, edx
call [draw_line]
pop ecx ebx
popad popad
.exit:
ret ret

View File

@ -311,7 +311,6 @@ drawwindow_IV:
; shr esi,1 ; shr esi,1
; and esi,0x007f7f7f ; and esi,0x007f7f7f
mov esi,[ebp+SKIN_DATA.colors.outer] mov esi,[ebp+SKIN_DATA.colors.outer]
or [edi+WDATA.fl_wdrawn], 4
call draw_rectangle call draw_rectangle
mov ecx,3 mov ecx,3
_dw3l: _dw3l:
@ -455,12 +454,6 @@ drawwindow_IV:
no_skin_add_button: no_skin_add_button:
pop edi pop edi
and [edi+WDATA.fl_wdrawn], not 4
test [edi+WDATA.fl_wdrawn], 2
jz @f
call drawwindowframes2
@@:
popa popa
ret 4 ret 4

File diff suppressed because it is too large Load Diff

View File

@ -684,7 +684,7 @@ end if
mov esi,boot_windefs mov esi,boot_windefs
call boot_log call boot_log
call setwindowdefaults call set_window_defaults
; SET BACKGROUND DEFAULTS ; SET BACKGROUND DEFAULTS
@ -3348,10 +3348,10 @@ sys_window_move:
pop eax pop eax
add ecx,eax add ecx,eax
add edx,ebx add edx,ebx
mov [dlx],eax ; save for drawlimits mov [draw_limits.left],eax ; save for drawlimits
mov [dly],ebx mov [draw_limits.top],ebx
mov [dlxe],ecx mov [draw_limits.right],ecx
mov [dlye],edx mov [draw_limits.bottom],edx
call calculatescreen call calculatescreen
mov [edi + WDATA.fl_redraw], 1 ; flag the process as redraw mov [edi + WDATA.fl_redraw], 1 ; flag the process as redraw
@ -3667,11 +3667,11 @@ redrawscreen:
add ecx,eax add ecx,eax
add edx,ebx add edx,ebx
mov ecx,[dlye] ; ecx = area y end ebx = window y start mov ecx,[draw_limits.bottom] ; ecx = area y end ebx = window y start
cmp ecx,ebx cmp ecx,ebx
jb ricino jb ricino
mov ecx,[dlxe] ; ecx = area x end eax = window x start mov ecx,[draw_limits.right] ; ecx = area x end eax = window x start
cmp ecx,eax cmp ecx,eax
jb ricino jb ricino
@ -3682,11 +3682,11 @@ redrawscreen:
add ecx, eax add ecx, eax
add edx, ebx add edx, ebx
mov eax,[dly] ; eax = area y start edx = window y end mov eax,[draw_limits.top] ; eax = area y start edx = window y end
cmp edx,eax cmp edx,eax
jb ricino jb ricino
mov eax,[dlx] ; eax = area x start ecx = window x end mov eax,[draw_limits.left] ; eax = area x start ecx = window x end
cmp ecx,eax cmp ecx,eax
jb ricino jb ricino
@ -3700,22 +3700,22 @@ redrawscreen:
test al,al test al,al
jz .az jz .az
lea eax,[edi+draw_data-window_data] lea eax,[edi+draw_data-window_data]
mov ebx,[dlx] mov ebx,[draw_limits.left]
cmp ebx,[eax+RECT.left] cmp ebx,[eax+RECT.left]
jae @f jae @f
mov [eax+RECT.left],ebx mov [eax+RECT.left],ebx
@@: @@:
mov ebx,[dly] mov ebx,[draw_limits.top]
cmp ebx,[eax+RECT.top] cmp ebx,[eax+RECT.top]
jae @f jae @f
mov [eax+RECT.top],ebx mov [eax+RECT.top],ebx
@@: @@:
mov ebx,[dlxe] mov ebx,[draw_limits.right]
cmp ebx,[eax+RECT.right] cmp ebx,[eax+RECT.right]
jbe @f jbe @f
mov [eax+RECT.right],ebx mov [eax+RECT.right],ebx
@@: @@:
mov ebx,[dlye] mov ebx,[draw_limits.bottom]
cmp ebx,[eax+RECT.bottom] cmp ebx,[eax+RECT.bottom]
jbe @f jbe @f
mov [eax+RECT.bottom],ebx mov [eax+RECT.bottom],ebx
@ -3726,13 +3726,13 @@ redrawscreen:
mov eax,edi mov eax,edi
add eax,draw_data-window_data add eax,draw_data-window_data
mov ebx,[dlx] ; set limits mov ebx,[draw_limits.left] ; set limits
mov [eax + RECT.left], ebx mov [eax + RECT.left], ebx
mov ebx,[dly] mov ebx,[draw_limits.top]
mov [eax + RECT.top], ebx mov [eax + RECT.top], ebx
mov ebx,[dlxe] mov ebx,[draw_limits.right]
mov [eax + RECT.right], ebx mov [eax + RECT.right], ebx
mov ebx,[dlye] mov ebx,[draw_limits.bottom]
mov [eax + RECT.bottom], ebx mov [eax + RECT.bottom], ebx
sub eax,draw_data-window_data sub eax,draw_data-window_data

View File

@ -99,6 +99,14 @@ virtual at 0
TASKDATA TASKDATA TASKDATA TASKDATA
end virtual end virtual
TSTATE_RUNNING = 0
TSTATE_RUN_SUSPENDED = 1
TSTATE_WAIT_SUSPENDED = 2
TSTATE_ZOMBIE = 3
TSTATE_TERMINATING = 4
TSTATE_WAITING = 5
TSTATE_FREE = 9
; structures definition ; structures definition
struc WDATA { struc WDATA {
.box BOX .box BOX
@ -109,11 +117,12 @@ struc WDATA {
.fl_wstate db ? .fl_wstate db ?
.fl_wdrawn db ? .fl_wdrawn db ?
.fl_redraw db ? .fl_redraw db ?
.sizeof:
} }
virtual at 0 virtual at 0
WDATA WDATA WDATA WDATA
end virtual end virtual
label WDATA.fl_wstyle byte at 0x13 label WDATA.fl_wstyle byte at WDATA.cl_workarea + 3
struc APPDATA struc APPDATA
{ {