Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2438 → Rev 2439

/kernel/branches/Kolibri-acpi/gui/window.inc
52,16 → 52,18
; type I - original style
call drawwindow_I
jmp window._.draw_window_caption.2
 
;--------------------------------------
align 4
@@:
dec al
jnz @f
 
; type II - only reserve area, no draw
call sys_window_mouse
; call sys_window_mouse
call [draw_pointer]
jmp .exit
 
;--------------------------------------
align 4
@@:
dec al
jnz @f
71,6 → 73,8
jmp window._.draw_window_caption.2
 
; type IV & V - skinned window (resizable & not)
;--------------------------------------
align 4
@@:
mov eax, [TASK_COUNT]
movzx eax, word[WIN_POS + eax * 2]
80,10 → 84,11
push eax
call drawwindow_IV
jmp window._.draw_window_caption.2
 
;--------------------------------------
align 4
.exit:
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
syscall_display_settings: ;///// system function 48 ///////////////////////////
132,10 → 137,11
cmp ebx, .sizeof.ftable / 4
ja @f
jmp [.ftable + ebx * 4]
;--------------------------------------
align 4
@@:
ret
 
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.00:
xor eax, eax
145,10 → 151,11
mov [windowtypechanged], eax
 
jmp syscall_display_settings._.redraw_whole_screen
 
;--------------------------------------
align 4
.exit:
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.01:
and ecx, 1
156,10 → 163,11
je .exit
mov [buttontype], ecx
mov [windowtypechanged], ebx
 
;--------------------------------------
align 4
.exit:
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.02:
dec ebx
170,7 → 178,7
rep movsb
mov [windowtypechanged], ebx
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.03:
mov edi, ecx
179,13 → 187,13
mov ecx, edx
rep movsb
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.04:
mov eax, [_skinh]
mov [esp + 32], eax
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.05:
mov eax, [screen_workarea.left - 2]
195,7 → 203,7
mov ax, word[screen_workarea.bottom]
mov [esp + 20], eax
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.06:
xor esi, esi
210,14 → 218,19
or eax, eax
jge @f
xor eax, eax
;--------------------------------------
align 4
@@:
mov [screen_workarea.left], eax
cmp ebx, edi
jle @f
mov ebx, edi
;--------------------------------------
align 4
@@:
mov [screen_workarea.right], ebx
 
;--------------------------------------
align 4
.check_horizontal:
mov edi, [Screen_Max_Y]
mov eax, edx
229,14 → 242,19
or eax, eax
jge @f
xor eax, eax
;--------------------------------------
align 4
@@:
mov [screen_workarea.top], eax
cmp ebx, edi
jle @f
mov ebx, edi
;--------------------------------------
align 4
@@:
mov [screen_workarea.bottom], ebx
 
;--------------------------------------
align 4
.check_if_redraw_needed:
or esi, esi
jz .exit
243,10 → 261,11
 
call repos_windows
jmp syscall_display_settings._.calculate_whole_screen
 
;--------------------------------------
align 4
.exit:
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.07:
mov eax, [_skinmargins + 0]
254,7 → 273,7
mov eax, [_skinmargins + 4]
mov [esp + 20], eax
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.08:
mov ebx, ecx
265,10 → 284,12
 
call syscall_display_settings._.calculate_whole_screen
jmp syscall_display_settings._.redraw_whole_screen
 
;--------------------------------------
align 4
.exit:
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings._.calculate_whole_screen:
xor eax, eax
xor ebx, ebx
275,7 → 296,8
mov ecx, [Screen_Max_X]
mov edx, [Screen_Max_Y]
jmp calculatescreen
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings._.redraw_whole_screen:
xor eax, eax
mov [draw_limits.left], eax
286,7 → 308,7
mov [draw_limits.bottom], eax
mov eax, window_data
jmp redrawscreen
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
syscall_set_window_shape: ;///// system function 50 ///////////////////////////
304,15 → 326,17
test ebx, ebx
jne .shape_scale
mov [edi + APPDATA.wnd_shape], ecx
 
