[KERNEL] the window subsystem was refactored, WDATA structures were expanded and magic numbers were replaced with constants

git-svn-id: svn://kolibrios.org@9926 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Doczom 2023-06-25 16:42:10 +00:00
parent 76202213a1
commit 9a2d26f2a7
13 changed files with 135 additions and 143 deletions

View File

@ -494,7 +494,7 @@ struct APPDATA
exc_handler dd ? ;+32 exc_handler dd ? ;+32
except_mask dd ? ;+36 except_mask dd ? ;+36
pl0_stack dd ? ;+40 pl0_stack dd ? ;+40
cursor dd ? ;+44 cursor dd ? ;+44 ; WDATA
fd_ev dd ? ;+48 fd_ev dd ? ;+48
bk_ev dd ? ;+52 bk_ev dd ? ;+52
fd_obj dd ? ;+56 fd_obj dd ? ;+56
@ -511,29 +511,28 @@ struct APPDATA
tls_base dd ? ;+104 tls_base dd ? ;+104
event_mask dd ? ;+108 stores event types allowed for task event_mask dd ? ;+108 stores event types allowed for task
tid dd ? ;+112 thread id tid dd ? ;+112 thread id
draw_bgr_x dd ? ;+116 draw_bgr_x dd ? ;+116 ; WDATA
draw_bgr_y dd ? ;+120 draw_bgr_y dd ? ;+120 ; WDATA
state db ? ;+124 thread state state db ? ;+124 thread state
wnd_number db ? ;+125 wnd_number db ? ;+125
dw ? ;+126 dw ? ;+126
wnd_shape dd ? ;+128 dd ? ;+128
wnd_shape_scale dd ? ;+132 dd ? ;+132
dd ? ;+136 dd ? ;+136
counter_sum dd ? ;+140 ; R counter_sum dd ? ;+140 ; R
saved_box BOX ;+144 saved_box BOX ;+144 ; WDATA
ipc_start dd ? ;+160 ipc_start dd ? ;+160
ipc_size dd ? ;+164 ipc_size dd ? ;+164
occurred_events dd ? ;+168 ; mask which accumulates occurred events occurred_events dd ? ;+168 ; mask which accumulates occurred events
debugger_slot dd ? ;+172 debugger_slot dd ? ;+172
terminate_protection dd ? ;+176 terminate_protection dd ? ;+176
keyboard_mode db ? ;+180 keyboard_mode db ? ;+180
captionEncoding db ? rb 3
rb 2
exec_params dd ? ;+184 exec_params dd ? ;+184
dbg_event_mem dd ? ;+188 dbg_event_mem dd ? ;+188
dbg_regs DBG_REGS ;+192 dbg_regs DBG_REGS ;+192
wnd_caption dd ? ;+212 dd ? ;+212
wnd_clientbox BOX ;+216 rd 4 ;+216
priority dd ? ;+232 priority dd ? ;+232
in_schedule LHEAD ;+236 in_schedule LHEAD ;+236
counter_add dd ? ;+244 ; R counter_add dd ? ;+244 ; R
@ -598,11 +597,17 @@ struct WDATA
fl_wstate db ? fl_wstate db ?
fl_wdrawn db ? fl_wdrawn db ?
fl_redraw db ? fl_redraw db ?
clientbox BOX
shape dd ?
shape_scale dd ?
caption dd ?
captionEncoding db ?
rb 3
ends ends
label WDATA.fl_wstyle byte at WDATA.cl_workarea + 3 label WDATA.fl_wstyle byte at WDATA.cl_workarea + 3
assert sizeof.WDATA = 32 assert sizeof.WDATA = 64
struct SYS_VARS struct SYS_VARS
bpp dd ? bpp dd ?

View File

@ -630,7 +630,7 @@ destroy_thread:
shl edi, BSF sizeof.APPDATA shl edi, BSF sizeof.APPDATA
cmp [SLOT_BASE + edi + APPDATA.state], TSTATE_FREE ; skip free slots cmp [SLOT_BASE + edi + APPDATA.state], TSTATE_FREE ; skip free slots
je .check_next_window je .check_next_window
shr edi, 3 shr edi, (BSF sizeof.APPDATA - BSF sizeof.WDATA)
add edi, window_data add edi, window_data
; \begin{diamond}[19.09.2006] ; \begin{diamond}[19.09.2006]
; skip minimized windows ; skip minimized windows

View File

@ -140,9 +140,6 @@ align 4
draw_background_temp: draw_background_temp:
mov [background_defined], 1 mov [background_defined], 1
call force_redraw_background call force_redraw_background
;--------------------------------------
align 4
nosb31:
ret ret
;-------------------------------------- ;--------------------------------------
align 4 align 4

View File

