9,7 → 9,7 |
$Revision$ |
|
;============================================================================== |
;///// public functions /////////////////////////////////////////////////////// |
; public functions |
;============================================================================== |
|
window.BORDER_SIZE = 5 |
18,10 → 18,11 |
common_colours rd 48 |
draw_limits RECT |
endg |
;------------------------------------------------------------------------------ |
|
;------------------------------------------------------------------------------ |
syscall_draw_window: ;///// system function 0 ///////////////////////////////// |
;------------------------------------------------------------------------------ |
|
align 4 |
syscall_draw_window: ; system function 0 |
mov eax, edx |
shr eax, 24 |
and al, 0x0f |
69,8 → 70,124 |
.exit: |
ret |
;------------------------------------------------------------------------------ |
syscall_display_settings: ;///// system function 48 /////////////////////////// |
|
|
align 4 |
; system function 1 |
syscall_setpixel: |
mov eax, ebx |
mov ebx, ecx |
mov ecx, edx |
mov edx, [TASK_BASE] |
add eax, [edx-twdw+WDATA.box.left] |
add ebx, [edx-twdw+WDATA.box.top] |
mov edi, [current_slot] |
add eax, [edi+APPDATA.wnd_clientbox.left] |
add ebx, [edi+APPDATA.wnd_clientbox.top] |
xor edi, edi ; no force |
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area |
jmp __sys_putpixel |
;------------------------------------------------------------------------------ |
|
|
align 4 |
; system function 4 |
syscall_writetext: |
|
push esi ;check pointer on kernel address. |
test ecx, 0x80000000 |
jz @f |
xor esi, esi |
@@: |
stdcall is_region_userspace, edx, esi |
pop esi |
jnz .err |
|
mov eax, [TASK_BASE] |
mov ebp, [eax-twdw+WDATA.box.left] |
push esi |
mov esi, [current_slot] |
add ebp, [esi+APPDATA.wnd_clientbox.left] |
shl ebp, 16 |
add ebp, [eax-twdw+WDATA.box.top] |
add bp, word[esi+APPDATA.wnd_clientbox.top] |
pop esi |
test ecx, 0x08000000 ; redirect the output to the user area |
jnz @f |
add ebx, ebp |
align 4 |
@@: |
mov eax, edi |
test ecx, 0x08000000 ; redirect the output to the user area |
jnz @f |
xor edi, edi |
jmp dtext |
|
@@: ; check pointer |
stdcall is_region_userspace, edi, 0 |
jnz .err |
jmp dtext |
.err: |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
; system function 13 |
syscall_drawrect: |
mov edi, edx ; color + gradient |
and edi, 0x80FFFFFF |
test bx, bx ; x.size |
je .drectr |
test cx, cx ; y.size |
je .drectr |
|
mov eax, ebx ; bad idea |
mov ebx, ecx |
|
movzx ecx, ax ; ecx - x.size |
shr eax, 16 ; eax - x.coord |
movzx edx, bx ; edx - y.size |
shr ebx, 16 ; ebx - y.coord |
mov esi, [current_slot] |
|
add eax, [esi + APPDATA.wnd_clientbox.left] |
add ebx, [esi + APPDATA.wnd_clientbox.top] |
add ecx, eax |
add edx, ebx |
jmp vesa20_drawbar |
.drectr: |
ret |
;------------------------------------------------------------------------------ |
|
align 4 |
; system function 38 |
syscall_drawline: |
mov edi, [TASK_BASE] |
movzx eax, word[edi-twdw+WDATA.box.left] |
mov ebp, eax |
mov esi, [current_slot] |
add ebp, [esi+APPDATA.wnd_clientbox.left] |
add ax, word[esi+APPDATA.wnd_clientbox.left] |
add ebp, ebx |
shl eax, 16 |
movzx ebx, word[edi-twdw+WDATA.box.top] |
add eax, ebp |
mov ebp, ebx |
add ebp, [esi+APPDATA.wnd_clientbox.top] |
add bx, word[esi+APPDATA.wnd_clientbox.top] |
add ebp, ecx |
shl ebx, 16 |
xor edi, edi |
add ebx, ebp |
mov ecx, edx |
jmp __sys_draw_line |
;------------------------------------------------------------------------------ |
|
|
align 4 |
; system function 48 |
syscall_display_settings: |
cmp ebx, 13 |
ja .ret |
jmp dword[.ftable + ebx*4] |
280,16 → 397,17 |
jmp .redrawScreen |
|
;------------------------------------------------------------------------------ |
syscall_set_window_shape: ;///// system function 50 /////////////////////////// |
;------------------------------------------------------------------------------ |
|
align 4 |
; system function 50 |
;; Set window shape address: |
;> ebx = 0 |
;> ecx = shape data address |
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
; -------------------------- |
;; Set window shape scale: |
;> ebx = 1 |
;> ecx = scale power (resulting scale is 2^ebx) |
;------------------------------------------------------------------------------ |
syscall_set_window_shape: |
mov edi, [current_slot] |
|
test ebx, ebx |
306,12 → 424,10 |
.exit: |
ret |
;------------------------------------------------------------------------------ |
|
align 4 |
;------------------------------------------------------------------------------ |
syscall_move_window: ;///// system function 67 //////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
; system function 67 |
syscall_move_window: |
mov edi, [current_slot_idx] |
shl edi, 5 |
add edi, window_data |
365,8 → 481,9 |
.exit: |
ret |
;------------------------------------------------------------------------------ |
syscall_window_settings: ;///// system function 71 //////////////////////////// |
;------------------------------------------------------------------------------ |
|
; system function 71 |
syscall_window_settings: |
mov edi, [current_slot_idx] |
shl edi, 5 |
or [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION |
382,9 → 499,9 |
mov [edi*8 + SLOT_BASE + APPDATA.captionEncoding], dl |
jmp window._.draw_window_caption |
;------------------------------------------------------------------------------ |
|
align 4 |
set_window_defaults: ;///////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
set_window_defaults: |
mov byte [window_data + 0x20 + WDATA.cl_titlebar + 3], 1 ; desktop is not movable |
push eax ecx |
xor eax, eax |
405,17 → 522,13 |
;------------------------------------------------------------------------------ |
|
align 4 |
;------------------------------------------------------------------------------ |
calculatescreen: ;///////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Scan all windows from bottom to top, calling `setscreen` for each one |
;? intersecting given screen area |
;------------------------------------------------------------------------------ |
;> eax = left |
;> ebx = top |
;> ecx = right |
;> edx = bottom |
;------------------------------------------------------------------------------ |
calculatescreen: |
push esi |
pushfd |
cli |
526,12 → 639,10 |
pop esi |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
repos_windows: ;/////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
repos_windows: |
mov ecx, [thread_count] |
mov edi, window_data + sizeof.WDATA * 2 |
call force_redraw_background |
602,10 → 713,9 |
mov [edi + WDATA.box.height], eax |
jmp .fix_client_box |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
draw_rectangle: ;////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;> eax = pack[16(left), 16(right)] |
;> ebx = pack[16(top), 16(bottom)] |
;> esi = color |
612,7 → 722,7 |
; ?? RR GG BB ; 0x01000000 negation |
; ; 0x02000000 used for draw_rectangle without top line |
; ; for example drawwindow_III and drawwindow_IV |
;------------------------------------------------------------------------------ |
draw_rectangle: |
push eax ebx ecx edi |
|
xor edi, edi |
669,12 → 779,10 |
inc edi |
jmp .flags_set |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
drawwindow_I_caption: ;//////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
drawwindow_I_caption: |
push [edx + WDATA.cl_titlebar] |
mov esi, edx |
|
724,12 → 832,10 |
pop [esi + WDATA.cl_titlebar] |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
drawwindow_I: ;//////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
drawwindow_I: |
pushad |
|
; window border |
772,12 → 878,10 |
popad |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
drawwindow_III_caption: ;///////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
drawwindow_III_caption: |
mov ecx, [edx + WDATA.cl_titlebar] |
push ecx |
mov esi, edx |
833,12 → 937,10 |
pop [esi + WDATA.cl_titlebar] |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
drawwindow_III: ;////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
drawwindow_III: |
pushad |
|
; window border |
906,12 → 1008,11 |
popad |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
waredraw: ;//////////////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Activate window, redrawing if necessary |
;------------------------------------------------------------------------------ |
waredraw: |
push -1 |
mov eax, [thread_count] |
lea eax, [WIN_POS + eax * 2] |
970,8 → 1071,9 |
inc eax |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
minimize_all_window: |
push ebx ecx edx esi edi |
pushfd |
1021,12 → 1123,10 |
;------------------------------------------------------------------------------ |
align 4 |
;------------------------------------------------------------------------------ |
minimize_window: ;///////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
|
;> eax = window number on screen |
;------------------------------------------------------------------------------ |
;# corrupts [dl*] |
;------------------------------------------------------------------------------ |
minimize_window: |
push edi |
pushfd |
cli |
1081,14 → 1181,12 |
pop edi |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
restore_minimized_window: ;//////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;> eax = window number on screen |
;------------------------------------------------------------------------------ |
;# corrupts [dl*] |
;------------------------------------------------------------------------------ |
restore_minimized_window: |
pushad |
pushfd |
cli |
1134,10 → 1232,9 |
align 4 |
; TODO: remove this proc |
;------------------------------------------------------------------------------ |
window_check_events: ;///////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
|
|
window_check_events: |
; do we have window minimize/restore request? |
cmp [window_minimize], 0 |
je .exit |
1159,14 → 1256,11 |
.exit: |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
sys_window_maximize_handler: ;///////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
;> esi = process slot |
;------------------------------------------------------------------------------ |
sys_window_maximize_handler: |
mov edi, esi |
shl edi, 5 |
add edi, window_data |
1227,14 → 1321,11 |
inc [_display.mask_seqno] |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
sys_window_rollup_handler: ;/////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
;> esi = process slot |
;------------------------------------------------------------------------------ |
sys_window_rollup_handler: |
mov edx, esi |
shl edx, 8 |
add edx, SLOT_BASE |
1281,7 → 1372,7 |
;------------------------------------------------------------------------------ |
align 4 |
;------------------------------------------------------------------------------ |
;sys_window_start_moving_handler: ;///////////////////////////////////////////// |
;sys_window_start_moving_handler: |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
1292,16 → 1383,13 |
; call window._.draw_negative_box |
; ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
sys_window_end_moving_handler: ;/////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
;> eax = old (original) window box |
;> ebx = new (final) window box |
;> esi = process slot |
;------------------------------------------------------------------------------ |
sys_window_end_moving_handler: |
; mov edi, ebx |
; call window._.end_moving__box |
|
1323,23 → 1411,24 |
call window._.set_window_box |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
sys_window_moving_handler: ;/////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
;> eax = old (from previous call) window box |
;> ebx = new (current) window box |
;> esi = process_slot |
;------------------------------------------------------------------------------ |
sys_window_moving_handler: |
mov edi, eax |
call window._.draw_negative_box |
mov edi, ebx |
call window._.draw_negative_box |
ret |
|
|
|
|
;============================================================================== |
;///// private functions ////////////////////////////////////////////////////// |
; private functions |
;============================================================================== |
|
iglobal |
1353,16 → 1442,13 |
endg |
|
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
window._.invalidate_screen: ;////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
;> eax = old (original) window box |
;> ebx = new (final) window box |
;> edi = pointer to WDATA struct |
;------------------------------------------------------------------------------ |
window._.invalidate_screen: |
push eax ebx |
|
; TODO: do we really need `draw_limits`? |
1405,16 → 1491,13 |
pop ebx eax |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
window._.set_window_box: ;///////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
;> eax = pointer to BOX struct |
;> bl = new window state flags |
;> edi = pointer to WDATA struct |
;------------------------------------------------------------------------------ |
window._.set_window_box: |
push eax ebx esi |
|
; don't do anything if the new box is identical to the old |
1486,14 → 1569,11 |
pop esi ebx eax |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
window._.set_window_clientbox: ;/////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
;> edi = pointer to WDATA struct |
;------------------------------------------------------------------------------ |
window._.set_window_clientbox: |
push eax ecx edi |
|
mov eax, [_skinh] |
1544,14 → 1624,11 |
pop edi ecx eax |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
window._.sys_set_window: ;///////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
;< edx = pointer to WDATA struct |
;------------------------------------------------------------------------------ |
window._.sys_set_window: |
mov eax, [current_slot_idx] |
shl eax, 5 |
add eax, window_data |
1637,14 → 1714,12 |
mov edx, edi |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
window._.check_window_position: ;////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Check if window is inside screen area |
;------------------------------------------------------------------------------ |
;> edi = pointer to WDATA |
;------------------------------------------------------------------------------ |
window._.check_window_position: |
push eax ebx ecx edx esi |
|
mov eax, [edi + WDATA.box.left] |
1725,14 → 1800,11 |
mov [edi + WDATA.box.top], ebx |
jmp .exit |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
window._.get_titlebar_height: ;//////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
;> edi = pointer to WDATA |
;------------------------------------------------------------------------------ |
window._.get_titlebar_height: |
mov al, [edi + WDATA.fl_wstyle] |
and al, 0x0f |
cmp al, 0x03 |
1745,14 → 1817,11 |
mov eax, 21 |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
window._.get_rolledup_height: ;//////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
;> edi = pointer to WDATA |
;------------------------------------------------------------------------------ |
window._.get_rolledup_height: |
mov al, [edi + WDATA.fl_wstyle] |
and al, 0x0f |
cmp al, 0x03 |
1773,18 → 1842,16 |
mov eax, 21 + 2 |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
window._.set_screen: ;///////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Reserve window area in screen buffer |
;------------------------------------------------------------------------------ |
;> eax = left |
;> ebx = top |
;> ecx = right |
;> edx = bottom |
;> esi = process number |
;------------------------------------------------------------------------------ |
window._.set_screen: |
virtual at esp |
ff_x dd ? |
ff_y dd ? |
1955,14 → 2022,12 |
pop esi edx ecx eax |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
window._.window_activate: ;//////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Activate window |
;------------------------------------------------------------------------------ |
;> esi = pointer to WIN_POS+ window data |
;------------------------------------------------------------------------------ |
; Activate window |
; esi = pointer to WIN_POS+ window data |
window._.window_activate: |
push eax ebx |
|
; if type of current active window is 3 or 4, it must be redrawn |
2041,12 → 2106,11 |
pop ebx eax |
ret |
;------------------------------------------------------------------------------ |
window._.window_deactivate: ;//////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Deactivate window |
;------------------------------------------------------------------------------ |
;> esi = pointer to WIN_POS+ window data |
;------------------------------------------------------------------------------ |
|
|
; Deactivate window |
; esi = pointer to WIN_POS+ window data |
window._.window_deactivate: |
push eax ebx |
;-------------------------------------- |
align 4 |
2094,14 → 2158,12 |
pop ebx eax |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
window._.check_window_draw: ;////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Check if window is necessary to draw |
;------------------------------------------------------------------------------ |
;> edi = pointer to WDATA |
;------------------------------------------------------------------------------ |
; Check if window is necessary to draw |
; edi = pointer to WDATA |
window._.check_window_draw: |
mov cl, [edi + WDATA.fl_wstyle] |
and cl, 0x0f |
cmp cl, 3 |
2168,13 → 2230,13 |
pop esi edx ebx eax |
xor ecx, ecx |
ret |
|
|
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
window._.draw_window_caption: ;//////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
window._.draw_window_caption: |
xor eax, eax |
mov edx, [thread_count] |
movzx edx, word[WIN_POS + edx * 2] |
2286,14 → 2348,12 |
.exit: |
jmp __sys_draw_pointer |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
window._.draw_negative_box: ;////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Draw negative box |
;------------------------------------------------------------------------------ |
;> edi = pointer to BOX struct |
;------------------------------------------------------------------------------ |
; Draw negative box |
; edi = pointer to BOX struct |
window._.draw_negative_box: |
push eax ebx esi |
mov esi, 0x01000000 |
;-------------------------------------- |
2321,14 → 2381,12 |
; xor esi, esi |
; jmp window._.draw_negative_box.1 |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
window._.get_rect: ;///////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> void __fastcall get_window_rect(struct RECT* rc); |
;------------------------------------------------------------------------------ |
;> ecx = pointer to RECT |
;------------------------------------------------------------------------------ |
; void __fastcall get_window_rect(struct RECT* rc); |
; ecx = pointer to RECT |
window._.get_rect: |
mov eax, [TASK_BASE] |
|
mov edx, [eax-twdw + WDATA.box.left] |
2344,12 → 2402,10 |
mov [ecx+RECT.bottom], edx |
ret |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
window._.redraw_top_wnd: ;//////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? redraw all windows one above the window |
;------------------------------------------------------------------------------ |
; redraw all windows one above the window |
;> eax = left |
;> ebx = top |
;> ecx = right |
2356,16 → 2412,14 |
;> edx = bottom |
;> esi = process number |
;! corrupted edi |
;------------------------------------------------------------------------------ |
window._.redraw_top_wnd: |
push 0 |
jmp window._.set_top_wnd.go |
;------------------------------------------------------------------------------ |
|
|
align 4 |
;------------------------------------------------------------------------------ |
window._.set_top_wnd: ;//////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? call set_screen for all windows one above the window |
;------------------------------------------------------------------------------ |
; call set_screen for all windows one above the window |
;> eax = left |
;> ebx = top |
;> ecx = right |
2372,8 → 2426,7 |
;> edx = bottom |
;> esi = process number |
;! corrupted edi |
;------------------------------------------------------------------------------ |
|
window._.set_top_wnd: |
push 1 |
.go: |
push esi |