;--------------------------------------
align 4
.shape_scale:
dec ebx
jnz .exit
mov [edi + APPDATA.wnd_shape_scale], ecx
 
;--------------------------------------
align 4
.exit:
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
syscall_move_window: ;///// system function 67 ////////////////////////////////
332,19 → 356,26
cmp ebx, -1
jne @f
mov ebx, [edi + WDATA.box.left]
;--------------------------------------
align 4
@@:
cmp ecx, -1
jne @f
mov ecx, [edi + WDATA.box.top]
;--------------------------------------
align 4
@@:
cmp edx, -1
jne @f
mov edx, [edi + WDATA.box.width]
;--------------------------------------
align 4
@@:
cmp esi, -1
jne @f
mov esi, [edi + WDATA.box.height]
 
;--------------------------------------
align 4
@@:
push esi edx ecx ebx
mov eax, esp
359,10 → 390,11
 
; NOTE: do we really need this? to be reworked
; call [draw_pointer]
 
;--------------------------------------
align 4
.exit:
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
syscall_window_settings: ;///// system function 71 /////////////////////////////
391,12 → 423,13
; jnz .exit_fail
 
; not implemented yet
 
;--------------------------------------
align 4
.exit_fail:
xor eax, eax
inc eax ; eax = 1 (fail)
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
set_window_defaults: ;/////////////////////////////////////////////////////////
407,6 → 440,8
push eax ecx
xor eax, eax
mov ecx, WIN_STACK
;--------------------------------------
align 4
@@:
inc eax
add ecx, 2
418,7 → 453,7
jne @b
pop ecx eax
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
calculatescreen: ;/////////////////////////////////////////////////////////////
445,7 → 480,8
jbe .exit
 
push edx ecx ebx eax
 
;--------------------------------------
align 4
.next_window:
movzx edi, word[WIN_POS + esi * 2]
shl edi, 5
475,25 → 511,33
cmp eax, [esp + RECT.left]
jae @f
mov eax, [esp + RECT.left]
;--------------------------------------
align 4
@@:
cmp ebx, [esp + RECT.top]
jae @f
mov ebx, [esp + RECT.top]
;--------------------------------------
align 4
@@:
cmp ecx, [esp + RECT.right]
jbe @f
mov ecx, [esp + RECT.right]
;--------------------------------------
align 4
@@:
cmp edx, [esp + RECT.bottom]
jbe @f
mov edx, [esp + RECT.bottom]
 
;--------------------------------------
align 4
@@:
push esi
movzx esi, word[WIN_POS + esi * 2]
call window._.set_screen
pop esi
 
;--------------------------------------
align 4
.skip_window:
inc esi
dec ebp
500,7 → 544,8
jnz .next_window
 
pop eax ebx ecx edx
 
;--------------------------------------
align 4
.exit:
pop ebp
inc [_display.mask_seqno]
507,7 → 552,7
popfd
pop esi
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
repos_windows: ;///////////////////////////////////////////////////////////////
519,7 → 564,8
call force_redraw_background
dec ecx
jle .exit
 
;--------------------------------------
align 4
.next_window:
mov [edi + WDATA.fl_redraw], 1
test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED
534,10 → 580,13
sub eax, ebx
jle @f
mov [edi + WDATA.box.width], ebx
;--------------------------------------
align 4
@@:
sub ebx, [edi + WDATA.box.width]
mov [edi + WDATA.box.left], ebx
 
;--------------------------------------
align 4
.fix_vertical:
mov eax, [edi + WDATA.box.top]
add eax, [edi + WDATA.box.height]
548,11 → 597,23
sub eax, ebx
jle @f
mov [edi + WDATA.box.height], ebx
;--------------------------------------
align 4
@@:
sub ebx, [edi + WDATA.box.height]
mov [edi + WDATA.box.top], ebx
jmp .fix_client_box
 
;--------------------------------------
align 4
.fix_client_box:
call window._.set_window_clientbox
add edi, sizeof.WDATA
loop .next_window
;--------------------------------------
align 4
.exit:
ret
;--------------------------------------
align 4
.fix_maximized:
mov eax, [screen_workarea.left]
mov [edi + WDATA.box.left], eax
566,20 → 627,12
sub eax, [screen_workarea.bottom]
neg eax
mov [edi + WDATA.box.height], eax
 