@ -95,12 +95,13 @@ syscall_button:
; make coordinates clientbox-relative ; make coordinates clientbox-relative
push eax push eax
mov eax, [current_slot] mov eax, [current_slot_idx]
shl eax, BSF sizeof.WDATA
rol ebx, 16 rol ebx, 16
add bx, word[eax + APPDATA.wnd_clientbox.left] add bx, word[window_data + eax + WDATA.clientbox.left]
rol ebx, 16 rol ebx, 16
rol ecx, 16 rol ecx, 16
add cx, word[eax + APPDATA.wnd_clientbox.top] add cx, word[window_data + eax + WDATA.clientbox.top]
rol ecx, 16 rol ecx, 16
pop eax pop eax
@ -339,12 +340,11 @@ sys_button_deactivate_handler:
mov esi, eax mov esi, eax
mov edi, ebx mov edi, ebx
movzx ecx, [esi + SYS_BUTTON.pslot] movzx ecx, [esi + SYS_BUTTON.pslot]
shl ecx, 5 shl ecx, BSF sizeof.WDATA
add ecx, window_data
mov eax, dword[esi + SYS_BUTTON.left] mov eax, dword[esi + SYS_BUTTON.left]
mov ebx, dword[esi + SYS_BUTTON.top] mov ebx, dword[esi + SYS_BUTTON.top]
add eax, [ecx + WDATA.box.left] add eax, [window_data + ecx + WDATA.box.left]
add ebx, [ecx + WDATA.box.top] add ebx, [window_data + ecx + WDATA.box.top]
mov ecx, eax mov ecx, eax
mov edx, ebx mov edx, ebx
bt edi, 30 bt edi, 30

View File

@ -67,9 +67,8 @@ create_event: ;; EXPORT use
; edx - uid ; edx - uid
;scratched: ebx,ecx,esi,edi ;scratched: ebx,ecx,esi,edi
mov ebx, [current_slot] mov ebx, [current_slot]
mov edx, [ebx+APPDATA.tid]
add ebx, APP_OBJ_OFFSET add ebx, APP_OBJ_OFFSET
mov edx, [current_slot]
mov edx, [edx+APPDATA.tid]
pushfd pushfd
cli cli
;-------------------------------------- ;--------------------------------------
@ -463,7 +462,7 @@ align 4
;-------------------------------------- ;--------------------------------------
align 4 align 4
.result: .result:
setae byte[esp+32+4] ;we consider that initially was: dword[esp+32+4]==72 setae byte[esp + SYSCALL_STACK.eax + 4] ;we consider that initially was: dword[esp+32+4]==72
;-------------------------------------- ;--------------------------------------
align 4 align 4
.retf: .retf:
@ -510,7 +509,7 @@ get_event_for_app: ;; used from f10,f11,f23
; eax - event number (=0 => no events) ; eax - event number (=0 => no events)
movzx edi, bh ; bh is assumed as [current_slot_idx] movzx edi, bh ; bh is assumed as [current_slot_idx]
mov ecx, [ebx+APPDATA.event_mask] mov ecx, [ebx+APPDATA.event_mask]
shl edi, 5 shl edi, BSF sizeof.WDATA
add edi, window_data add edi, window_data
and ecx, 0x7FFFFFFF and ecx, 0x7FFFFFFF
;-------------------------------------- ;--------------------------------------
@ -553,7 +552,7 @@ align 4
push eax push eax
mov eax, [current_slot] mov eax, [current_slot]
mov eax, [eax + APPDATA.event_mask] mov eax, [eax + APPDATA.event_mask]
test eax, 0x80000000 ; bit 31: active/inactive filter f.40 test eax, EVM_MOUSE_FILTER ; bit 31: active/inactive filter f.40
jz @f jz @f
pop eax pop eax
jmp .FlagAutoReset jmp .FlagAutoReset

View File

@ -294,7 +294,7 @@ mouse._.left_button_release_handler:
jz .exit jz .exit
mov eax, esi mov eax, esi
shl eax, 5 shl eax, BSF sizeof.WDATA
add eax, window_data + WDATA.box add eax, window_data + WDATA.box
mov ebx, mouse.active_sys_window.old_box mov ebx, mouse.active_sys_window.old_box
mov ecx, sizeof.BOX mov ecx, sizeof.BOX
@ -515,7 +515,7 @@ mouse._.move_handler:
push eax push eax
mov edi, esi mov edi, esi
shl edi, 5 shl edi, BSF sizeof.WDATA
add edi, window_data add edi, window_data
call window._.get_rolledup_height call window._.get_rolledup_height
mov ecx, eax mov ecx, eax
@ -582,7 +582,7 @@ mouse._.move_handler:
mov [fl_moving], 1 mov [fl_moving], 1
push edi push edi
mov edi, esi mov edi, esi
shl edi, 5 shl edi, BSF sizeof.WDATA
add edi, WDATA.box + window_data add edi, WDATA.box + window_data
call window._.draw_negative_box call window._.draw_negative_box
pop edi pop edi
@ -609,7 +609,7 @@ mouse._.find_sys_window_under_cursor:
add esi, [mouse.state.pos.x] add esi, [mouse.state.pos.x]
movzx esi, byte[esi] movzx esi, byte[esi]
mov edi, esi mov edi, esi
shl edi, 5 shl edi, BSF sizeof.WDATA
add edi, window_data add edi, window_data
ret ret
@ -821,14 +821,13 @@ dd .loadCursorUni
mov ax, [MOUSE_Y] mov ax, [MOUSE_Y]
mov esi, [current_slot_idx] mov esi, [current_slot_idx]
shl esi, BSF sizeof.WDATA shl esi, BSF sizeof.WDATA
mov bx, word [esi + window_data + WDATA.box.left] mov bx, word[window_data + esi + WDATA.box.left]
shl ebx, 16 shl ebx, 16
mov bx, word [esi + window_data + WDATA.box.top] mov bx, word[window_data + esi + WDATA.box.top]
sub eax, ebx sub eax, ebx
mov edi, [current_slot] sub ax, word[window_data + esi + WDATA.clientbox.top]
sub ax, word[edi + APPDATA.wnd_clientbox.top]
rol eax, 16 rol eax, 16
sub ax, word[edi + APPDATA.wnd_clientbox.left] sub ax, word[window_data + esi + WDATA.clientbox.left]
rol eax, 16 rol eax, 16
mov [esp + SYSCALL_STACK.eax], eax mov [esp + SYSCALL_STACK.eax], eax
ret ret

