[KERNEL] The window subsystem has been redesigned:

-extended WDATA structures up to 128 bytes
-added the background_windows constant
-the draw_data array has been deleted
-APPDATA.window and WDATA.thread fields added
-minor fixes in the operation of external file system drivers

git-svn-id: svn://kolibrios.org@9930 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Doczom 2023-08-18 20:51:33 +00:00
parent 48e0317921
commit 0a5beb0bc0
13 changed files with 242 additions and 227 deletions

View File

@ -1241,7 +1241,6 @@ end virtual
add ebp, 8 ; ebp points to part of PARTITION structure
xor eax, eax ; first sector of the partition
call fs_read32_sys
;push eax
; 2. Run tests for all supported filesystems. If at least one test succeeded,
; go to 4.
; For tests:
@ -1249,6 +1248,9 @@ end virtual
; [esp] = error code after bootsector read: 0 = ok, otherwise = failed,
; ebx points to the buffer for bootsector,
; ebx+[esi+DISK.MediaInfo.SectorSize] points to sector-sized buffer that can be used for anything.
; lock fs list
mov ecx, [fs_list]
@@:
cmp ecx, fs_list
@ -1260,7 +1262,8 @@ end virtual
test eax, eax
jnz .success
pop eax
mov eax, ecx
pop ecx
mov ecx, [ecx]
jmp @b
@@:
@ -1301,6 +1304,8 @@ end virtual
sub ebp, 8 ; restore ebp
; 4. Return with eax = pointer to PARTITION or NULL.
pop ecx
; unlock fs list
ret
iglobal

View File

@ -223,6 +223,7 @@ DRIVE_DATA_SIZE = 16
OS_BASE = 0x80000000
window_data = OS_BASE + 0x0001000
background_window = window_data + sizeof.WDATA
;TASK_TABLE = OS_BASE + 0x0003000
;CURRENT_TASK = OS_BASE + 0x0003000
@ -231,7 +232,7 @@ window_data = OS_BASE + 0x0001000
;TASK_DATA = OS_BASE + 0x0003020
;TASK_EVENT = OS_BASE + 0x0003020
CDDataBuf = OS_BASE + 0x0005000
;CDDataBuf = OS_BASE + 0x0005000
;unused 0x6000 - 0x8fff
@ -494,7 +495,7 @@ struct APPDATA
exc_handler dd ? ;+32
except_mask dd ? ;+36
pl0_stack dd ? ;+40
cursor dd ? ;+44 ; WDATA
dd ? ;+44
fd_ev dd ? ;+48
bk_ev dd ? ;+52
fd_obj dd ? ;+56
@ -502,7 +503,7 @@ struct APPDATA
saved_esp dd ? ;+64
io_map rd 2 ;+68
dbg_state dd ? ;+76
cur_dir dd ? ;+80
cur_dir dd ? ;+80 ; directory this thread
wait_timeout dd ? ;+84
saved_esp0 dd ? ;+88
wait_begin dd ? ;+92 +++
@ -511,20 +512,20 @@ struct APPDATA
tls_base dd ? ;+104
event_mask dd ? ;+108 stores event types allowed for task
tid dd ? ;+112 thread id
draw_bgr_x dd ? ;+116 ; WDATA
draw_bgr_y dd ? ;+120 ; WDATA
dd ? ;+116
dd ? ;+120
state db ? ;+124 thread state
wnd_number db ? ;+125
dw ? ;+126
dd ? ;+128
window dd ? ;+128 ptr WDATA
dd ? ;+132
dd ? ;+136
counter_sum dd ? ;+140 ; R
saved_box BOX ;+144 ; WDATA
rd 4 ;+144
ipc_start dd ? ;+160
ipc_size dd ? ;+164
occurred_events dd ? ;+168 ; mask which accumulates occurred events
debugger_slot dd ? ;+172
debugger_slot dd ? ;+172 ; index in SLOT_BASE array
terminate_protection dd ? ;+176
keyboard_mode db ? ;+180
rb 3
@ -537,7 +538,7 @@ struct APPDATA
in_schedule LHEAD ;+236
counter_add dd ? ;+244 ; R
cpu_usage dd ? ;+248 ; R
temp_cursor dd 0 ;+252 ; temporary place to save cursor
dd ? ;+252 ; temporary place to save cursor
ends
assert sizeof.APPDATA = 256
@ -575,7 +576,9 @@ WSTATE_NORMAL = 00000000b
WSTATE_MAXIMIZED = 00000001b
WSTATE_MINIMIZED = 00000010b
WSTATE_ROLLEDUP = 00000100b
WSTATE_USED = 10000000b
; fl_redraw
WSTATE_REDRAW = 00000001b
WSTATE_WNDDRAWN = 00000010b
@ -603,11 +606,19 @@ struct WDATA
caption dd ?
captionEncoding db ?
rb 3
saved_box BOX
cursor dd ?
temp_cursor dd ?
draw_bgr_x dd ?
draw_bgr_y dd ?
draw_data RECT
thread dd ? ; prt APPDATA
rb 64 - 16 - 4*2 - 4*2 - 4 - 16
ends
label WDATA.fl_wstyle byte at WDATA.cl_workarea + 3
assert sizeof.WDATA = 64
assert sizeof.WDATA = 128
struct SYS_VARS
bpp dd ?

View File

@ -566,10 +566,6 @@ destroy_thread:
mov edi, esi
mov ecx, sizeof.WDATA/4
rep stosd
lea edi, [esi - window_data + draw_data]
mov ecx, sizeof.WDATA/4
rep stosd
popa
; debuggee test

View File