.fix_client_box:
call window._.set_window_clientbox
 
add edi, sizeof.WDATA
loop .next_window
 
.exit:
ret
 
align 4
jmp .fix_client_box
;------------------------------------------------------------------------------
sys_window_mouse: ;////////////////////////////////////////////////////////////
;align 4
;------------------------------------------------------------------------------
;sys_window_mouse: ;////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
;? <description>
;------------------------------------------------------------------------------
; NOTE: commented out since doesn't provide necessary functionality
597,8 → 650,8
;
; .exit:
; pop eax
ret
 
; ret
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
draw_rectangle: ;//////////////////////////////////////////////////////////////
613,13 → 666,13
push eax ebx ecx edi
 
xor edi, edi
 
;--------------------------------------
align 4
.flags_set:
push ebx
 
; set line color
mov ecx, esi
; sub esi, 1 shl 25
; draw top border
rol ebx, 16
push ebx
629,6 → 682,8
jnz @f
sub ecx, 1 shl 25
call [draw_line]
;--------------------------------------
align 4
@@:
; draw bottom border
mov ebx, [esp - 2]
652,13 → 707,14
 
pop edi ecx ebx eax
ret
 
;--------------------------------------
align 4
.forced:
push eax ebx ecx edi
xor edi, edi
inc edi
jmp .flags_set
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
drawwindow_I_caption: ;////////////////////////////////////////////////////////
677,11 → 733,14
cmp ebx, eax
jbe @f
mov ebx, eax
;--------------------------------------
align 4
@@:
push ebx
 
xor edi, edi
 
;--------------------------------------
align 4
.next_line:
mov ebx, edx
shl ebx, 16
697,6 → 756,8
jz @f
sub ecx, 0x00040404
mov [esi + WDATA.cl_titlebar], ecx
;--------------------------------------
align 4
@@:
and ecx, 0x00ffffff
call [draw_line]
707,7 → 768,7
add esp, 4
pop [esi + WDATA.cl_titlebar]
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
drawwindow_I: ;////////////////////////////////////////////////////////////////
753,11 → 814,12
mov ecx, [esi + WDATA.box.width]
mov edx, [esi + WDATA.box.height]
call [drawbar]
 
;--------------------------------------
align 4
.exit:
popad
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
drawwindow_III_caption: ;/////////////////////////////////////////////////////
777,11 → 839,14
cmp ebx, eax
jb @f
mov ebx, eax
;--------------------------------------
align 4
@@:
push ebx
 
xor edi, edi
 
;--------------------------------------
align 4
.next_line:
mov ebx, edx
shl ebx, 16
795,10 → 860,14
test ecx, 0x40000000
jz @f
add ecx, 0x00040404
;--------------------------------------
align 4
@@:
test ecx, 0x80000000
jz @f
sub ecx, 0x00040404
;--------------------------------------
align 4
@@:
mov [esi + WDATA.cl_titlebar], ecx
and ecx, 0x00ffffff
810,7 → 879,7
add esp, 4
pop [esi + WDATA.cl_titlebar]
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
drawwindow_III: ;//////////////////////////////////////////////////////////////
842,7 → 911,8
mov ecx, 3
mov esi, [edx + WDATA.cl_frames]
or esi, 1 shl 25; 0x02000000 used for draw_rectangle without top line
 
;--------------------------------------
align 4
.next_frame:
add eax, 1 * 65536 - 1
add ebx, 0 * 65536 - 1
882,11 → 952,12
sub ecx, 4
sub edx, 4
call [drawbar]
 
;--------------------------------------
align 4
.exit:
popad
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
waredraw: ;////////////////////////////////////////////////////////////////////
935,7 → 1006,8
mov [edi + WDATA.fl_redraw], 1
xor eax, eax
jmp .exit
 
