/kernel/branches/flat_kernel/gui/window.inc |
---|
1,44 → 1,44 |
get_titlebar_height: ; edi = window draw_data pointer |
mov al,[edi+WDATA.fl_wstyle] |
and al,0x0F |
cmp al,0x03 |
jne @f |
mov eax,[_skinh] |
ret |
@@: mov eax,21 |
ret |
mov al,[edi+WDATA.fl_wstyle] |
and al,0x0F |
cmp al,0x03 |
jne @f |
mov eax,[_skinh] |
ret |
@@: mov eax,21 |
ret |
get_rolledup_height: ; edi = window draw_data pointer |
mov al,[edi+WDATA.fl_wstyle] |
and al,0x0F |
cmp al,0x03 |
jne @f |
mov eax,[_skinh] |
add eax,3 |
ret |
@@: or al,al |
jnz @f |
mov eax,21 |
ret |
@@: mov eax,21+2 |
ret |
mov al,[edi+WDATA.fl_wstyle] |
and al,0x0F |
cmp al,0x03 |
jne @f |
mov eax,[_skinh] |
add eax,3 |
ret |
@@: or al,al |
jnz @f |
mov eax,21 |
ret |
@@: mov eax,21+2 |
ret |
setwindowdefaults: |
pushad |
pushad |
xor eax,eax |
mov ecx,WIN_STACK |
xor eax,eax |
mov ecx,WIN_STACK |
@@: |
inc eax |
add ecx,2 |
mov [ecx+0x000],ax ; process no |
mov [ecx+0x400],ax ; positions in stack |
cmp ecx,WIN_POS-2 ; the more high, the more surface |
jnz @b |
inc eax |
add ecx,2 |
mov [ecx+0x000],ax ; process no |
mov [ecx+0x400],ax ; positions in stack |
cmp ecx,WIN_POS-2 ; the more high, the more surface |
jnz @b |
popad |
ret |
popad |
ret |
51,85 → 51,85 |
; ÷àñòåé îêîí âûçâàòü setscreen |
align 4 |
calculatescreen: |
pushad |
pushfd |
cli |
pushad |
pushfd |
cli |
push edx ecx ebx eax |
push edx ecx ebx eax |
mov esi, 1 |
call setscreen |
mov esi, 1 |
call setscreen |
mov ebp, [TASK_COUNT] ; number of processes |
cmp ebp, 1 |
jbe .finish |
align 4 |
mov ebp, [TASK_COUNT] ; number of processes |
cmp ebp, 1 |
jbe .finish |
align 4 |
.new_wnd: |
movzx edi, word [WIN_POS + esi * 2] |
shl edi, 5 |
movzx edi, word [WIN_POS + esi * 2] |
shl edi, 5 |
cmp [CURRENT_TASK+edi+TASKDATA.state], byte 9 |
je .not_wnd |
cmp [CURRENT_TASK+edi+TASKDATA.state], byte 9 |
je .not_wnd |
add edi, window_data |
test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
jnz .not_wnd |
add edi, window_data |
test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
jnz .not_wnd |
mov eax,[edi+WDATA.box.left] |
cmp eax, [esp+RECT.right] |
ja .out_of_bounds |
mov ebx,[edi+WDATA.box.top] |
cmp ebx, [esp+RECT.bottom] |
ja .out_of_bounds |
mov ecx,[edi+WDATA.box.width] |
add ecx, eax |
cmp ecx, [esp+RECT.left] |
jb .out_of_bounds |
mov edx,[edi+WDATA.box.height] |
add edx, ebx |
cmp edx, [esp+RECT.top] |
jb .out_of_bounds |
mov eax,[edi+WDATA.box.left] |
cmp eax, [esp+RECT.right] |
ja .out_of_bounds |
mov ebx,[edi+WDATA.box.top] |
cmp ebx, [esp+RECT.bottom] |
ja .out_of_bounds |
mov ecx,[edi+WDATA.box.width] |
add ecx, eax |
cmp ecx, [esp+RECT.left] |
jb .out_of_bounds |
mov edx,[edi+WDATA.box.height] |
add edx, ebx |
cmp edx, [esp+RECT.top] |
jb .out_of_bounds |
cmp eax, [esp+RECT.left] |
jae @f |
mov eax, [esp+RECT.left] |
jae @f |
mov eax, [esp+RECT.left] |
@@: |
cmp ebx, [esp+RECT.top] |
jae @f |
mov ebx, [esp+RECT.top] |
jae @f |
mov ebx, [esp+RECT.top] |
@@: |
cmp ecx, [esp+RECT.right] |
jbe @f |
mov ecx, [esp+RECT.right] |
jbe @f |
mov ecx, [esp+RECT.right] |
@@: |
cmp edx, [esp+RECT.bottom] |
jbe @f |
mov edx, [esp+RECT.bottom] |
jbe @f |
mov edx, [esp+RECT.bottom] |
@@: |
push esi |
movzx esi, word [WIN_POS + esi * 2] |
call setscreen |
pop esi |
push esi |
movzx esi, word [WIN_POS + esi * 2] |
call setscreen |
pop esi |
.not_wnd: |
.out_of_bounds: |
inc esi |
dec ebp |
jnz .new_wnd |
inc esi |
dec ebp |
jnz .new_wnd |
.finish: |
pop eax ebx ecx edx |
popfd |
popad |
popfd |
popad |
ret |
virtual at esp |
ff_x dd ? |
ff_y dd ? |
ff_x dd ? |
ff_y dd ? |
ff_width dd ? |
ff_xsz dd ? |
ff_ysz dd ? |
146,54 → 146,54 |
; esi process number |
pushad |
; \begin{diamond}[29.08.2006] |
cmp esi, 1 |
jz @f |
mov edi, esi |
shl edi, 5 |
cmp [edi+window_data+WDATA.box.width], 0 |
jnz @f |
cmp [edi+window_data+WDATA.box.height], 0 |
jz .ret |
cmp esi, 1 |
jz @f |
mov edi, esi |
shl edi, 5 |
cmp [edi+window_data+WDATA.box.width], 0 |
jnz @f |
cmp [edi+window_data+WDATA.box.height], 0 |
jz .ret |
@@: |
; \end{diamond}[29.08.2006] |
mov edi, esi ;;;word [esi*2+WIN_POS] |
shl edi, 8 |
add edi, SLOT_BASE ; address of random shaped window area |
cmp [edi+APPDATA.wnd_shape], dword 0 |
jne .free_form |
mov edi, esi ;;;word [esi*2+WIN_POS] |
shl edi, 8 |
add edi, SLOT_BASE ; address of random shaped window area |
cmp [edi+APPDATA.wnd_shape], dword 0 |
jne .free_form |
; get x&y size |
sub ecx, eax |
sub edx, ebx |
inc ecx |
inc edx |
; get x&y size |
sub ecx, eax |
sub edx, ebx |
inc ecx |
inc edx |
; get WinMap start |
mov edi, [ScreenWidth] ; screen_sx |
inc edi |
imul edi, ebx |
add edi, eax |
add edi, WinMapAddress |
; get WinMap start |
mov edi, [ScreenWidth] ; screen_sx |
inc edi |
imul edi, ebx |
add edi, eax |
add edi, WinMapAddress |
.new_y: |
push ecx ; sx |
push edx |
push ecx ; sx |
push edx |
mov edx, esi |
align 4 |
mov edx, esi |
align 4 |
.new_x: |
mov byte [edi], dl |
inc edi |
dec ecx |
jnz .new_x |
mov byte [edi], dl |
inc edi |
dec ecx |
jnz .new_x |
pop edx |
pop ecx |
add edi, [ScreenWidth] |
inc edi |
sub edi, ecx |
dec edx |
jnz .new_y |
pop edx |
pop ecx |
add edi, [ScreenWidth] |
inc edi |
sub edi, ecx |
dec edx |
jnz .new_y |
.ret: |
popad |
ret |
200,105 → 200,105 |
.read_byte: |
;eax - address |
;esi - slot |
push eax |
push ebx |
push ecx |
push edx |
mov edx,eax |
mov eax,esi |
lea ebx,[esp+12] |
mov ecx,1 |
call read_process_memory |
pop edx |
pop ecx |
pop ebx |
pop eax |
ret |
push eax |
push ebx |
push ecx |
push edx |
mov edx,eax |
mov eax,esi |
lea ebx,[esp+12] |
mov ecx,1 |
call read_process_memory |
pop edx |
pop ecx |
pop ebx |
pop eax |
ret |
.free_form: |
; for (y=0; y <= x_size; y++) |
; for (x=0; x <= x_size; x++) |
; if (shape[coord(x,y,scale)]==1) |
; set_pixel(x, y, process_number); |
; for (y=0; y <= x_size; y++) |
; for (x=0; x <= x_size; x++) |
; if (shape[coord(x,y,scale)]==1) |
; set_pixel(x, y, process_number); |
sub ecx, eax |
sub edx, ebx |
inc ecx |
inc edx |
sub ecx, eax |
sub edx, ebx |
inc ecx |
inc edx |
push dword [edi+APPDATA.wnd_shape_scale] ; push scale first -> for loop |
push dword [edi+APPDATA.wnd_shape_scale] ; push scale first -> for loop |
; get WinMap start -> ebp |
push eax |
mov eax, [ScreenWidth] ; screen_sx |
inc eax |
imul eax, ebx |
add eax, [esp] |
add eax, WinMapAddress |
mov ebp, eax |
; get WinMap start -> ebp |
push eax |
mov eax, [ScreenWidth] ; screen_sx |
inc eax |
imul eax, ebx |
add eax, [esp] |
add eax, WinMapAddress |
mov ebp, eax |
mov edi, [edi+APPDATA.wnd_shape] |
pop eax |
mov edi, [edi+APPDATA.wnd_shape] |
pop eax |
; eax = x_start |
; ebx = y_start |
; ecx = x_size |
; edx = y_size |
; esi = process_number |
; edi = &shape |
; [scale] |
push edx ecx ; for loop - x,y size |
; eax = x_start |
; ebx = y_start |
; ecx = x_size |
; edx = y_size |
; esi = process_number |
; edi = &shape |
; [scale] |
push edx ecx ; for loop - x,y size |
mov ecx, esi |
shl ecx, 5 |
mov edx, [window_data+ecx+WDATA.box.top] |
push [window_data+ecx+WDATA.box.width] ; for loop - width |
mov ecx, [window_data+ecx+WDATA.box.left] |
sub ebx, edx |
sub eax, ecx |
push ebx eax ; for loop - x,y |
mov ecx, esi |
shl ecx, 5 |
mov edx, [window_data+ecx+WDATA.box.top] |
push [window_data+ecx+WDATA.box.width] ; for loop - width |
mov ecx, [window_data+ecx+WDATA.box.left] |
sub ebx, edx |
sub eax, ecx |
push ebx eax ; for loop - x,y |
add [ff_xsz], eax |
add [ff_ysz], ebx |
add [ff_xsz], eax |
add [ff_ysz], ebx |
mov ebx, [ff_y] |
mov ebx, [ff_y] |
.ff_new_y: |
mov edx, [ff_x] |
mov edx, [ff_x] |
.ff_new_x: |
; -- body -- |
mov ecx, [ff_scale] |
mov eax, [ff_width] |
inc eax |
shr eax, cl |
push ebx edx |
shr ebx, cl |
shr edx, cl |
imul eax, ebx |
add eax, edx |
pop edx ebx |
add eax, edi |
call .read_byte |
test al,al |
jz @f |
mov eax, esi |
mov [ebp], al |
; -- body -- |
mov ecx, [ff_scale] |
mov eax, [ff_width] |
inc eax |
shr eax, cl |
push ebx edx |
shr ebx, cl |
shr edx, cl |
imul eax, ebx |
add eax, edx |
pop edx ebx |
add eax, edi |
call .read_byte |
test al,al |
jz @f |
mov eax, esi |
mov [ebp], al |
@@: |
; -- end body -- |
inc ebp |
inc edx |
cmp edx, [ff_xsz] |
jb .ff_new_x |
sub ebp, [ff_xsz] |
add ebp, [ff_x] |
add ebp, [ScreenWidth] ; screen.x |
inc ebp |
inc ebx |
cmp ebx, [ff_ysz] |
jb .ff_new_y |
; -- end body -- |
inc ebp |
inc edx |
cmp edx, [ff_xsz] |
jb .ff_new_x |
sub ebp, [ff_xsz] |
add ebp, [ff_x] |
add ebp, [ScreenWidth] ; screen.x |
inc ebp |
inc ebx |
cmp ebx, [ff_ysz] |
jb .ff_new_y |
add esp, 24 |
add esp, 24 |
popad |
ret |
339,7 → 339,7 |
pushad |
test eax, eax ; redraw display |
test eax, eax ; redraw display |
jnz dspl0 |
test ebx, ebx |
jnz dspl0 |
409,105 → 409,105 |
ret |
no_skin_height: |
cmp eax,5 ; get screen workarea |
jne no_get_workarea |
popad |
mov eax,[screen_workarea.left-2] |
mov ax,word[screen_workarea.right] |
mov [esp+36],eax |
mov eax,[screen_workarea.top-2] |
mov ax,word[screen_workarea.bottom] |
mov [esp+24],eax |
ret |
cmp eax,5 ; get screen workarea |
jne no_get_workarea |
popad |
mov eax,[screen_workarea.left-2] |
mov ax,word[screen_workarea.right] |
mov [esp+36],eax |
mov eax,[screen_workarea.top-2] |
mov ax,word[screen_workarea.bottom] |
mov [esp+24],eax |
ret |
no_get_workarea: |
cmp eax,6 ; set screen workarea |
jne no_set_workarea |
movsx eax,word[esp+16+2] |
movsx ebx,word[esp+16] |
cmp eax,ebx |
jge .lp1 |
or eax,eax;[ScreenWidth] |
jl @f |
mov [screen_workarea.left],eax |
@@: cmp ebx,[ScreenWidth] |
jg .lp1 |
mov [screen_workarea.right],ebx |
.lp1: movsx eax,word[esp+24+2] |
movsx ebx,word[esp+24] |
cmp eax,ebx |
jge .lp2 |
or eax,eax;[0xFE04] |
jl @f |
mov [screen_workarea.top],eax |
@@: cmp ebx,[ScreenHeight] |
jg .lp2 |
mov [screen_workarea.bottom],ebx |
.lp2: call repos_windows |
mov eax, 0 |
mov ebx, 0 |
mov ecx, [ScreenWidth] |
mov edx, [ScreenHeight] |
cmp eax,6 ; set screen workarea |
jne no_set_workarea |
movsx eax,word[esp+16+2] |
movsx ebx,word[esp+16] |
cmp eax,ebx |
jge .lp1 |
or eax,eax;[ScreenWidth] |
jl @f |
mov [screen_workarea.left],eax |
@@: cmp ebx,[ScreenWidth] |
jg .lp1 |
mov [screen_workarea.right],ebx |
.lp1: movsx eax,word[esp+24+2] |
movsx ebx,word[esp+24] |
cmp eax,ebx |
jge .lp2 |
or eax,eax;[0xFE04] |
jl @f |
mov [screen_workarea.top],eax |
@@: cmp ebx,[ScreenHeight] |
jg .lp2 |
mov [screen_workarea.bottom],ebx |
.lp2: call repos_windows |
mov eax, 0 |
mov ebx, 0 |
mov ecx, [ScreenWidth] |
mov edx, [ScreenHeight] |
call calculatescreen |
; jmp redraw_screen_direct |
.exit: |
popad |
ret |
popad |
ret |
no_set_workarea: |
cmp eax,7 ; get skin margins |
jne no_get_skinmargins |
popad |
mov eax,dword[_skinmargins+0] |
mov [esp+36],eax |
mov eax,dword[_skinmargins+4] |
mov [esp+24],eax |
ret |
cmp eax,7 ; get skin margins |
jne no_get_skinmargins |
popad |
mov eax,dword[_skinmargins+0] |
mov [esp+36],eax |
mov eax,dword[_skinmargins+4] |
mov [esp+24],eax |
ret |
no_get_skinmargins: |
cmp eax,8 ; set window skin |
jne no_set_skin |
mov eax,ebx |
mov edi,[TASK_BASE] |
add ebx,[edi+TASKDATA.mem_start] ; abs start of info block |
pushd [ebx+0] [ebx+4] [ebx+8] [ebx+12] |
mov dword[ebx+0],0 ; read |
mov dword[ebx+4],0 ; from the beginning |
mov dword[ebx+8],64 ; 32 KBytes maximum |
mov ecx,skin_data+64*512 |
sub ecx,[edi+0x10] |
mov dword[ebx+12],ecx ; destination |
push eax |
pushad |
call file_system |
popad |
pop eax |
popd [ebx+12] [ebx+8] [ebx+4] [ebx+0] |
cmp eax,ERROR_SUCCESS |
je @f |
cmp eax,ERROR_END_OF_FILE |
jne .exit |
@@: cmp [skin_data+64*512+SKIN_HEADER.ident],'SKIN' |
mov eax,ERROR_UNKNOWN_FS |
jne .exit |
mov esi,skin_data+64*512 |
mov edi,skin_data |
mov ecx,(64*512)/4 |
rep movsd |
call parse_skin_data |
cmp eax,8 ; set window skin |
jne no_set_skin |
mov eax,ebx |
mov edi,[TASK_BASE] |
add ebx,[edi+TASKDATA.mem_start] ; abs start of info block |
pushd [ebx+0] [ebx+4] [ebx+8] [ebx+12] |
mov dword[ebx+0],0 ; read |
mov dword[ebx+4],0 ; from the beginning |
mov dword[ebx+8],64 ; 32 KBytes maximum |
mov ecx,skin_data+64*512 |
sub ecx,[edi+0x10] |
mov dword[ebx+12],ecx ; destination |
push eax |
pushad |
call file_system |
popad |
pop eax |
popd [ebx+12] [ebx+8] [ebx+4] [ebx+0] |
cmp eax,ERROR_SUCCESS |
je @f |
cmp eax,ERROR_END_OF_FILE |
jne .exit |
@@: cmp [skin_data+64*512+SKIN_HEADER.ident],'SKIN' |
mov eax,ERROR_UNKNOWN_FS |
jne .exit |
mov esi,skin_data+64*512 |
mov edi,skin_data |
mov ecx,(64*512)/4 |
rep movsd |
call parse_skin_data |
pushad |
mov eax, 0 |
mov ebx, 0 |
mov ecx, [ScreenWidth] |
mov edx, [ScreenHeight] |
call calculatescreen |
mov eax, 0 |
mov ebx, 0 |
mov ecx, [ScreenWidth] |
mov edx, [ScreenHeight] |
call calculatescreen |
popad |
mov dword[esp+32+36],0 |
jmp redraw_screen_direct |
mov dword[esp+32+36],0 |
jmp redraw_screen_direct |
.exit: |
mov [esp+32+36],eax |
popad |
ret |
mov [esp+32+36],eax |
popad |
ret |
no_set_skin: |
popad |
515,58 → 515,58 |
repos_windows: |
mov ecx,[TASK_COUNT] |
mov edi, OS_BASE+0x20*2 |
mov ecx,[TASK_COUNT] |
mov edi, OS_BASE+0x20*2 |
mov byte[REDRAW_BACKGROUND],1 |
dec ecx |
jge @f |
ret |
@@: mov [edi+WDATA.fl_redraw],1 |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jz .lp2 |
mov eax,[screen_workarea.left] |
mov [edi+WDATA.box.left],eax |
sub eax,[screen_workarea.right] |
neg eax |
mov [edi+WDATA.box.width],eax |
mov eax,[screen_workarea.top] |
mov [edi+WDATA.box.top],eax |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz .lp1 |
sub eax,[screen_workarea.bottom] |
neg eax |
mov [edi+WDATA.box.height],eax |
dec ecx |
jge @f |
ret |
@@: mov [edi+WDATA.fl_redraw],1 |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jz .lp2 |
mov eax,[screen_workarea.left] |
mov [edi+WDATA.box.left],eax |
sub eax,[screen_workarea.right] |
neg eax |
mov [edi+WDATA.box.width],eax |
mov eax,[screen_workarea.top] |
mov [edi+WDATA.box.top],eax |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz .lp1 |
sub eax,[screen_workarea.bottom] |
neg eax |
mov [edi+WDATA.box.height],eax |
.lp1: |
call set_window_clientbox |
add edi,0x20 |
loop @b |
ret |
.lp2: mov eax,[edi+WDATA.box.left] |
add eax,[edi+WDATA.box.width] |
call set_window_clientbox |
add edi,0x20 |
loop @b |
ret |
.lp2: mov eax,[edi+WDATA.box.left] |
add eax,[edi+WDATA.box.width] |
mov ebx,[ScreenWidth] |
; inc ebx |
cmp eax,ebx |
jle .lp4 |
mov eax,[edi+WDATA.box.width] |
mov eax,[edi+WDATA.box.width] |
sub eax,ebx |
jle .lp3 |
mov [edi+WDATA.box.width],ebx |
.lp3: sub ebx,[edi+WDATA.box.width] |
mov [edi+WDATA.box.left],ebx |
.lp4: mov eax,[edi+WDATA.box.top] |
add eax,[edi+WDATA.box.height] |
mov [edi+WDATA.box.width],ebx |
.lp3: sub ebx,[edi+WDATA.box.width] |
mov [edi+WDATA.box.left],ebx |
.lp4: mov eax,[edi+WDATA.box.top] |
add eax,[edi+WDATA.box.height] |
mov ebx,[ScreenHeight] |
; inc ebx |
cmp eax,ebx |
jle .lp6 |
mov eax,[edi+WDATA.box.height] |
mov eax,[edi+WDATA.box.height] |
sub eax,ebx |
jle .lp5 |
mov [edi+WDATA.box.height],ebx |
.lp5: sub ebx,[edi+WDATA.box.height] |
mov [edi+WDATA.box.top],ebx |
.lp6: jmp .lp1 |
mov [edi+WDATA.box.height],ebx |
.lp5: sub ebx,[edi+WDATA.box.height] |
mov [edi+WDATA.box.top],ebx |
.lp6: jmp .lp1 |
uglobal |
common_colours: |
578,7 → 578,7 |
check_window_position: |
pushad ; window inside screen ? |
pushad ; window inside screen ? |
movzx eax,word [edi+WDATA.box.left] |
movzx ebx,word [edi+WDATA.box.top] |
585,7 → 585,7 |
movzx ecx,word [edi+WDATA.box.width] |
movzx edx,word [edi+WDATA.box.height] |
mov esi,ecx ; check x pos |
mov esi,ecx ; check x pos |
add esi,eax |
cmp esi,[ScreenWidth] |
jbe x_pos_ok |
593,7 → 593,7 |
xor eax, eax |
x_pos_ok: |
mov esi,edx ; check y pos |
mov esi,edx ; check y pos |
add esi,ebx |
cmp esi,[ScreenHeight] |
jbe y_pos_ok |
601,7 → 601,7 |
mov ebx,0 |
y_pos_ok: |
mov esi,ecx ; check x size |
mov esi,ecx ; check x size |
add esi,eax |
cmp esi,[ScreenWidth] |
jbe x_size_ok |
609,7 → 609,7 |
mov [edi+WDATA.box.width],ecx |
x_size_ok: |
mov esi,edx ; check y size |
mov esi,edx ; check y size |
add esi,ebx |
cmp esi,[ScreenHeight] |
jbe y_size_ok |
633,7 → 633,7 |
mov eax,[timer_ticks] |
cmp [new_window_starting],eax |
jb swml1 |
jb swml1 |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
651,101 → 651,101 |
drawwindow_I_caption: |
mov ecx,[edx+WDATA.cl_titlebar] ; grab bar |
push ecx |
mov esi,edx |
mov edx,[esi+WDATA.box.top] |
add edx,1 |
mov ebx,[esi+WDATA.box.top] |
add ebx,21 |
mov eax,[esi+WDATA.box.top] |
add eax,[esi+WDATA.box.height] |
cmp ebx,eax |
jb .wdsizeok |
mov ebx,eax |
mov ecx,[edx+WDATA.cl_titlebar] ; grab bar |
push ecx |
mov esi,edx |
mov edx,[esi+WDATA.box.top] |
add edx,1 |
mov ebx,[esi+WDATA.box.top] |
add ebx,21 |
mov eax,[esi+WDATA.box.top] |
add eax,[esi+WDATA.box.height] |
cmp ebx,eax |
jb .wdsizeok |
mov ebx,eax |
.wdsizeok: |
push ebx |
push ebx |
.drwi: |
mov ebx,edx |
shl ebx,16 |
add ebx,edx |
mov eax,[esi+WDATA.box.left] |
inc eax |
shl eax,16 |
add eax,[esi+WDATA.box.left] |
add eax,[esi+WDATA.box.width] |
sub eax,1 |
push edx |
mov edx,0x80000000 |
mov ecx,[esi+WDATA.cl_titlebar] |
and ecx,edx |
cmp ecx,edx |
jnz .nofa |
mov ecx,[esi+WDATA.cl_titlebar] |
sub ecx,0x00040404 |
mov [esi+WDATA.cl_titlebar],ecx |
and ecx,0x00ffffff |
jmp .faj |
mov ebx,edx |
shl ebx,16 |
add ebx,edx |
mov eax,[esi+WDATA.box.left] |
inc eax |
shl eax,16 |
add eax,[esi+WDATA.box.left] |
add eax,[esi+WDATA.box.width] |
sub eax,1 |
push edx |
mov edx,0x80000000 |
mov ecx,[esi+WDATA.cl_titlebar] |
and ecx,edx |
cmp ecx,edx |
jnz .nofa |
mov ecx,[esi+WDATA.cl_titlebar] |
sub ecx,0x00040404 |
mov [esi+WDATA.cl_titlebar],ecx |
and ecx,0x00ffffff |
jmp .faj |
.nofa: |
mov ecx,[esi+WDATA.cl_titlebar] |
and ecx,0x00ffffff |
mov ecx,[esi+WDATA.cl_titlebar] |
and ecx,0x00ffffff |
.faj: |
pop edx |
mov edi,0 |
call [draw_line] |
inc edx |
cmp edx,[esp] |
jb .drwi |
add esp,4 |
pop ecx |
mov [esi+WDATA.cl_titlebar],ecx |
pop edx |
mov edi,0 |
call [draw_line] |
inc edx |
cmp edx,[esp] |
jb .drwi |
add esp,4 |
pop ecx |
mov [esi+WDATA.cl_titlebar],ecx |
ret |
ret |
drawwindow_I: |
pushad |
or [edx+WDATA.fl_wdrawn], 4 |
pushad |
or [edx+WDATA.fl_wdrawn], 4 |
mov esi,[edx+WDATA.cl_frames] ; rectangle |
mov eax,[edx+WDATA.box.left] |
shl eax,16 |
add eax,[edx+WDATA.box.left] |
add eax,[edx+WDATA.box.width] |
mov ebx,[edx+WDATA.box.top] |
shl ebx,16 |
add ebx,[edx+WDATA.box.top] |
add ebx,[edx+WDATA.box.height] |
call draw_rectangle |
mov esi,[edx+WDATA.cl_frames] ; rectangle |
mov eax,[edx+WDATA.box.left] |
shl eax,16 |
add eax,[edx+WDATA.box.left] |
add eax,[edx+WDATA.box.width] |
mov ebx,[edx+WDATA.box.top] |
shl ebx,16 |
add ebx,[edx+WDATA.box.top] |
add ebx,[edx+WDATA.box.height] |
call draw_rectangle |
and [edx+WDATA.fl_wdrawn], not 4 |
test [edx+WDATA.fl_wdrawn], 2 |
jz @f |
call drawwindowframes2 |
and [edx+WDATA.fl_wdrawn], not 4 |
test [edx+WDATA.fl_wdrawn], 2 |
jz @f |
call drawwindowframes2 |
@@: |
call drawwindow_I_caption |
call drawwindow_I_caption |
mov edx,[esi+WDATA.box.top] ; inside work area |
add edx,21+5 |
mov ebx,[esi+WDATA.box.top] |
add ebx,[esi+WDATA.box.height] |
cmp edx,ebx |
jg noinside |
mov eax,1 |
mov ebx,21 |
mov ecx,[esi+WDATA.box.width] |
mov edx,[esi+WDATA.box.height] |
mov edi,[esi+WDATA.cl_workarea] |
mov edx,[esi+WDATA.box.top] ; inside work area |
add edx,21+5 |
mov ebx,[esi+WDATA.box.top] |
add ebx,[esi+WDATA.box.height] |
cmp edx,ebx |
jg noinside |
mov eax,1 |
mov ebx,21 |
mov ecx,[esi+WDATA.box.width] |
mov edx,[esi+WDATA.box.height] |
mov edi,[esi+WDATA.cl_workarea] |
test edi,0x40000000 |
jnz noinside |
call [drawbar] |
call [drawbar] |
noinside: |
popad |
popad |
ret |
ret |
draw_rectangle: |
756,149 → 756,149 |
r_bx equ [esp+18] ; y end |
;esi ; color |
pushad |
pushad |
mov ecx,esi ; yb,xb -> yb,xe |
mov eax, r_eax |
rol eax, 16 |
mov ebx,r_ebx |
shl ebx,16 |
mov bx,r_ebx |
xor edi, edi |
call [draw_line] |
mov ecx,esi ; yb,xb -> yb,xe |
mov eax, r_eax |
rol eax, 16 |
mov ebx,r_ebx |
shl ebx,16 |
mov bx,r_ebx |
xor edi, edi |
call [draw_line] |
mov ebx,r_bx ; ye,xb -> ye,xe |
shl ebx,16 |
mov bx,r_bx |
call [draw_line] |
mov ebx,r_bx ; ye,xb -> ye,xe |
shl ebx,16 |
mov bx,r_bx |
call [draw_line] |
mov ecx,esi ; ya,xa -> ye,xa |
mov eax,r_eax |
shl eax,16 |
mov ax,r_eax |
mov ebx,r_ebx |
shl ebx,16 |
mov bx,r_bx |
mov edi,0 |
call [draw_line] |
mov ecx,esi ; ya,xa -> ye,xa |
mov eax,r_eax |
shl eax,16 |
mov ax,r_eax |
mov ebx,r_ebx |
shl ebx,16 |
mov bx,r_bx |
mov edi,0 |
call [draw_line] |
mov eax,r_ax ; ya,xe -> ye,xe |
shl eax,16 |
mov ax,r_ax |
call [draw_line] |
mov eax,r_ax ; ya,xe -> ye,xe |
shl eax,16 |
mov ax,r_ax |
call [draw_line] |
popad |
ret |
popad |
ret |
drawwindow_III_caption: |
mov ecx,[edx+WDATA.cl_titlebar] ; GRAB BAR |
push ecx |
mov esi,edx |
mov edx,[esi+WDATA.box.top] |
add edx,4 |
mov ebx,[esi+WDATA.box.top] |
add ebx,20 |
mov eax,[esi+WDATA.box.top] |
add eax,[esi+WDATA.box.height] |
cmp ebx,eax |
jb .wdsizeok |
mov ebx,eax |
mov ecx,[edx+WDATA.cl_titlebar] ; GRAB BAR |
push ecx |
mov esi,edx |
mov edx,[esi+WDATA.box.top] |
add edx,4 |
mov ebx,[esi+WDATA.box.top] |
add ebx,20 |
mov eax,[esi+WDATA.box.top] |
add eax,[esi+WDATA.box.height] |
cmp ebx,eax |
jb .wdsizeok |
mov ebx,eax |
.wdsizeok: |
push ebx |
push ebx |
.drwi: |
mov ebx,edx |
shl ebx,16 |
add ebx,edx |
mov eax,[esi+WDATA.box.left] |
shl eax,16 |
add eax,[esi+WDATA.box.left] |
add eax,[esi+WDATA.box.width] |
add eax,4*65536-4 |
mov ecx,[esi+WDATA.cl_titlebar] |
test ecx,0x40000000 |
jz .nofa |
add ecx,0x040404 |
mov ebx,edx |
shl ebx,16 |
add ebx,edx |
mov eax,[esi+WDATA.box.left] |
shl eax,16 |
add eax,[esi+WDATA.box.left] |
add eax,[esi+WDATA.box.width] |
add eax,4*65536-4 |
mov ecx,[esi+WDATA.cl_titlebar] |
test ecx,0x40000000 |
jz .nofa |
add ecx,0x040404 |
.nofa: |
test ecx,0x80000000 |
jz .nofa2 |
sub ecx,0x040404 |
test ecx,0x80000000 |
jz .nofa2 |
sub ecx,0x040404 |
.nofa2: |
mov [esi+WDATA.cl_titlebar],ecx |
and ecx,0xffffff |
xor edi, edi |
call [draw_line] |
inc edx |
cmp edx,[esp] |
jb .drwi |
add esp,4 |
pop ecx |
mov [esi+WDATA.cl_titlebar],ecx |
mov [esi+WDATA.cl_titlebar],ecx |
and ecx,0xffffff |
xor edi, edi |
call [draw_line] |
inc edx |
cmp edx,[esp] |
jb .drwi |
add esp,4 |
pop ecx |
mov [esi+WDATA.cl_titlebar],ecx |
ret |
ret |
drawwindow_III: |
pushad |
pushad |
mov edi,edx ; RECTANGLE |
mov eax,[edi+WDATA.box.left] |
shl eax,16 |
mov edi,edx ; RECTANGLE |
mov eax,[edi+WDATA.box.left] |
shl eax,16 |
mov ax, word [edi+WDATA.box.left] |
add ax, word [edi+WDATA.box.width] |
mov ebx,[edi+WDATA.box.top] |
shl ebx,16 |
mov ebx,[edi+WDATA.box.top] |
shl ebx,16 |
mov bx, word [edi+WDATA.box.top] |
add bx, word [edi+WDATA.box.height] |
mov esi,[edi+WDATA.cl_frames] |
shr esi,1 |
and esi,0x007f7f7f |
push esi |
or [edi+WDATA.fl_wdrawn], 4 |
call draw_rectangle |
and [edi+WDATA.fl_wdrawn], not 4 |
test [edi+WDATA.fl_wdrawn], 2 |
jz @f |
call drawwindowframes2 |
mov esi,[edi+WDATA.cl_frames] |
shr esi,1 |
and esi,0x007f7f7f |
push esi |
or [edi+WDATA.fl_wdrawn], 4 |
call draw_rectangle |
and [edi+WDATA.fl_wdrawn], not 4 |
test [edi+WDATA.fl_wdrawn], 2 |
jz @f |
call drawwindowframes2 |
@@: |
mov ecx,3 |
mov ecx,3 |
dw3l: |
add eax,1*65536-1 |
add ebx,1*65536-1 |
mov esi,[edi+WDATA.cl_frames] |
call draw_rectangle |
dec ecx |
jnz dw3l |
pop esi |
add eax,1*65536-1 |
add ebx,1*65536-1 |
call draw_rectangle |
add eax,1*65536-1 |
add ebx,1*65536-1 |
mov esi,[edi+WDATA.cl_frames] |
call draw_rectangle |
dec ecx |
jnz dw3l |
pop esi |
add eax,1*65536-1 |
add ebx,1*65536-1 |
call draw_rectangle |
call drawwindow_III_caption |
call drawwindow_III_caption |
mov edx,[esi+WDATA.box.top] ; WORK AREA |
add edx,21+5 |
mov ebx,[esi+WDATA.box.top] |
add ebx,[esi+WDATA.box.height] |
cmp edx,ebx |
jg noinside2 |
mov eax,5 |
mov ebx,20 |
mov ecx,[esi+WDATA.box.width] |
mov edx,[esi+WDATA.box.height] |
sub ecx,4 |
sub edx,4 |
mov edi,[esi+WDATA.cl_workarea] |
mov edx,[esi+WDATA.box.top] ; WORK AREA |
add edx,21+5 |
mov ebx,[esi+WDATA.box.top] |
add ebx,[esi+WDATA.box.height] |
cmp edx,ebx |
jg noinside2 |
mov eax,5 |
mov ebx,20 |
mov ecx,[esi+WDATA.box.width] |
mov edx,[esi+WDATA.box.height] |
sub ecx,4 |
sub edx,4 |
mov edi,[esi+WDATA.cl_workarea] |
test edi,0x40000000 |
jnz noinside2 |
call [drawbar] |
call [drawbar] |
noinside2: |
popad |
popad |
ret |
ret |
906,63 → 906,63 |
align 4 |
windowactivate: |
; esi = abs mem position in stack 0xC400+ |
; esi = abs mem position in stack 0xC400+ |
pushad |
pushad |
; if type of current active window is 3, |
; it must be redrawn |
mov eax, [TASK_COUNT] |
movzx eax, word [WIN_POS + eax*2] |
shl eax, 5 |
add eax, window_data |
mov ebx, [eax + WDATA.cl_workarea] |
and ebx, 0x0f000000 |
cmp ebx, 0x03000000 |
jne @f |
mov [eax + WDATA.fl_redraw], byte 1 |
mov eax, [TASK_COUNT] |
movzx eax, word [WIN_POS + eax*2] |
shl eax, 5 |
add eax, window_data |
mov ebx, [eax + WDATA.cl_workarea] |
and ebx, 0x0f000000 |
cmp ebx, 0x03000000 |
jne @f |
mov [eax + WDATA.fl_redraw], byte 1 |
@@: |
push esi |
push esi |
movzx eax, word [esi] ; ax <- process no |
movzx eax, word [WIN_STACK+eax*2] ; ax <- position in window stack |
xor esi, esi ; drop others |
xor esi, esi ; drop others |
waloop: |
cmp esi, dword [TASK_COUNT] |
jae wacont |
inc esi |
lea edi, [WIN_STACK + esi*2] |
mov bx, [edi] ; position of the current process |
cmp bx, ax |
jbe @f |
dec bx ; upper? => drop! |
mov [edi], bx |
cmp esi, dword [TASK_COUNT] |
jae wacont |
inc esi |
lea edi, [WIN_STACK + esi*2] |
mov bx, [edi] ; position of the current process |
cmp bx, ax |
jbe @f |
dec bx ; upper? => drop! |
mov [edi], bx |
@@: |
jmp waloop |
jmp waloop |
wacont: |
; set to no 1 |
pop esi ; esi = pointer at 0xC400 |
; set to no 1 |
pop esi ; esi = pointer at 0xC400 |
movzx eax, word [esi] |
mov bx, [TASK_COUNT] ; number of processes |
mov [WIN_STACK+eax*2], bx ; this is the last (and the upper) |
mov bx, [TASK_COUNT] ; number of processes |
mov [WIN_STACK+eax*2], bx ; this is the last (and the upper) |
; update on screen -window stack |
xor esi, esi |
; update on screen -window stack |
xor esi, esi |
waloop2: |
mov edi, [TASK_COUNT] |
cmp esi, edi |
jae wacont2 |
inc esi |
movzx ebx, word [esi*2 + WIN_STACK] |
mov [ebx*2 + WIN_POS], si |
jmp waloop2 |
mov edi, [TASK_COUNT] |
cmp esi, edi |
jae wacont2 |
inc esi |
movzx ebx, word [esi*2 + WIN_STACK] |
mov [ebx*2 + WIN_POS], si |
jmp waloop2 |
wacont2: |
mov [KEY_COUNT], byte 0 ; empty keyboard buffer |
mov [BTN_COUNT], byte 0 ; empty button buffer |
popad |
ret |
mov [KEY_COUNT], byte 0 ; empty keyboard buffer |
mov [BTN_COUNT], byte 0 ; empty button buffer |
popad |
ret |
; check if window is necessary to draw |
969,78 → 969,78 |
checkwindowdraw: |
; edi = position in window_data+ |
; edi = position in window_data+ |
mov eax, [edi + WDATA.cl_workarea] |
and eax, 0x0f000000 |
cmp eax, 0x03000000 |
je .return_yes ; window type 3 |
mov eax, [edi + WDATA.cl_workarea] |
and eax, 0x0f000000 |
cmp eax, 0x03000000 |
je .return_yes ; window type 3 |
mov esi, edi |
sub esi, window_data |
shr esi, 5 |
mov esi, edi |
sub esi, window_data |
shr esi, 5 |
; esi = process number |
; esi = process number |
movzx eax, word [WIN_STACK + esi * 2] ; get value of the curr process |
lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 |
movzx eax, word [WIN_STACK + esi * 2] ; get value of the curr process |
lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 |
push esi |
push esi |
.new_check: |
pop esi |
add esi, 2 |
push esi |
pop esi |
add esi, 2 |
push esi |
mov eax, [TASK_COUNT] |
lea eax, word [WIN_POS + eax * 2] ; number of the upper window |
mov eax, [TASK_COUNT] |
lea eax, word [WIN_POS + eax * 2] ; number of the upper window |
cmp esi, eax |
ja .all_wnds_to_top |
cmp esi, eax |
ja .all_wnds_to_top |
movzx eax, word [esi] |
shl eax, 5 |
cmp [CURRENT_TASK + eax + TASKDATA.state], byte 9 |
je .new_check ; skip dead windows |
movzx eax, word [esi] |
shl eax, 5 |
cmp [CURRENT_TASK + eax + TASKDATA.state], byte 9 |
je .new_check ; skip dead windows |
lea esi, [eax+window_data] |
lea esi, [eax+window_data] |
mov ebx, [edi+WDATA.box.top] ; y0 |
mov edx, [edi+WDATA.box.height] |
add edx, ebx ; y0e |
mov ebx, [edi+WDATA.box.top] ; y0 |
mov edx, [edi+WDATA.box.height] |
add edx, ebx ; y0e |
mov ecx, [esi+WDATA.box.top] ; y ; y check |
cmp ecx, edx |
jae .new_check ; y < y0e |
mov eax, [esi+WDATA.box.height] |
add ecx, eax ; ye |
cmp ebx, ecx ; y0 >= ye |
ja .new_check |
mov ecx, [esi+WDATA.box.top] ; y ; y check |
cmp ecx, edx |
jae .new_check ; y < y0e |
mov eax, [esi+WDATA.box.height] |
add ecx, eax ; ye |
cmp ebx, ecx ; y0 >= ye |
ja .new_check |
mov eax, [edi+WDATA.box.left] ; x0 |
mov ecx, [edi+WDATA.box.width] |
add ecx, eax ; x0e |
mov eax, [edi+WDATA.box.left] ; x0 |
mov ecx, [edi+WDATA.box.width] |
add ecx, eax ; x0e |
mov edx, [esi+WDATA.box.left] ; x ; x check |
cmp edx, ecx |
jae .new_check ; x < x0e |
mov ecx, [esi+WDATA.box.width] |
add edx, ecx |
cmp eax, edx |
ja .new_check |
mov edx, [esi+WDATA.box.left] ; x ; x check |
cmp edx, ecx |
jae .new_check ; x < x0e |
mov ecx, [esi+WDATA.box.width] |
add edx, ecx |
cmp eax, edx |
ja .new_check |
pop esi |
pop esi |
.return_yes: |
mov ecx,1 ; overlap some window |
ret |
mov ecx,1 ; overlap some window |
ret |
.all_wnds_to_top: |
pop esi |
pop esi |
xor ecx, ecx ; passed all windows to top |
ret |
xor ecx, ecx ; passed all windows to top |
ret |
1047,719 → 1047,698 |
waredraw: ; if redraw necessary at activate |
pushad |
pushad |
call checkwindowdraw ; draw window on activation ? |
test ecx, ecx |
jz .do_not_draw |
call checkwindowdraw ; draw window on activation ? |
test ecx, ecx |
jz .do_not_draw |
popad |
mov [MOUSE_DOWN], byte 1 ; do draw mouse |
call windowactivate |
popad |
mov [MOUSE_DOWN], byte 1 ; do draw mouse |
call windowactivate |
; update screen info |
pushad |
mov edi, [TASK_COUNT] ; the last process (number) |
movzx esi, word [WIN_POS + edi * 2] |
shl esi, 5 |
add esi, window_data |
; update screen info |
pushad |
mov edi, [TASK_COUNT] ; the last process (number) |
movzx esi, word [WIN_POS + edi * 2] |
shl esi, 5 |
add esi, window_data |
; coordinates of the upper window |
mov eax, [esi + WDATA.box.left] ; cx |
mov ebx, [esi + WDATA.box.top] ; cy |
mov ecx, [esi + WDATA.box.width] ; sx |
; coordinates of the upper window |
mov eax, [esi + WDATA.box.left] ; cx |
mov ebx, [esi + WDATA.box.top] ; cy |
mov ecx, [esi + WDATA.box.width] ; sx |
mov edx, [esi + WDATA.box.height] ; sy |
add ecx, eax ; ecx = x_end |
add edx, ebx ; edx = y_end |
add ecx, eax ; ecx = x_end |
add edx, ebx ; edx = y_end |
mov edi, [TASK_COUNT] |
movzx esi, word [WIN_POS + edi * 2] |
call setscreen |
popad |
mov edi, [TASK_COUNT] |
movzx esi, word [WIN_POS + edi * 2] |
call setscreen |
popad |
mov [edi + WDATA.fl_redraw], 1 ; redraw flag for app |
mov [MOUSE_DOWN],byte 0 ; mouse down checks |
mov [MOUSE_DOWN],byte 0 ; mouse down checks |
ret |
ret |
.do_not_draw: |
popad |
popad |
call windowactivate |
mov [MOUSE_DOWN],byte 0 ; mouse down checks |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
ret |
call windowactivate |
mov [MOUSE_DOWN],byte 0 ; mouse down checks |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
ret |
; eax = window number on screen |
; corrupts registers and [dl*] |
minimize_window: |
movzx eax, word [WIN_POS+eax*2] |
shl eax, 5 |
add eax, window_data |
test [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
jnz .skip_redrawings |
pushfd |
cli |
or [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
mov edi, eax |
;call calculatescreen |
mov eax, [edi+WDATA.box.left] |
mov [dlx], eax |
mov ecx, eax |
add ecx, [edi+WDATA.box.width] |
mov [dlxe], ecx |
mov ebx, [edi+WDATA.box.top] |
mov [dly], ebx |
mov edx, ebx |
add edx, [edi+WDATA.box.height] |
mov [dlye], edx |
call calculatescreen |
xor esi, esi |
xor eax, eax |
call redrawscreen |
popfd |
movzx eax, word [WIN_POS+eax*2] |
shl eax, 5 |
add eax, window_data |
test [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
jnz .skip_redrawings |
pushfd |
cli |
or [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
mov edi, eax |
;call calculatescreen |
mov eax, [edi+WDATA.box.left] |
mov [dlx], eax |
mov ecx, eax |
add ecx, [edi+WDATA.box.width] |
mov [dlxe], ecx |
mov ebx, [edi+WDATA.box.top] |
mov [dly], ebx |
mov edx, ebx |
add edx, [edi+WDATA.box.height] |
mov [dlye], edx |
call calculatescreen |
xor esi, esi |
xor eax, eax |
call redrawscreen |
popfd |
.skip_redrawings: |
ret |
ret |
; eax = window number on screen |
; corrupts registers and [dl*] |
restore_minimized_window: |
pushfd |
cli |
movzx esi, word [WIN_POS+eax*2] |
mov edi, esi |
shl edi, 5 |
add edi, window_data |
test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
jz .skip_redrawings |
mov [edi+WDATA.fl_redraw], 1 |
and [edi+WDATA.fl_wstate], not WSTATE_MINIMIZED |
cmp eax, [TASK_COUNT] ; the uppermost window |
jnz .no_uppermost |
mov eax, [edi+WDATA.box.left] |
mov ebx, [edi+WDATA.box.top] |
mov ecx, eax |
mov edx, ebx |
add ecx, [edi+WDATA.box.width] |
add edx, [edi+WDATA.box.height] |
call setscreen |
jmp .done |
pushfd |
cli |
movzx esi, word [WIN_POS+eax*2] |
mov edi, esi |
shl edi, 5 |
add edi, window_data |
test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
jz .skip_redrawings |
mov [edi+WDATA.fl_redraw], 1 |
and [edi+WDATA.fl_wstate], not WSTATE_MINIMIZED |
cmp eax, [TASK_COUNT] ; the uppermost window |
jnz .no_uppermost |
mov eax, [edi+WDATA.box.left] |
mov ebx, [edi+WDATA.box.top] |
mov ecx, eax |
mov edx, ebx |
add ecx, [edi+WDATA.box.width] |
add edx, [edi+WDATA.box.height] |
call setscreen |
jmp .done |
.no_uppermost: |
mov eax, [edi+WDATA.box.left] |
mov ebx, [edi+WDATA.box.top] |
mov ecx, eax |
mov edx, ebx |
add ecx, [edi+WDATA.box.width] |
add edx, [edi+WDATA.box.height] |
call calculatescreen |
mov eax, [edi+WDATA.box.left] |
mov ebx, [edi+WDATA.box.top] |
mov ecx, eax |
mov edx, ebx |
add ecx, [edi+WDATA.box.width] |
add edx, [edi+WDATA.box.height] |
call calculatescreen |
.done: |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
.skip_redrawings: |
popfd |
ret |
popfd |
ret |
iglobal |
window_moving db 'K : Window - move/resize',13,10,0 |
window_moved db 'K : Window - done',13,10,0 |
window_moved db 'K : Window - done',13,10,0 |
endg |
; check window touch |
align 4 |
checkwindows: |
pushad |
pushad |
cmp [window_minimize], 0 |
je .no_minimizing |
mov eax, [TASK_COUNT] ; the uppermost window |
mov bl, 0 |
xchg [window_minimize], bl |
cmp bl, 1 |
jne .restore |
call minimize_window |
jmp .continue |
cmp [window_minimize], 0 |
je .no_minimizing |
mov eax, [TASK_COUNT] ; the uppermost window |
mov bl, 0 |
xchg [window_minimize], bl |
cmp bl, 1 |
jne .restore |
call minimize_window |
jmp .continue |
.restore: |
call restore_minimized_window |
call restore_minimized_window |
.continue: |
.no_minimizing: |
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? |
jne .mouse_buttons_pressed |
;..................................... start 1/4 : modified by vhanla ................. |
mov [bPressedMouseXY_W],0 |
;..................................... end 1/4 : modified by vhanla ................... |
popad |
ret |
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? |
jne .mouse_buttons_pressed |
popad |
ret |
.mouse_buttons_pressed: |
;..................................... start 2/4 : modified by vhanla ................. |
jmp @f |
bPressedMouseXY_W db 0x0 |
@@: |
;..................................... end 2/4 : modified by vhanla ................... |
mov esi,[TASK_COUNT] |
inc esi |
;..................................... start 3/4 : modified by vhanla ................. |
push ax |
cmp [bPressedMouseXY_W],0 |
jnz @f |
mov [bPressedMouseXY_W],1 |
mov ax,[MOUSE_X] |
mov [mx],ax |
mov ax,[MOUSE_Y] |
mov [my],ax |
@@: |
pop ax |
;..................................... end 3/4 : modified by vhanla ................... |
mov esi,[TASK_COUNT] |
inc esi |
cwloop: |
cmp esi,2 |
jb .exit |
cmp esi,2 |
jb .exit |
dec esi |
movzx edi, word [WIN_POS + esi * 2] ; ebx |
shl edi, 5 |
add edi, window_data |
dec esi |
movzx edi, word [WIN_POS + esi * 2] ; ebx |
shl edi, 5 |
add edi, window_data |
; mov edi, ebx |
mov ecx, [edi + WDATA.box.left] |
mov edx, [edi + WDATA.box.top] |
mov eax,ecx |
mov ebx,edx |
test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED |
jnz cwloop |
mov eax,ecx |
mov ebx,edx |
test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED |
jnz cwloop |
;..................................... start 4/4 : modified by vhanla ................. |
movzx eax, word [mx]; movzx eax,word[MOUSE_X] |
movzx ebx, word [my]; movzx ebx,word[MOUSE_Y] |
;..................................... endt 4/4 : modified by vhanla .................. |
cmp ecx, eax |
jae cwloop |
cmp edx, ebx |
jae cwloop |
movzx eax, word [MOUSE_X] |
movzx ebx, word [MOUSE_Y] |
cmp ecx, eax |
jae cwloop |
cmp edx, ebx |
jae cwloop |
add ecx, [edi + WDATA.box.width] |
add edx, [edi + WDATA.box.height] |
cmp eax, ecx |
jae cwloop |
cmp ebx, edx |
jae cwloop |
cmp eax, ecx |
jae cwloop |
cmp ebx, edx |
jae cwloop |
pushad |
mov eax, esi |
mov ebx, [TASK_COUNT] |
cmp eax, ebx ; is this window active? |
jz .move_resize_window |
pushad |
mov eax, esi |
mov ebx, [TASK_COUNT] |
cmp eax, ebx ; is this window active? |
jz .move_resize_window |
; eax = position in windowing stack |
; redraw must ? |
lea esi, [WIN_POS + esi * 2] |
call waredraw |
add esp, 32 |
; eax = position in windowing stack |
; redraw must ? |
lea esi, [WIN_POS + esi * 2] |
call waredraw |
add esp, 32 |
.exit: |
popad |
ret |
popad |
ret |
.move_resize_window: ; MOVE OR RESIZE WINDOW |
popad |
popad |
; Check for user enabled fixed window |
; Check for user enabled fixed window |
mov edx, [edi + WDATA.cl_titlebar] |
and edx, 0x0f000000 |
cmp edx, 0x01000000 |
jne .window_move_enabled_for_user |
popad |
ret |
and edx, 0x0f000000 |
cmp edx, 0x01000000 |
jne .window_move_enabled_for_user |
popad |
ret |
.window_move_enabled_for_user: |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz .no_resize_2 |
jnz .no_resize_2 |
mov [do_resize_from_corner],byte 0 ; resize for skinned window |
mov [do_resize_from_corner],byte 0 ; resize for skinned window |
mov edx, [edi + WDATA.cl_workarea] |
and edx, 0x0f000000 |
cmp edx, 0x02000000 |
jb .no_resize_2 ; not type 2 wnd |
and edx, 0x0f000000 |
cmp edx, 0x02000000 |
jb .no_resize_2 ; not type 2 wnd |
mov edx, [edi + WDATA.box.top] |
add edx, [edi + WDATA.box.height] |
sub edx, 6 ; edx = y_end - 6 |
cmp ebx, edx ; ebx = mouse_y |
jb .no_resize_2 |
mov [do_resize_from_corner],byte 1 |
jmp .continue |
sub edx, 6 ; edx = y_end - 6 |
cmp ebx, edx ; ebx = mouse_y |
jb .no_resize_2 |
mov [do_resize_from_corner],byte 1 |
jmp .continue |
.no_resize_2: |
push eax |
call get_titlebar_height |
push eax |
call get_titlebar_height |
add eax,[edi + WDATA.box.top] |
cmp ebx,eax |
pop eax |
jae .exit |
cmp ebx,eax |
pop eax |
jae .exit |
.continue: |
push esi |
mov esi, window_moving |
call sys_msg_board_str |
pop esi |
push esi |
mov esi, window_moving |
call sys_msg_board_str |
pop esi |
mov ecx, [timer_ticks] ; double-click ? |
mov edx, ecx |
sub edx, [latest_window_touch] |
mov [latest_window_touch], ecx |
mov [latest_window_touch_delta], edx |
mov ecx, [timer_ticks] ; double-click ? |
mov edx, ecx |
sub edx, [latest_window_touch] |
mov [latest_window_touch], ecx |
mov [latest_window_touch_delta], edx |
mov cl, [BTN_DOWN] ; save for shade check |
mov [do_resize], cl |
mov cl, [BTN_DOWN] ; save for shade check |
mov [do_resize], cl |
no_emulation_righ_button: |
mov ecx, [edi + WDATA.box.left] |
mov edx, [edi + WDATA.box.top] |
push eax ecx edx |
mov [dlx], ecx ; save for drawlimits |
mov [dly], edx |
push eax ecx edx |
mov [dlx], ecx ; save for drawlimits |
mov [dly], edx |
mov eax, [edi + WDATA.box.width] |
add ecx, eax |
add ecx, eax |
mov eax, [edi + WDATA.box.height] |
add edx, eax |
mov [dlxe], ecx |
mov [dlye], edx |
pop edx ecx eax |
add edx, eax |
mov [dlxe], ecx |
mov [dlye], edx |
pop edx ecx eax |
sub eax, ecx |
sub ebx, edx |
sub eax, ecx |
sub ebx, edx |
mov esi, [MOUSE_X] |
mov [WIN_TEMP_XY], esi |
mov esi, [MOUSE_X] |
mov [WIN_TEMP_XY], esi |
pushad ; wait for putimages to finish |
pushad ; wait for putimages to finish |
; mov eax,5 |
; call delay_hs |
mov eax,[edi + WDATA.box.left] |
mov [npx],eax |
mov [npx],eax |
mov eax,[edi + WDATA.box.top] |
mov [npy],eax |
popad |
mov [npy],eax |
popad |
push eax ; save old coordinates |
push eax ; save old coordinates |
mov ax, word [edi + WDATA.box.left] |
mov word [oldc+BOX.left],ax |
mov word [oldc+BOX.left],ax |
mov ax, word [edi + WDATA.box.top] |
mov word [oldc+BOX.top],ax |
mov word [oldc+BOX.top],ax |
mov ax, word [edi + WDATA.box.width] |
mov word [oldc+BOX.width],ax |
mov word [npxe],ax |
mov word [oldc+BOX.width],ax |
mov word [npxe],ax |
mov ax, word [edi + WDATA.box.height] |
mov word [oldc+BOX.height],ax |
mov word [npye],ax |
pop eax |
mov word [oldc+BOX.height],ax |
mov word [npye],ax |
pop eax |
call drawwindowframes |
call drawwindowframes |
mov [reposition],0 |
mov [MOUSE_DOWN],byte 1 ; no reaction to mouse up/down |
mov [reposition],0 |
mov [MOUSE_DOWN],byte 1 ; no reaction to mouse up/down |
; move window |
; move window |
newchm: |
mov [DONT_DRAW_MOUSE],byte 1 |
mov [DONT_DRAW_MOUSE],byte 1 |
call checkidle |
call checkidle |
call checkVga_N13 |
call checkVga_N13 |
mov [MOUSE_BACKGROUND],byte 0 |
mov [MOUSE_BACKGROUND],byte 0 |
call [draw_pointer] |
call [draw_pointer] |
pushad |
call stack_handler |
popad |
pushad |
call stack_handler |
popad |
mov esi,[WIN_TEMP_XY] |
cmp esi,[MOUSE_X] |
je cwb |
mov esi,[WIN_TEMP_XY] |
cmp esi,[MOUSE_X] |
je cwb |
mov cx,[MOUSE_X] |
mov dx,[MOUSE_Y] |
sub cx,ax |
sub dx,bx |
mov cx,[MOUSE_X] |
mov dx,[MOUSE_Y] |
sub cx,ax |
sub dx,bx |
push ax |
push bx |
push ax |
push bx |
call drawwindowframes |
call drawwindowframes |
mov ax,[ScreenWidth] |
mov bx,[ScreenHeight] |
mov ax,[ScreenWidth] |
mov bx,[ScreenHeight] |
cmp [do_resize_from_corner],1 |
je no_new_position |
cmp [do_resize_from_corner],1 |
je no_new_position |
mov word [npx],word 0 ; x repos ? |
cmp ax,cx |
jb noreposx |
mov [reposition],1 |
sub ax,word [npxe] |
mov word [npx],ax |
cmp ax,cx |
jb noreposx |
mov word [npx],cx |
mov word [npx],word 0 ; x repos ? |
cmp ax,cx |
jb noreposx |
mov [reposition],1 |
sub ax,word [npxe] |
mov word [npx],ax |
cmp ax,cx |
jb noreposx |
mov word [npx],cx |
noreposx: |
mov word [npy],word 0 ; y repos ? |
cmp bx,dx |
jb noreposy |
mov [reposition],1 |
sub bx,word [npye] |
mov word [npy],bx |
cmp bx,dx |
jb noreposy |
mov word [npy],dx |
mov word [npy],word 0 ; y repos ? |
cmp bx,dx |
jb noreposy |
mov [reposition],1 |
sub bx,word [npye] |
mov word [npy],bx |
cmp bx,dx |
jb noreposy |
mov word [npy],dx |
noreposy: |
no_new_position: |
cmp [do_resize_from_corner],0 ; resize from right corner |
je norepos_size |
pushad |
cmp [do_resize_from_corner],0 ; resize from right corner |
je norepos_size |
pushad |
mov edx,edi |
sub edx,window_data |
;shr edx,5 |
;shl edx,8 |
;add edx,0x80000 ; process base at 0x80000+ |
mov edx,edi |
sub edx,window_data |
;shr edx,5 |
;shl edx,8 |
;add edx,0x80000 ; process base at 0x80000+ |
lea edx, [SLOT_BASE + edx*8] |
movzx eax,word [MOUSE_X] |
movzx eax,word [MOUSE_X] |
cmp eax,[edi + WDATA.box.left] |
jb nnepx |
jb nnepx |
sub eax,[edi + WDATA.box.left] |
cmp eax,32 ; [edx+0x90+8] |
jge nnepx2 |
mov eax,32 ; [edx+0x90+8] |
cmp eax,32 ; [edx+0x90+8] |
jge nnepx2 |
mov eax,32 ; [edx+0x90+8] |
nnepx2: |
mov [npxe],eax |
mov [npxe],eax |
nnepx: |
call get_rolledup_height |
mov ebx,eax |
movzx eax,word [MOUSE_Y] |
call get_rolledup_height |
mov ebx,eax |
movzx eax,word [MOUSE_Y] |
cmp eax,[edi + WDATA.box.top] |
jb nnepy |
jb nnepy |
sub eax,[edi + WDATA.box.top] |
cmp eax,ebx ; [edx+0x90+12] |
jge nnepy2 |
mov eax,ebx ; [edx+0x90+12] |
cmp eax,ebx ; [edx+0x90+12] |
jge nnepy2 |
mov eax,ebx ; [edx+0x90+12] |
nnepy2: |
mov [npye],eax |
mov [npye],eax |
nnepy: |
mov [reposition],1 |
mov [reposition],1 |
popad |
popad |
norepos_size: |
pop bx |
pop ax |
call drawwindowframes |
pop bx |
pop ax |
call drawwindowframes |
mov esi,[MOUSE_X] |
mov [WIN_TEMP_XY],esi |
mov esi,[MOUSE_X] |
mov [WIN_TEMP_XY],esi |
cwb: |
cmp [BTN_DOWN],byte 0 |
jne newchm |
; new position done |
mov [DONT_DRAW_MOUSE],byte 1 |
mov cl,0 |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jnz @f |
mov cl,[reposition] |
call drawwindowframes |
cmp [BTN_DOWN],byte 0 |
jne newchm |
; new position done |
mov [DONT_DRAW_MOUSE],byte 1 |
mov cl,0 |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jnz @f |
mov cl,[reposition] |
call drawwindowframes |
mov eax,[npx] |
mov eax,[npx] |
mov [edi + WDATA.box.left],eax |
mov eax,[npy] |
mov eax,[npy] |
mov [edi + WDATA.box.top],eax |
mov eax,[npxe] |
mov eax,[npxe] |
mov [edi + WDATA.box.width],eax |
mov eax,[npye] |
mov eax,[npye] |
mov [edi + WDATA.box.height],eax |
call set_window_clientbox |
call set_window_clientbox |
@@: mov [reposition],cl |
@@: mov [reposition],cl |
cmp [reposition],1 ; save new position and size |
jne no_bounds_save |
push esi edi ecx |
mov esi,edi |
mov ecx,2 |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP or WSTATE_MAXIMIZED |
jnz @f |
add ecx,2 |
cmp [reposition],1 ; save new position and size |
jne no_bounds_save |
push esi edi ecx |
mov esi,edi |
mov ecx,2 |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP or WSTATE_MAXIMIZED |
jnz @f |
add ecx,2 |
@@: sub edi,window_data |
shr edi,5 |
shl edi,8 |
add edi,SLOT_BASE+APPDATA.saved_box |
cld |
rep movsd |
pop ecx edi esi |
shr edi,5 |
shl edi,8 |
add edi,SLOT_BASE+APPDATA.saved_box |
cld |
rep movsd |
pop ecx edi esi |
no_bounds_save: |
pushad ; WINDOW SHADE/FULLSCREEN |
pushad ; WINDOW SHADE/FULLSCREEN |
cmp [reposition],1 |
je no_window_sizing |
mov edx,edi |
sub edx,window_data |
shr edx,5 |
shl edx,8 |
add edx,SLOT_BASE ; process base at 0x80000+ |
cmp [reposition],1 |
je no_window_sizing |
mov edx,edi |
sub edx,window_data |
shr edx,5 |
shl edx,8 |
add edx,SLOT_BASE ; process base at 0x80000+ |
cmp [do_resize],2 ; window shade ? |
jne no_window_shade |
mov [reposition],1 |
cmp [do_resize],2 ; window shade ? |
jne no_window_shade |
mov [reposition],1 |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz wnd_rolldown |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz wnd_rolldown |
wnd_rollup: |
or [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
call get_rolledup_height |
jmp @f |
or [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
call get_rolledup_height |
jmp @f |
wnd_rolldown: |
and [edi+WDATA.fl_wstate],not WSTATE_ROLLEDUP |
and [edi+WDATA.fl_wstate],not WSTATE_ROLLEDUP |
mov eax,[edx + APPDATA.saved_box.height] ; 0x90+BOX.height |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jz @f |
mov eax,[screen_workarea.bottom] |
sub eax,[screen_workarea.top] |
@@: mov [edi+WDATA.box.height],eax |
call set_window_clientbox |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jz @f |
mov eax,[screen_workarea.bottom] |
sub eax,[screen_workarea.top] |
@@: mov [edi+WDATA.box.height],eax |
call set_window_clientbox |
no_window_shade: |
cmp [do_resize],1 ; fullscreen/restore ? |
jne no_fullscreen_restore |
cmp [latest_window_touch_delta],dword 50 |
jg no_fullscreen_restore |
mov [reposition],1 |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jnz restore_from_fullscreen |
or [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
mov eax,[screen_workarea.left] |
mov [edi+WDATA.box.left],eax |
sub eax,[screen_workarea.right] |
neg eax |
mov [edi+WDATA.box.width],eax |
mov eax,[screen_workarea.top] |
mov [edi+WDATA.box.top],eax |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz @f |
sub eax,[screen_workarea.bottom] |
neg eax |
mov [edi+WDATA.box.height],eax |
cmp [do_resize],1 ; fullscreen/restore ? |
jne no_fullscreen_restore |
cmp [latest_window_touch_delta],dword 50 |
jg no_fullscreen_restore |
mov [reposition],1 |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jnz restore_from_fullscreen |
or [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
mov eax,[screen_workarea.left] |
mov [edi+WDATA.box.left],eax |
sub eax,[screen_workarea.right] |
neg eax |
mov [edi+WDATA.box.width],eax |
mov eax,[screen_workarea.top] |
mov [edi+WDATA.box.top],eax |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz @f |
sub eax,[screen_workarea.bottom] |
neg eax |
mov [edi+WDATA.box.height],eax |
@@: |
jmp restore_from_fullscreen.clientbox |
jmp restore_from_fullscreen.clientbox |
restore_from_fullscreen: |
and [edi+WDATA.fl_wstate],not WSTATE_MAXIMIZED |
push [edi+WDATA.box.height] |
push edi ; restore |
lea esi, [edx + APPDATA.saved_box] |
mov ecx,4 |
cld |
rep movsd |
pop edi |
pop eax |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jz @f |
mov [edi+WDATA.box.height],eax |
and [edi+WDATA.fl_wstate],not WSTATE_MAXIMIZED |
push [edi+WDATA.box.height] |
push edi ; restore |
lea esi, [edx + APPDATA.saved_box] |
mov ecx,4 |
cld |
rep movsd |
pop edi |
pop eax |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jz @f |
mov [edi+WDATA.box.height],eax |
@@: |
.clientbox: |
call set_window_clientbox |
call set_window_clientbox |
no_fullscreen_restore: |
mov eax,[edi+WDATA.box.top] ; check Y inside screen |
add eax,[edi+WDATA.box.height] |
cmp eax,[ScreenHeight] |
jbe no_window_sizing |
mov eax,[edi+WDATA.box.left] ; check X inside screen |
add eax,[edi+WDATA.box.width] |
cmp eax,[ScreenWidth] |
jbe no_window_sizing |
mov eax,[ScreenWidth] |
sub eax,[edi+WDATA.box.width] |
mov [edi+WDATA.box.left],eax |
mov eax,[ScreenHeight] |
sub eax,[edi+WDATA.box.height] |
mov [edi+WDATA.box.top],eax |
call set_window_clientbox |
mov eax,[edi+WDATA.box.top] ; check Y inside screen |
add eax,[edi+WDATA.box.height] |
cmp eax,[ScreenHeight] |
jbe no_window_sizing |
mov eax,[edi+WDATA.box.left] ; check X inside screen |
add eax,[edi+WDATA.box.width] |
cmp eax,[ScreenWidth] |
jbe no_window_sizing |
mov eax,[ScreenWidth] |
sub eax,[edi+WDATA.box.width] |
mov [edi+WDATA.box.left],eax |
mov eax,[ScreenHeight] |
sub eax,[edi+WDATA.box.height] |
mov [edi+WDATA.box.top],eax |
call set_window_clientbox |
no_window_sizing: |
popad |
popad |
cmp [reposition],0 |
je retwm |
cmp [reposition],0 |
je retwm |
mov [DONT_DRAW_MOUSE],byte 1 ; no mouse |
mov [DONT_DRAW_MOUSE],byte 1 ; no mouse |
push eax ebx ecx edx |
mov eax,[edi+WDATA.box.left] |
mov ebx,[edi+WDATA.box.top] |
mov ecx,[edi+WDATA.box.width] |
mov edx,[edi+WDATA.box.height] |
add ecx,eax |
add edx,ebx |
call calculatescreen |
push eax ebx ecx edx |
mov eax,[edi+WDATA.box.left] |
mov ebx,[edi+WDATA.box.top] |
mov ecx,[edi+WDATA.box.width] |
mov edx,[edi+WDATA.box.height] |
add ecx,eax |
add edx,ebx |
call calculatescreen |
mov eax,[oldc+BOX.left] |
mov ebx,[oldc+BOX.top] |
mov ecx,[oldc+BOX.width] |
mov edx,[oldc+BOX.height] |
add ecx,eax |
add edx,ebx |
call calculatescreen |
pop edx ecx ebx eax |
mov eax,[oldc+BOX.left] |
mov ebx,[oldc+BOX.top] |
mov ecx,[oldc+BOX.width] |
mov edx,[oldc+BOX.height] |
add ecx,eax |
add edx,ebx |
call calculatescreen |
pop edx ecx ebx eax |
mov eax,edi |
call redrawscreen |
mov eax,edi |
call redrawscreen |
mov [edi+WDATA.fl_redraw],1 |
mov [edi+WDATA.fl_redraw],1 |
mov ecx,100 ; wait to avoid mouse residuals |
mov ecx,100 ; wait to avoid mouse residuals |
waitre2: |
mov [DONT_DRAW_MOUSE],byte 1 |
call checkidle |
cmp [edi+WDATA.fl_redraw],0 |
jz retwm |
loop waitre2 |
mov [DONT_DRAW_MOUSE],byte 1 |
call checkidle |
cmp [edi+WDATA.fl_redraw],0 |
jz retwm |
loop waitre2 |
retwm: |
mov [DONT_DRAW_MOUSE],byte 0 ; mouse pointer |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
mov [MOUSE_DOWN],byte 0 ; react to mouse up/down |
mov [DONT_DRAW_MOUSE],byte 0 ; mouse pointer |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
mov [MOUSE_DOWN],byte 0 ; react to mouse up/down |
mov esi,window_moved |
call sys_msg_board_str |
mov esi,window_moved |
call sys_msg_board_str |
popad |
popad |
ret |
ret |
uglobal |
add_window_data dd 0 |
add_window_data dd 0 |
do_resize_from_corner db 0x0 |
reposition db 0x0 |
latest_window_touch dd 0x0 |
reposition db 0x0 |
latest_window_touch dd 0x0 |
latest_window_touch_delta dd 0x0 |
do_resize db 0x0 |
oldc dd 0x0,0x0,0x0,0x0 |
oldc dd 0x0,0x0,0x0,0x0 |
dlx dd 0x0 |
dly dd 0x0 |
dlxe dd 0x0 |
dlye dd 0x0 |
dlx dd 0x0 |
dly dd 0x0 |
dlxe dd 0x0 |
dlye dd 0x0 |
npx dd 0x0 |
npy dd 0x0 |
npxe dd 0x0 |
npye dd 0x0 |
npx dd 0x0 |
npy dd 0x0 |
npxe dd 0x0 |
npye dd 0x0 |
mpx dd 0x0 |
mpy dd 0x0 |
mpx dd 0x0 |
mpy dd 0x0 |
endg |
; draw negative window frames |
drawwindowframes2: |
pushad |
cli |
jmp drawwindowframes.do |
pushad |
cli |
jmp drawwindowframes.do |
drawwindowframes: |
pushad |
cli |
pushad |
cli |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jnz .ret |
mov eax, [npx] |
cmp eax, [edi+WDATA.box.left] |
jnz .nowndframe |
mov eax, [npxe] |
cmp eax, [edi+WDATA.box.width] |
jnz .nowndframe |
mov eax, [npy] |
cmp eax, [edi+WDATA.box.top] |
jnz .nowndframe |
mov eax, [npye] |
cmp eax, [edi+WDATA.box.height] |
jnz .nowndframe |
xor [edi+WDATA.fl_wdrawn], 2 |
test [edi+WDATA.fl_wdrawn], 4 |
jnz .ret |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jnz .ret |
mov eax, [npx] |
cmp eax, [edi+WDATA.box.left] |
jnz .nowndframe |
mov eax, [npxe] |
cmp eax, [edi+WDATA.box.width] |
jnz .nowndframe |
mov eax, [npy] |
cmp eax, [edi+WDATA.box.top] |
jnz .nowndframe |
mov eax, [npye] |
cmp eax, [edi+WDATA.box.height] |
jnz .nowndframe |
xor [edi+WDATA.fl_wdrawn], 2 |
test [edi+WDATA.fl_wdrawn], 4 |
jnz .ret |
.nowndframe: |
.do: |
mov edi, 1 |
mov ecx, 0x01000000 |
mov eax,[npx] |
shl eax,16 |
add eax,[npx] |
add eax,[npxe] |
add eax,65536*1-1 |
mov ebx,[npy] |
shl ebx,16 |
add ebx,[npy] |
call [draw_line] |
mov edi, 1 |
mov ecx, 0x01000000 |
mov eax,[npx] |
shl eax,16 |
add eax,[npx] |
add eax,[npxe] |
add eax,65536*1-1 |
mov ebx,[npy] |
shl ebx,16 |
add ebx,[npy] |
call [draw_line] |
mov eax,[npx] |
shl eax,16 |
add eax,[npx] |
add eax,[npxe] |
add eax,65536*1-1 |
mov ebx,[npy] |
add ebx,[npye] |
shl ebx,16 |
add ebx,[npy] |
add ebx,[npye] |
call [draw_line] |
mov eax,[npx] |
shl eax,16 |
add eax,[npx] |
add eax,[npxe] |
add eax,65536*1-1 |
mov ebx,[npy] |
add ebx,[npye] |
shl ebx,16 |
add ebx,[npy] |
add ebx,[npye] |
call [draw_line] |
mov eax,[npx] |
shl eax,16 |
add eax,[npx] |
mov ebx,[npy] |
shl ebx,16 |
add ebx,[npy] |
add ebx,[npye] |
call [draw_line] |
mov eax,[npx] |
shl eax,16 |
add eax,[npx] |
mov ebx,[npy] |
shl ebx,16 |
add ebx,[npy] |
add ebx,[npye] |
call [draw_line] |
mov eax,[npx] |
add eax,[npxe] |
shl eax,16 |
add eax,[npx] |
add eax,[npxe] |
mov ebx,[npy] |
shl ebx,16 |
add ebx,[npy] |
add ebx,[npye] |
call [draw_line] |
mov eax,[npx] |
add eax,[npxe] |
shl eax,16 |
add eax,[npx] |
add eax,[npxe] |
mov ebx,[npy] |
shl ebx,16 |
add ebx,[npy] |
add ebx,[npye] |
call [draw_line] |
.ret: |
sti |
popad |
ret |
sti |
popad |
ret |
/kernel/branches/flat_kernel/gui/button.inc |
---|
59,225 → 59,225 |
drawbuttonframes: |
push esi |
push edi |
push eax |
push ebx |
push ecx |
push edx |
push esi |
push edi |
push eax |
push ebx |
push ecx |
push edx |
shr eax,16 |
shr ebx,16 |
mov edx,[TASK_BASE] |
shr eax,16 |
shr ebx,16 |
mov edx,[TASK_BASE] |
add eax,[edx-twdw + WDATA.box.left] |
add ebx,[edx-twdw + WDATA.box.top] |
mov cx,ax |
mov dx,bx |
shl eax,16 |
shl ebx,16 |
mov ax,cx |
mov bx,dx |
add ax,word [esp+12] |
mov esi,ebx |
mov edi,0 |
mov ecx,[esp+0] |
call incecx |
call [draw_line] |
mov cx,ax |
mov dx,bx |
shl eax,16 |
shl ebx,16 |
mov ax,cx |
mov bx,dx |
add ax,word [esp+12] |
mov esi,ebx |
mov edi,0 |
mov ecx,[esp+0] |
call incecx |
call [draw_line] |
movzx edx,word [esp+8] |
add ebx,edx |
shl edx,16 |
add ebx,edx |
mov ecx,[esp+0] |
call dececx |
call [draw_line] |
movzx edx,word [esp+8] |
add ebx,edx |
shl edx,16 |
add ebx,edx |
mov ecx,[esp+0] |
call dececx |
call [draw_line] |
mov ebx,esi |
push edx |
mov edx,eax |
shr edx,16 |
mov ax,dx |
mov edx,ebx |
shr edx,16 |
mov bx,dx |
mov dx,[esp+8+4] |
add bx,dx |
pop edx |
mov edi,0 |
mov ecx,[esp+0] |
call incecx |
call [draw_line] |
mov ebx,esi |
push edx |
mov edx,eax |
shr edx,16 |
mov ax,dx |
mov edx,ebx |
shr edx,16 |
mov bx,dx |
mov dx,[esp+8+4] |
add bx,dx |
pop edx |
mov edi,0 |
mov ecx,[esp+0] |
call incecx |
call [draw_line] |
mov esi,edx |
mov dx,[esp+12] |
add ax,dx |
shl edx,16 |
add eax,edx |
add ebx,1*65536 |
mov edx,esi |
mov ecx,[esp+0] |
call dececx |
call [draw_line] |
mov esi,edx |
mov dx,[esp+12] |
add ax,dx |
shl edx,16 |
add eax,edx |
add ebx,1*65536 |
mov edx,esi |
mov ecx,[esp+0] |
call dececx |
call [draw_line] |
pop edx |
pop ecx |
pop ebx |
pop eax |
pop edi |
pop esi |
pop edx |
pop ecx |
pop ebx |
pop eax |
pop edi |
pop esi |
ret |
ret |
button_dececx: |
cmp [buttontype],dword 1 |
jne .finish |
cmp [buttontype],dword 1 |
jne .finish |
; je bdece |
; ret |
; bdece: |
push eax |
mov eax,0x01 |
cmp edi,20 |
jg @f |
mov eax,0x02 |
push eax |
mov eax,0x01 |
cmp edi,20 |
jg @f |
mov eax,0x02 |
@@: |
test ecx,0xff |
jz @f |
sub ecx,eax |
test ecx,0xff |
jz @f |
sub ecx,eax |
@@: |
shl eax,8 |
test ecx,0xff00 |
jz @f |
sub ecx,eax |
shl eax,8 |
test ecx,0xff00 |
jz @f |
sub ecx,eax |
@@: |
shl eax,8 |
test ecx,0xff0000 |
jz @f |
sub ecx,eax |
shl eax,8 |
test ecx,0xff0000 |
jz @f |
sub ecx,eax |
@@: |
pop eax |
pop eax |
.finish: |
ret |
ret |
sys_button: |
push edi |
mov edi,[CURRENT_TASK] |
shl edi,8 |
rol eax,16 |
add ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.left] |
rol eax,16 |
rol ebx,16 |
add bx,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top] |
rol ebx,16 |
pop edi |
push edi |
mov edi,[CURRENT_TASK] |
shl edi,8 |
rol eax,16 |
add ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.left] |
rol eax,16 |
rol ebx,16 |
add bx,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top] |
rol ebx,16 |
pop edi |
.forced: |
test ecx,0x80000000 |
jnz remove_button |
test ecx,0x80000000 |
jnz remove_button |
push esi |
push edi |
push eax ; <x,xs> |
push ebx ; <y,ys> |
push ecx ; <id> |
push edx |
push esi |
push edi |
push eax ; <x,xs> |
push ebx ; <y,ys> |
push ecx ; <id> |
push edx |
or ax,ax |
jle noaddbutt |
or bx,bx |
jle noaddbutt |
or ax,ax |
jle noaddbutt |
or bx,bx |
jle noaddbutt |
test ecx,0x40000000 |
jnz button_no_draw |
test ecx,0x40000000 |
jnz button_no_draw |
pushad ; button body |
push ebx |
shr eax,16 |
shr ebx,16 |
mov edx,[TASK_BASE] |
mov esi,[edx-twdw + WDATA.box.left] |
mov edi,[edx-twdw + WDATA.box.top] |
add eax,esi |
add ebx,edi |
mov cx,ax |
mov dx,bx |
shl eax,16 |
shl ebx,16 |
mov ax,cx |
mov bx,dx |
movzx ecx,word [4+32+esp+12] |
add eax,ecx |
mov ecx,[4+32+esp+0] |
cmp [buttontype],dword 0 |
je @f |
call incecx2 |
pushad ; button body |
push ebx |
shr eax,16 |
shr ebx,16 |
mov edx,[TASK_BASE] |
mov esi,[edx-twdw + WDATA.box.left] |
mov edi,[edx-twdw + WDATA.box.top] |
add eax,esi |
add ebx,edi |
mov cx,ax |
mov dx,bx |
shl eax,16 |
shl ebx,16 |
mov ax,cx |
mov bx,dx |
movzx ecx,word [4+32+esp+12] |
add eax,ecx |
mov ecx,[4+32+esp+0] |
cmp [buttontype],dword 0 |
je @f |
call incecx2 |
@@: |
movzx edi,word [esp] |
movzx edi,word [esp] |
pop edx |
and edx, 0xFFFF |
pop edx |
and edx, 0xFFFF |
.newline: |
call button_dececx |
push edi |
xor edi, edi |
call [draw_line] |
pop edi |
add ebx,1*65536+1 ; [ y start | y end ] |
dec edx |
jnz .newline |
popad |
call button_dececx |
push edi |
xor edi, edi |
call [draw_line] |
pop edi |
add ebx,1*65536+1 ; [ y start | y end ] |
dec edx |
jnz .newline |
popad |
call drawbuttonframes |
call drawbuttonframes |
button_no_draw: |
and ecx,0xffff |
and ecx,0xffff |
mov edi,[BTN_ADDR] |
movzx eax,word [edi] |
cmp eax,max_buttons |
jge noaddbutt |
inc eax |
mov [edi],ax |
mov edi,[BTN_ADDR] |
movzx eax,word [edi] |
cmp eax,max_buttons |
jge noaddbutt |
inc eax |
mov [edi],ax |
shl eax,4 |
add eax,edi |
shl eax,4 |
add eax,edi |
mov bx,[CURRENT_TASK] |
mov [eax],bx |
mov bx,[CURRENT_TASK] |
mov [eax],bx |
add eax,2 ; save button id number |
mov ebx,[esp+4] |
mov [eax],bx ; bits 0-15 |
shr ebx,16 |
mov [eax-2+0xc],bx; bits 16-31 |
add eax,2 ; x start |
mov bx,[esp+12+2] |
mov [eax],bx |
add eax,2 ; x size |
mov bx,[esp+12+0] |
mov [eax],bx |
add eax,2 ; y start |
mov bx,[esp+8+2] |
mov [eax],bx |
add eax,2 ; y size |
mov bx,[esp+8+0] |
mov [eax],bx |
add eax,2 ; save button id number |
mov ebx,[esp+4] |
mov [eax],bx ; bits 0-15 |
shr ebx,16 |
mov [eax-2+0xc],bx; bits 16-31 |
add eax,2 ; x start |
mov bx,[esp+12+2] |
mov [eax],bx |
add eax,2 ; x size |
mov bx,[esp+12+0] |
mov [eax],bx |
add eax,2 ; y start |
mov bx,[esp+8+2] |
mov [eax],bx |
add eax,2 ; y size |
mov bx,[esp+8+0] |
mov [eax],bx |
noaddbutt: |
pop edx |
pop ecx |
pop ebx |
pop eax |
pop edi |
pop esi |
pop edx |
pop ecx |
pop ebx |
pop eax |
pop edi |
pop esi |
ret |
ret |
remove_button: |
294,7 → 294,7 |
rnewba: |
dec bx |
jz rnmba |
jz rnmba |
add eax,0x10 |
323,44 → 323,44 |
find_pressed_button_frames: |
pushad |
pushad |
movzx ebx,word [eax+0] |
shl ebx,5 |
add ebx,window_data |
movzx ebx,word [eax+0] |
shl ebx,5 |
add ebx,window_data |
mov ecx, [ebx+ WDATA.box.left] ; window x start |
movzx edx,word [eax+4] ; button x start |
add ecx,edx |
push ecx |
movzx edx,word [eax+4] ; button x start |
add ecx,edx |
push ecx |
mov dx,[eax+6] ; button x size |
add cx,dx |
mov esi,ecx |
inc esi |
mov ecx, [ebx+WDATA.box.top] ; window y start |
mov dx,[eax+8] ; button y start |
add ecx,edx |
mov ebx,ecx |
mov dx,[eax+10] ; button y size |
add dx,cx |
inc dx |
mov dx,[eax+6] ; button x size |
add cx,dx |
mov esi,ecx |
inc esi |
mov ecx, [ebx+WDATA.box.top] ; window y start |
mov dx,[eax+8] ; button y start |
add ecx,edx |
mov ebx,ecx |
mov dx,[eax+10] ; button y size |
add dx,cx |
inc dx |
pop eax |
pop eax |
; eax x beginning |
; ebx y beginning |
; esi x end |
; edx y end |
; ecx color |
; eax x beginning |
; ebx y beginning |
; esi x end |
; edx y end |
; ecx color |
mov [pressed_button_eax],eax |
mov [pressed_button_ebx],ebx |
mov [pressed_button_ecx],ecx |
mov [pressed_button_edx],edx |
mov [pressed_button_esi],esi |
mov [pressed_button_eax],eax |
mov [pressed_button_ebx],ebx |
mov [pressed_button_ecx],ecx |
mov [pressed_button_edx],edx |
mov [pressed_button_esi],esi |
popad |
ret |
popad |
ret |
uglobal |
pressed_button_eax dd 0 |
373,70 → 373,70 |
; negative button image |
negativebutton: |
; If requested, do not display button |
; boarder on press. |
test ebx,0x20000000 |
jz draw_negative_button |
ret |
; If requested, do not display button |
; boarder on press. |
test ebx,0x20000000 |
jz draw_negative_button |
ret |
draw_negative_button: |
pushad |
pushad |
mov eax,[pressed_button_eax] |
mov ebx,[pressed_button_ebx] |
mov ecx,[pressed_button_ecx] |
mov edx,[pressed_button_edx] |
mov esi,[pressed_button_esi] |
mov ecx,0x01000000 |
mov eax,[pressed_button_eax] |
mov ebx,[pressed_button_ebx] |
mov ecx,[pressed_button_ecx] |
mov edx,[pressed_button_edx] |
mov esi,[pressed_button_esi] |
mov ecx,0x01000000 |
dec edx |
push edx |
inc edx |
dec esi |
push esi |
inc esi |
dec edx |
push edx |
inc edx |
dec esi |
push esi |
inc esi |
push eax |
push ebx |
push ecx |
push edx |
push edi |
push eax |
push ebx |
push ecx |
push edx |
push edi |
call [disable_mouse] |
call [disable_mouse] |
bdbnewline: |
mov edi,1 ; force |
cmp eax,[esp+16] |
jz bneg |
cmp eax,[esp+20] |
jz bneg |
cmp ebx,[esp+12] |
jz bneg |
cmp ebx,[esp+24] |
jnz nbneg |
mov edi,1 ; force |
cmp eax,[esp+16] |
jz bneg |
cmp eax,[esp+20] |
jz bneg |
cmp ebx,[esp+12] |
jz bneg |
cmp ebx,[esp+24] |
jnz nbneg |
; jz bneg |
; jmp nbneg |
bneg: |
;;;call [disable_mouse] |
call [putpixel] |
;;;call [disable_mouse] |
call [putpixel] |
nbneg: |
inc eax |
cmp eax,esi |
jnz bdbnewline |
mov eax,[esp+16] |
inc ebx |
cmp ebx,edx |
jnz bdbnewline |
inc eax |
cmp eax,esi |
jnz bdbnewline |
mov eax,[esp+16] |
inc ebx |
cmp ebx,edx |
jnz bdbnewline |
add esp,28 |
add esp,28 |
popad |
popad |
ret |
ret |
; check buttons |
458,11 → 458,9 |
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed |
jnz @f |
;..................................... start 1/5 : modified by vhanla ............................. |
mov [bPressedMouseXY_B],0 |
;..................................... end 1/5 : modified by vhanla ............................. |
ret |
@@: |
pushad |
xor esi, esi |
474,20 → 472,6 |
ret |
@@: |
;..................................... start 2/5 : modified by vhanla ............................. |
;here i catch the coordinates when the mouse's button is clicked |
push ax |
cmp [bPressedMouseXY_B],0;FALSE |
jnz @f |
mov [bPressedMouseXY_B],1;TRUE - it was already clicked |
mov ax,[MOUSE_X] |
mov [mx],ax |
mov ax,[MOUSE_Y] |
mov [my],ax |
@@: |
pop ax |
;and it is only refreshed after the mouse's button release |
;..................................... end 2/5 : modified by vhanla ............................. |
push esi |
inc edx |
501,7 → 485,7 |
cmp edx,esi |
jge bch |
popad ; no button pressed |
popad ; no button pressed |
ret |
bch: |
512,6 → 496,10 |
shl eax,4 |
add eax,edi |
;......................start 1/2 : modified by vhanla ............................. |
mov [buttonid],eax |
;......................end 1/2 : modified by vhanla ............................. |
; check that button is at top of windowing stack |
movzx ebx,word [eax] |
524,8 → 512,8 |
movzx ebx,word [eax+0] |
shl ebx,5 |
test [ebx+window_data+WDATA.fl_wstate],WSTATE_MINIMIZED |
jnz buttonnewcheck |
test [ebx+window_data+WDATA.fl_wstate],WSTATE_MINIMIZED |
jnz buttonnewcheck |
; add ebx,window_data |
; mov ecx,[window_data+ebx+8] ; window end X |
539,7 → 527,7 |
jge buttonnewcheck |
; check coordinates |
; mouse x >= button x ? |
; mouse x >= button x ? |
movzx ebx,word [eax+0] |
shl ebx,5 |
add ebx,window_data |
546,34 → 534,30 |
mov ecx, [ebx+WDATA.box.left] ; window x start |
movzx edx,word [eax+4] ; button x start |
add edx,ecx |
;..................................... start 3/5 : modified by vhanla ............................. |
mov cx,[mx] ;mov cx,[MOUSE_X] |
;..................................... end 3/5 : modified by vhanla ............................. |
mov cx,[MOUSE_X] |
cmp edx,ecx |
jg buttonnewcheck |
jg buttonnewcheck |
movzx ebx,word [eax+6] ; button x size |
add edx,ebx |
cmp ecx,edx |
jg buttonnewcheck |
jg buttonnewcheck |
; mouse y >= button y ? |
; mouse y >= button y ? |
movzx ebx,word [eax+0] |
shl ebx,5 |
add ebx,window_data |
mov ecx, [ebx+WDATA.box.top] ; window y start |
mov ecx, [ebx+WDATA.box.top] ; window y start |
movzx edx,word [eax+8] ; button y start |
add edx,ecx |
;..................................... start 4/5 : modified by vhanla ............................. |
mov cx,[my] ;mov cx,[MOUSE_Y] |
;..................................... start 4/5 : modified by vhanla ............................. |
mov cx,[MOUSE_Y] |
cmp edx,ecx |
jg buttonnewcheck |
jg buttonnewcheck |
movzx ebx,word [eax+10] ; button y size |
add edx,ebx |
cmp ecx,edx |
jg buttonnewcheck |
jg buttonnewcheck |
; mouse on button |
580,9 → 564,9 |
pop edx |
pop esi |
mov bx,[eax+0xc] ; button id : bits 16-31 |
mov bx,[eax+0xc] ; button id : bits 16-31 |
shl ebx,16 |
mov bx,[eax+2] ; button id : bits 00-16 |
mov bx,[eax+2] ; button id : bits 00-16 |
push ebx |
mov [MOUSE_DOWN],byte 1 ; no mouse down checks |
607,60 → 591,58 |
call negativebutton |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
;..................................... start 5/5 : modified by vhanla ............................. |
;..................................... start 2/2 : modified by vhanla ............................. |
; check coordinates |
jmp @f |
mx dw 0x0 ; keeps the x mouse's position when it was clicked |
my dw 0x0 ; keeps the y mouse's position when it was clicked |
bPressedMouseXY_B db 0x0 |
@@: |
jmp afterbuttonid |
buttonid dd 0x0 ;here a will backup the eax value |
afterbuttonid: |
pusha |
; mouse x >= button x ? |
movzx ebx,word [eax+0] |
shl ebx,5 |
add ebx,window_data |
mov ecx, [ebx+WDATA.box.left] ; window x start |
shl ebx,5 |
add ebx,window_data |
mov ecx, [ebx+WDATA.box.left] ; window x start |
movzx edx,word [eax+4] ; button x start |
add edx,ecx |
mov cx,[MOUSE_X] |
cmp edx,ecx |
jg no_on_button ;if we release the pointer out of the button area |
add edx,ecx |
mov cx,[MOUSE_X] |
cmp edx,ecx |
jg no_on_button ;if we release the pointer out of the button area |
movzx ebx,word [eax+6] ; button x size |
add edx,ebx |
cmp ecx,edx |
jg no_on_button |
add edx,ebx |
cmp ecx,edx |
jg no_on_button |
; mouse y >= button y ? |
; mouse y >= button y ? |
movzx ebx,word [eax+0] |
shl ebx,5 |
add ebx,window_data |
mov ecx, [ebx+WDATA.box.top] ; window y start |
shl ebx,5 |
add ebx,window_data |
mov ecx, [ebx+WDATA.box.top] ; window y start |
movzx edx,word [eax+8] ; button y start |
add edx,ecx |
mov cx,[MOUSE_Y] |
cmp edx,ecx |
jg no_on_button |
add edx,ecx |
mov cx,[MOUSE_Y] |
cmp edx,ecx |
jg no_on_button |
movzx ebx,word [eax+10] ; button y size |
add edx,ebx |
cmp ecx,edx |
jg no_on_button |
add edx,ebx |
cmp ecx,edx |
jg no_on_button |
popa |
mov [BTN_COUNT],byte 1 ; no of buttons in buffer |
pop ebx |
mov [BTN_BUFF],ebx ; lets put the button id in buffer |
mov [BTN_COUNT],byte 1 ; no of buttons in buffer |
pop ebx |
mov [BTN_BUFF],ebx ; lets put the button id in buffer |
push ebx |
pusha |
jmp yes_on_button |
no_on_button: |
mov [BTN_COUNT],byte 0 ; no of buttons in buffer |
mov [BTN_COUNT],byte 0 ; no of buttons in buffer |
yes_on_button: |
mov [MOUSE_DOWN],byte 0 ; mouse down -> do not draw |
mov [MOUSE_DOWN],byte 0 ; mouse down -> do not draw |
popa |
pop ebx |
popa |
ret |
;..................................... end 5/5 : modified by vhanla ................................ |
;..................................... end 2/2 : modified by vhanla ................................ |
/kernel/trunk/gui/window.inc |
---|
1,44 → 1,44 |
get_titlebar_height: ; edi = window draw_data pointer |
mov al,[edi+WDATA.fl_wstyle] |
and al,0x0F |
cmp al,0x03 |
jne @f |
mov eax,[_skinh] |
ret |
@@: mov eax,21 |
ret |
mov al,[edi+WDATA.fl_wstyle] |
and al,0x0F |
cmp al,0x03 |
jne @f |
mov eax,[_skinh] |
ret |
@@: mov eax,21 |
ret |
get_rolledup_height: ; edi = window draw_data pointer |
mov al,[edi+WDATA.fl_wstyle] |
and al,0x0F |
cmp al,0x03 |
jne @f |
mov eax,[_skinh] |
add eax,3 |
ret |
@@: or al,al |
jnz @f |
mov eax,21 |
ret |
@@: mov eax,21+2 |
ret |
mov al,[edi+WDATA.fl_wstyle] |
and al,0x0F |
cmp al,0x03 |
jne @f |
mov eax,[_skinh] |
add eax,3 |
ret |
@@: or al,al |
jnz @f |
mov eax,21 |
ret |
@@: mov eax,21+2 |
ret |
setwindowdefaults: |
pushad |
pushad |
xor eax,eax |
mov ecx,WIN_STACK |
xor eax,eax |
mov ecx,WIN_STACK |
@@: |
inc eax |
add ecx,2 |
mov [ecx+0x000],ax ; process no |
mov [ecx+0x400],ax ; positions in stack |
cmp ecx,WIN_POS-2 ; the more high, the more surface |
jnz @b |
inc eax |
add ecx,2 |
mov [ecx+0x000],ax ; process no |
mov [ecx+0x400],ax ; positions in stack |
cmp ecx,WIN_POS-2 ; the more high, the more surface |
jnz @b |
popad |
ret |
popad |
ret |
51,85 → 51,85 |
; ÷àñòåé îêîí âûçâàòü setscreen |
align 4 |
calculatescreen: |
pushad |
pushfd |
cli |
pushad |
pushfd |
cli |
push edx ecx ebx eax |
push edx ecx ebx eax |
mov esi, 1 |
call setscreen |
mov esi, 1 |
call setscreen |
mov ebp, [TASK_COUNT] ; number of processes |
cmp ebp, 1 |
jbe .finish |
align 4 |
mov ebp, [TASK_COUNT] ; number of processes |
cmp ebp, 1 |
jbe .finish |
align 4 |
.new_wnd: |
movzx edi, word [WIN_POS + esi * 2] |
shl edi, 5 |
movzx edi, word [WIN_POS + esi * 2] |
shl edi, 5 |
cmp [CURRENT_TASK+edi+TASKDATA.state], byte 9 |
je .not_wnd |
cmp [CURRENT_TASK+edi+TASKDATA.state], byte 9 |
je .not_wnd |
add edi, window_data |
test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
jnz .not_wnd |
add edi, window_data |
test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
jnz .not_wnd |
mov eax,[edi+WDATA.box.left] |
cmp eax, [esp+RECT.right] |
ja .out_of_bounds |
mov ebx,[edi+WDATA.box.top] |
cmp ebx, [esp+RECT.bottom] |
ja .out_of_bounds |
mov ecx,[edi+WDATA.box.width] |
add ecx, eax |
cmp ecx, [esp+RECT.left] |
jb .out_of_bounds |
mov edx,[edi+WDATA.box.height] |
add edx, ebx |
cmp edx, [esp+RECT.top] |
jb .out_of_bounds |
mov eax,[edi+WDATA.box.left] |
cmp eax, [esp+RECT.right] |
ja .out_of_bounds |
mov ebx,[edi+WDATA.box.top] |
cmp ebx, [esp+RECT.bottom] |
ja .out_of_bounds |
mov ecx,[edi+WDATA.box.width] |
add ecx, eax |
cmp ecx, [esp+RECT.left] |
jb .out_of_bounds |
mov edx,[edi+WDATA.box.height] |
add edx, ebx |
cmp edx, [esp+RECT.top] |
jb .out_of_bounds |
cmp eax, [esp+RECT.left] |
jae @f |
mov eax, [esp+RECT.left] |
jae @f |
mov eax, [esp+RECT.left] |
@@: |
cmp ebx, [esp+RECT.top] |
jae @f |
mov ebx, [esp+RECT.top] |
jae @f |
mov ebx, [esp+RECT.top] |
@@: |
cmp ecx, [esp+RECT.right] |
jbe @f |
mov ecx, [esp+RECT.right] |
jbe @f |
mov ecx, [esp+RECT.right] |
@@: |
cmp edx, [esp+RECT.bottom] |
jbe @f |
mov edx, [esp+RECT.bottom] |
jbe @f |
mov edx, [esp+RECT.bottom] |
@@: |
push esi |
movzx esi, word [WIN_POS + esi * 2] |
call setscreen |
pop esi |
push esi |
movzx esi, word [WIN_POS + esi * 2] |
call setscreen |
pop esi |
.not_wnd: |
.out_of_bounds: |
inc esi |
dec ebp |
jnz .new_wnd |
inc esi |
dec ebp |
jnz .new_wnd |
.finish: |
pop eax ebx ecx edx |
popfd |
popad |
popfd |
popad |
ret |
virtual at esp |
ff_x dd ? |
ff_y dd ? |
ff_x dd ? |
ff_y dd ? |
ff_width dd ? |
ff_xsz dd ? |
ff_ysz dd ? |
146,54 → 146,54 |
; esi process number |
pushad |
; \begin{diamond}[29.08.2006] |
cmp esi, 1 |
jz @f |
mov edi, esi |
shl edi, 5 |
cmp [edi+window_data+WDATA.box.width], 0 |
jnz @f |
cmp [edi+window_data+WDATA.box.height], 0 |
jz .ret |
cmp esi, 1 |
jz @f |
mov edi, esi |
shl edi, 5 |
cmp [edi+window_data+WDATA.box.width], 0 |
jnz @f |
cmp [edi+window_data+WDATA.box.height], 0 |
jz .ret |
@@: |
; \end{diamond}[29.08.2006] |
mov edi, esi ;;;word [esi*2+WIN_POS] |
shl edi, 8 |
add edi, SLOT_BASE ; address of random shaped window area |
cmp [edi+APPDATA.wnd_shape], dword 0 |
jne .free_form |
mov edi, esi ;;;word [esi*2+WIN_POS] |
shl edi, 8 |
add edi, SLOT_BASE ; address of random shaped window area |
cmp [edi+APPDATA.wnd_shape], dword 0 |
jne .free_form |
; get x&y size |
sub ecx, eax |
sub edx, ebx |
inc ecx |
inc edx |
; get x&y size |
sub ecx, eax |
sub edx, ebx |
inc ecx |
inc edx |
; get WinMap start |
mov edi, [ScreenWidth] ; screen_sx |
inc edi |
imul edi, ebx |
add edi, eax |
add edi, WinMapAddress |
; get WinMap start |
mov edi, [ScreenWidth] ; screen_sx |
inc edi |
imul edi, ebx |
add edi, eax |
add edi, WinMapAddress |
.new_y: |
push ecx ; sx |
push edx |
push ecx ; sx |
push edx |
mov edx, esi |
align 4 |
mov edx, esi |
align 4 |
.new_x: |
mov byte [edi], dl |
inc edi |
dec ecx |
jnz .new_x |
mov byte [edi], dl |
inc edi |
dec ecx |
jnz .new_x |
pop edx |
pop ecx |
add edi, [ScreenWidth] |
inc edi |
sub edi, ecx |
dec edx |
jnz .new_y |
pop edx |
pop ecx |
add edi, [ScreenWidth] |
inc edi |
sub edi, ecx |
dec edx |
jnz .new_y |
.ret: |
popad |
ret |
200,105 → 200,105 |
.read_byte: |
;eax - address |
;esi - slot |
push eax |
push ebx |
push ecx |
push edx |
mov edx,eax |
mov eax,esi |
lea ebx,[esp+12] |
mov ecx,1 |
call read_process_memory |
pop edx |
pop ecx |
pop ebx |
pop eax |
ret |
push eax |
push ebx |
push ecx |
push edx |
mov edx,eax |
mov eax,esi |
lea ebx,[esp+12] |
mov ecx,1 |
call read_process_memory |
pop edx |
pop ecx |
pop ebx |
pop eax |
ret |
.free_form: |
; for (y=0; y <= x_size; y++) |
; for (x=0; x <= x_size; x++) |
; if (shape[coord(x,y,scale)]==1) |
; set_pixel(x, y, process_number); |
; for (y=0; y <= x_size; y++) |
; for (x=0; x <= x_size; x++) |
; if (shape[coord(x,y,scale)]==1) |
; set_pixel(x, y, process_number); |
sub ecx, eax |
sub edx, ebx |
inc ecx |
inc edx |
sub ecx, eax |
sub edx, ebx |
inc ecx |
inc edx |
push dword [edi+APPDATA.wnd_shape_scale] ; push scale first -> for loop |
push dword [edi+APPDATA.wnd_shape_scale] ; push scale first -> for loop |
; get WinMap start -> ebp |
push eax |
mov eax, [ScreenWidth] ; screen_sx |
inc eax |
imul eax, ebx |
add eax, [esp] |
add eax, WinMapAddress |
mov ebp, eax |
; get WinMap start -> ebp |
push eax |
mov eax, [ScreenWidth] ; screen_sx |
inc eax |
imul eax, ebx |
add eax, [esp] |
add eax, WinMapAddress |
mov ebp, eax |
mov edi, [edi+APPDATA.wnd_shape] |
pop eax |
mov edi, [edi+APPDATA.wnd_shape] |
pop eax |
; eax = x_start |
; ebx = y_start |
; ecx = x_size |
; edx = y_size |
; esi = process_number |
; edi = &shape |
; [scale] |
push edx ecx ; for loop - x,y size |
; eax = x_start |
; ebx = y_start |
; ecx = x_size |
; edx = y_size |
; esi = process_number |
; edi = &shape |
; [scale] |
push edx ecx ; for loop - x,y size |
mov ecx, esi |
shl ecx, 5 |
mov edx, [window_data+ecx+WDATA.box.top] |
push [window_data+ecx+WDATA.box.width] ; for loop - width |
mov ecx, [window_data+ecx+WDATA.box.left] |
sub ebx, edx |
sub eax, ecx |
push ebx eax ; for loop - x,y |
mov ecx, esi |
shl ecx, 5 |
mov edx, [window_data+ecx+WDATA.box.top] |
push [window_data+ecx+WDATA.box.width] ; for loop - width |
mov ecx, [window_data+ecx+WDATA.box.left] |
sub ebx, edx |
sub eax, ecx |
push ebx eax ; for loop - x,y |
add [ff_xsz], eax |
add [ff_ysz], ebx |
add [ff_xsz], eax |
add [ff_ysz], ebx |
mov ebx, [ff_y] |
mov ebx, [ff_y] |
.ff_new_y: |
mov edx, [ff_x] |
mov edx, [ff_x] |
.ff_new_x: |
; -- body -- |
mov ecx, [ff_scale] |
mov eax, [ff_width] |
inc eax |
shr eax, cl |
push ebx edx |
shr ebx, cl |
shr edx, cl |
imul eax, ebx |
add eax, edx |
pop edx ebx |
add eax, edi |
call .read_byte |
test al,al |
jz @f |
mov eax, esi |
mov [ebp], al |
; -- body -- |
mov ecx, [ff_scale] |
mov eax, [ff_width] |
inc eax |
shr eax, cl |
push ebx edx |
shr ebx, cl |
shr edx, cl |
imul eax, ebx |
add eax, edx |
pop edx ebx |
add eax, edi |
call .read_byte |
test al,al |
jz @f |
mov eax, esi |
mov [ebp], al |
@@: |
; -- end body -- |
inc ebp |
inc edx |
cmp edx, [ff_xsz] |
jb .ff_new_x |
sub ebp, [ff_xsz] |
add ebp, [ff_x] |
add ebp, [ScreenWidth] ; screen.x |
inc ebp |
inc ebx |
cmp ebx, [ff_ysz] |
jb .ff_new_y |
; -- end body -- |
inc ebp |
inc edx |
cmp edx, [ff_xsz] |
jb .ff_new_x |
sub ebp, [ff_xsz] |
add ebp, [ff_x] |
add ebp, [ScreenWidth] ; screen.x |
inc ebp |
inc ebx |
cmp ebx, [ff_ysz] |
jb .ff_new_y |
add esp, 24 |
add esp, 24 |
popad |
ret |
339,7 → 339,7 |
pushad |
test eax, eax ; redraw display |
test eax, eax ; redraw display |
jnz dspl0 |
test ebx, ebx |
jnz dspl0 |
409,105 → 409,105 |
ret |
no_skin_height: |
cmp eax,5 ; get screen workarea |
jne no_get_workarea |
popad |
mov eax,[screen_workarea.left-2] |
mov ax,word[screen_workarea.right] |
mov [esp+36],eax |
mov eax,[screen_workarea.top-2] |
mov ax,word[screen_workarea.bottom] |
mov [esp+24],eax |
ret |
cmp eax,5 ; get screen workarea |
jne no_get_workarea |
popad |
mov eax,[screen_workarea.left-2] |
mov ax,word[screen_workarea.right] |
mov [esp+36],eax |
mov eax,[screen_workarea.top-2] |
mov ax,word[screen_workarea.bottom] |
mov [esp+24],eax |
ret |
no_get_workarea: |
cmp eax,6 ; set screen workarea |
jne no_set_workarea |
movsx eax,word[esp+16+2] |
movsx ebx,word[esp+16] |
cmp eax,ebx |
jge .lp1 |
or eax,eax;[ScreenWidth] |
jl @f |
mov [screen_workarea.left],eax |
@@: cmp ebx,[ScreenWidth] |
jg .lp1 |
mov [screen_workarea.right],ebx |
.lp1: movsx eax,word[esp+24+2] |
movsx ebx,word[esp+24] |
cmp eax,ebx |
jge .lp2 |
or eax,eax;[0xFE04] |
jl @f |
mov [screen_workarea.top],eax |
@@: cmp ebx,[ScreenHeight] |
jg .lp2 |
mov [screen_workarea.bottom],ebx |
.lp2: call repos_windows |
mov eax, 0 |
mov ebx, 0 |
mov ecx, [ScreenWidth] |
mov edx, [ScreenHeight] |
cmp eax,6 ; set screen workarea |
jne no_set_workarea |
movsx eax,word[esp+16+2] |
movsx ebx,word[esp+16] |
cmp eax,ebx |
jge .lp1 |
or eax,eax;[ScreenWidth] |
jl @f |
mov [screen_workarea.left],eax |
@@: cmp ebx,[ScreenWidth] |
jg .lp1 |
mov [screen_workarea.right],ebx |
.lp1: movsx eax,word[esp+24+2] |
movsx ebx,word[esp+24] |
cmp eax,ebx |
jge .lp2 |
or eax,eax;[0xFE04] |
jl @f |
mov [screen_workarea.top],eax |
@@: cmp ebx,[ScreenHeight] |
jg .lp2 |
mov [screen_workarea.bottom],ebx |
.lp2: call repos_windows |
mov eax, 0 |
mov ebx, 0 |
mov ecx, [ScreenWidth] |
mov edx, [ScreenHeight] |
call calculatescreen |
; jmp redraw_screen_direct |
.exit: |
popad |
ret |
popad |
ret |
no_set_workarea: |
cmp eax,7 ; get skin margins |
jne no_get_skinmargins |
popad |
mov eax,dword[_skinmargins+0] |
mov [esp+36],eax |
mov eax,dword[_skinmargins+4] |
mov [esp+24],eax |
ret |
cmp eax,7 ; get skin margins |
jne no_get_skinmargins |
popad |
mov eax,dword[_skinmargins+0] |
mov [esp+36],eax |
mov eax,dword[_skinmargins+4] |
mov [esp+24],eax |
ret |
no_get_skinmargins: |
cmp eax,8 ; set window skin |
jne no_set_skin |
mov eax,ebx |
mov edi,[TASK_BASE] |
add ebx,[edi+TASKDATA.mem_start] ; abs start of info block |
pushd [ebx+0] [ebx+4] [ebx+8] [ebx+12] |
mov dword[ebx+0],0 ; read |
mov dword[ebx+4],0 ; from the beginning |
mov dword[ebx+8],64 ; 32 KBytes maximum |
mov ecx,skin_data+64*512 |
sub ecx,[edi+0x10] |
mov dword[ebx+12],ecx ; destination |
push eax |
pushad |
call file_system |
popad |
pop eax |
popd [ebx+12] [ebx+8] [ebx+4] [ebx+0] |
cmp eax,ERROR_SUCCESS |
je @f |
cmp eax,ERROR_END_OF_FILE |
jne .exit |
@@: cmp [skin_data+64*512+SKIN_HEADER.ident],'SKIN' |
mov eax,ERROR_UNKNOWN_FS |
jne .exit |
mov esi,skin_data+64*512 |
mov edi,skin_data |
mov ecx,(64*512)/4 |
rep movsd |
call parse_skin_data |
cmp eax,8 ; set window skin |
jne no_set_skin |
mov eax,ebx |
mov edi,[TASK_BASE] |
add ebx,[edi+TASKDATA.mem_start] ; abs start of info block |
pushd [ebx+0] [ebx+4] [ebx+8] [ebx+12] |
mov dword[ebx+0],0 ; read |
mov dword[ebx+4],0 ; from the beginning |
mov dword[ebx+8],64 ; 32 KBytes maximum |
mov ecx,skin_data+64*512 |
sub ecx,[edi+0x10] |
mov dword[ebx+12],ecx ; destination |
push eax |
pushad |
call file_system |
popad |
pop eax |
popd [ebx+12] [ebx+8] [ebx+4] [ebx+0] |
cmp eax,ERROR_SUCCESS |
je @f |
cmp eax,ERROR_END_OF_FILE |
jne .exit |
@@: cmp [skin_data+64*512+SKIN_HEADER.ident],'SKIN' |
mov eax,ERROR_UNKNOWN_FS |
jne .exit |
mov esi,skin_data+64*512 |
mov edi,skin_data |
mov ecx,(64*512)/4 |
rep movsd |
call parse_skin_data |
pushad |
mov eax, 0 |
mov ebx, 0 |
mov ecx, [ScreenWidth] |
mov edx, [ScreenHeight] |
call calculatescreen |
mov eax, 0 |
mov ebx, 0 |
mov ecx, [ScreenWidth] |
mov edx, [ScreenHeight] |
call calculatescreen |
popad |
mov dword[esp+32+36],0 |
jmp redraw_screen_direct |
mov dword[esp+32+36],0 |
jmp redraw_screen_direct |
.exit: |
mov [esp+32+36],eax |
popad |
ret |
mov [esp+32+36],eax |
popad |
ret |
no_set_skin: |
popad |
515,58 → 515,58 |
repos_windows: |
mov ecx,[TASK_COUNT] |
mov edi, OS_BASE+0x20*2 |
mov ecx,[TASK_COUNT] |
mov edi, OS_BASE+0x20*2 |
mov byte[REDRAW_BACKGROUND],1 |
dec ecx |
jge @f |
ret |
@@: mov [edi+WDATA.fl_redraw],1 |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jz .lp2 |
mov eax,[screen_workarea.left] |
mov [edi+WDATA.box.left],eax |
sub eax,[screen_workarea.right] |
neg eax |
mov [edi+WDATA.box.width],eax |
mov eax,[screen_workarea.top] |
mov [edi+WDATA.box.top],eax |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz .lp1 |
sub eax,[screen_workarea.bottom] |
neg eax |
mov [edi+WDATA.box.height],eax |
dec ecx |
jge @f |
ret |
@@: mov [edi+WDATA.fl_redraw],1 |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jz .lp2 |
mov eax,[screen_workarea.left] |
mov [edi+WDATA.box.left],eax |
sub eax,[screen_workarea.right] |
neg eax |
mov [edi+WDATA.box.width],eax |
mov eax,[screen_workarea.top] |
mov [edi+WDATA.box.top],eax |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz .lp1 |
sub eax,[screen_workarea.bottom] |
neg eax |
mov [edi+WDATA.box.height],eax |
.lp1: |
call set_window_clientbox |
add edi,0x20 |
loop @b |
ret |
.lp2: mov eax,[edi+WDATA.box.left] |
add eax,[edi+WDATA.box.width] |
call set_window_clientbox |
add edi,0x20 |
loop @b |
ret |
.lp2: mov eax,[edi+WDATA.box.left] |
add eax,[edi+WDATA.box.width] |
mov ebx,[ScreenWidth] |
; inc ebx |
cmp eax,ebx |
jle .lp4 |
mov eax,[edi+WDATA.box.width] |
mov eax,[edi+WDATA.box.width] |
sub eax,ebx |
jle .lp3 |
mov [edi+WDATA.box.width],ebx |
.lp3: sub ebx,[edi+WDATA.box.width] |
mov [edi+WDATA.box.left],ebx |
.lp4: mov eax,[edi+WDATA.box.top] |
add eax,[edi+WDATA.box.height] |
mov [edi+WDATA.box.width],ebx |
.lp3: sub ebx,[edi+WDATA.box.width] |
mov [edi+WDATA.box.left],ebx |
.lp4: mov eax,[edi+WDATA.box.top] |
add eax,[edi+WDATA.box.height] |
mov ebx,[ScreenHeight] |
; inc ebx |
cmp eax,ebx |
jle .lp6 |
mov eax,[edi+WDATA.box.height] |
mov eax,[edi+WDATA.box.height] |
sub eax,ebx |
jle .lp5 |
mov [edi+WDATA.box.height],ebx |
.lp5: sub ebx,[edi+WDATA.box.height] |
mov [edi+WDATA.box.top],ebx |
.lp6: jmp .lp1 |
mov [edi+WDATA.box.height],ebx |
.lp5: sub ebx,[edi+WDATA.box.height] |
mov [edi+WDATA.box.top],ebx |
.lp6: jmp .lp1 |
uglobal |
common_colours: |
578,7 → 578,7 |
check_window_position: |
pushad ; window inside screen ? |
pushad ; window inside screen ? |
movzx eax,word [edi+WDATA.box.left] |
movzx ebx,word [edi+WDATA.box.top] |
585,7 → 585,7 |
movzx ecx,word [edi+WDATA.box.width] |
movzx edx,word [edi+WDATA.box.height] |
mov esi,ecx ; check x pos |
mov esi,ecx ; check x pos |
add esi,eax |
cmp esi,[ScreenWidth] |
jbe x_pos_ok |
593,7 → 593,7 |
xor eax, eax |
x_pos_ok: |
mov esi,edx ; check y pos |
mov esi,edx ; check y pos |
add esi,ebx |
cmp esi,[ScreenHeight] |
jbe y_pos_ok |
601,7 → 601,7 |
mov ebx,0 |
y_pos_ok: |
mov esi,ecx ; check x size |
mov esi,ecx ; check x size |
add esi,eax |
cmp esi,[ScreenWidth] |
jbe x_size_ok |
609,7 → 609,7 |
mov [edi+WDATA.box.width],ecx |
x_size_ok: |
mov esi,edx ; check y size |
mov esi,edx ; check y size |
add esi,ebx |
cmp esi,[ScreenHeight] |
jbe y_size_ok |
633,7 → 633,7 |
mov eax,[timer_ticks] |
cmp [new_window_starting],eax |
jb swml1 |
jb swml1 |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
651,101 → 651,101 |
drawwindow_I_caption: |
mov ecx,[edx+WDATA.cl_titlebar] ; grab bar |
push ecx |
mov esi,edx |
mov edx,[esi+WDATA.box.top] |
add edx,1 |
mov ebx,[esi+WDATA.box.top] |
add ebx,21 |
mov eax,[esi+WDATA.box.top] |
add eax,[esi+WDATA.box.height] |
cmp ebx,eax |
jb .wdsizeok |
mov ebx,eax |
mov ecx,[edx+WDATA.cl_titlebar] ; grab bar |
push ecx |
mov esi,edx |
mov edx,[esi+WDATA.box.top] |
add edx,1 |
mov ebx,[esi+WDATA.box.top] |
add ebx,21 |
mov eax,[esi+WDATA.box.top] |
add eax,[esi+WDATA.box.height] |
cmp ebx,eax |
jb .wdsizeok |
mov ebx,eax |
.wdsizeok: |
push ebx |
push ebx |
.drwi: |
mov ebx,edx |
shl ebx,16 |
add ebx,edx |
mov eax,[esi+WDATA.box.left] |
inc eax |
shl eax,16 |
add eax,[esi+WDATA.box.left] |
add eax,[esi+WDATA.box.width] |
sub eax,1 |
push edx |
mov edx,0x80000000 |
mov ecx,[esi+WDATA.cl_titlebar] |
and ecx,edx |
cmp ecx,edx |
jnz .nofa |
mov ecx,[esi+WDATA.cl_titlebar] |
sub ecx,0x00040404 |
mov [esi+WDATA.cl_titlebar],ecx |
and ecx,0x00ffffff |
jmp .faj |
mov ebx,edx |
shl ebx,16 |
add ebx,edx |
mov eax,[esi+WDATA.box.left] |
inc eax |
shl eax,16 |
add eax,[esi+WDATA.box.left] |
add eax,[esi+WDATA.box.width] |
sub eax,1 |
push edx |
mov edx,0x80000000 |
mov ecx,[esi+WDATA.cl_titlebar] |
and ecx,edx |
cmp ecx,edx |
jnz .nofa |
mov ecx,[esi+WDATA.cl_titlebar] |
sub ecx,0x00040404 |
mov [esi+WDATA.cl_titlebar],ecx |
and ecx,0x00ffffff |
jmp .faj |
.nofa: |
mov ecx,[esi+WDATA.cl_titlebar] |
and ecx,0x00ffffff |
mov ecx,[esi+WDATA.cl_titlebar] |
and ecx,0x00ffffff |
.faj: |
pop edx |
mov edi,0 |
call [draw_line] |
inc edx |
cmp edx,[esp] |
jb .drwi |
add esp,4 |
pop ecx |
mov [esi+WDATA.cl_titlebar],ecx |
pop edx |
mov edi,0 |
call [draw_line] |
inc edx |
cmp edx,[esp] |
jb .drwi |
add esp,4 |
pop ecx |
mov [esi+WDATA.cl_titlebar],ecx |
ret |
ret |
drawwindow_I: |
pushad |
or [edx+WDATA.fl_wdrawn], 4 |
pushad |
or [edx+WDATA.fl_wdrawn], 4 |
mov esi,[edx+WDATA.cl_frames] ; rectangle |
mov eax,[edx+WDATA.box.left] |
shl eax,16 |
add eax,[edx+WDATA.box.left] |
add eax,[edx+WDATA.box.width] |
mov ebx,[edx+WDATA.box.top] |
shl ebx,16 |
add ebx,[edx+WDATA.box.top] |
add ebx,[edx+WDATA.box.height] |
call draw_rectangle |
mov esi,[edx+WDATA.cl_frames] ; rectangle |
mov eax,[edx+WDATA.box.left] |
shl eax,16 |
add eax,[edx+WDATA.box.left] |
add eax,[edx+WDATA.box.width] |
mov ebx,[edx+WDATA.box.top] |
shl ebx,16 |
add ebx,[edx+WDATA.box.top] |
add ebx,[edx+WDATA.box.height] |
call draw_rectangle |
and [edx+WDATA.fl_wdrawn], not 4 |
test [edx+WDATA.fl_wdrawn], 2 |
jz @f |
call drawwindowframes2 |
and [edx+WDATA.fl_wdrawn], not 4 |
test [edx+WDATA.fl_wdrawn], 2 |
jz @f |
call drawwindowframes2 |
@@: |
call drawwindow_I_caption |
call drawwindow_I_caption |
mov edx,[esi+WDATA.box.top] ; inside work area |
add edx,21+5 |
mov ebx,[esi+WDATA.box.top] |
add ebx,[esi+WDATA.box.height] |
cmp edx,ebx |
jg noinside |
mov eax,1 |
mov ebx,21 |
mov ecx,[esi+WDATA.box.width] |
mov edx,[esi+WDATA.box.height] |
mov edi,[esi+WDATA.cl_workarea] |
mov edx,[esi+WDATA.box.top] ; inside work area |
add edx,21+5 |
mov ebx,[esi+WDATA.box.top] |
add ebx,[esi+WDATA.box.height] |
cmp edx,ebx |
jg noinside |
mov eax,1 |
mov ebx,21 |
mov ecx,[esi+WDATA.box.width] |
mov edx,[esi+WDATA.box.height] |
mov edi,[esi+WDATA.cl_workarea] |
test edi,0x40000000 |
jnz noinside |
call [drawbar] |
call [drawbar] |
noinside: |
popad |
popad |
ret |
ret |
draw_rectangle: |
756,149 → 756,149 |
r_bx equ [esp+18] ; y end |
;esi ; color |
pushad |
pushad |
mov ecx,esi ; yb,xb -> yb,xe |
mov eax, r_eax |
rol eax, 16 |
mov ebx,r_ebx |
shl ebx,16 |
mov bx,r_ebx |
xor edi, edi |
call [draw_line] |
mov ecx,esi ; yb,xb -> yb,xe |
mov eax, r_eax |
rol eax, 16 |
mov ebx,r_ebx |
shl ebx,16 |
mov bx,r_ebx |
xor edi, edi |
call [draw_line] |
mov ebx,r_bx ; ye,xb -> ye,xe |
shl ebx,16 |
mov bx,r_bx |
call [draw_line] |
mov ebx,r_bx ; ye,xb -> ye,xe |
shl ebx,16 |
mov bx,r_bx |
call [draw_line] |
mov ecx,esi ; ya,xa -> ye,xa |
mov eax,r_eax |
shl eax,16 |
mov ax,r_eax |
mov ebx,r_ebx |
shl ebx,16 |
mov bx,r_bx |
mov edi,0 |
call [draw_line] |
mov ecx,esi ; ya,xa -> ye,xa |
mov eax,r_eax |
shl eax,16 |
mov ax,r_eax |
mov ebx,r_ebx |
shl ebx,16 |
mov bx,r_bx |
mov edi,0 |
call [draw_line] |
mov eax,r_ax ; ya,xe -> ye,xe |
shl eax,16 |
mov ax,r_ax |
call [draw_line] |
mov eax,r_ax ; ya,xe -> ye,xe |
shl eax,16 |
mov ax,r_ax |
call [draw_line] |
popad |
ret |
popad |
ret |
drawwindow_III_caption: |
mov ecx,[edx+WDATA.cl_titlebar] ; GRAB BAR |
push ecx |
mov esi,edx |
mov edx,[esi+WDATA.box.top] |
add edx,4 |
mov ebx,[esi+WDATA.box.top] |
add ebx,20 |
mov eax,[esi+WDATA.box.top] |
add eax,[esi+WDATA.box.height] |
cmp ebx,eax |
jb .wdsizeok |
mov ebx,eax |
mov ecx,[edx+WDATA.cl_titlebar] ; GRAB BAR |
push ecx |
mov esi,edx |
mov edx,[esi+WDATA.box.top] |
add edx,4 |
mov ebx,[esi+WDATA.box.top] |
add ebx,20 |
mov eax,[esi+WDATA.box.top] |
add eax,[esi+WDATA.box.height] |
cmp ebx,eax |
jb .wdsizeok |
mov ebx,eax |
.wdsizeok: |
push ebx |
push ebx |
.drwi: |
mov ebx,edx |
shl ebx,16 |
add ebx,edx |
mov eax,[esi+WDATA.box.left] |
shl eax,16 |
add eax,[esi+WDATA.box.left] |
add eax,[esi+WDATA.box.width] |
add eax,4*65536-4 |
mov ecx,[esi+WDATA.cl_titlebar] |
test ecx,0x40000000 |
jz .nofa |
add ecx,0x040404 |
mov ebx,edx |
shl ebx,16 |
add ebx,edx |
mov eax,[esi+WDATA.box.left] |
shl eax,16 |
add eax,[esi+WDATA.box.left] |
add eax,[esi+WDATA.box.width] |
add eax,4*65536-4 |
mov ecx,[esi+WDATA.cl_titlebar] |
test ecx,0x40000000 |
jz .nofa |
add ecx,0x040404 |
.nofa: |
test ecx,0x80000000 |
jz .nofa2 |
sub ecx,0x040404 |
test ecx,0x80000000 |
jz .nofa2 |
sub ecx,0x040404 |
.nofa2: |
mov [esi+WDATA.cl_titlebar],ecx |
and ecx,0xffffff |
xor edi, edi |
call [draw_line] |
inc edx |
cmp edx,[esp] |
jb .drwi |
add esp,4 |
pop ecx |
mov [esi+WDATA.cl_titlebar],ecx |
mov [esi+WDATA.cl_titlebar],ecx |
and ecx,0xffffff |
xor edi, edi |
call [draw_line] |
inc edx |
cmp edx,[esp] |
jb .drwi |
add esp,4 |
pop ecx |
mov [esi+WDATA.cl_titlebar],ecx |
ret |
ret |
drawwindow_III: |
pushad |
pushad |
mov edi,edx ; RECTANGLE |
mov eax,[edi+WDATA.box.left] |
shl eax,16 |
mov edi,edx ; RECTANGLE |
mov eax,[edi+WDATA.box.left] |
shl eax,16 |
mov ax, word [edi+WDATA.box.left] |
add ax, word [edi+WDATA.box.width] |
mov ebx,[edi+WDATA.box.top] |
shl ebx,16 |
mov ebx,[edi+WDATA.box.top] |
shl ebx,16 |
mov bx, word [edi+WDATA.box.top] |
add bx, word [edi+WDATA.box.height] |
mov esi,[edi+WDATA.cl_frames] |
shr esi,1 |
and esi,0x007f7f7f |
push esi |
or [edi+WDATA.fl_wdrawn], 4 |
call draw_rectangle |
and [edi+WDATA.fl_wdrawn], not 4 |
test [edi+WDATA.fl_wdrawn], 2 |
jz @f |
call drawwindowframes2 |
mov esi,[edi+WDATA.cl_frames] |
shr esi,1 |
and esi,0x007f7f7f |
push esi |
or [edi+WDATA.fl_wdrawn], 4 |
call draw_rectangle |
and [edi+WDATA.fl_wdrawn], not 4 |
test [edi+WDATA.fl_wdrawn], 2 |
jz @f |
call drawwindowframes2 |
@@: |
mov ecx,3 |
mov ecx,3 |
dw3l: |
add eax,1*65536-1 |
add ebx,1*65536-1 |
mov esi,[edi+WDATA.cl_frames] |
call draw_rectangle |
dec ecx |
jnz dw3l |
pop esi |
add eax,1*65536-1 |
add ebx,1*65536-1 |
call draw_rectangle |
add eax,1*65536-1 |
add ebx,1*65536-1 |
mov esi,[edi+WDATA.cl_frames] |
call draw_rectangle |
dec ecx |
jnz dw3l |
pop esi |
add eax,1*65536-1 |
add ebx,1*65536-1 |
call draw_rectangle |
call drawwindow_III_caption |
call drawwindow_III_caption |
mov edx,[esi+WDATA.box.top] ; WORK AREA |
add edx,21+5 |
mov ebx,[esi+WDATA.box.top] |
add ebx,[esi+WDATA.box.height] |
cmp edx,ebx |
jg noinside2 |
mov eax,5 |
mov ebx,20 |
mov ecx,[esi+WDATA.box.width] |
mov edx,[esi+WDATA.box.height] |
sub ecx,4 |
sub edx,4 |
mov edi,[esi+WDATA.cl_workarea] |
mov edx,[esi+WDATA.box.top] ; WORK AREA |
add edx,21+5 |
mov ebx,[esi+WDATA.box.top] |
add ebx,[esi+WDATA.box.height] |
cmp edx,ebx |
jg noinside2 |
mov eax,5 |
mov ebx,20 |
mov ecx,[esi+WDATA.box.width] |
mov edx,[esi+WDATA.box.height] |
sub ecx,4 |
sub edx,4 |
mov edi,[esi+WDATA.cl_workarea] |
test edi,0x40000000 |
jnz noinside2 |
call [drawbar] |
call [drawbar] |
noinside2: |
popad |
popad |
ret |
ret |
906,63 → 906,63 |
align 4 |
windowactivate: |
; esi = abs mem position in stack 0xC400+ |
; esi = abs mem position in stack 0xC400+ |
pushad |
pushad |
; if type of current active window is 3, |
; it must be redrawn |
mov eax, [TASK_COUNT] |
movzx eax, word [WIN_POS + eax*2] |
shl eax, 5 |
add eax, window_data |
mov ebx, [eax + WDATA.cl_workarea] |
and ebx, 0x0f000000 |
cmp ebx, 0x03000000 |
jne @f |
mov [eax + WDATA.fl_redraw], byte 1 |
mov eax, [TASK_COUNT] |
movzx eax, word [WIN_POS + eax*2] |
shl eax, 5 |
add eax, window_data |
mov ebx, [eax + WDATA.cl_workarea] |
and ebx, 0x0f000000 |
cmp ebx, 0x03000000 |
jne @f |
mov [eax + WDATA.fl_redraw], byte 1 |
@@: |
push esi |
push esi |
movzx eax, word [esi] ; ax <- process no |
movzx eax, word [WIN_STACK+eax*2] ; ax <- position in window stack |
xor esi, esi ; drop others |
xor esi, esi ; drop others |
waloop: |
cmp esi, dword [TASK_COUNT] |
jae wacont |
inc esi |
lea edi, [WIN_STACK + esi*2] |
mov bx, [edi] ; position of the current process |
cmp bx, ax |
jbe @f |
dec bx ; upper? => drop! |
mov [edi], bx |
cmp esi, dword [TASK_COUNT] |
jae wacont |
inc esi |
lea edi, [WIN_STACK + esi*2] |
mov bx, [edi] ; position of the current process |
cmp bx, ax |
jbe @f |
dec bx ; upper? => drop! |
mov [edi], bx |
@@: |
jmp waloop |
jmp waloop |
wacont: |
; set to no 1 |
pop esi ; esi = pointer at 0xC400 |
; set to no 1 |
pop esi ; esi = pointer at 0xC400 |
movzx eax, word [esi] |
mov bx, [TASK_COUNT] ; number of processes |
mov [WIN_STACK+eax*2], bx ; this is the last (and the upper) |
mov bx, [TASK_COUNT] ; number of processes |
mov [WIN_STACK+eax*2], bx ; this is the last (and the upper) |
; update on screen -window stack |
xor esi, esi |
; update on screen -window stack |
xor esi, esi |
waloop2: |
mov edi, [TASK_COUNT] |
cmp esi, edi |
jae wacont2 |
inc esi |
movzx ebx, word [esi*2 + WIN_STACK] |
mov [ebx*2 + WIN_POS], si |
jmp waloop2 |
mov edi, [TASK_COUNT] |
cmp esi, edi |
jae wacont2 |
inc esi |
movzx ebx, word [esi*2 + WIN_STACK] |
mov [ebx*2 + WIN_POS], si |
jmp waloop2 |
wacont2: |
mov [KEY_COUNT], byte 0 ; empty keyboard buffer |
mov [BTN_COUNT], byte 0 ; empty button buffer |
popad |
ret |
mov [KEY_COUNT], byte 0 ; empty keyboard buffer |
mov [BTN_COUNT], byte 0 ; empty button buffer |
popad |
ret |
; check if window is necessary to draw |
969,78 → 969,78 |
checkwindowdraw: |
; edi = position in window_data+ |
; edi = position in window_data+ |
mov eax, [edi + WDATA.cl_workarea] |
and eax, 0x0f000000 |
cmp eax, 0x03000000 |
je .return_yes ; window type 3 |
mov eax, [edi + WDATA.cl_workarea] |
and eax, 0x0f000000 |
cmp eax, 0x03000000 |
je .return_yes ; window type 3 |
mov esi, edi |
sub esi, window_data |
shr esi, 5 |
mov esi, edi |
sub esi, window_data |
shr esi, 5 |
; esi = process number |
; esi = process number |
movzx eax, word [WIN_STACK + esi * 2] ; get value of the curr process |
lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 |
movzx eax, word [WIN_STACK + esi * 2] ; get value of the curr process |
lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 |
push esi |
push esi |
.new_check: |
pop esi |
add esi, 2 |
push esi |
pop esi |
add esi, 2 |
push esi |
mov eax, [TASK_COUNT] |
lea eax, word [WIN_POS + eax * 2] ; number of the upper window |
mov eax, [TASK_COUNT] |
lea eax, word [WIN_POS + eax * 2] ; number of the upper window |
cmp esi, eax |
ja .all_wnds_to_top |
cmp esi, eax |
ja .all_wnds_to_top |
movzx eax, word [esi] |
shl eax, 5 |
cmp [CURRENT_TASK + eax + TASKDATA.state], byte 9 |
je .new_check ; skip dead windows |
movzx eax, word [esi] |
shl eax, 5 |
cmp [CURRENT_TASK + eax + TASKDATA.state], byte 9 |
je .new_check ; skip dead windows |
lea esi, [eax+window_data] |
lea esi, [eax+window_data] |
mov ebx, [edi+WDATA.box.top] ; y0 |
mov edx, [edi+WDATA.box.height] |
add edx, ebx ; y0e |
mov ebx, [edi+WDATA.box.top] ; y0 |
mov edx, [edi+WDATA.box.height] |
add edx, ebx ; y0e |
mov ecx, [esi+WDATA.box.top] ; y ; y check |
cmp ecx, edx |
jae .new_check ; y < y0e |
mov eax, [esi+WDATA.box.height] |
add ecx, eax ; ye |
cmp ebx, ecx ; y0 >= ye |
ja .new_check |
mov ecx, [esi+WDATA.box.top] ; y ; y check |
cmp ecx, edx |
jae .new_check ; y < y0e |
mov eax, [esi+WDATA.box.height] |
add ecx, eax ; ye |
cmp ebx, ecx ; y0 >= ye |
ja .new_check |
mov eax, [edi+WDATA.box.left] ; x0 |
mov ecx, [edi+WDATA.box.width] |
add ecx, eax ; x0e |
mov eax, [edi+WDATA.box.left] ; x0 |
mov ecx, [edi+WDATA.box.width] |
add ecx, eax ; x0e |
mov edx, [esi+WDATA.box.left] ; x ; x check |
cmp edx, ecx |
jae .new_check ; x < x0e |
mov ecx, [esi+WDATA.box.width] |
add edx, ecx |
cmp eax, edx |
ja .new_check |
mov edx, [esi+WDATA.box.left] ; x ; x check |
cmp edx, ecx |
jae .new_check ; x < x0e |
mov ecx, [esi+WDATA.box.width] |
add edx, ecx |
cmp eax, edx |
ja .new_check |
pop esi |
pop esi |
.return_yes: |
mov ecx,1 ; overlap some window |
ret |
mov ecx,1 ; overlap some window |
ret |
.all_wnds_to_top: |
pop esi |
pop esi |
xor ecx, ecx ; passed all windows to top |
ret |
xor ecx, ecx ; passed all windows to top |
ret |
1047,719 → 1047,698 |
waredraw: ; if redraw necessary at activate |
pushad |
pushad |
call checkwindowdraw ; draw window on activation ? |
test ecx, ecx |
jz .do_not_draw |
call checkwindowdraw ; draw window on activation ? |
test ecx, ecx |
jz .do_not_draw |
popad |
mov [MOUSE_DOWN], byte 1 ; do draw mouse |
call windowactivate |
popad |
mov [MOUSE_DOWN], byte 1 ; do draw mouse |
call windowactivate |
; update screen info |
pushad |
mov edi, [TASK_COUNT] ; the last process (number) |
movzx esi, word [WIN_POS + edi * 2] |
shl esi, 5 |
add esi, window_data |
; update screen info |
pushad |
mov edi, [TASK_COUNT] ; the last process (number) |
movzx esi, word [WIN_POS + edi * 2] |
shl esi, 5 |
add esi, window_data |
; coordinates of the upper window |
mov eax, [esi + WDATA.box.left] ; cx |
mov ebx, [esi + WDATA.box.top] ; cy |
mov ecx, [esi + WDATA.box.width] ; sx |
; coordinates of the upper window |
mov eax, [esi + WDATA.box.left] ; cx |
mov ebx, [esi + WDATA.box.top] ; cy |
mov ecx, [esi + WDATA.box.width] ; sx |
mov edx, [esi + WDATA.box.height] ; sy |
add ecx, eax ; ecx = x_end |
add edx, ebx ; edx = y_end |
add ecx, eax ; ecx = x_end |
add edx, ebx ; edx = y_end |
mov edi, [TASK_COUNT] |
movzx esi, word [WIN_POS + edi * 2] |
call setscreen |
popad |
mov edi, [TASK_COUNT] |
movzx esi, word [WIN_POS + edi * 2] |
call setscreen |
popad |
mov [edi + WDATA.fl_redraw], 1 ; redraw flag for app |
mov [MOUSE_DOWN],byte 0 ; mouse down checks |
mov [MOUSE_DOWN],byte 0 ; mouse down checks |
ret |
ret |
.do_not_draw: |
popad |
popad |
call windowactivate |
mov [MOUSE_DOWN],byte 0 ; mouse down checks |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
ret |
call windowactivate |
mov [MOUSE_DOWN],byte 0 ; mouse down checks |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
ret |
; eax = window number on screen |
; corrupts registers and [dl*] |
minimize_window: |
movzx eax, word [WIN_POS+eax*2] |
shl eax, 5 |
add eax, window_data |
test [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
jnz .skip_redrawings |
pushfd |
cli |
or [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
mov edi, eax |
;call calculatescreen |
mov eax, [edi+WDATA.box.left] |
mov [dlx], eax |
mov ecx, eax |
add ecx, [edi+WDATA.box.width] |
mov [dlxe], ecx |
mov ebx, [edi+WDATA.box.top] |
mov [dly], ebx |
mov edx, ebx |
add edx, [edi+WDATA.box.height] |
mov [dlye], edx |
call calculatescreen |
xor esi, esi |
xor eax, eax |
call redrawscreen |
popfd |
movzx eax, word [WIN_POS+eax*2] |
shl eax, 5 |
add eax, window_data |
test [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
jnz .skip_redrawings |
pushfd |
cli |
or [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
mov edi, eax |
;call calculatescreen |
mov eax, [edi+WDATA.box.left] |
mov [dlx], eax |
mov ecx, eax |
add ecx, [edi+WDATA.box.width] |
mov [dlxe], ecx |
mov ebx, [edi+WDATA.box.top] |
mov [dly], ebx |
mov edx, ebx |
add edx, [edi+WDATA.box.height] |
mov [dlye], edx |
call calculatescreen |
xor esi, esi |
xor eax, eax |
call redrawscreen |
popfd |
.skip_redrawings: |
ret |
ret |
; eax = window number on screen |
; corrupts registers and [dl*] |
restore_minimized_window: |
pushfd |
cli |
movzx esi, word [WIN_POS+eax*2] |
mov edi, esi |
shl edi, 5 |
add edi, window_data |
test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
jz .skip_redrawings |
mov [edi+WDATA.fl_redraw], 1 |
and [edi+WDATA.fl_wstate], not WSTATE_MINIMIZED |
cmp eax, [TASK_COUNT] ; the uppermost window |
jnz .no_uppermost |
mov eax, [edi+WDATA.box.left] |
mov ebx, [edi+WDATA.box.top] |
mov ecx, eax |
mov edx, ebx |
add ecx, [edi+WDATA.box.width] |
add edx, [edi+WDATA.box.height] |
call setscreen |
jmp .done |
pushfd |
cli |
movzx esi, word [WIN_POS+eax*2] |
mov edi, esi |
shl edi, 5 |
add edi, window_data |
test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
jz .skip_redrawings |
mov [edi+WDATA.fl_redraw], 1 |
and [edi+WDATA.fl_wstate], not WSTATE_MINIMIZED |
cmp eax, [TASK_COUNT] ; the uppermost window |
jnz .no_uppermost |
mov eax, [edi+WDATA.box.left] |
mov ebx, [edi+WDATA.box.top] |
mov ecx, eax |
mov edx, ebx |
add ecx, [edi+WDATA.box.width] |
add edx, [edi+WDATA.box.height] |
call setscreen |
jmp .done |
.no_uppermost: |
mov eax, [edi+WDATA.box.left] |
mov ebx, [edi+WDATA.box.top] |
mov ecx, eax |
mov edx, ebx |
add ecx, [edi+WDATA.box.width] |
add edx, [edi+WDATA.box.height] |
call calculatescreen |
mov eax, [edi+WDATA.box.left] |
mov ebx, [edi+WDATA.box.top] |
mov ecx, eax |
mov edx, ebx |
add ecx, [edi+WDATA.box.width] |
add edx, [edi+WDATA.box.height] |
call calculatescreen |
.done: |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
.skip_redrawings: |
popfd |
ret |
popfd |
ret |
iglobal |
window_moving db 'K : Window - move/resize',13,10,0 |
window_moved db 'K : Window - done',13,10,0 |
window_moved db 'K : Window - done',13,10,0 |
endg |
; check window touch |
align 4 |
checkwindows: |
pushad |
pushad |
cmp [window_minimize], 0 |
je .no_minimizing |
mov eax, [TASK_COUNT] ; the uppermost window |
mov bl, 0 |
xchg [window_minimize], bl |
cmp bl, 1 |
jne .restore |
call minimize_window |
jmp .continue |
cmp [window_minimize], 0 |
je .no_minimizing |
mov eax, [TASK_COUNT] ; the uppermost window |
mov bl, 0 |
xchg [window_minimize], bl |
cmp bl, 1 |
jne .restore |
call minimize_window |
jmp .continue |
.restore: |
call restore_minimized_window |
call restore_minimized_window |
.continue: |
.no_minimizing: |
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? |
jne .mouse_buttons_pressed |
;..................................... start 1/4 : modified by vhanla ................. |
mov [bPressedMouseXY_W],0 |
;..................................... end 1/4 : modified by vhanla ................... |
popad |
ret |
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? |
jne .mouse_buttons_pressed |
popad |
ret |
.mouse_buttons_pressed: |
;..................................... start 2/4 : modified by vhanla ................. |
jmp @f |
bPressedMouseXY_W db 0x0 |
@@: |
;..................................... end 2/4 : modified by vhanla ................... |
mov esi,[TASK_COUNT] |
inc esi |
;..................................... start 3/4 : modified by vhanla ................. |
push ax |
cmp [bPressedMouseXY_W],0 |
jnz @f |
mov [bPressedMouseXY_W],1 |
mov ax,[MOUSE_X] |
mov [mx],ax |
mov ax,[MOUSE_Y] |
mov [my],ax |
@@: |
pop ax |
;..................................... end 3/4 : modified by vhanla ................... |
mov esi,[TASK_COUNT] |
inc esi |
cwloop: |
cmp esi,2 |
jb .exit |
cmp esi,2 |
jb .exit |
dec esi |
movzx edi, word [WIN_POS + esi * 2] ; ebx |
shl edi, 5 |
add edi, window_data |
dec esi |
movzx edi, word [WIN_POS + esi * 2] ; ebx |
shl edi, 5 |
add edi, window_data |
; mov edi, ebx |
mov ecx, [edi + WDATA.box.left] |
mov edx, [edi + WDATA.box.top] |
mov eax,ecx |
mov ebx,edx |
test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED |
jnz cwloop |
mov eax,ecx |
mov ebx,edx |
test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED |
jnz cwloop |
;..................................... start 4/4 : modified by vhanla ................. |
movzx eax, word [mx]; movzx eax,word[MOUSE_X] |
movzx ebx, word [my]; movzx ebx,word[MOUSE_Y] |
;..................................... endt 4/4 : modified by vhanla .................. |
cmp ecx, eax |
jae cwloop |
cmp edx, ebx |
jae cwloop |
movzx eax, word [MOUSE_X] |
movzx ebx, word [MOUSE_Y] |
cmp ecx, eax |
jae cwloop |
cmp edx, ebx |
jae cwloop |
add ecx, [edi + WDATA.box.width] |
add edx, [edi + WDATA.box.height] |
cmp eax, ecx |
jae cwloop |
cmp ebx, edx |
jae cwloop |
cmp eax, ecx |
jae cwloop |
cmp ebx, edx |
jae cwloop |
pushad |
mov eax, esi |
mov ebx, [TASK_COUNT] |
cmp eax, ebx ; is this window active? |
jz .move_resize_window |
pushad |
mov eax, esi |
mov ebx, [TASK_COUNT] |
cmp eax, ebx ; is this window active? |
jz .move_resize_window |
; eax = position in windowing stack |
; redraw must ? |
lea esi, [WIN_POS + esi * 2] |
call waredraw |
add esp, 32 |
; eax = position in windowing stack |
; redraw must ? |
lea esi, [WIN_POS + esi * 2] |
call waredraw |
add esp, 32 |
.exit: |
popad |
ret |
popad |
ret |
.move_resize_window: ; MOVE OR RESIZE WINDOW |
popad |
popad |
; Check for user enabled fixed window |
; Check for user enabled fixed window |
mov edx, [edi + WDATA.cl_titlebar] |
and edx, 0x0f000000 |
cmp edx, 0x01000000 |
jne .window_move_enabled_for_user |
popad |
ret |
and edx, 0x0f000000 |
cmp edx, 0x01000000 |
jne .window_move_enabled_for_user |
popad |
ret |
.window_move_enabled_for_user: |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz .no_resize_2 |
jnz .no_resize_2 |
mov [do_resize_from_corner],byte 0 ; resize for skinned window |
mov [do_resize_from_corner],byte 0 ; resize for skinned window |
mov edx, [edi + WDATA.cl_workarea] |
and edx, 0x0f000000 |
cmp edx, 0x02000000 |
jb .no_resize_2 ; not type 2 wnd |
and edx, 0x0f000000 |
cmp edx, 0x02000000 |
jb .no_resize_2 ; not type 2 wnd |
mov edx, [edi + WDATA.box.top] |
add edx, [edi + WDATA.box.height] |
sub edx, 6 ; edx = y_end - 6 |
cmp ebx, edx ; ebx = mouse_y |
jb .no_resize_2 |
mov [do_resize_from_corner],byte 1 |
jmp .continue |
sub edx, 6 ; edx = y_end - 6 |
cmp ebx, edx ; ebx = mouse_y |
jb .no_resize_2 |
mov [do_resize_from_corner],byte 1 |
jmp .continue |
.no_resize_2: |
push eax |
call get_titlebar_height |
push eax |
call get_titlebar_height |
add eax,[edi + WDATA.box.top] |
cmp ebx,eax |
pop eax |
jae .exit |
cmp ebx,eax |
pop eax |
jae .exit |
.continue: |
push esi |
mov esi, window_moving |
call sys_msg_board_str |
pop esi |
push esi |
mov esi, window_moving |
call sys_msg_board_str |
pop esi |
mov ecx, [timer_ticks] ; double-click ? |
mov edx, ecx |
sub edx, [latest_window_touch] |
mov [latest_window_touch], ecx |
mov [latest_window_touch_delta], edx |
mov ecx, [timer_ticks] ; double-click ? |
mov edx, ecx |
sub edx, [latest_window_touch] |
mov [latest_window_touch], ecx |
mov [latest_window_touch_delta], edx |
mov cl, [BTN_DOWN] ; save for shade check |
mov [do_resize], cl |
mov cl, [BTN_DOWN] ; save for shade check |
mov [do_resize], cl |
no_emulation_righ_button: |
mov ecx, [edi + WDATA.box.left] |
mov edx, [edi + WDATA.box.top] |
push eax ecx edx |
mov [dlx], ecx ; save for drawlimits |
mov [dly], edx |
push eax ecx edx |
mov [dlx], ecx ; save for drawlimits |
mov [dly], edx |
mov eax, [edi + WDATA.box.width] |
add ecx, eax |
add ecx, eax |
mov eax, [edi + WDATA.box.height] |
add edx, eax |
mov [dlxe], ecx |
mov [dlye], edx |
pop edx ecx eax |
add edx, eax |
mov [dlxe], ecx |
mov [dlye], edx |
pop edx ecx eax |
sub eax, ecx |
sub ebx, edx |
sub eax, ecx |
sub ebx, edx |
mov esi, [MOUSE_X] |
mov [WIN_TEMP_XY], esi |
mov esi, [MOUSE_X] |
mov [WIN_TEMP_XY], esi |
pushad ; wait for putimages to finish |
pushad ; wait for putimages to finish |
; mov eax,5 |
; call delay_hs |
mov eax,[edi + WDATA.box.left] |
mov [npx],eax |
mov [npx],eax |
mov eax,[edi + WDATA.box.top] |
mov [npy],eax |
popad |
mov [npy],eax |
popad |
push eax ; save old coordinates |
push eax ; save old coordinates |
mov ax, word [edi + WDATA.box.left] |
mov word [oldc+BOX.left],ax |
mov word [oldc+BOX.left],ax |
mov ax, word [edi + WDATA.box.top] |
mov word [oldc+BOX.top],ax |
mov word [oldc+BOX.top],ax |
mov ax, word [edi + WDATA.box.width] |
mov word [oldc+BOX.width],ax |
mov word [npxe],ax |
mov word [oldc+BOX.width],ax |
mov word [npxe],ax |
mov ax, word [edi + WDATA.box.height] |
mov word [oldc+BOX.height],ax |
mov word [npye],ax |
pop eax |
mov word [oldc+BOX.height],ax |
mov word [npye],ax |
pop eax |
call drawwindowframes |
call drawwindowframes |
mov [reposition],0 |
mov [MOUSE_DOWN],byte 1 ; no reaction to mouse up/down |
mov [reposition],0 |
mov [MOUSE_DOWN],byte 1 ; no reaction to mouse up/down |
; move window |
; move window |
newchm: |
mov [DONT_DRAW_MOUSE],byte 1 |
mov [DONT_DRAW_MOUSE],byte 1 |
call checkidle |
call checkidle |
call checkVga_N13 |
call checkVga_N13 |
mov [MOUSE_BACKGROUND],byte 0 |
mov [MOUSE_BACKGROUND],byte 0 |
call [draw_pointer] |
call [draw_pointer] |
pushad |
call stack_handler |
popad |
pushad |
call stack_handler |
popad |
mov esi,[WIN_TEMP_XY] |
cmp esi,[MOUSE_X] |
je cwb |
mov esi,[WIN_TEMP_XY] |
cmp esi,[MOUSE_X] |
je cwb |
mov cx,[MOUSE_X] |
mov dx,[MOUSE_Y] |
sub cx,ax |
sub dx,bx |
mov cx,[MOUSE_X] |
mov dx,[MOUSE_Y] |
sub cx,ax |
sub dx,bx |
push ax |
push bx |
push ax |
push bx |
call drawwindowframes |
call drawwindowframes |
mov ax,[ScreenWidth] |
mov bx,[ScreenHeight] |
mov ax,[ScreenWidth] |
mov bx,[ScreenHeight] |
cmp [do_resize_from_corner],1 |
je no_new_position |
cmp [do_resize_from_corner],1 |
je no_new_position |
mov word [npx],word 0 ; x repos ? |
cmp ax,cx |
jb noreposx |
mov [reposition],1 |
sub ax,word [npxe] |
mov word [npx],ax |
cmp ax,cx |
jb noreposx |
mov word [npx],cx |
mov word [npx],word 0 ; x repos ? |
cmp ax,cx |
jb noreposx |
mov [reposition],1 |
sub ax,word [npxe] |
mov word [npx],ax |
cmp ax,cx |
jb noreposx |
mov word [npx],cx |
noreposx: |
mov word [npy],word 0 ; y repos ? |
cmp bx,dx |
jb noreposy |
mov [reposition],1 |
sub bx,word [npye] |
mov word [npy],bx |
cmp bx,dx |
jb noreposy |
mov word [npy],dx |
mov word [npy],word 0 ; y repos ? |
cmp bx,dx |
jb noreposy |
mov [reposition],1 |
sub bx,word [npye] |
mov word [npy],bx |
cmp bx,dx |
jb noreposy |
mov word [npy],dx |
noreposy: |
no_new_position: |
cmp [do_resize_from_corner],0 ; resize from right corner |
je norepos_size |
pushad |
cmp [do_resize_from_corner],0 ; resize from right corner |
je norepos_size |
pushad |
mov edx,edi |
sub edx,window_data |
;shr edx,5 |
;shl edx,8 |
;add edx,0x80000 ; process base at 0x80000+ |
mov edx,edi |
sub edx,window_data |
;shr edx,5 |
;shl edx,8 |
;add edx,0x80000 ; process base at 0x80000+ |
lea edx, [SLOT_BASE + edx*8] |
movzx eax,word [MOUSE_X] |
movzx eax,word [MOUSE_X] |
cmp eax,[edi + WDATA.box.left] |
jb nnepx |
jb nnepx |
sub eax,[edi + WDATA.box.left] |
cmp eax,32 ; [edx+0x90+8] |
jge nnepx2 |
mov eax,32 ; [edx+0x90+8] |
cmp eax,32 ; [edx+0x90+8] |
jge nnepx2 |
mov eax,32 ; [edx+0x90+8] |
nnepx2: |
mov [npxe],eax |
mov [npxe],eax |
nnepx: |
call get_rolledup_height |
mov ebx,eax |
movzx eax,word [MOUSE_Y] |
call get_rolledup_height |
mov ebx,eax |
movzx eax,word [MOUSE_Y] |
cmp eax,[edi + WDATA.box.top] |
jb nnepy |
jb nnepy |
sub eax,[edi + WDATA.box.top] |
cmp eax,ebx ; [edx+0x90+12] |
jge nnepy2 |
mov eax,ebx ; [edx+0x90+12] |
cmp eax,ebx ; [edx+0x90+12] |
jge nnepy2 |
mov eax,ebx ; [edx+0x90+12] |
nnepy2: |
mov [npye],eax |
mov [npye],eax |
nnepy: |
mov [reposition],1 |
mov [reposition],1 |
popad |
popad |
norepos_size: |
pop bx |
pop ax |
call drawwindowframes |
pop bx |
pop ax |
call drawwindowframes |
mov esi,[MOUSE_X] |
mov [WIN_TEMP_XY],esi |
mov esi,[MOUSE_X] |
mov [WIN_TEMP_XY],esi |
cwb: |
cmp [BTN_DOWN],byte 0 |
jne newchm |
; new position done |
mov [DONT_DRAW_MOUSE],byte 1 |
mov cl,0 |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jnz @f |
mov cl,[reposition] |
call drawwindowframes |
cmp [BTN_DOWN],byte 0 |
jne newchm |
; new position done |
mov [DONT_DRAW_MOUSE],byte 1 |
mov cl,0 |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jnz @f |
mov cl,[reposition] |
call drawwindowframes |
mov eax,[npx] |
mov eax,[npx] |
mov [edi + WDATA.box.left],eax |
mov eax,[npy] |
mov eax,[npy] |
mov [edi + WDATA.box.top],eax |
mov eax,[npxe] |
mov eax,[npxe] |
mov [edi + WDATA.box.width],eax |
mov eax,[npye] |
mov eax,[npye] |
mov [edi + WDATA.box.height],eax |
call set_window_clientbox |
call set_window_clientbox |
@@: mov [reposition],cl |
@@: mov [reposition],cl |
cmp [reposition],1 ; save new position and size |
jne no_bounds_save |
push esi edi ecx |
mov esi,edi |
mov ecx,2 |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP or WSTATE_MAXIMIZED |
jnz @f |
add ecx,2 |
cmp [reposition],1 ; save new position and size |
jne no_bounds_save |
push esi edi ecx |
mov esi,edi |
mov ecx,2 |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP or WSTATE_MAXIMIZED |
jnz @f |
add ecx,2 |
@@: sub edi,window_data |
shr edi,5 |
shl edi,8 |
add edi,SLOT_BASE+APPDATA.saved_box |
cld |
rep movsd |
pop ecx edi esi |
shr edi,5 |
shl edi,8 |
add edi,SLOT_BASE+APPDATA.saved_box |
cld |
rep movsd |
pop ecx edi esi |
no_bounds_save: |
pushad ; WINDOW SHADE/FULLSCREEN |
pushad ; WINDOW SHADE/FULLSCREEN |
cmp [reposition],1 |
je no_window_sizing |
mov edx,edi |
sub edx,window_data |
shr edx,5 |
shl edx,8 |
add edx,SLOT_BASE ; process base at 0x80000+ |
cmp [reposition],1 |
je no_window_sizing |
mov edx,edi |
sub edx,window_data |
shr edx,5 |
shl edx,8 |
add edx,SLOT_BASE ; process base at 0x80000+ |
cmp [do_resize],2 ; window shade ? |
jne no_window_shade |
mov [reposition],1 |
cmp [do_resize],2 ; window shade ? |
jne no_window_shade |
mov [reposition],1 |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz wnd_rolldown |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz wnd_rolldown |
wnd_rollup: |
or [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
call get_rolledup_height |
jmp @f |
or [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
call get_rolledup_height |
jmp @f |
wnd_rolldown: |
and [edi+WDATA.fl_wstate],not WSTATE_ROLLEDUP |
and [edi+WDATA.fl_wstate],not WSTATE_ROLLEDUP |
mov eax,[edx + APPDATA.saved_box.height] ; 0x90+BOX.height |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jz @f |
mov eax,[screen_workarea.bottom] |
sub eax,[screen_workarea.top] |
@@: mov [edi+WDATA.box.height],eax |
call set_window_clientbox |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jz @f |
mov eax,[screen_workarea.bottom] |
sub eax,[screen_workarea.top] |
@@: mov [edi+WDATA.box.height],eax |
call set_window_clientbox |
no_window_shade: |
cmp [do_resize],1 ; fullscreen/restore ? |
jne no_fullscreen_restore |
cmp [latest_window_touch_delta],dword 50 |
jg no_fullscreen_restore |
mov [reposition],1 |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jnz restore_from_fullscreen |
or [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
mov eax,[screen_workarea.left] |
mov [edi+WDATA.box.left],eax |
sub eax,[screen_workarea.right] |
neg eax |
mov [edi+WDATA.box.width],eax |
mov eax,[screen_workarea.top] |
mov [edi+WDATA.box.top],eax |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz @f |
sub eax,[screen_workarea.bottom] |
neg eax |
mov [edi+WDATA.box.height],eax |
cmp [do_resize],1 ; fullscreen/restore ? |
jne no_fullscreen_restore |
cmp [latest_window_touch_delta],dword 50 |
jg no_fullscreen_restore |
mov [reposition],1 |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jnz restore_from_fullscreen |
or [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
mov eax,[screen_workarea.left] |
mov [edi+WDATA.box.left],eax |
sub eax,[screen_workarea.right] |
neg eax |
mov [edi+WDATA.box.width],eax |
mov eax,[screen_workarea.top] |
mov [edi+WDATA.box.top],eax |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz @f |
sub eax,[screen_workarea.bottom] |
neg eax |
mov [edi+WDATA.box.height],eax |
@@: |
jmp restore_from_fullscreen.clientbox |
jmp restore_from_fullscreen.clientbox |
restore_from_fullscreen: |
and [edi+WDATA.fl_wstate],not WSTATE_MAXIMIZED |
push [edi+WDATA.box.height] |
push edi ; restore |
lea esi, [edx + APPDATA.saved_box] |
mov ecx,4 |
cld |
rep movsd |
pop edi |
pop eax |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jz @f |
mov [edi+WDATA.box.height],eax |
and [edi+WDATA.fl_wstate],not WSTATE_MAXIMIZED |
push [edi+WDATA.box.height] |
push edi ; restore |
lea esi, [edx + APPDATA.saved_box] |
mov ecx,4 |
cld |
rep movsd |
pop edi |
pop eax |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jz @f |
mov [edi+WDATA.box.height],eax |
@@: |
.clientbox: |
call set_window_clientbox |
call set_window_clientbox |
no_fullscreen_restore: |
mov eax,[edi+WDATA.box.top] ; check Y inside screen |
add eax,[edi+WDATA.box.height] |
cmp eax,[ScreenHeight] |
jbe no_window_sizing |
mov eax,[edi+WDATA.box.left] ; check X inside screen |
add eax,[edi+WDATA.box.width] |
cmp eax,[ScreenWidth] |
jbe no_window_sizing |
mov eax,[ScreenWidth] |
sub eax,[edi+WDATA.box.width] |
mov [edi+WDATA.box.left],eax |
mov eax,[ScreenHeight] |
sub eax,[edi+WDATA.box.height] |
mov [edi+WDATA.box.top],eax |
call set_window_clientbox |
mov eax,[edi+WDATA.box.top] ; check Y inside screen |
add eax,[edi+WDATA.box.height] |
cmp eax,[ScreenHeight] |
jbe no_window_sizing |
mov eax,[edi+WDATA.box.left] ; check X inside screen |
add eax,[edi+WDATA.box.width] |
cmp eax,[ScreenWidth] |
jbe no_window_sizing |
mov eax,[ScreenWidth] |
sub eax,[edi+WDATA.box.width] |
mov [edi+WDATA.box.left],eax |
mov eax,[ScreenHeight] |
sub eax,[edi+WDATA.box.height] |
mov [edi+WDATA.box.top],eax |
call set_window_clientbox |
no_window_sizing: |
popad |
popad |
cmp [reposition],0 |
je retwm |
cmp [reposition],0 |
je retwm |
mov [DONT_DRAW_MOUSE],byte 1 ; no mouse |
mov [DONT_DRAW_MOUSE],byte 1 ; no mouse |
push eax ebx ecx edx |
mov eax,[edi+WDATA.box.left] |
mov ebx,[edi+WDATA.box.top] |
mov ecx,[edi+WDATA.box.width] |
mov edx,[edi+WDATA.box.height] |
add ecx,eax |
add edx,ebx |
call calculatescreen |
push eax ebx ecx edx |
mov eax,[edi+WDATA.box.left] |
mov ebx,[edi+WDATA.box.top] |
mov ecx,[edi+WDATA.box.width] |
mov edx,[edi+WDATA.box.height] |
add ecx,eax |
add edx,ebx |
call calculatescreen |
mov eax,[oldc+BOX.left] |
mov ebx,[oldc+BOX.top] |
mov ecx,[oldc+BOX.width] |
mov edx,[oldc+BOX.height] |
add ecx,eax |
add edx,ebx |
call calculatescreen |
pop edx ecx ebx eax |
mov eax,[oldc+BOX.left] |
mov ebx,[oldc+BOX.top] |
mov ecx,[oldc+BOX.width] |
mov edx,[oldc+BOX.height] |
add ecx,eax |
add edx,ebx |
call calculatescreen |
pop edx ecx ebx eax |
mov eax,edi |
call redrawscreen |
mov eax,edi |
call redrawscreen |
mov [edi+WDATA.fl_redraw],1 |
mov [edi+WDATA.fl_redraw],1 |
mov ecx,100 ; wait to avoid mouse residuals |
mov ecx,100 ; wait to avoid mouse residuals |
waitre2: |
mov [DONT_DRAW_MOUSE],byte 1 |
call checkidle |
cmp [edi+WDATA.fl_redraw],0 |
jz retwm |
loop waitre2 |
mov [DONT_DRAW_MOUSE],byte 1 |
call checkidle |
cmp [edi+WDATA.fl_redraw],0 |
jz retwm |
loop waitre2 |
retwm: |
mov [DONT_DRAW_MOUSE],byte 0 ; mouse pointer |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
mov [MOUSE_DOWN],byte 0 ; react to mouse up/down |
mov [DONT_DRAW_MOUSE],byte 0 ; mouse pointer |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
mov [MOUSE_DOWN],byte 0 ; react to mouse up/down |
mov esi,window_moved |
call sys_msg_board_str |
mov esi,window_moved |
call sys_msg_board_str |
popad |
popad |
ret |
ret |
uglobal |
add_window_data dd 0 |
add_window_data dd 0 |
do_resize_from_corner db 0x0 |
reposition db 0x0 |
latest_window_touch dd 0x0 |
reposition db 0x0 |
latest_window_touch dd 0x0 |
latest_window_touch_delta dd 0x0 |
do_resize db 0x0 |
oldc dd 0x0,0x0,0x0,0x0 |
oldc dd 0x0,0x0,0x0,0x0 |
dlx dd 0x0 |
dly dd 0x0 |
dlxe dd 0x0 |
dlye dd 0x0 |
dlx dd 0x0 |
dly dd 0x0 |
dlxe dd 0x0 |
dlye dd 0x0 |
npx dd 0x0 |
npy dd 0x0 |
npxe dd 0x0 |
npye dd 0x0 |
npx dd 0x0 |
npy dd 0x0 |
npxe dd 0x0 |
npye dd 0x0 |
mpx dd 0x0 |
mpy dd 0x0 |
mpx dd 0x0 |
mpy dd 0x0 |
endg |
; draw negative window frames |
drawwindowframes2: |
pushad |
cli |
jmp drawwindowframes.do |
pushad |
cli |
jmp drawwindowframes.do |
drawwindowframes: |
pushad |
cli |
pushad |
cli |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jnz .ret |
mov eax, [npx] |
cmp eax, [edi+WDATA.box.left] |
jnz .nowndframe |
mov eax, [npxe] |
cmp eax, [edi+WDATA.box.width] |
jnz .nowndframe |
mov eax, [npy] |
cmp eax, [edi+WDATA.box.top] |
jnz .nowndframe |
mov eax, [npye] |
cmp eax, [edi+WDATA.box.height] |
jnz .nowndframe |
xor [edi+WDATA.fl_wdrawn], 2 |
test [edi+WDATA.fl_wdrawn], 4 |
jnz .ret |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jnz .ret |
mov eax, [npx] |
cmp eax, [edi+WDATA.box.left] |
jnz .nowndframe |
mov eax, [npxe] |
cmp eax, [edi+WDATA.box.width] |
jnz .nowndframe |
mov eax, [npy] |
cmp eax, [edi+WDATA.box.top] |
jnz .nowndframe |
mov eax, [npye] |
cmp eax, [edi+WDATA.box.height] |
jnz .nowndframe |
xor [edi+WDATA.fl_wdrawn], 2 |
test [edi+WDATA.fl_wdrawn], 4 |
jnz .ret |
.nowndframe: |
.do: |
mov edi, 1 |
mov ecx, 0x01000000 |
mov eax,[npx] |
shl eax,16 |
add eax,[npx] |
add eax,[npxe] |
add eax,65536*1-1 |
mov ebx,[npy] |
shl ebx,16 |
add ebx,[npy] |
call [draw_line] |
mov edi, 1 |
mov ecx, 0x01000000 |
mov eax,[npx] |
shl eax,16 |
add eax,[npx] |
add eax,[npxe] |
add eax,65536*1-1 |
mov ebx,[npy] |
shl ebx,16 |
add ebx,[npy] |
call [draw_line] |
mov eax,[npx] |
shl eax,16 |
add eax,[npx] |
add eax,[npxe] |
add eax,65536*1-1 |
mov ebx,[npy] |
add ebx,[npye] |
shl ebx,16 |
add ebx,[npy] |
add ebx,[npye] |
call [draw_line] |
mov eax,[npx] |
shl eax,16 |
add eax,[npx] |
add eax,[npxe] |
add eax,65536*1-1 |
mov ebx,[npy] |
add ebx,[npye] |
shl ebx,16 |
add ebx,[npy] |
add ebx,[npye] |
call [draw_line] |
mov eax,[npx] |
shl eax,16 |
add eax,[npx] |
mov ebx,[npy] |
shl ebx,16 |
add ebx,[npy] |
add ebx,[npye] |
call [draw_line] |
mov eax,[npx] |
shl eax,16 |
add eax,[npx] |
mov ebx,[npy] |
shl ebx,16 |
add ebx,[npy] |
add ebx,[npye] |
call [draw_line] |
mov eax,[npx] |
add eax,[npxe] |
shl eax,16 |
add eax,[npx] |
add eax,[npxe] |
mov ebx,[npy] |
shl ebx,16 |
add ebx,[npy] |
add ebx,[npye] |
call [draw_line] |
mov eax,[npx] |
add eax,[npxe] |
shl eax,16 |
add eax,[npx] |
add eax,[npxe] |
mov ebx,[npy] |
shl ebx,16 |
add ebx,[npy] |
add ebx,[npye] |
call [draw_line] |
.ret: |
sti |
popad |
ret |
sti |
popad |
ret |
/kernel/trunk/gui/button.inc |
---|
59,225 → 59,225 |
drawbuttonframes: |
push esi |
push edi |
push eax |
push ebx |
push ecx |
push edx |
push esi |
push edi |
push eax |
push ebx |
push ecx |
push edx |
shr eax,16 |
shr ebx,16 |
mov edx,[TASK_BASE] |
shr eax,16 |
shr ebx,16 |
mov edx,[TASK_BASE] |
add eax,[edx-twdw + WDATA.box.left] |
add ebx,[edx-twdw + WDATA.box.top] |
mov cx,ax |
mov dx,bx |
shl eax,16 |
shl ebx,16 |
mov ax,cx |
mov bx,dx |
add ax,word [esp+12] |
mov esi,ebx |
mov edi,0 |
mov ecx,[esp+0] |
call incecx |
call [draw_line] |
mov cx,ax |
mov dx,bx |
shl eax,16 |
shl ebx,16 |
mov ax,cx |
mov bx,dx |
add ax,word [esp+12] |
mov esi,ebx |
mov edi,0 |
mov ecx,[esp+0] |
call incecx |
call [draw_line] |
movzx edx,word [esp+8] |
add ebx,edx |
shl edx,16 |
add ebx,edx |
mov ecx,[esp+0] |
call dececx |
call [draw_line] |
movzx edx,word [esp+8] |
add ebx,edx |
shl edx,16 |
add ebx,edx |
mov ecx,[esp+0] |
call dececx |
call [draw_line] |
mov ebx,esi |
push edx |
mov edx,eax |
shr edx,16 |
mov ax,dx |
mov edx,ebx |
shr edx,16 |
mov bx,dx |
mov dx,[esp+8+4] |
add bx,dx |
pop edx |
mov edi,0 |
mov ecx,[esp+0] |
call incecx |
call [draw_line] |
mov ebx,esi |
push edx |
mov edx,eax |
shr edx,16 |
mov ax,dx |
mov edx,ebx |
shr edx,16 |
mov bx,dx |
mov dx,[esp+8+4] |
add bx,dx |
pop edx |
mov edi,0 |
mov ecx,[esp+0] |
call incecx |
call [draw_line] |
mov esi,edx |
mov dx,[esp+12] |
add ax,dx |
shl edx,16 |
add eax,edx |
add ebx,1*65536 |
mov edx,esi |
mov ecx,[esp+0] |
call dececx |
call [draw_line] |
mov esi,edx |
mov dx,[esp+12] |
add ax,dx |
shl edx,16 |
add eax,edx |
add ebx,1*65536 |
mov edx,esi |
mov ecx,[esp+0] |
call dececx |
call [draw_line] |
pop edx |
pop ecx |
pop ebx |
pop eax |
pop edi |
pop esi |
pop edx |
pop ecx |
pop ebx |
pop eax |
pop edi |
pop esi |
ret |
ret |
button_dececx: |
cmp [buttontype],dword 1 |
jne .finish |
cmp [buttontype],dword 1 |
jne .finish |
; je bdece |
; ret |
; bdece: |
push eax |
mov eax,0x01 |
cmp edi,20 |
jg @f |
mov eax,0x02 |
push eax |
mov eax,0x01 |
cmp edi,20 |
jg @f |
mov eax,0x02 |
@@: |
test ecx,0xff |
jz @f |
sub ecx,eax |
test ecx,0xff |
jz @f |
sub ecx,eax |
@@: |
shl eax,8 |
test ecx,0xff00 |
jz @f |
sub ecx,eax |
shl eax,8 |
test ecx,0xff00 |
jz @f |
sub ecx,eax |
@@: |
shl eax,8 |
test ecx,0xff0000 |
jz @f |
sub ecx,eax |
shl eax,8 |
test ecx,0xff0000 |
jz @f |
sub ecx,eax |
@@: |
pop eax |
pop eax |
.finish: |
ret |
ret |
sys_button: |
push edi |
mov edi,[CURRENT_TASK] |
shl edi,8 |
rol eax,16 |
add ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.left] |
rol eax,16 |
rol ebx,16 |
add bx,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top] |
rol ebx,16 |
pop edi |
push edi |
mov edi,[CURRENT_TASK] |
shl edi,8 |
rol eax,16 |
add ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.left] |
rol eax,16 |
rol ebx,16 |
add bx,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top] |
rol ebx,16 |
pop edi |
.forced: |
test ecx,0x80000000 |
jnz remove_button |
test ecx,0x80000000 |
jnz remove_button |
push esi |
push edi |
push eax ; <x,xs> |
push ebx ; <y,ys> |
push ecx ; <id> |
push edx |
push esi |
push edi |
push eax ; <x,xs> |
push ebx ; <y,ys> |
push ecx ; <id> |
push edx |
or ax,ax |
jle noaddbutt |
or bx,bx |
jle noaddbutt |
or ax,ax |
jle noaddbutt |
or bx,bx |
jle noaddbutt |
test ecx,0x40000000 |
jnz button_no_draw |
test ecx,0x40000000 |
jnz button_no_draw |
pushad ; button body |
push ebx |
shr eax,16 |
shr ebx,16 |
mov edx,[TASK_BASE] |
mov esi,[edx-twdw + WDATA.box.left] |
mov edi,[edx-twdw + WDATA.box.top] |
add eax,esi |
add ebx,edi |
mov cx,ax |
mov dx,bx |
shl eax,16 |
shl ebx,16 |
mov ax,cx |
mov bx,dx |
movzx ecx,word [4+32+esp+12] |
add eax,ecx |
mov ecx,[4+32+esp+0] |
cmp [buttontype],dword 0 |
je @f |
call incecx2 |
pushad ; button body |
push ebx |
shr eax,16 |
shr ebx,16 |
mov edx,[TASK_BASE] |
mov esi,[edx-twdw + WDATA.box.left] |
mov edi,[edx-twdw + WDATA.box.top] |
add eax,esi |
add ebx,edi |
mov cx,ax |
mov dx,bx |
shl eax,16 |
shl ebx,16 |
mov ax,cx |
mov bx,dx |
movzx ecx,word [4+32+esp+12] |
add eax,ecx |
mov ecx,[4+32+esp+0] |
cmp [buttontype],dword 0 |
je @f |
call incecx2 |
@@: |
movzx edi,word [esp] |
movzx edi,word [esp] |
pop edx |
and edx, 0xFFFF |
pop edx |
and edx, 0xFFFF |
.newline: |
call button_dececx |
push edi |
xor edi, edi |
call [draw_line] |
pop edi |
add ebx,1*65536+1 ; [ y start | y end ] |
dec edx |
jnz .newline |
popad |
call button_dececx |
push edi |
xor edi, edi |
call [draw_line] |
pop edi |
add ebx,1*65536+1 ; [ y start | y end ] |
dec edx |
jnz .newline |
popad |
call drawbuttonframes |
call drawbuttonframes |
button_no_draw: |
and ecx,0xffff |
and ecx,0xffff |
mov edi,[BTN_ADDR] |
movzx eax,word [edi] |
cmp eax,max_buttons |
jge noaddbutt |
inc eax |
mov [edi],ax |
mov edi,[BTN_ADDR] |
movzx eax,word [edi] |
cmp eax,max_buttons |
jge noaddbutt |
inc eax |
mov [edi],ax |
shl eax,4 |
add eax,edi |
shl eax,4 |
add eax,edi |
mov bx,[CURRENT_TASK] |
mov [eax],bx |
mov bx,[CURRENT_TASK] |
mov [eax],bx |
add eax,2 ; save button id number |
mov ebx,[esp+4] |
mov [eax],bx ; bits 0-15 |
shr ebx,16 |
mov [eax-2+0xc],bx; bits 16-31 |
add eax,2 ; x start |
mov bx,[esp+12+2] |
mov [eax],bx |
add eax,2 ; x size |
mov bx,[esp+12+0] |
mov [eax],bx |
add eax,2 ; y start |
mov bx,[esp+8+2] |
mov [eax],bx |
add eax,2 ; y size |
mov bx,[esp+8+0] |
mov [eax],bx |
add eax,2 ; save button id number |
mov ebx,[esp+4] |
mov [eax],bx ; bits 0-15 |
shr ebx,16 |
mov [eax-2+0xc],bx; bits 16-31 |
add eax,2 ; x start |
mov bx,[esp+12+2] |
mov [eax],bx |
add eax,2 ; x size |
mov bx,[esp+12+0] |
mov [eax],bx |
add eax,2 ; y start |
mov bx,[esp+8+2] |
mov [eax],bx |
add eax,2 ; y size |
mov bx,[esp+8+0] |
mov [eax],bx |
noaddbutt: |
pop edx |
pop ecx |
pop ebx |
pop eax |
pop edi |
pop esi |
pop edx |
pop ecx |
pop ebx |
pop eax |
pop edi |
pop esi |
ret |
ret |
remove_button: |
294,7 → 294,7 |
rnewba: |
dec bx |
jz rnmba |
jz rnmba |
add eax,0x10 |
323,44 → 323,44 |
find_pressed_button_frames: |
pushad |
pushad |
movzx ebx,word [eax+0] |
shl ebx,5 |
add ebx,window_data |
movzx ebx,word [eax+0] |
shl ebx,5 |
add ebx,window_data |
mov ecx, [ebx+ WDATA.box.left] ; window x start |
movzx edx,word [eax+4] ; button x start |
add ecx,edx |
push ecx |
movzx edx,word [eax+4] ; button x start |
add ecx,edx |
push ecx |
mov dx,[eax+6] ; button x size |
add cx,dx |
mov esi,ecx |
inc esi |
mov ecx, [ebx+WDATA.box.top] ; window y start |
mov dx,[eax+8] ; button y start |
add ecx,edx |
mov ebx,ecx |
mov dx,[eax+10] ; button y size |
add dx,cx |
inc dx |
mov dx,[eax+6] ; button x size |
add cx,dx |
mov esi,ecx |
inc esi |
mov ecx, [ebx+WDATA.box.top] ; window y start |
mov dx,[eax+8] ; button y start |
add ecx,edx |
mov ebx,ecx |
mov dx,[eax+10] ; button y size |
add dx,cx |
inc dx |
pop eax |
pop eax |
; eax x beginning |
; ebx y beginning |
; esi x end |
; edx y end |
; ecx color |
; eax x beginning |
; ebx y beginning |
; esi x end |
; edx y end |
; ecx color |
mov [pressed_button_eax],eax |
mov [pressed_button_ebx],ebx |
mov [pressed_button_ecx],ecx |
mov [pressed_button_edx],edx |
mov [pressed_button_esi],esi |
mov [pressed_button_eax],eax |
mov [pressed_button_ebx],ebx |
mov [pressed_button_ecx],ecx |
mov [pressed_button_edx],edx |
mov [pressed_button_esi],esi |
popad |
ret |
popad |
ret |
uglobal |
pressed_button_eax dd 0 |
373,70 → 373,70 |
; negative button image |
negativebutton: |
; If requested, do not display button |
; boarder on press. |
test ebx,0x20000000 |
jz draw_negative_button |
ret |
; If requested, do not display button |
; boarder on press. |
test ebx,0x20000000 |
jz draw_negative_button |
ret |
draw_negative_button: |
pushad |
pushad |
mov eax,[pressed_button_eax] |
mov ebx,[pressed_button_ebx] |
mov ecx,[pressed_button_ecx] |
mov edx,[pressed_button_edx] |
mov esi,[pressed_button_esi] |
mov ecx,0x01000000 |
mov eax,[pressed_button_eax] |
mov ebx,[pressed_button_ebx] |
mov ecx,[pressed_button_ecx] |
mov edx,[pressed_button_edx] |
mov esi,[pressed_button_esi] |
mov ecx,0x01000000 |
dec edx |
push edx |
inc edx |
dec esi |
push esi |
inc esi |
dec edx |
push edx |
inc edx |
dec esi |
push esi |
inc esi |
push eax |
push ebx |
push ecx |
push edx |
push edi |
push eax |
push ebx |
push ecx |
push edx |
push edi |
call [disable_mouse] |
call [disable_mouse] |
bdbnewline: |
mov edi,1 ; force |
cmp eax,[esp+16] |
jz bneg |
cmp eax,[esp+20] |
jz bneg |
cmp ebx,[esp+12] |
jz bneg |
cmp ebx,[esp+24] |
jnz nbneg |
mov edi,1 ; force |
cmp eax,[esp+16] |
jz bneg |
cmp eax,[esp+20] |
jz bneg |
cmp ebx,[esp+12] |
jz bneg |
cmp ebx,[esp+24] |
jnz nbneg |
; jz bneg |
; jmp nbneg |
bneg: |
;;;call [disable_mouse] |
call [putpixel] |
;;;call [disable_mouse] |
call [putpixel] |
nbneg: |
inc eax |
cmp eax,esi |
jnz bdbnewline |
mov eax,[esp+16] |
inc ebx |
cmp ebx,edx |
jnz bdbnewline |
inc eax |
cmp eax,esi |
jnz bdbnewline |
mov eax,[esp+16] |
inc ebx |
cmp ebx,edx |
jnz bdbnewline |
add esp,28 |
add esp,28 |
popad |
popad |
ret |
ret |
; check buttons |
458,11 → 458,9 |
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed |
jnz @f |
;..................................... start 1/5 : modified by vhanla ............................. |
mov [bPressedMouseXY_B],0 |
;..................................... end 1/5 : modified by vhanla ............................. |
ret |
@@: |
pushad |
xor esi, esi |
474,20 → 472,6 |
ret |
@@: |
;..................................... start 2/5 : modified by vhanla ............................. |
;here i catch the coordinates when the mouse's button is clicked |
push ax |
cmp [bPressedMouseXY_B],0;FALSE |
jnz @f |
mov [bPressedMouseXY_B],1;TRUE - it was already clicked |
mov ax,[MOUSE_X] |
mov [mx],ax |
mov ax,[MOUSE_Y] |
mov [my],ax |
@@: |
pop ax |
;and it is only refreshed after the mouse's button release |
;..................................... end 2/5 : modified by vhanla ............................. |
push esi |
inc edx |
501,7 → 485,7 |
cmp edx,esi |
jge bch |
popad ; no button pressed |
popad ; no button pressed |
ret |
bch: |
512,6 → 496,10 |
shl eax,4 |
add eax,edi |
;......................start 1/2 : modified by vhanla ............................. |
mov [buttonid],eax |
;......................end 1/2 : modified by vhanla ............................. |
; check that button is at top of windowing stack |
movzx ebx,word [eax] |
524,8 → 512,8 |
movzx ebx,word [eax+0] |
shl ebx,5 |
test [ebx+window_data+WDATA.fl_wstate],WSTATE_MINIMIZED |
jnz buttonnewcheck |
test [ebx+window_data+WDATA.fl_wstate],WSTATE_MINIMIZED |
jnz buttonnewcheck |
; add ebx,window_data |
; mov ecx,[window_data+ebx+8] ; window end X |
539,7 → 527,7 |
jge buttonnewcheck |
; check coordinates |
; mouse x >= button x ? |
; mouse x >= button x ? |
movzx ebx,word [eax+0] |
shl ebx,5 |
add ebx,window_data |
546,34 → 534,30 |
mov ecx, [ebx+WDATA.box.left] ; window x start |
movzx edx,word [eax+4] ; button x start |
add edx,ecx |
;..................................... start 3/5 : modified by vhanla ............................. |
mov cx,[mx] ;mov cx,[MOUSE_X] |
;..................................... end 3/5 : modified by vhanla ............................. |
mov cx,[MOUSE_X] |
cmp edx,ecx |
jg buttonnewcheck |
jg buttonnewcheck |
movzx ebx,word [eax+6] ; button x size |
add edx,ebx |
cmp ecx,edx |
jg buttonnewcheck |
jg buttonnewcheck |
; mouse y >= button y ? |
; mouse y >= button y ? |
movzx ebx,word [eax+0] |
shl ebx,5 |
add ebx,window_data |
mov ecx, [ebx+WDATA.box.top] ; window y start |
mov ecx, [ebx+WDATA.box.top] ; window y start |
movzx edx,word [eax+8] ; button y start |
add edx,ecx |
;..................................... start 4/5 : modified by vhanla ............................. |
mov cx,[my] ;mov cx,[MOUSE_Y] |
;..................................... start 4/5 : modified by vhanla ............................. |
mov cx,[MOUSE_Y] |
cmp edx,ecx |
jg buttonnewcheck |
jg buttonnewcheck |
movzx ebx,word [eax+10] ; button y size |
add edx,ebx |
cmp ecx,edx |
jg buttonnewcheck |
jg buttonnewcheck |
; mouse on button |
580,9 → 564,9 |
pop edx |
pop esi |
mov bx,[eax+0xc] ; button id : bits 16-31 |
mov bx,[eax+0xc] ; button id : bits 16-31 |
shl ebx,16 |
mov bx,[eax+2] ; button id : bits 00-16 |
mov bx,[eax+2] ; button id : bits 00-16 |
push ebx |
mov [MOUSE_DOWN],byte 1 ; no mouse down checks |
607,60 → 591,58 |
call negativebutton |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
;..................................... start 5/5 : modified by vhanla ............................. |
;..................................... start 2/2 : modified by vhanla ............................. |
; check coordinates |
jmp @f |
mx dw 0x0 ; keeps the x mouse's position when it was clicked |
my dw 0x0 ; keeps the y mouse's position when it was clicked |
bPressedMouseXY_B db 0x0 |
@@: |
jmp afterbuttonid |
buttonid dd 0x0 ;here a will backup the eax value |
afterbuttonid: |
pusha |
; mouse x >= button x ? |
movzx ebx,word [eax+0] |
shl ebx,5 |
add ebx,window_data |
mov ecx, [ebx+WDATA.box.left] ; window x start |
shl ebx,5 |
add ebx,window_data |
mov ecx, [ebx+WDATA.box.left] ; window x start |
movzx edx,word [eax+4] ; button x start |
add edx,ecx |
mov cx,[MOUSE_X] |
cmp edx,ecx |
jg no_on_button ;if we release the pointer out of the button area |
add edx,ecx |
mov cx,[MOUSE_X] |
cmp edx,ecx |
jg no_on_button ;if we release the pointer out of the button area |
movzx ebx,word [eax+6] ; button x size |
add edx,ebx |
cmp ecx,edx |
jg no_on_button |
add edx,ebx |
cmp ecx,edx |
jg no_on_button |
; mouse y >= button y ? |
; mouse y >= button y ? |
movzx ebx,word [eax+0] |
shl ebx,5 |
add ebx,window_data |
mov ecx, [ebx+WDATA.box.top] ; window y start |
shl ebx,5 |
add ebx,window_data |
mov ecx, [ebx+WDATA.box.top] ; window y start |
movzx edx,word [eax+8] ; button y start |
add edx,ecx |
mov cx,[MOUSE_Y] |
cmp edx,ecx |
jg no_on_button |
add edx,ecx |
mov cx,[MOUSE_Y] |
cmp edx,ecx |
jg no_on_button |
movzx ebx,word [eax+10] ; button y size |
add edx,ebx |
cmp ecx,edx |
jg no_on_button |
add edx,ebx |
cmp ecx,edx |
jg no_on_button |
popa |
mov [BTN_COUNT],byte 1 ; no of buttons in buffer |
pop ebx |
mov [BTN_BUFF],ebx ; lets put the button id in buffer |
mov [BTN_COUNT],byte 1 ; no of buttons in buffer |
pop ebx |
mov [BTN_BUFF],ebx ; lets put the button id in buffer |
push ebx |
pusha |
jmp yes_on_button |
no_on_button: |
mov [BTN_COUNT],byte 0 ; no of buttons in buffer |
mov [BTN_COUNT],byte 0 ; no of buttons in buffer |
yes_on_button: |
mov [MOUSE_DOWN],byte 0 ; mouse down -> do not draw |
mov [MOUSE_DOWN],byte 0 ; mouse down -> do not draw |
popa |
pop ebx |
popa |
ret |
;..................................... end 5/5 : modified by vhanla ................................ |
;..................................... end 2/2 : modified by vhanla ................................ |