@ -969,8 +969,6 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
mov [SLOT_BASE + ebx + APPDATA.fd_obj], edx
mov [SLOT_BASE + ebx + APPDATA.bk_obj], edx
mov ecx, [def_cursor]
mov [SLOT_BASE + ebx + APPDATA.cursor], ecx
mov eax, [pl0_stack]
mov [SLOT_BASE + ebx + APPDATA.pl0_stack], eax
add eax, RING0_STACK_SIZE
@ -993,22 +991,29 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
mov eax, [slot]
mov [SLOT_BASE + ebx + APPDATA.wnd_number], al
mov ebx, eax
shl ebx, BSF sizeof.WDATA
lea ecx, [draw_data + ebx];ecx - pointer to draw data
;mov ebx, eax
shl eax, BSF sizeof.WDATA
add eax, window_data
mov ecx, eax
mov [SLOT_BASE + ebx + APPDATA.window], eax
mov [eax + WDATA.thread], ebx
add [eax + WDATA.thread], SLOT_BASE
; set window state to 'normal' (non-minimized/maximized/rolled-up) state
mov [window_data + ebx + WDATA.fl_wstate], WSTATE_NORMAL
mov [window_data + ebx + WDATA.fl_redraw], 1
mov [eax + WDATA.fl_wstate], WSTATE_NORMAL + WSTATE_USED
mov [eax + WDATA.fl_redraw], WSTATE_REDRAW
mov edx, [def_cursor]
mov [eax + WDATA.cursor], edx
;set draw data to full screen
xor eax, eax
mov [ecx + RECT.left], eax
mov [ecx + RECT.top], eax
mov [ecx + WDATA.draw_data.left], eax
mov [ecx + WDATA.draw_data.top], eax
mov eax, [screen_workarea.right]
mov [ecx + RECT.right], eax
mov [ecx + WDATA.draw_data.right], eax
mov eax, [screen_workarea.bottom]
mov [ecx + RECT.bottom], eax
mov [ecx + WDATA.draw_data.bottom], eax
mov ebx, [pl0_stack]
mov esi, [params]

View File

@ -350,8 +350,7 @@ align 64
fpu_data:
rb 0xa80 ; bochs avx512
fpu_data_size = $ - fpu_data
draw_data:
rb sizeof.WDATA*256
BPSLine_calc_area rd MAX_SCREEN_HEIGHT
d_width_calc_area rd MAX_SCREEN_HEIGHT
mouseunder rd 16*24
@ -437,8 +436,8 @@ thread_count dd ?
mididp dd ?
midisp dd ?
cdbase dd ?
cdid dd ?
;cdbase dd ?
;cdid dd ?
hdbase dd ? ; for boot 0x1f0
hdid dd ?
@ -548,3 +547,6 @@ RESERVED_PORTS:
rb 64*1024
sys_pgmap:
rb 1024*1024/8
CDDataBuf: rb 0x1000

View File

@ -289,11 +289,12 @@ nosb7:
jnz nosb8
mov ecx, [current_slot]
mov ecx, [ecx + APPDATA.window]
xor eax, eax
xchg eax, [ecx + APPDATA.draw_bgr_x]
xchg eax, [ecx + WDATA.draw_bgr_x]
mov [esp + SYSCALL_STACK.eax], eax ; eax = [left]*65536 + [right]
xor eax, eax
xchg eax, [ecx + APPDATA.draw_bgr_y]
xchg eax, [ecx + WDATA.draw_bgr_y]
mov [esp + SYSCALL_STACK.ebx], eax ; ebx = [top]*65536 + [bottom]
ret
;---------------------------------------
@ -328,11 +329,11 @@ nosb8:
mov [background_defined], 1
mov [draw_data + sizeof.WDATA + RECT.left], eax
mov [draw_data + sizeof.WDATA + RECT.top], ebx
mov [background_window + WDATA.draw_data.left], eax
mov [background_window + WDATA.draw_data.top], ebx
mov [draw_data + sizeof.WDATA + RECT.right], ecx
mov [draw_data + sizeof.WDATA + RECT.bottom], edx
mov [background_window + WDATA.draw_data.right], ecx
mov [background_window + WDATA.draw_data.bottom], edx
inc [REDRAW_BACKGROUND]
call wakeup_osloop
@ -353,15 +354,15 @@ endg
align 4
force_redraw_background:
and [draw_data + sizeof.WDATA + RECT.left], 0
and [draw_data + sizeof.WDATA + RECT.top], 0
and [background_window + WDATA.draw_data.left], 0
and [background_window + WDATA.draw_data.top], 0
push eax ebx
mov eax, [_display.width]
mov ebx, [_display.height]
dec eax
dec ebx
mov [draw_data + sizeof.WDATA + RECT.right], eax
mov [draw_data + sizeof.WDATA + RECT.bottom], ebx
mov [background_window + WDATA.draw_data.right], eax
mov [background_window + WDATA.draw_data.bottom], ebx
pop ebx eax
inc [REDRAW_BACKGROUND]
call wakeup_osloop
@ -424,7 +425,7 @@ align 4
; esi - buffer of 0x00RRGGBB
mov eax, [img_background]
cmp eax, static_background_data
jz .ret_39_3
jz .fail_39_3
align 4
@@:
movzx eax, cx ; store y in eax
@ -489,12 +490,13 @@ align 4
.end_copy_rect:
xor eax, eax
mov [esp + SYSCALL_STACK.eax], eax
align 4
.ret_39_3:
ret
;--------------------------------------
align 4
.fail_39_3:
mov eax, -1
align 4
.ret_39_3:
mov [esp + SYSCALL_STACK.eax], -1
ret
;--------------------------------------
align 4

View File