;--------------------------------------
align 4
.do_not_draw:
; no it's not, just activate the window
call window._.window_activate
942,13 → 1014,13
xor eax, eax
mov byte[MOUSE_BACKGROUND], al
mov byte[DONT_DRAW_MOUSE], al
 
 
;--------------------------------------
align 4
.exit:
mov byte[MOUSE_DOWN], 0
inc eax
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
minimize_window: ;/////////////////////////////////////////////////////////////
988,12 → 1060,13
call redrawscreen
 
pop esi edx ecx ebx eax
 
;--------------------------------------
align 4
.exit:
popfd
pop edi
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
restore_minimized_window: ;////////////////////////////////////////////////////
1021,6 → 1094,8
cmp eax, [TASK_COUNT]
jz @f
mov ebp, calculatescreen
;--------------------------------------
align 4
@@:
mov eax, [edi + WDATA.box.left]
mov ebx, [edi + WDATA.box.top]
1031,12 → 1106,13
call ebp
inc [_display.mask_seqno]
mov byte[MOUSE_BACKGROUND], 0
 
;--------------------------------------
align 4
.exit:
popfd
popad
ret
 
;------------------------------------------------------------------------------
align 4
; TODO: remove this proc
;------------------------------------------------------------------------------
1056,13 → 1132,15
jnz @f
call minimize_window
jmp .exit
 
;--------------------------------------
align 4
@@:
call restore_minimized_window
 
;--------------------------------------
align 4
.exit:
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
sys_window_maximize_handler: ;/////////////////////////////////////////////////
1099,7 → 1177,8
sub [esp + BOX.height], ecx
mov eax, esp
jmp .set_box
 
;--------------------------------------
align 4
.restore_size:
mov eax, esi
shl eax, 8
1109,7 → 1188,8
[eax + BOX.top] \
[eax + BOX.left]
mov eax, esp
 
;--------------------------------------
align 4
.set_box:
test bl, WSTATE_ROLLEDUP
jz @f
1118,15 → 1198,17
call window._.get_rolledup_height
mov [ecx + BOX.height], eax
xchg eax, ecx
 
;--------------------------------------
align 4
@@:
call window._.set_window_box
add esp, sizeof.BOX
 
;--------------------------------------
align 4
.exit:
inc [_display.mask_seqno]
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
sys_window_rollup_handler: ;///////////////////////////////////////////////////
1154,7 → 1236,8
[edi + WDATA.box.left]
mov eax, esp
jmp .set_box
 
;--------------------------------------
align 4
.restore_size:
test bl, WSTATE_MAXIMIZED
jnz @f
1161,7 → 1244,8
add esp, -sizeof.BOX
lea eax, [edx + APPDATA.saved_box]
jmp .set_box
 
;--------------------------------------
align 4
@@:
mov eax, [screen_workarea.top]
push [screen_workarea.bottom] \
1170,13 → 1254,13
[edi + WDATA.box.left]
sub [esp + BOX.height], eax
mov eax, esp
 
;--------------------------------------
align 4
.set_box:
call window._.set_window_box
add esp, sizeof.BOX
 
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
sys_window_start_moving_handler: ;/////////////////////////////////////////////
1188,9 → 1272,8
;------------------------------------------------------------------------------
mov edi, eax
call window._.draw_negative_box
 
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
sys_window_end_moving_handler: ;///////////////////////////////////////////////
1212,7 → 1295,7
mov bl, [edi + WDATA.fl_wstate]
call window._.set_window_box
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
sys_window_moving_handler: ;///////////////////////////////////////////////////
1228,7 → 1311,6
mov edi, ebx
call window._.draw_negative_box
ret
 
;==============================================================================
;///// private functions //////////////////////////////////////////////////////
;==============================================================================
1251,7 → 1333,7
; to be reworked
; new_window_starting dd ?
;endg
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.invalidate_screen: ;//////////////////////////////////////////////////
1271,6 → 1353,8
cmp ecx, edx
jle @f
mov ecx, edx
;--------------------------------------
align 4
@@:
mov [draw_limits.left], ecx
mov ecx, [eax + BOX.left]
1279,6 → 1363,8
cmp ecx, edx
jae @f
mov ecx, edx
;--------------------------------------
align 4
@@:
mov [draw_limits.right], ecx
mov ecx, [eax + BOX.top]
1286,6 → 1372,8
cmp ecx, edx
jle @f
mov ecx, edx
;--------------------------------------
align 4
@@:
mov [draw_limits.top], ecx
mov ecx, [eax + BOX.top]
1294,9 → 1382,10
cmp ecx, edx
jae @f
mov ecx, edx
;--------------------------------------
align 4
@@:
mov [draw_limits.bottom], ecx
 