View File

@ -97,7 +97,7 @@ parse_skin_data:
jne .exit jne .exit
mov edi, skin_udata mov edi, skin_udata
mov ecx, (skin_udata.end-skin_udata)/4 mov ecx, (skin_udata.size)/4
xor eax, eax xor eax, eax
cld cld
rep stosd rep stosd

View File

@ -59,6 +59,6 @@ skin_udata:
align 4 align 4
skin_udata.end: skin_udata.size = $ - skin_udata
endg endg

View File

@ -80,11 +80,10 @@ syscall_setpixel:
mov ecx, edx mov ecx, edx
mov edx, [current_slot_idx] mov edx, [current_slot_idx]
shl edx, BSF sizeof.WDATA shl edx, BSF sizeof.WDATA
add eax, [edx + window_data + WDATA.box.left] add eax, [window_data + edx + WDATA.box.left]
add ebx, [edx + window_data + WDATA.box.top] add ebx, [window_data + edx + WDATA.box.top]
mov edi, [current_slot] add eax, [window_data + edx + WDATA.clientbox.left]
add eax, [edi+APPDATA.wnd_clientbox.left] add ebx, [window_data + edx + WDATA.clientbox.top]
add ebx, [edi+APPDATA.wnd_clientbox.top]
xor edi, edi ; no force xor edi, edi ; no force
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
jmp __sys_putpixel jmp __sys_putpixel
@ -106,14 +105,11 @@ syscall_writetext:
mov eax, [current_slot_idx] mov eax, [current_slot_idx]
shl eax, BSF sizeof.WDATA shl eax, BSF sizeof.WDATA
mov ebp, [eax + window_data + WDATA.box.left] mov ebp, [window_data + eax + WDATA.box.left]
push esi add ebp, [window_data + eax + WDATA.clientbox.left]
mov esi, [current_slot]
add ebp, [esi+APPDATA.wnd_clientbox.left]
shl ebp, 16 shl ebp, 16
add ebp, [eax + window_data + WDATA.box.top] add ebp, [window_data + eax + WDATA.box.top]
add bp, word[esi+APPDATA.wnd_clientbox.top] add bp, word[window_data + eax + WDATA.clientbox.top]
pop esi
test ecx, 0x08000000 ; redirect the output to the user area test ecx, 0x08000000 ; redirect the output to the user area
jnz @f jnz @f
add ebx, ebp add ebx, ebp
@ -151,10 +147,10 @@ syscall_drawrect:
shr eax, 16 ; eax - x.coord shr eax, 16 ; eax - x.coord
movzx edx, bx ; edx - y.size movzx edx, bx ; edx - y.size
shr ebx, 16 ; ebx - y.coord shr ebx, 16 ; ebx - y.coord
mov esi, [current_slot] mov esi, [current_slot_idx]
shl esi, BSF sizeof.WDATA
add eax, [esi + APPDATA.wnd_clientbox.left] add eax, [window_data + esi + WDATA.clientbox.left]
add ebx, [esi + APPDATA.wnd_clientbox.top] add ebx, [window_data + esi + WDATA.clientbox.top]
add ecx, eax add ecx, eax
add edx, ebx add edx, ebx
jmp vesa20_drawbar jmp vesa20_drawbar
@ -167,18 +163,17 @@ align 4
syscall_drawline: syscall_drawline:
mov edi, [current_slot_idx] mov edi, [current_slot_idx]
shl edi, BSF sizeof.WDATA shl edi, BSF sizeof.WDATA
movzx eax, word[edi + window_data + WDATA.box.left] movzx eax, word[window_data + edi + WDATA.box.left]
mov ebp, eax mov ebp, eax
mov esi, [current_slot] add ebp, [window_data + edi + WDATA.clientbox.left]
add ebp, [esi+APPDATA.wnd_clientbox.left] add ax, word[window_data + edi + WDATA.clientbox.left]
add ax, word[esi+APPDATA.wnd_clientbox.left]
add ebp, ebx add ebp, ebx
shl eax, 16 shl eax, 16
movzx ebx, word[edi + window_data + WDATA.box.top] movzx ebx, word[window_data + edi + WDATA.box.top]
add eax, ebp add eax, ebp
mov ebp, ebx mov ebp, ebx
add ebp, [esi+APPDATA.wnd_clientbox.top] add ebp, [window_data + edi + WDATA.clientbox.top]
add bx, word[esi+APPDATA.wnd_clientbox.top] add bx, word[window_data + edi + WDATA.clientbox.top]
add ebp, ecx add ebp, ecx
shl ebx, 16 shl ebx, 16
xor edi, edi xor edi, edi
@ -411,17 +406,18 @@ align 4
;> ebx = 1 ;> ebx = 1
;> ecx = scale power (resulting scale is 2^ebx) ;> ecx = scale power (resulting scale is 2^ebx)
syscall_set_window_shape: syscall_set_window_shape:
mov edi, [current_slot] mov edi, [current_slot_idx]
shl edi, BSF sizeof.WDATA
test ebx, ebx test ebx, ebx
jne .shape_scale jne .shape_scale
mov [edi + APPDATA.wnd_shape], ecx mov [window_data + edi + WDATA.shape], ecx
;-------------------------------------- ;--------------------------------------
align 4 align 4
.shape_scale: .shape_scale:
dec ebx dec ebx
jnz .exit jnz .exit
mov [edi + APPDATA.wnd_shape_scale], ecx mov [window_data + edi + WDATA.shape_scale], ecx
;-------------------------------------- ;--------------------------------------
align 4 align 4
.exit: .exit:
@ -498,8 +494,8 @@ syscall_window_settings:
jc @f jc @f
xor edx, edx xor edx, edx
@@: @@:
mov [edi*8 + SLOT_BASE + APPDATA.wnd_caption], ecx mov [window_data + edi + WDATA.caption], ecx
mov [edi*8 + SLOT_BASE + APPDATA.captionEncoding], dl mov [window_data + edi + WDATA.captionEncoding], dl
jmp window._.draw_window_caption jmp window._.draw_window_caption
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -561,7 +557,7 @@ align 4
movzx edi, word[WIN_POS + esi * 2] movzx edi, word[WIN_POS + esi * 2]
shl edi, BSF sizeof.WDATA ;size of TASKDATA and WDATA = 32 bytes shl edi, BSF sizeof.WDATA ;size of TASKDATA and WDATA = 32 bytes
cmp byte [SLOT_BASE + edi*8 + APPDATA.state], TSTATE_FREE cmp byte [SLOT_BASE + edi*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.state], TSTATE_FREE
je .skip_window je .skip_window
add edi, window_data add edi, window_data
@ -1090,10 +1086,10 @@ align 4
movzx edi, word[WIN_POS + eax * 2] movzx edi, word[WIN_POS + eax * 2]
shl edi, BSF sizeof.WDATA shl edi, BSF sizeof.WDATA
; it is a unused slot? ; it is a unused slot?
cmp byte [SLOT_BASE + edi*8 + APPDATA.state], TSTATE_FREE cmp byte [SLOT_BASE + edi*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.state], TSTATE_FREE
je @f je @f
; it is a hidden thread? ; it is a hidden thread?
lea esi, [SLOT_BASE + edi*8 + APPDATA.app_name] lea esi, [SLOT_BASE + edi*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.app_name]
cmp [esi], byte '@' cmp [esi], byte '@'
je @f je @f
; is it already minimized? ; is it already minimized?
@ -1549,7 +1545,7 @@ end if
mov eax, edi mov eax, edi
sub eax, window_data sub eax, window_data
shl eax, 3 shl eax, (BSF sizeof.APPDATA - BSF sizeof.WDATA)
add eax, SLOT_BASE add eax, SLOT_BASE
lea ebx, [edi + WDATA.box] lea ebx, [edi + WDATA.box]
@ -1584,43 +1580,41 @@ window._.set_window_clientbox:
mov [window_topleft + 8 * 4 + 4], eax mov [window_topleft + 8 * 4 + 4], eax
mov ecx, edi mov ecx, edi
sub edi, window_data
shl edi, 3
test [ecx + WDATA.fl_wstyle], WSTYLE_CLIENTRELATIVE test [ecx + WDATA.fl_wstyle], WSTYLE_CLIENTRELATIVE
jz .whole_window jz .whole_window
movzx eax, [ecx + WDATA.fl_wstyle] movzx eax, [ecx + WDATA.fl_wstyle]
and eax, 0x0F and eax, 0x0F
mov eax, [eax * 8 + window_topleft + 0] mov eax, [eax * 8 + window_topleft + 0]
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax mov [ecx + WDATA.clientbox.left], eax
shl eax, 1 shl eax, 1
neg eax neg eax
add eax, [ecx + WDATA.box.width] add eax, [ecx + WDATA.box.width]
inc eax ;Leency: as window is created width+1 so client the same inc eax ;Leency: as window is created width+1 so client the same
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax mov [ecx + WDATA.clientbox.width], eax
movzx eax, [ecx + WDATA.fl_wstyle] movzx eax, [ecx + WDATA.fl_wstyle]
and eax, 0x0F and eax, 0x0F
push [eax * 8 + window_topleft + 0] push [eax * 8 + window_topleft + 0]
mov eax, [eax * 8 + window_topleft + 4] mov eax, [eax * 8 + window_topleft + 4]
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax mov [ecx + WDATA.clientbox.top], eax
neg eax neg eax
sub eax, [esp] sub eax, [esp]
add eax, [ecx + WDATA.box.height] add eax, [ecx + WDATA.box.height]
inc eax ;Leency: as window is created height+1 so client the same inc eax ;Leency: as window is created height+1 so client the same
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax mov [ecx + WDATA.clientbox.height], eax
add esp, 4 add esp, 4
jmp .exit jmp .exit
;-------------------------------------- ;--------------------------------------
align 4 align 4
.whole_window: .whole_window:
xor eax, eax xor eax, eax
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax mov [ecx + WDATA.clientbox.left], eax
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax mov [ecx + WDATA.clientbox.top], eax
mov eax, [ecx + WDATA.box.width] mov eax, [ecx + WDATA.box.width]
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax mov [ecx + WDATA.clientbox.width], eax
mov eax, [ecx + WDATA.box.height] mov eax, [ecx + WDATA.box.height]
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax mov [ecx + WDATA.clientbox.height], eax
;-------------------------------------- ;--------------------------------------
align 4 align 4
.exit: .exit:
@ -1666,9 +1660,9 @@ window._.sys_set_window:
mov cl, [edi + WDATA.fl_wstyle] mov cl, [edi + WDATA.fl_wstyle]
mov eax, [edi + WDATA.cl_frames] mov eax, [edi + WDATA.cl_frames]
mov esi, [esp]
sub edi, window_data sub edi, window_data
shl edi, 3 shl edi, (BSF sizeof.APPDATA - BSF sizeof.WDATA)
add edi, SLOT_BASE
and cl, 0x0F and cl, 0x0F
cmp cl, 3 cmp cl, 3
@ -1680,10 +1674,9 @@ window._.sys_set_window:
;-------------------------------------- ;--------------------------------------
align 4 align 4
@@: @@:
mov [edi + APPDATA.wnd_caption], eax mov [esi + WDATA.caption], eax
mov esi, [esp] add edi, SLOT_BASE + APPDATA.saved_box
add edi, APPDATA.saved_box
movsd movsd
movsd movsd
movsd movsd
@ -1866,10 +1859,12 @@ end virtual
pushad pushad
cmp esi, 1
jz .check_for_shaped_window
mov edi, esi mov edi, esi
shl edi, BSF sizeof.WDATA shl edi, BSF sizeof.WDATA
cmp esi, 1
jz .check_for_shaped_window
cmp [window_data + edi + WDATA.box.width], 0 cmp [window_data + edi + WDATA.box.width], 0
jnz .check_for_shaped_window jnz .check_for_shaped_window
cmp [window_data + edi + WDATA.box.height], 0 cmp [window_data + edi + WDATA.box.height], 0
@ -1877,10 +1872,7 @@ end virtual
;-------------------------------------- ;--------------------------------------
align 4 align 4
.check_for_shaped_window: .check_for_shaped_window:
mov edi, esi cmp [window_data + edi + WDATA.shape], 0
shl edi, BSF sizeof.APPDATA
add edi, SLOT_BASE
cmp [edi + APPDATA.wnd_shape], 0
jne .shaped_window jne .shaped_window
; get x&y size ; get x&y size
@ -1930,7 +1922,7 @@ align 4
inc ecx inc ecx
inc edx inc edx
push [edi + APPDATA.wnd_shape_scale] ; push scale first -> for loop push [window_data + edi + WDATA.shape_scale] ; push scale first -> for loop
; get WinMap start -> ebp ; get WinMap start -> ebp
push eax push eax
@ -1940,7 +1932,7 @@ align 4
add eax, [_display.win_map] add eax, [_display.win_map]
mov ebp, eax mov ebp, eax
mov edi, [edi + APPDATA.wnd_shape] mov edi, [window_data + edi + WDATA.shape]
pop eax pop eax
; eax = x_start ; eax = x_start
@ -2178,7 +2170,7 @@ window._.check_window_draw:
mov eax, edi mov eax, edi
sub eax, window_data sub eax, window_data
shr eax, 5 shr eax, BSF sizeof.WDATA
movzx eax, word[WIN_STACK + eax * 2] ; get value of the curr process movzx eax, word[WIN_STACK + eax * 2] ; get value of the curr process
lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400
@ -2195,7 +2187,7 @@ align 4
movzx edx, word[esi] movzx edx, word[esi]
shl edx, BSF sizeof.WDATA ; size of TASKDATA and WDATA is 32 bytes shl edx, BSF sizeof.WDATA ; size of TASKDATA and WDATA is 32 bytes
cmp byte [SLOT_BASE + edx*8 - sizeof.APPDATA + APPDATA.state], TSTATE_FREE cmp byte [SLOT_BASE + edx*(sizeof.APPDATA/sizeof.WDATA) - sizeof.APPDATA + APPDATA.state], TSTATE_FREE
je .next_window je .next_window
mov eax, [edi + WDATA.box.top] mov eax, [edi + WDATA.box.top]
@ -2250,7 +2242,7 @@ window._.draw_window_caption:
align 4 align 4
@@: @@:
mov edx, [current_slot_idx] mov edx, [current_slot_idx]
shl edx, 5 shl edx, BSF sizeof.WDATA
add edx, window_data add edx, window_data
movzx ebx, [edx + WDATA.fl_wstyle] movzx ebx, [edx + WDATA.fl_wstyle]
and bl, 0x0F and bl, 0x0F
@ -2287,9 +2279,9 @@ align 4
.2: .2:
mov edi, [current_slot_idx] mov edi, [current_slot_idx]
shl edi, BSF sizeof.WDATA shl edi, BSF sizeof.WDATA
test [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION test [window_data + edi + WDATA.fl_wstyle], WSTYLE_HASCAPTION
jz .exit jz .exit
mov edx, [edi * 8 + SLOT_BASE + APPDATA.wnd_caption] mov edx, [window_data + edi + WDATA.caption]
or edx, edx or edx, edx
jz .exit jz .exit
@ -2332,7 +2324,7 @@ align 4
mov esi, eax mov esi, eax
add ebx, ebp add ebx, ebp
mov ecx, [common_colours + 16] mov ecx, [common_colours + 16]
mov al, [edi*8 + SLOT_BASE + APPDATA.captionEncoding] mov al, [window_data + edi + WDATA.captionEncoding]
test al, al test al, al
jnz @f jnz @f
mov al, 1 mov al, 1
@ -2463,7 +2455,7 @@ align 4
movzx edi, word[WIN_POS + esi * 2] movzx edi, word[WIN_POS + esi * 2]
shl edi, BSF sizeof.WDATA ;size of TASKDATA and WDATA = 32 bytes shl edi, BSF sizeof.WDATA ;size of TASKDATA and WDATA = 32 bytes
cmp byte [SLOT_BASE + edi*8 + APPDATA.state], TSTATE_FREE cmp byte [SLOT_BASE + edi*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.state], TSTATE_FREE
je .skip_window je .skip_window
add edi, window_data add edi, window_data

View File

@ -551,7 +551,7 @@ high_code:
xor eax, eax xor eax, eax
mov [clipboard_slots], eax mov [clipboard_slots], eax
mov [clipboard_write_lock], eax mov [clipboard_write_lock], eax
stdcall kernel_alloc, 4096 stdcall kernel_alloc, PAGE_SIZE
test eax, eax test eax, eax
jnz @f jnz @f
@ -1554,16 +1554,14 @@ draw_num_text:
mov ebx, [esp+64+32-8+4] mov ebx, [esp+64+32-8+4]
; add window start x & y ; add window start x & y
mov edi, [current_slot_idx] mov ecx, [current_slot_idx]
mov ecx, edi
shl edi, BSF sizeof.APPDATA
shl ecx, BSF sizeof.WDATA shl ecx, BSF sizeof.WDATA
mov eax, [window_data + ecx + WDATA.box.left] mov eax, [window_data + ecx + WDATA.box.left]
add eax, [SLOT_BASE + edi + APPDATA.wnd_clientbox.left] add eax, [window_data + ecx + WDATA.clientbox.left]
shl eax, 16 shl eax, 16
add eax, [window_data + ecx + WDATA.box.top] add eax, [window_data + ecx + WDATA.box.top]
add eax, [SLOT_BASE + edi + APPDATA.wnd_clientbox.top] add eax, [window_data + ecx + WDATA.clientbox.top]
add ebx, eax add ebx, eax
mov ecx, [esp+64+32-12+4] mov ecx, [esp+64+32-12+4]
mov eax, [esp+64+8] ; background color (if given) mov eax, [esp+64+8] ; background color (if given)
@ -2109,7 +2107,7 @@ sysfn_deactivate: ; 18.1 = DEACTIVATE WINDOW
je .nowindowdeactivate ; already deactive je .nowindowdeactivate ; already deactive
mov edi, ecx mov edi, ecx
shl edi, 5 shl edi, BSF sizeof.WDATA
add edi, window_data add edi, window_data
movzx esi, word [WIN_STACK + ecx * 2] movzx esi, word [WIN_STACK + ecx * 2]
lea esi, [WIN_POS + esi * 2] lea esi, [WIN_POS + esi * 2]
@ -2174,7 +2172,7 @@ sysfn_zmodif:
mov eax, edx mov eax, edx
shl edx, BSF sizeof.WDATA shl edx, BSF sizeof.WDATA
cmp [edx*8 + SLOT_BASE + APPDATA.state], TSTATE_FREE cmp [edx*(sizeof.APPDATA/sizeof.WDATA) + SLOT_BASE + APPDATA.state], TSTATE_FREE
je .fail je .fail
cmp ecx, 1 cmp ecx, 1
@ -2533,16 +2531,16 @@ sys_cpuusage:
call memmove call memmove
pop ecx pop ecx
shr ecx, 3 shr ecx, (BSF sizeof.APPDATA - BSF sizeof.WDATA)
; +22: address of the process in memory ; +22: address of the process in memory
; +26: size of used memory - 1 ; +26: size of used memory - 1
push edi push edi
lea edi, [ebx+12] lea edi, [ebx+12]
xor eax, eax xor eax, eax
mov edx, 0x100000*16 mov edx, 0x100000*16
cmp ecx, 1 shl 5 cmp ecx, 1 shl BSF sizeof.WDATA
je .os_mem je .os_mem
mov edx, [SLOT_BASE + ecx*8 + APPDATA.process] mov edx, [SLOT_BASE + ecx*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.process]
mov edx, [edx + PROC.mem_used] mov edx, [edx + PROC.mem_used]
mov eax, std_application_base_address mov eax, std_application_base_address
.os_mem: .os_mem:
@ -2551,7 +2549,7 @@ sys_cpuusage:
stosd stosd
; +30: PID/TID ; +30: PID/TID
mov eax, [SLOT_BASE + ecx*8 + APPDATA.tid] mov eax, [SLOT_BASE + ecx*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.tid]
stosd stosd
; window position and size ; window position and size
@ -2563,11 +2561,11 @@ sys_cpuusage:
movsd movsd
; Process state (+50) ; Process state (+50)
movzx eax, byte [SLOT_BASE + ecx*8 + APPDATA.state] movzx eax, byte [SLOT_BASE + ecx*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.state]
stosd stosd
; Window client area box ; Window client area box
lea esi, [SLOT_BASE + ecx*8 + APPDATA.wnd_clientbox] lea esi, [window_data + ecx + WDATA.clientbox]
movsd movsd
movsd movsd
movsd movsd
@ -2578,11 +2576,11 @@ sys_cpuusage:
stosb stosb
; Event mask (+71) ; Event mask (+71)
mov EAX, dword [SLOT_BASE + ecx*8 + APPDATA.event_mask] mov EAX, dword [SLOT_BASE + ecx*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.event_mask]
stosd stosd
; Keyboard mode (+75) ; Keyboard mode (+75)
mov al, byte [SLOT_BASE + ecx*8 + APPDATA.keyboard_mode] mov al, byte [SLOT_BASE + ecx*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.keyboard_mode]
stosb stosb
pop esi pop esi
@ -3086,7 +3084,7 @@ bgli:
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 dl, 1 mov dl, 1
;-------------------------------------- ;--------------------------------------
align 4 align 4
@ -3104,7 +3102,7 @@ align 4
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 dl, 1 mov dl, 1
;-------------------------------------- ;--------------------------------------
align 4 align 4
@ -3594,10 +3592,11 @@ align 4
;-------------------------------------- ;--------------------------------------
align 4 align 4
@@: @@:
mov edi, [current_slot] mov edi, [current_slot_idx]
add dx, word[edi + APPDATA.wnd_clientbox.top] shl edi, BSF sizeof.WDATA
add dx, word[window_data + edi + WDATA.clientbox.top]
rol edx, 16 rol edx, 16
add dx, word[edi + APPDATA.wnd_clientbox.left] add dx, word[window_data + edi + WDATA.clientbox.left]
rol edx, 16 rol edx, 16
;-------------------------------------- ;--------------------------------------
align 4 align 4
@ -3632,10 +3631,11 @@ sys_putimage_palette:
pop esi ecx pop esi ecx
jnz sys_putimage.exit jnz sys_putimage.exit
mov eax, [current_slot] mov eax, [current_slot_idx]
add dx, word [eax + APPDATA.wnd_clientbox.top] shl eax, BSF sizeof.WDATA
add dx, word [window_data + eax + WDATA.clientbox.top]
rol edx, 16 rol edx, 16
add dx, word [eax + APPDATA.wnd_clientbox.left] add dx, word [window_data + eax + WDATA.clientbox.left]
rol edx, 16 rol edx, 16
;-------------------------------------- ;--------------------------------------
align 4 align 4
@ -3944,11 +3944,12 @@ putimage_get16bpp:
; edx y end ; edx y end
; edi color ; edi color
;__sys_drawbar: ;__sys_drawbar:
; mov esi, [current_slot] ; mov esi, [current_slot_idx]
; add eax, [esi+APPDATA.wnd_clientbox.left] ; shl esi, BSF sizeof.WDATA
; add ecx, [esi+APPDATA.wnd_clientbox.left] ; add eax, [window_data+esi+WDATA.clientbox.left]
; add ebx, [esi+APPDATA.wnd_clientbox.top] ; add ecx, [window_data+esi+WDATA.clientbox.left]
; add edx, [esi+APPDATA.wnd_clientbox.top] ; add ebx, [window_data+esi+WDATA.clientbox.top]
; add edx, [window_data+esi+WDATA.clientbox.top]
;-------------------------------------- ;--------------------------------------
;align 4 ;align 4
;.forced: ;.forced:

View File

@ -271,9 +271,8 @@ end virtual
test [esp + .flags], BLIT_CLIENT_RELATIVE test [esp + .flags], BLIT_CLIENT_RELATIVE
jz .no_client_relative jz .no_client_relative
mov eax, [current_slot] add ebx, [window_data + eax + WDATA.clientbox.left]
add ebx, [eax + APPDATA.wnd_clientbox.left] add ebp, [window_data + eax + WDATA.clientbox.top]
add ebp, [eax + APPDATA.wnd_clientbox.top]
.no_client_relative: .no_client_relative:
mov ecx, ebx mov ecx, ebx

View File

@ -338,7 +338,7 @@ create_cursor:
mov [eax + CURSOR.hot_x], ebx mov [eax + CURSOR.hot_x], ebx
mov [eax + CURSOR.hot_y], ebx mov [eax + CURSOR.hot_y], ebx
stdcall kernel_alloc, 0x1000 stdcall kernel_alloc, PAGE_SIZE
test eax, eax test eax, eax
jz .fail jz .fail
@ -392,7 +392,7 @@ align 4
mov [edi + CURSOR.hot_y], edx mov [edi + CURSOR.hot_y], edx
xchg edi, eax xchg edi, eax
mov ecx, 1024 mov ecx, PAGE_SIZE/4
cld cld
rep movsd rep movsd
jmp .add_cursor jmp .add_cursor

View File

@ -156,7 +156,7 @@ init_video:
or esi, PG_GLOBAL + PAT_WC + PG_UWR or esi, PG_GLOBAL + PAT_WC + PG_UWR
and esi, [pte_valid_mask] and esi, [pte_valid_mask]
stdcall alloc_kernel_space, 0x1000 stdcall alloc_kernel_space, PAGE_SIZE
mov edi, eax mov edi, eax
mov ebx, 4 mov ebx, 4
@ -168,15 +168,15 @@ init_video:
stdcall map_page, edi, eax, PG_SWR stdcall map_page, edi, eax, PG_SWR
mov eax, esi mov eax, esi
mov ecx, 1024 mov ecx, PAGE_SIZE/4
@@: @@:
stosd stosd
add eax, 0x1000 add eax, PAGE_SIZE
loop @B loop @B
add esi, 0x400000 add esi, 0x400000
add ebp, 4 add ebp, 4
sub edi, 4096 sub edi, PAGE_SIZE
dec ebx dec ebx
jnz .new_pd jnz .new_pd
stdcall free_kernel_space, edi stdcall free_kernel_space, edi
@ -185,7 +185,7 @@ init_video:
.fake: .fake:
mov [BOOT.mtrr], byte 2 mov [BOOT.mtrr], byte 2
stdcall alloc_kernel_space, 0x1000 stdcall alloc_kernel_space, PAGE_SIZE
push eax ;store in stack for subsequent push eax ;store in stack for subsequent
mov edi, eax ;free_kernel_space call mov edi, eax ;free_kernel_space call
@ -197,13 +197,13 @@ init_video:
; max VGA=640*480*4=1228800 bytes ; max VGA=640*480*4=1228800 bytes
; + 32*640*4=81920 bytes for mouse pointer ; + 32*640*4=81920 bytes for mouse pointer
stdcall alloc_pages, ((1228800+81920)/4096) stdcall alloc_pages, ((1228800+81920)/PAGE_SIZE)
or eax, PG_GLOBAL+PG_UWR or eax, PG_GLOBAL+PG_UWR
and eax, [pte_valid_mask] and eax, [pte_valid_mask]
mov ecx, (1228800+81920)/4096 mov ecx, (1228800+81920)/PAGE_SIZE
@@: @@:
stosd stosd
add eax, 0x1000 add eax, PAGE_SIZE
loop @B loop @B
call free_kernel_space call free_kernel_space
@ -221,7 +221,7 @@ set_framebuffer:
cli cli
mov [_display.current_lfb], ecx mov [_display.current_lfb], ecx
.patch_pde: .patch_pde:
lea edi, [eax + PROC.pdt_0+4096-32] ;last 8 pd entries up to 32Mb framebuffer lea edi, [eax + PROC.pdt_0 + PAGE_SIZE -32] ;last 8 pd entries up to 32Mb framebuffer
mov ecx, 4 mov ecx, 4
rep movsd ;patch pde rep movsd ;patch pde
sub esi, 16 sub esi, 16