@ -390,15 +390,15 @@ mouse._.move_handler:
.set_resizing_cursor:
; DEBUGF 1, ".set_resizing_cursor eax = %x\n", eax
; change cursor to resizing cursor
shl esi, BSF sizeof.APPDATA
add esi, SLOT_BASE
shl esi, BSF sizeof.WDATA
add esi, window_data
; if resizing cursor we need (eax) isnt set already, set it
cmp eax, [esi + APPDATA.cursor]
cmp eax, [esi + WDATA.cursor]
je @f
; DEBUGF 1, "changing cursor to resizing\n"
xchg eax, [esi + APPDATA.cursor] ; set resizing cursor, prev cursor goes to eax
xchg eax, [esi + WDATA.cursor] ; set resizing cursor, prev cursor goes to eax
; save previous cursor (will be restored when we'll get out of the resizing area)
; if we change resizing cursor to resizing cursor then dont update previous cursor
cmp eax, [def_cursor_hresize]
@ -410,23 +410,23 @@ mouse._.move_handler:
cmp eax, [def_cursor_dresize2]
je @f
mov [esi + APPDATA.temp_cursor], eax ; save prev cursor
mov [esi + WDATA.temp_cursor], eax ; save prev cursor
@@:
jmp .end1
.not_in_resize_area:
; DEBUGF 1, ".not_in_resize_area\n"
shl esi, BSF sizeof.APPDATA
add esi, SLOT_BASE
mov eax, [esi + APPDATA.temp_cursor]
shl esi, BSF sizeof.WDATA
add esi, window_data
mov eax, [esi + WDATA.temp_cursor]
test eax, eax
jz .end1
; restore prev cursor
mov [esi + APPDATA.temp_cursor], 0
mov [esi + APPDATA.cursor], eax
mov [esi + WDATA.temp_cursor], 0
mov [esi + WDATA.cursor], eax
.end1:
pop ebx eax
@ -819,15 +819,15 @@ dd .loadCursorUni
mov eax, [MOUSE_X]
shl eax, 16
mov ax, [MOUSE_Y]
mov esi, [current_slot_idx]
shl esi, BSF sizeof.WDATA
mov bx, word[window_data + esi + WDATA.box.left]
mov esi, [current_slot]
mov esi, [esi + APPDATA.window]
mov bx, word[esi + WDATA.box.left]
shl ebx, 16
mov bx, word[window_data + esi + WDATA.box.top]
mov bx, word[esi + WDATA.box.top]
sub eax, ebx
sub ax, word[window_data + esi + WDATA.clientbox.top]
sub ax, word[esi + WDATA.clientbox.top]
rol eax, 16
sub ax, word[window_data + esi + WDATA.clientbox.left]
sub ax, word[esi + WDATA.clientbox.left]
rol eax, 16
mov [esp + SYSCALL_STACK.eax], eax
ret

View File

@ -78,12 +78,12 @@ syscall_setpixel:
mov eax, ebx
mov ebx, ecx
mov ecx, edx
mov edx, [current_slot_idx]
shl edx, BSF sizeof.WDATA
add eax, [window_data + edx + WDATA.box.left]
add ebx, [window_data + edx + WDATA.box.top]
add eax, [window_data + edx + WDATA.clientbox.left]
add ebx, [window_data + edx + WDATA.clientbox.top]
mov edx, [current_slot]
mov edx, [edx + APPDATA.window]
add eax, [edx + WDATA.box.left]
add ebx, [edx + WDATA.box.top]
add eax, [edx + WDATA.clientbox.left]
add ebx, [edx + WDATA.clientbox.top]
xor edi, edi ; no force
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
jmp __sys_putpixel
@ -103,13 +103,13 @@ syscall_writetext:
pop esi
jnz .err
mov eax, [current_slot_idx]
shl eax, BSF sizeof.WDATA
mov ebp, [window_data + eax + WDATA.box.left]
add ebp, [window_data + eax + WDATA.clientbox.left]
mov eax, [current_slot]
mov eax, [eax + APPDATA.window]
mov ebp, [eax + WDATA.box.left]
add ebp, [eax + WDATA.clientbox.left]
shl ebp, 16
add ebp, [window_data + eax + WDATA.box.top]
add bp, word[window_data + eax + WDATA.clientbox.top]
add ebp, [eax + WDATA.box.top]
add bp, word[eax + WDATA.clientbox.top]
test ecx, 0x08000000 ; redirect the output to the user area
jnz @f
add ebx, ebp
@ -147,10 +147,10 @@ syscall_drawrect:
shr eax, 16 ; eax - x.coord
movzx edx, bx ; edx - y.size
shr ebx, 16 ; ebx - y.coord
mov esi, [current_slot_idx]
shl esi, BSF sizeof.WDATA
add eax, [window_data + esi + WDATA.clientbox.left]
add ebx, [window_data + esi + WDATA.clientbox.top]
mov esi, [current_slot]
mov esi, [esi + APPDATA.window]
add eax, [esi + WDATA.clientbox.left]
add ebx, [esi + WDATA.clientbox.top]
add ecx, eax
add edx, ebx
jmp vesa20_drawbar
@ -161,19 +161,19 @@ syscall_drawrect:
align 4
; system function 38
syscall_drawline:
mov edi, [current_slot_idx]
shl edi, BSF sizeof.WDATA
movzx eax, word[window_data + edi + WDATA.box.left]
mov edi, [current_slot]
mov edi, [edi + APPDATA.window]
movzx eax, word[edi + WDATA.box.left]
mov ebp, eax
add ebp, [window_data + edi + WDATA.clientbox.left]
add ax, word[window_data + edi + WDATA.clientbox.left]
add ebp, [edi + WDATA.clientbox.left]
add ax, word[edi + WDATA.clientbox.left]
add ebp, ebx
shl eax, 16
movzx ebx, word[window_data + edi + WDATA.box.top]
movzx ebx, word[edi + WDATA.box.top]
add eax, ebp
mov ebp, ebx
add ebp, [window_data + edi + WDATA.clientbox.top]
add bx, word[window_data + edi + WDATA.clientbox.top]
add ebp, [edi + WDATA.clientbox.top]
add bx, word[edi + WDATA.clientbox.top]
add ebp, ecx
shl ebx, 16
xor edi, edi
@ -483,9 +483,9 @@ align 4
; system function 71
syscall_window_settings:
mov edi, [current_slot_idx]
shl edi, BSF sizeof.WDATA
or [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
mov edi, [current_slot]
mov edi, [edi + APPDATA.window]
or [edi + WDATA.fl_wstyle], WSTYLE_HASCAPTION
cmp ebx, 2
jz @f
xor edx, edx
@ -494,14 +494,14 @@ syscall_window_settings:
jc @f
xor edx, edx
@@:
mov [window_data + edi + WDATA.caption], ecx
mov [window_data + edi + WDATA.captionEncoding], dl
mov [edi + WDATA.caption], ecx
mov [edi + WDATA.captionEncoding], dl
jmp window._.draw_window_caption
;------------------------------------------------------------------------------
align 4
set_window_defaults:
mov byte [window_data + sizeof.WDATA + WDATA.cl_titlebar + 3], 1 ; desktop is not movable
mov byte [background_window + WDATA.cl_titlebar + 3], 1 ; desktop is not movable
push eax ecx
xor eax, eax
mov ecx, WIN_STACK
@ -555,10 +555,10 @@ align 4
align 4
.next_window:
movzx edi, word[WIN_POS + esi * 2]
shl edi, BSF sizeof.WDATA ;size of TASKDATA and WDATA = 32 bytes
shl edi, BSF sizeof.WDATA
cmp byte [SLOT_BASE + edi*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.state], TSTATE_FREE
je .skip_window
test byte [window_data + edi + WDATA.fl_wstate], WSTATE_USED
jz .skip_window
add edi, window_data
test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
@ -1086,17 +1086,17 @@ align 4
movzx edi, word[WIN_POS + eax * 2]
shl edi, BSF sizeof.WDATA
; it is a unused slot?
cmp byte [SLOT_BASE + edi*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.state], TSTATE_FREE
je @f
test byte [window_data + edi + WDATA.fl_wstate], WSTATE_USED
jz @f
; it is a hidden thread?
lea esi, [SLOT_BASE + edi*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.app_name]
cmp [esi], byte '@'
je @f
; is it already minimized?
test [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED
test [window_data + edi + WDATA.fl_wstate], WSTATE_MINIMIZED
jnz @f
; no it's not, let's do that
or [edi + window_data+WDATA.fl_wstate], WSTATE_MINIMIZED
or [window_data + edi + WDATA.fl_wstate], WSTATE_MINIMIZED
inc edx
;--------------------------------------
align 4
@ -1291,13 +1291,10 @@ sys_window_maximize_handler:
;--------------------------------------
align 4
.restore_size:
mov eax, esi
shl eax, BSF sizeof.APPDATA
add eax, SLOT_BASE + APPDATA.saved_box
push [eax + BOX.height] \
[eax + BOX.width] \
[eax + BOX.top] \
[eax + BOX.left]
push [edi + WDATA.saved_box.height] \
[edi + WDATA.saved_box.width] \
[edi + WDATA.saved_box.top] \
[edi + WDATA.saved_box.left]
mov eax, esp
;--------------------------------------
align 4
@ -1325,10 +1322,6 @@ align 4
align 4
;> esi = process slot
sys_window_rollup_handler:
mov edx, esi
shl edx, BSF sizeof.APPDATA
add edx, SLOT_BASE
; toggle normal/rolled up window state
mov bl, [edi + WDATA.fl_wstate]
xor bl, WSTATE_ROLLEDUP
@ -1350,7 +1343,7 @@ align 4
test bl, WSTATE_MAXIMIZED
jnz @f
add esp, -sizeof.BOX
lea eax, [edx + APPDATA.saved_box]
lea eax, [edi + WDATA.saved_box]
jmp .set_box
;--------------------------------------
align 4
@ -1543,17 +1536,12 @@ end if
test cl, WSTATE_MAXIMIZED
jnz .exit
mov eax, edi
sub eax, window_data
shl eax, (BSF sizeof.APPDATA - BSF sizeof.WDATA)
add eax, SLOT_BASE
lea ebx, [edi + WDATA.box]
xchg esp, ebx
pop [eax + APPDATA.saved_box.left] \
[eax + APPDATA.saved_box.top] \
[eax + APPDATA.saved_box.width] \
pop [edi + WDATA.saved_box.left] \
[edi + WDATA.saved_box.top] \
[edi + WDATA.saved_box.width] \
edx
xchg esp, ebx
@ -1561,7 +1549,7 @@ end if
test ch, WSTATE_ROLLEDUP
jnz .exit
mov [eax + APPDATA.saved_box.height], edx
mov [edi + WDATA.saved_box.height], edx
;--------------------------------------
align 4
.exit:
@ -1661,8 +1649,6 @@ window._.sys_set_window:
mov eax, [edi + WDATA.cl_frames]
mov esi, [esp]
sub edi, window_data
shl edi, (BSF sizeof.APPDATA - BSF sizeof.WDATA)
and cl, 0x0F
cmp cl, 3
@ -1676,7 +1662,7 @@ align 4
@@:
mov [esi + WDATA.caption], eax
add edi, SLOT_BASE + APPDATA.saved_box
add edi, WDATA.saved_box
movsd
movsd
movsd
@ -2186,7 +2172,7 @@ align 4
ja .exit.no_redraw
movzx edx, word[esi]
shl edx, BSF sizeof.WDATA ; size of TASKDATA and WDATA is 32 bytes
shl edx, BSF sizeof.WDATA
cmp byte [SLOT_BASE + edx*(sizeof.APPDATA/sizeof.WDATA) - sizeof.APPDATA + APPDATA.state], TSTATE_FREE
je .next_window
@ -2453,10 +2439,10 @@ align 4
align 4
.next_window:
movzx edi, word[WIN_POS + esi * 2]
shl edi, BSF sizeof.WDATA ;size of TASKDATA and WDATA = 32 bytes
shl edi, BSF sizeof.WDATA
cmp byte [SLOT_BASE + edi*(sizeof.APPDATA/sizeof.WDATA) + APPDATA.state], TSTATE_FREE
je .skip_window
test byte [window_data + edi + WDATA.fl_wstate], WSTATE_USED
jz .skip_window
add edi, window_data
test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED

View File

@ -115,9 +115,9 @@ save_draw_mouse:
add eax, [_display.win_map]
movzx edx, byte [ebx + eax]
shl edx, BSF sizeof.APPDATA
shl edx, BSF sizeof.WDATA
; edx - thread slot of window under cursor
mov esi, [SLOT_BASE + edx + APPDATA.cursor] ; cursor of window under cursor
mov esi, [window_data + edx + WDATA.cursor] ; cursor of window under cursor
; if cursor of window under cursor already equal to the
; current_cursor then just draw it
@ -127,7 +127,7 @@ save_draw_mouse:
; eax = thread slot of current active window
mov eax, [thread_count]
movzx eax, word [WIN_POS + eax*2]
shl eax, BSF sizeof.APPDATA
shl eax, BSF sizeof.WDATA
; window under cursor == active window ?
cmp eax, edx
@ -138,7 +138,7 @@ save_draw_mouse:
and bl, mouse.WINDOW_RESIZE_S_FLAG or mouse.WINDOW_RESIZE_W_FLAG or mouse.WINDOW_RESIZE_E_FLAG
test bl, bl
jz .active_isnt_resizing
mov esi, [SLOT_BASE + eax + APPDATA.cursor] ; esi = cursor of active window, it is resizing cursor
mov esi, [window_data + eax + WDATA.cursor] ; esi = cursor of active window, it is resizing cursor
jmp @f
.active_isnt_resizing:
@ -153,7 +153,7 @@ save_draw_mouse:
je @f
; set cursor of window under cursor
mov esi, [SLOT_BASE + edx + APPDATA.cursor]
mov esi, [window_data + edx + WDATA.cursor]
cmp esi, [current_cursor]
je .draw
@ -171,7 +171,7 @@ align 4
;align 4
;.fail:
; mov ecx, [def_cursor]
; mov [edx+SLOT_BASE+APPDATA.cursor], ecx
; mov [window_data + edx + WDATA.cursor], ecx
; stdcall [_display.move_cursor], ecx ; stdcall: [esp]=ebx,eax
; popad
; ret

View File

@ -897,10 +897,17 @@ include "detect/vortex86.inc" ; Vortex86 SoC detection code
call boot_log
call reserve_irqs_ports
mov [SLOT_BASE + APPDATA.window], window_data
mov [SLOT_BASE + sizeof.APPDATA + APPDATA.window], window_data + sizeof.WDATA
mov [SLOT_BASE + sizeof.APPDATA*2 + APPDATA.window], window_data + sizeof.WDATA*2
mov [window_data + WDATA.thread], SLOT_BASE
mov [window_data + sizeof.WDATA + WDATA.thread], SLOT_BASE + sizeof.APPDATA
mov [window_data + sizeof.WDATA*2 + WDATA.thread], SLOT_BASE + sizeof.APPDATA*2
call init_display
mov eax, [def_cursor]
mov [SLOT_BASE + APPDATA.cursor + sizeof.APPDATA], eax
mov [SLOT_BASE + APPDATA.cursor + sizeof.APPDATA*2], eax
mov [window_data + sizeof.WDATA + WDATA.cursor], eax
mov [window_data + sizeof.WDATA*2 + WDATA.cursor], eax
; PRINT CPU FREQUENCY
@ -1179,6 +1186,10 @@ proc setup_os_slot
mov [edx + APPDATA.wnd_number], dh
mov byte [edx + APPDATA.tid], dh
movzx eax, dh
shl eax, BSF sizeof.WDATA
add eax, window_data
mov [edx + APPDATA.window], eax
ret
endp
@ -1349,7 +1360,6 @@ set_variables:
mov byte [KEY_COUNT], al ; keyboard buffer
mov byte [BTN_COUNT], al ; button buffer
; mov [MOUSE_X],dword 100*65536+100 ; mouse x/y
pop eax
ret
@ -1554,14 +1564,14 @@ draw_num_text:
mov ebx, [esp+64+32-8+4]
; add window start x & y
mov ecx, [current_slot_idx]
shl ecx, BSF sizeof.WDATA
mov ecx, [current_slot]
mov ecx, [ecx + APPDATA.window]
mov eax, [window_data + ecx + WDATA.box.left]
add eax, [window_data + ecx + WDATA.clientbox.left]
mov eax, [ecx + WDATA.box.left]
add eax, [ecx + WDATA.clientbox.left]
shl eax, 16
add eax, [window_data + ecx + WDATA.box.top]
add eax, [window_data + ecx + WDATA.clientbox.top]
add eax, [ecx + WDATA.box.top]
add eax, [ecx + WDATA.clientbox.top]
add ebx, eax
mov ecx, [esp+64+32-12+4]
mov eax, [esp+64+8] ; background color (if given)
@ -1896,6 +1906,7 @@ sys_end:
; restore default cursor before killing
pusha
mov ecx, [current_slot]
mov ecx, [ecx + APPDATA.window]
call restore_default_cursor_before_killing
popa
@@:
@ -1924,11 +1935,12 @@ sys_end:
jmp .waitterm
;------------------------------------------------------------------------------
align 4
; ecx - ptr WDATA
restore_default_cursor_before_killing:
pushfd
cli
mov eax, [def_cursor]
mov [ecx + APPDATA.cursor], eax
mov [ecx + WDATA.cursor], eax
movzx eax, word [MOUSE_Y]
movzx ebx, word [MOUSE_X]
@ -1936,8 +1948,8 @@ restore_default_cursor_before_killing:
add eax, [_display.win_map]
movzx edx, byte [ebx + eax]
shl edx, BSF sizeof.APPDATA
mov esi, [SLOT_BASE + edx + APPDATA.cursor]
shl edx, BSF sizeof.WDATA
mov esi, [window_data + edx + WDATA.cursor]
cmp esi, [current_cursor]
je @f
@ -1994,9 +2006,9 @@ sys_system:
;------------------------------------------------------------------------------
sysfn_shutdown: ; 18.9 = system shutdown
cmp ecx, SYSTEM_SHUTDOWN
jl exit_for_anyone
jl .exit_for_anyone
cmp ecx, SYSTEM_RESTART
jg exit_for_anyone
jg .exit_for_anyone
mov [BOOT.shutdown_type], cl
mov eax, [thread_count]
@ -2004,7 +2016,7 @@ sysfn_shutdown: ; 18.9 = system shutdown
mov [shutdown_processes], eax
call wakeup_osloop
and dword [esp + SYSCALL_STACK.eax], 0
exit_for_anyone:
.exit_for_anyone:
ret
uglobal
shutdown_processes:
@ -2055,10 +2067,10 @@ sysfn_terminate: ; 18.2 = TERMINATE
; restore default cursor before killing
pusha
mov ecx, [esp+32]
shl ecx, BSF sizeof.APPDATA
add ecx, SLOT_BASE
shl ecx, BSF sizeof.WDATA
add ecx, window_data
mov eax, [def_cursor]
cmp [ecx + APPDATA.cursor], eax
cmp [ecx + WDATA.cursor], eax
je @f
call restore_default_cursor_before_killing
@@:
@ -2172,8 +2184,8 @@ sysfn_zmodif:
mov eax, edx
shl edx, BSF sizeof.WDATA
cmp [edx*(sizeof.APPDATA/sizeof.WDATA) + SLOT_BASE + APPDATA.state], TSTATE_FREE
je .fail
test [window_data + edx + WDATA.fl_wstate], WSTATE_USED
jz .fail
cmp ecx, 1
jnz .set_zmod
@ -2204,7 +2216,7 @@ sysfn_zmodif:
call window._.redraw_top_wnd
shl esi, BSF sizeof.WDATA
mov [esi + window_data + WDATA.fl_redraw], 1
mov [esi + window_data + WDATA.fl_redraw], WSTATE_REDRAW
mov eax, 1
@ -2640,16 +2652,16 @@ sys_redrawstat:
cmp ebx, 2
jnz .srl1
mov edx, [current_slot_idx] ; return whole screen draw area for this app
shl edx, BSF sizeof.WDATA
mov [draw_data + edx + RECT.left], 0
mov [draw_data + edx + RECT.top], 0
mov edx, [current_slot] ; return whole screen draw area for this app
mov edx, [edx + APPDATA.window]
mov [edx + WDATA.draw_data.left], 0
mov [edx + WDATA.draw_data.top], 0
mov eax, [_display.width]
dec eax
mov [draw_data + edx + RECT.right], eax
mov [edx + WDATA.draw_data.right], eax
mov eax, [_display.height]
dec eax
mov [draw_data + edx + RECT.bottom], eax
mov [edx + WDATA.draw_data.bottom], eax
.srl1:
ret
@ -2863,14 +2875,14 @@ align 4
;--------------------------------------
align 4
backgr:
mov eax, [draw_data + sizeof.WDATA + RECT.left]
mov eax, [background_window + WDATA.draw_data.left]
shl eax, 16
add eax, [draw_data + sizeof.WDATA + RECT.right]
add eax, [background_window + WDATA.draw_data.right]
mov [BG_Rect_X_left_right], eax ; [left]*65536 + [right]
mov eax, [draw_data + sizeof.WDATA + RECT.top]
mov eax, [background_window + WDATA.draw_data.top]
shl eax, 16
add eax, [draw_data + sizeof.WDATA + RECT.bottom]
add eax, [background_window + WDATA.draw_data.bottom]
mov [BG_Rect_Y_top_bottom], eax ; [top]*65536 + [bottom]
call drawbackground
@ -2884,47 +2896,53 @@ backgr:
;--------------------------------------
align 4
set_bgr_event:
add edi, sizeof.APPDATA
add edi, sizeof.WDATA
mov eax, [BG_Rect_X_left_right]
mov edx, [BG_Rect_Y_top_bottom]
cmp [SLOT_BASE + edi + APPDATA.draw_bgr_x], 0
cmp [window_data + edi + WDATA.draw_bgr_x], 0
jz .set
.join:
cmp word [SLOT_BASE + edi + APPDATA.draw_bgr_x], ax
cmp word [window_data + edi + WDATA.draw_bgr_x], ax
jae @f
mov word [SLOT_BASE + edi + APPDATA.draw_bgr_x], ax
mov word [window_data + edi + WDATA.draw_bgr_x], ax
@@:
shr eax, 16
cmp word [SLOT_BASE + edi + APPDATA.draw_bgr_x + 2], ax
cmp word [window_data + edi + WDATA.draw_bgr_x + 2], ax
jbe @f
mov word [SLOT_BASE + edi + APPDATA.draw_bgr_x + 2], ax
mov word [window_data + edi + WDATA.draw_bgr_x + 2], ax
@@:
cmp word [SLOT_BASE + edi + APPDATA.draw_bgr_y], dx
cmp word [window_data + edi + WDATA.draw_bgr_y], dx
jae @f
mov word [SLOT_BASE + edi + APPDATA.draw_bgr_y], dx
mov word [window_data + edi + WDATA.draw_bgr_y], dx
@@:
shr edx, 16
cmp word [SLOT_BASE + edi + APPDATA.draw_bgr_y+2], dx
cmp word [window_data + edi + WDATA.draw_bgr_y+2], dx
jbe @f
mov word [SLOT_BASE + edi + APPDATA.draw_bgr_y+2], dx
mov word [window_data + edi + WDATA.draw_bgr_y+2], dx
@@:
jmp .common
.set:
mov [SLOT_BASE + edi + APPDATA.draw_bgr_x], eax
mov [SLOT_BASE + edi + APPDATA.draw_bgr_y], edx
mov [window_data + edi + WDATA.draw_bgr_x], eax
mov [window_data + edi + WDATA.draw_bgr_y], edx
.common:
or [SLOT_BASE + edi + APPDATA.occurred_events], EVENT_BACKGROUND
loop set_bgr_event
mov eax, [window_data + edi + WDATA.thread]
test eax, eax
jz @f
or [eax + APPDATA.occurred_events], EVENT_BACKGROUND
@@:
sub ecx, 1
jnz set_bgr_event
;loop set_bgr_event
pop edi ecx
;--------- set event 5 stop -----------
dec [REDRAW_BACKGROUND] ; got new update request?
jnz backgr
xor eax, eax
mov [draw_data + sizeof.WDATA + RECT.left], eax
mov [draw_data + sizeof.WDATA + RECT.top], eax
mov [draw_data + sizeof.WDATA + RECT.right], eax
mov [draw_data + sizeof.WDATA + RECT.bottom], eax
mov [background_window + WDATA.draw_data.left], eax
mov [background_window + WDATA.draw_data.top], eax
mov [background_window + WDATA.draw_data.right], eax
mov [background_window + WDATA.draw_data.bottom], eax
;--------------------------------------
align 4
nobackgr:
@ -2986,8 +3004,8 @@ newct:
.terminate:
pushad
mov ecx, eax
shl ecx, BSF sizeof.APPDATA
add ecx, SLOT_BASE
shl ecx, BSF sizeof.WDATA
add ecx, window_data
call restore_default_cursor_before_killing
popad
@ -3079,39 +3097,38 @@ bgli:
jz .az
mov dl, 0
lea eax, [edi + draw_data - window_data]
mov ebx, [draw_limits.left]
cmp ebx, [eax + RECT.left]
cmp ebx, [edi + WDATA.draw_data.left]
jae @f
mov [eax + RECT.left], ebx
mov [edi + WDATA.draw_data.left], ebx
mov dl, 1
;--------------------------------------
align 4
@@:
mov ebx, [draw_limits.top]
cmp ebx, [eax + RECT.top]
cmp ebx, [edi + WDATA.draw_data.top]
jae @f
mov [eax + RECT.top], ebx
mov [edi + WDATA.draw_data.top], ebx
mov dl, 1
;--------------------------------------
align 4
@@:
mov ebx, [draw_limits.right]
cmp ebx, [eax + RECT.right]
cmp ebx, [edi + WDATA.draw_data.right]
jbe @f
mov [eax + RECT.right], ebx
mov [edi + WDATA.draw_data.right], ebx
mov dl, 1
;--------------------------------------
align 4
@@:
mov ebx, [draw_limits.bottom]
cmp ebx, [eax + RECT.bottom]
cmp ebx, [edi + WDATA.draw_data.bottom]
jbe @f
mov [eax + RECT.bottom], ebx
mov [edi + WDATA.draw_data.bottom], ebx
mov dl, 1
;--------------------------------------
align 4
@ -3123,18 +3140,15 @@ align 4
align 4
.az:
mov eax, edi
add eax, draw_data-window_data
mov ebx, [draw_limits.left] ; set limits
mov [eax + RECT.left], ebx
mov [eax + WDATA.draw_data.left], ebx
mov ebx, [draw_limits.top]
mov [eax + RECT.top], ebx
mov [eax + WDATA.draw_data.top], ebx
mov ebx, [draw_limits.right]
mov [eax + RECT.right], ebx
mov [eax + WDATA.draw_data.right], ebx
mov ebx, [draw_limits.bottom]
mov [eax + RECT.bottom], ebx
sub eax, draw_data-window_data
mov [eax + WDATA.draw_data.bottom], ebx
cmp dword [esp], 1
jne nobgrd
@ -3203,7 +3217,7 @@ align 4
.found:
pop ebp edi eax
mov [eax + WDATA.fl_redraw], byte 1 ; mark as redraw
mov [eax + WDATA.fl_redraw], WSTATE_REDRAW ; mark as redraw
;--------------------------------------
align 4
ricino:
@ -3224,7 +3238,7 @@ calculatebackground: ; background
mov ecx, [_display.win_map_size]
shr ecx, 2
rep stosd
mov byte[window_data + sizeof.WDATA + WDATA.z_modif], ZPOS_DESKTOP
mov byte[background_window + WDATA.z_modif], ZPOS_DESKTOP
mov [REDRAW_BACKGROUND], 0
ret
;-----------------------------------------------------------------------------

View File

@ -41,7 +41,7 @@
; 0x80000000 -> 0FFF physical page zero - do not write
; (used by int 13h in some configurations)
;
; 0x80001000 -> 2FFF window_data - 256 entries
; 0x80001000 -> 8FFF window_data - 256 entries
;
; 0000 dword x start
; 0004 dword y start
@ -52,15 +52,6 @@
; 0018 dword color of frames
; 001C dword window flags, +30 = window drawn, +31 redraw flag
;
; 3000 -> 4FFF free
;
; 5000 -> 68FF free (6k6)
; 6900 -> 6EFF saved picture under mouse pointer (1k5)
;
; 6F00 -> 6FFF free (256)
;
; 7000 -> 7FFF used CD driver
;
; 8000 -> A3FF used FLOPPY driver
;
; A400 -> B0FF free (3k3), unused ACTIVE_PROC_STACK

View File

@ -294,14 +294,16 @@ proc set_cursor stdcall, hcursor:dword
; cmp [eax+CURSOR.size], CURSOR_SIZE
; jne .fail
mov ebx, [current_slot]
xchg eax, [ebx + APPDATA.cursor]
mov ebx, [ebx + APPDATA.window]
xchg eax, [ebx + WDATA.cursor]
jmp .end
;--------------------------------------
align 4
.fail:
mov eax, [def_cursor]
mov ebx, [current_slot]
xchg eax, [ebx + APPDATA.cursor]
mov ebx, [ebx + APPDATA.window]
xchg eax, [ebx + WDATA.cursor]
align 4
.end:
mov [redrawmouse_unconditional], 1
@ -464,10 +466,11 @@ proc delete_cursor stdcall, hcursor:dword
jne .fail
mov ebx, [current_slot]
cmp esi, [ebx + APPDATA.cursor]
mov ebx, [ebx + APPDATA.window]
cmp esi, [ebx + WDATA.cursor]
jne @F
mov eax, [def_cursor]
mov [ebx + APPDATA.cursor], eax
mov [ebx + WDATA.cursor], eax
;--------------------------------------
align 4
@@:

View File

@ -2013,9 +2013,9 @@ vesa20_drawbackground_tiled:
pushad
; External loop for all y from start to end
mov ebx, [draw_data + sizeof.WDATA + RECT.top] ; y start
mov ebx, [background_window + WDATA.draw_data.top] ; y start
dp2:
mov ebp, [draw_data + sizeof.WDATA + RECT.left] ; x start
mov ebp, [background_window + WDATA.draw_data.left] ; x start
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
; and LFB data (output for our function) [edi]
; mov eax, [BytesPerScanLine]
@ -2113,7 +2113,7 @@ vesa20_drawbackground_tiled:
add ebp, edx
add eax, edx
cmp eax, [draw_data + sizeof.WDATA + RECT.right]
cmp eax, [background_window + WDATA.draw_data.right]
ja dp4
sub ecx, edx
jnz dp3
@ -2128,7 +2128,7 @@ vesa20_drawbackground_tiled:
dp4:
; next scan line
inc ebx
cmp ebx, [draw_data + sizeof.WDATA + RECT.bottom]
cmp ebx, [background_window + WDATA.draw_data.bottom]
jbe dp2
popad
mov [EGA_counter], 1
@ -2166,8 +2166,8 @@ vesa20_drawbackground_stretch:
push eax ; low
; External loop for all y from start to end
mov ebx, [draw_data + sizeof.WDATA + RECT.top] ; y start
mov ebp, [draw_data + sizeof.WDATA + RECT.left] ; x start
mov ebx, [background_window + WDATA.draw_data.top] ; y start
mov ebp, [background_window + WDATA.draw_data.left] ; x start
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
; and LFB data (output for our function) [edi]
; mov eax, [BytesPerScanLine]
@ -2309,7 +2309,7 @@ vesa20_drawbackground_stretch:
add eax, 1
mov [esp+20], eax
add esi, 4
cmp eax, [draw_data + sizeof.WDATA + RECT.right]
cmp eax, [background_window + WDATA.draw_data.right]
jbe sdp3a
sdp4:
@ -2317,11 +2317,11 @@ vesa20_drawbackground_stretch:
mov ebx, [esp+24]
add ebx, 1
mov [esp+24], ebx
cmp ebx, [draw_data + sizeof.WDATA + RECT.bottom]
cmp ebx, [background_window + WDATA.draw_data.bottom]
ja sdpdone
; advance edi, ebp to next scan line
sub eax, [draw_data + sizeof.WDATA + RECT.left]
sub eax, [background_window + WDATA.draw_data.left]
sub ebp, eax
add ebp, [_display.width]
sub edi, eax
@ -2346,7 +2346,7 @@ vesa20_drawbackground_stretch:
lea eax, [eax*3]
imul eax, [BgrDataWidth]
sub [esp], eax
mov eax, [draw_data + sizeof.WDATA + RECT.left]
mov eax, [background_window + WDATA.draw_data.left]
mov [esp+20], eax
test ebx, ebx
jz sdp3
@ -2386,7 +2386,7 @@ smooth_line:
mov eax, [esp+20+8]
add eax, 1
mov [esp+20+8], eax
cmp eax, [draw_data + sizeof.WDATA + RECT.right]
cmp eax, [background_window + WDATA.draw_data.right]
ja @f
add ecx, [esp+36+8]
mov eax, edx
@ -2396,7 +2396,7 @@ smooth_line:
sub esi, eax
jmp smooth_line
@@:
mov eax, [draw_data + sizeof.WDATA + RECT.left]
mov eax, [background_window + WDATA.draw_data.left]
mov [esp+20+8], eax
ret