; recalculate screen buffer at old position
push ebx
mov edx, [eax + BOX.height]
1307,7 → 1396,6
add edx, ebx
call calculatescreen
pop eax
 
; recalculate screen buffer at new position
mov edx, [eax + BOX.height]
mov ecx, [eax + BOX.width]
1325,7 → 1413,7
 
pop ebx eax
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.set_window_box: ;/////////////////////////////////////////////////////
1350,10 → 1438,10
repz cmpsd
pop edi
jz .exit
;--------------------------------------
align 4
@@:
 
add esp, -sizeof.BOX
 
mov ebx, esp
if WDATA.box
lea esi, [edi + WDATA.box]
1402,11 → 1490,12
jnz .exit
 
mov [eax + APPDATA.saved_box.height], edx
 
;--------------------------------------
align 4
.exit:
pop esi ebx eax
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.set_window_clientbox: ;///////////////////////////////////////////////
1447,7 → 1536,8
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax
add esp, 4
jmp .exit
 
;--------------------------------------
align 4
.whole_window:
xor eax, eax
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax
1456,11 → 1546,12
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax
mov eax, [ecx + WDATA.box.height]
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax
 
;--------------------------------------
align 4
.exit:
pop edi ecx eax
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.sys_set_window: ;/////////////////////////////////////////////////////
1519,7 → 1610,8
je @f
 
xor eax, eax
 
;--------------------------------------
align 4
@@:
mov [edi + APPDATA.wnd_caption], eax
 
1547,7 → 1639,8
 
mov byte[KEY_COUNT], 0 ; empty keyboard buffer
mov byte[BTN_COUNT], 0 ; empty button buffer
 
;--------------------------------------
align 4
.set_client_box:
; update window client box coordinates
call window._.set_window_clientbox
1556,7 → 1649,7
mov [edi + WDATA.fl_redraw], 0
mov edx, edi
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.check_window_position: ;//////////////////////////////////////////////
1575,7 → 1668,8
mov esi, [Screen_Max_X]
cmp ecx, esi
ja .fix_width_high
 
;--------------------------------------
align 4
.check_left:
or eax, eax
jl .fix_left_low
1582,12 → 1676,14
add eax, ecx
cmp eax, esi
jg .fix_left_high
 
;--------------------------------------
align 4
.check_height:
mov esi, [Screen_Max_Y]
cmp edx, esi
ja .fix_height_high
 
;--------------------------------------
align 4
.check_top:
or ebx, ebx
jl .fix_top_low
1594,43 → 1690,50
add ebx, edx
cmp ebx, esi
jg .fix_top_high
 
;--------------------------------------
align 4
.exit:
pop esi edx ecx ebx eax
ret
 
;--------------------------------------
align 4
.fix_width_high:
mov ecx, esi
mov [edi + WDATA.box.width], esi
jmp .check_left
 
;--------------------------------------
align 4
.fix_left_low:
xor eax, eax
mov [edi + WDATA.box.left], eax
jmp .check_height
 
;--------------------------------------
align 4
.fix_left_high:
mov eax, esi
sub eax, ecx
mov [edi + WDATA.box.left], eax
jmp .check_height
 
;--------------------------------------
align 4
.fix_height_high:
mov edx, esi
mov [edi + WDATA.box.height], esi
jmp .check_top
 
;--------------------------------------
align 4
.fix_top_low:
xor ebx, ebx
mov [edi + WDATA.box.top], ebx
jmp .exit
 
;--------------------------------------
align 4
.fix_top_high:
mov ebx, esi
sub ebx, edx
mov [edi + WDATA.box.top], ebx
jmp .exit
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.get_titlebar_height: ;////////////////////////////////////////////////
1645,10 → 1748,12
jne @f
mov eax, [_skinh]
ret
;--------------------------------------
align 4
@@:
mov eax, 21
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.get_rolledup_height: ;////////////////////////////////////////////////
1664,15 → 1769,19
mov eax, [_skinh]
add eax, 3
ret
;--------------------------------------
align 4
@@:
or al, al
jnz @f
mov eax, 21
ret
;--------------------------------------
align 4
@@:
mov eax, 21 + 2
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.set_screen: ;/////////////////////////////////////////////////////////
1704,7 → 1813,8
jnz .check_for_shaped_window
cmp [window_data + edi + WDATA.box.height], 0
jz .exit
 
;--------------------------------------
align 4
.check_for_shaped_window:
mov edi, esi
shl edi, 8
1731,7 → 1841,8
push ax
shl eax, 16
pop ax
 
;--------------------------------------
align 4
.next_line:
push ecx
shr ecx, 2
1746,7 → 1857,8
jnz .next_line
 
jmp .exit
 
;--------------------------------------
align 4
.shaped_window:
; for (y=0; y <= x_size; y++)
; for (x=0; x <= x_size; x++)
1794,10 → 1906,12
add [ff_ysz], ebx
 
mov ebx, [ff_y]
 
;--------------------------------------
align 4
.ff_new_y:
mov edx, [ff_x]
 
;--------------------------------------
align 4
.ff_new_x:
; -- body --
mov ecx, [ff_scale]
1817,6 → 1931,8
mov eax, esi
mov [ebp], al
; -- end body --
;--------------------------------------
align 4
@@:
inc ebp
inc edx
1832,12 → 1948,14
jb .ff_new_y
 
add esp, 24
 
;--------------------------------------
align 4
.exit:
popad
inc [_display.mask_seqno]
ret
 
;--------------------------------------
align 4
.read_byte:
; eax - address
; esi - slot
1848,7 → 1966,7
call read_process_memory
pop esi edx ecx eax
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.window_activate: ;////////////////////////////////////////////////////
1873,10 → 1991,12
je .set_window_redraw_flag
cmp al, 0x04
jne .move_others_down
 
;--------------------------------------
align 4
.set_window_redraw_flag:
mov [window_data + ebx + WDATA.fl_redraw], 1
 
;--------------------------------------
align 4
.move_others_down:
; ax <- process no
movzx ebx, word[esi]
1885,7 → 2005,8
 
; drop others
xor eax, eax
 
;--------------------------------------
align 4
.next_stack_window:
cmp eax, [TASK_COUNT]
jae .move_self_up
1901,7 → 2022,8
jbe .next_stack_window
dec word[WIN_STACK + eax * 2]
jmp .next_stack_window
 
;--------------------------------------
align 4
.move_self_up:
movzx ebx, word[esi]
; number of processes
1911,7 → 2033,8
 
; update on screen - window stack
xor eax, eax
 
;--------------------------------------
align 4
.next_window_pos:
cmp eax, [TASK_COUNT]
jae .reset_vars
1919,7 → 2042,8
movzx ebx, word[WIN_STACK + eax * 2]
mov [WIN_POS + ebx * 2], ax
jmp .next_window_pos
 
;--------------------------------------
align 4
.reset_vars:
mov byte[KEY_COUNT], 0
mov byte[BTN_COUNT], 0
1928,7 → 2052,6
 
pop ebx eax
ret
 
;------------------------------------------------------------------------------
window._.window_deactivate: ;////////////////////////////////////////////////////
;------------------------------------------------------------------------------
1937,7 → 2060,8
;> esi = pointer to WIN_POS+ window data
;------------------------------------------------------------------------------
push eax ebx
;------------------------------------------------------------------------------
;--------------------------------------
align 4
.move_others_up:
; ax <- process no
movzx ebx, word[esi]
1945,6 → 2069,8
movzx ebx, word[WIN_STACK + ebx * 2]
; up others
xor eax, eax
;--------------------------------------
align 4
.next_stack_window:
cmp eax, [TASK_COUNT]
jae .move_self_down
1953,7 → 2079,8
jae .next_stack_window
inc word[WIN_STACK + eax * 2]
jmp .next_stack_window
;----------------------------------------------
;--------------------------------------
align 4
.move_self_down:
movzx ebx, word[esi]
; this is the last (and the low)
1960,6 → 2087,8
mov [WIN_STACK + ebx * 2], word 1
; update on screen - window stack
xor eax, eax
;--------------------------------------
align 4
.next_window_pos:
cmp eax, [TASK_COUNT]
jae .reset_vars
1967,7 → 2096,8
movzx ebx, word[WIN_STACK + eax * 2]
mov [WIN_POS + ebx * 2], ax
jmp .next_window_pos
;-----------------------------------------------
;--------------------------------------
align 4
.reset_vars:
mov byte[KEY_COUNT], 0
mov byte[BTN_COUNT], 0
1999,7 → 2129,8
 
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
 
;--------------------------------------
align 4
.next_window:
add esi, 2
 
2037,17 → 2168,19
jge .next_window
 
pop esi edx ebx eax
 
;--------------------------------------
align 4
.exit.redraw:
xor ecx, ecx
inc ecx
ret
 
;--------------------------------------
align 4
.exit.no_redraw:
pop esi edx ebx eax
xor ecx, ecx
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.draw_window_caption: ;////////////////////////////////////////////////
2060,6 → 2193,8
cmp edx, [CURRENT_TASK]
jne @f
inc eax
;--------------------------------------
align 4
@@:
mov edx, [CURRENT_TASK]
shl edx, 5
2072,13 → 2207,15
je .draw_caption_style_3
 
jmp .not_style_3
 
;--------------------------------------
align 4
.draw_caption_style_3:
push edx
call drawwindow_IV_caption
add esp, 4
jmp .2
 
;--------------------------------------
align 4
.not_style_3:
cmp bl, 2
jne .not_style_2
2085,13 → 2222,15
 
call drawwindow_III_caption
jmp .2
 
;--------------------------------------
align 4
.not_style_2:
cmp bl, 0
jne .2
 
call drawwindow_I_caption
 
;--------------------------------------
align 4
.2:
mov edi, [CURRENT_TASK]
shl edi, 5
2109,7 → 2248,8
je .skinned
 
jmp .not_skinned
 
;--------------------------------------
align 4
.skinned:
mov ebp, [edi + window_data + WDATA.box.left - 2]
mov bp, word[edi + window_data + WDATA.box.top]
2136,7 → 2276,8
add bx, -3
add ebx, ebp
jmp .dodraw
 
;--------------------------------------
align 4
.not_skinned:
cmp al, 1
je .exit
2157,17 → 2298,19
mov esi, eax
mov ebx, 0x00080007
add ebx, ebp
 
;--------------------------------------
align 4
.dodraw:
mov ecx, [common_colours + 16]
or ecx, 0x80000000
xor edi, edi
call dtext_asciiz_esi
 
;--------------------------------------
align 4
.exit:
call [draw_pointer]
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.draw_negative_box: ;//////////////////////////////////////////////////
2178,6 → 2321,8
;------------------------------------------------------------------------------
push eax ebx esi
mov esi, 0x01000000
;--------------------------------------
align 4
.1:
mov eax, [edi + BOX.left - 2]
mov ax, word[edi + BOX.left]
2189,6 → 2334,8
pop esi ebx eax
ret
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.end_moving__box: ;//////////////////////////////////////////////////
;------------------------------------------------------------------------------
;? Draw positive box
2198,9 → 2345,9
push eax ebx esi
xor esi, esi
jmp window._.draw_negative_box.1
 
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.get_rect: ;/////////////////////////////////////////////////////
;------------------------------------------------------------------------------
;? <description> void __fastcall get_window_rect(struct RECT* rc);
2220,6 → 2367,5
 
add edx, [eax-twdw + WDATA.box.height]
mov [ecx+RECT.bottom], edx
 
ret
 
;------------------------------------------------------------------------------