1035,9 → 1035,8 |
align 32 |
osloop: |
call [draw_pointer] |
call check_buttons |
call checkwindows |
; call check_window_move_request |
call window_check_events |
call mouse_check_events |
call checkmisc |
call checkVga_N13 |
call stack_handler |
2675,11 → 2674,7 |
test eax, eax |
jz .exit |
mov eax, [BTN_BUFF] |
shl eax, 8 |
; // Alver 22.06.2008 // { |
mov al, byte [btn_down_determ] |
and al,0xFE ; delete left button bit |
; } \\ Alver \\ |
mov [BTN_COUNT], byte 0 |
mov [esp + 32], eax |
.exit: |
2911,480 → 2906,6 |
srl1: |
ret |
|
|
sys_drawwindow: |
|
mov eax,edx |
shr eax,16+8 |
and eax,15 |
|
; cmp eax,0 ; type I - original style |
jne nosyswI |
inc [mouse_pause] |
call [_display.disable_mouse] |
call sys_set_window |
call [_display.disable_mouse] |
call drawwindow_I |
;dec [mouse_pause] |
;call [draw_pointer] |
;ret |
jmp draw_window_caption.2 |
nosyswI: |
|
cmp al,1 ; type II - only reserve area, no draw |
jne nosyswII |
inc [mouse_pause] |
call [_display.disable_mouse] |
call sys_set_window |
call [_display.disable_mouse] |
call sys_window_mouse |
dec [mouse_pause] |
call [draw_pointer] |
ret |
nosyswII: |
|
cmp al,2 ; type III - new style |
jne nosyswIII |
inc [mouse_pause] |
call [_display.disable_mouse] |
call sys_set_window |
call [_display.disable_mouse] |
call drawwindow_III |
;dec [mouse_pause] |
;call [draw_pointer] |
;ret |
jmp draw_window_caption.2 |
nosyswIII: |
|
cmp al,3 ; type IV - skinned window |
je draw_skin_window |
cmp al,4 ; type V - skinned window not sized! {not_sized_skin_window} |
jne nosyswV |
draw_skin_window: |
|
inc [mouse_pause] |
call [_display.disable_mouse] |
call sys_set_window |
call [_display.disable_mouse] |
mov eax, [TASK_COUNT] |
movzx eax, word [WIN_POS + eax*2] |
cmp eax, [CURRENT_TASK] |
setz al |
movzx eax, al |
push eax |
call drawwindow_IV |
;dec [mouse_pause] |
;call [draw_pointer] |
;ret |
jmp draw_window_caption.2 |
nosyswV: |
|
ret |
|
|
draw_window_caption: |
inc [mouse_pause] |
call [_display.disable_mouse] |
|
xor eax,eax |
mov edx,[TASK_COUNT] |
movzx edx,word[WIN_POS+edx*2] |
cmp edx,[CURRENT_TASK] |
jne @f |
inc eax |
@@: mov edx,[CURRENT_TASK] |
shl edx,5 |
add edx,window_data |
movzx ebx,[edx+WDATA.fl_wstyle] |
and bl,0x0F |
cmp bl,3 |
je .draw_caption_style_3 ;{for 3 and 4 style write caption} |
cmp bl,4 |
je .draw_caption_style_3 |
|
jmp .not_style_3 |
.draw_caption_style_3: |
|
push edx |
call drawwindow_IV_caption |
add esp,4 |
jmp .2 |
|
.not_style_3: |
cmp bl,2 |
jne .not_style_2 |
|
call drawwindow_III_caption |
jmp .2 |
|
.not_style_2: |
cmp bl,0 |
jne .2 |
|
call drawwindow_I_caption |
|
;-------------------------------------------------------------- |
.2: ;jmp @f |
mov edi,[CURRENT_TASK] |
shl edi,5 |
test [edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION |
jz @f |
mov edx,[edi*8+SLOT_BASE+APPDATA.wnd_caption] |
or edx,edx |
jz @f |
|
movzx eax,[edi+window_data+WDATA.fl_wstyle] |
and al,0x0F |
cmp al,3 |
je .skinned |
cmp al,4 |
je .skinned |
|
jmp .not_skinned |
.skinned: |
mov ebp,[edi+window_data+WDATA.box.left-2] |
mov bp,word[edi+window_data+WDATA.box.top] |
movzx eax,word[edi+window_data+WDATA.box.width] |
sub ax,[_skinmargins.left] |
sub ax,[_skinmargins.right] |
push edx |
cwde |
cdq |
mov ebx,6 |
idiv ebx |
pop edx |
or eax,eax |
js @f |
mov esi,eax |
mov ebx,dword[_skinmargins.left-2] |
mov bx,word[_skinh] |
sub bx,[_skinmargins.bottom] |
sub bx,[_skinmargins.top] |
sar bx,1 |
adc bx,0 |
add bx,[_skinmargins.top] |
add bx,-3 |
add ebx,ebp |
jmp .dodraw |
|
.not_skinned: |
cmp al,1 |
je @f |
|
mov ebp,[edi+window_data+WDATA.box.left-2] |
mov bp,word[edi+window_data+WDATA.box.top] |
movzx eax,word[edi+window_data+WDATA.box.width] |
sub eax,16 |
push edx |
cwde |
cdq |
mov ebx,6 |
idiv ebx |
pop edx |
or eax,eax |
js @f |
mov esi,eax |
mov ebx,0x00080007 |
add ebx,ebp |
.dodraw: |
mov ecx,[common_colours+16];0x00FFFFFF |
or ecx, 0x80000000 |
xor edi,edi |
; // Alver 22.06.2008 // { |
; call dtext |
call dtext_asciiz_esi |
; } \\ Alver \\ |
|
@@: |
;-------------------------------------------------------------- |
dec [mouse_pause] |
call [draw_pointer] |
ret |
|
iglobal |
align 4 |
window_topleft dd \ |
1, 21,\ ;type 0 |
0, 0,\ ;type 1 |
5, 20,\ ;type 2 |
5, ?,\ ;type 3 {set by skin} |
5, ? ;type 4 {set by skin} |
endg |
|
set_window_clientbox: |
push eax ecx edi |
|
mov eax,[_skinh] |
mov [window_topleft+4*7],eax |
mov [window_topleft+4*9],eax |
|
mov ecx,edi |
sub edi,window_data |
shl edi,3 |
test [ecx+WDATA.fl_wstyle],WSTYLE_CLIENTRELATIVE |
jz @f |
|
movzx eax,[ecx+WDATA.fl_wstyle] |
and eax,0x0F |
mov eax,[eax*8+window_topleft+0] |
mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.left],eax |
shl eax,1 |
neg eax |
add eax,[ecx+WDATA.box.width] |
mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.width],eax |
|
movzx eax,[ecx+WDATA.fl_wstyle] |
and eax,0x0F |
push [eax*8+window_topleft+0] |
mov eax,[eax*8+window_topleft+4] |
mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.top],eax |
neg eax |
sub eax,[esp] |
add eax,[ecx+WDATA.box.height] |
mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.height],eax |
add esp,4 |
|
pop edi ecx eax |
ret |
@@: |
xor eax,eax |
mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.left],eax |
mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.top],eax |
mov eax,[ecx+WDATA.box.width] |
mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.width],eax |
mov eax,[ecx+WDATA.box.height] |
mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.height],eax |
|
pop edi ecx eax |
ret |
|
sys_set_window: |
|
mov eax,[CURRENT_TASK] |
shl eax,5 |
add eax,window_data |
|
; colors |
mov [eax+WDATA.cl_workarea],edx |
mov [eax+WDATA.cl_titlebar],esi |
mov [eax+WDATA.cl_frames],edi |
|
mov edi, eax |
|
; check flag (?) |
test [edi+WDATA.fl_wdrawn],1 |
jnz newd |
|
mov eax,[timer_ticks] ;[0xfdf0] |
add eax,100 |
mov [new_window_starting],eax |
|
movsx eax,bx |
mov [edi+WDATA.box.width],eax |
movsx eax,cx |
mov [edi+WDATA.box.height],eax |
sar ebx,16 |
sar ecx,16 |
mov [edi+WDATA.box.left],ebx |
mov [edi+WDATA.box.top],ecx |
|
call check_window_position |
|
push ecx esi edi ; save for window fullscreen/resize |
;mov esi,edi |
|
mov cl, [edi+WDATA.fl_wstyle] |
mov eax, [edi+WDATA.cl_frames] |
|
sub edi,window_data |
shl edi,3 |
add edi,SLOT_BASE |
|
and cl,0x0F |
mov [edi+APPDATA.wnd_caption],0 |
cmp cl,3 |
je set_APPDATA_wnd_caption |
cmp cl,4 ; {SPraid.simba} |
je set_APPDATA_wnd_caption |
|
jmp @f |
set_APPDATA_wnd_caption: |
mov [edi+APPDATA.wnd_caption],eax |
@@: mov esi,[esp+0] |
|
add edi, APPDATA.saved_box |
movsd |
movsd |
movsd |
movsd |
pop edi esi ecx |
|
mov esi, [CURRENT_TASK] |
movzx esi, word [WIN_STACK+esi*2] |
lea esi, [WIN_POS+esi*2] |
call waredraw |
|
;;; mov ebx, 1 |
;;; call delay_hs |
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 [KEY_COUNT],byte 0 ; empty keyboard buffer |
mov [BTN_COUNT],byte 0 ; empty button buffer |
|
newd: |
call set_window_clientbox |
|
mov [edi+WDATA.fl_redraw],byte 0 ; no redraw |
mov edx,edi |
|
ret |
|
syscall_windowsettings: |
|
.set_window_caption: |
dec ebx ; subfunction #1 - set window caption |
jnz .exit_fail |
|
; NOTE: only window owner thread can set its caption, |
; so there's no parameter for PID/TID |
|
mov edi,[CURRENT_TASK] |
shl edi,5 |
|
; have to check if caption is within application memory limit |
; check is trivial, and if application resizes its memory, |
; caption still can become over bounds |
; diamond, 31.10.2006: check removed because with new memory manager |
; there can be valid data after APPDATA.mem_size bound |
; mov ecx,[edi*8+SLOT_BASE+APPDATA.mem_size] |
; add ecx,255 ; max caption length |
; cmp ebx,ecx |
; ja .exit_fail |
|
mov [edi*8+SLOT_BASE+APPDATA.wnd_caption],ecx |
or [edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION |
|
call draw_window_caption |
|
xor eax,eax ; eax = 0 (success) |
ret |
|
; .get_window_caption: |
; dec eax ; subfunction #2 - get window caption |
; jnz .exit_fail |
|
; not implemented yet |
|
.exit_fail: |
xor eax,eax |
inc eax ; eax = 1 (fail) |
ret |
|
|
sys_window_move: |
|
mov edi,[CURRENT_TASK] |
shl edi,5 |
add edi,window_data |
|
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jnz .window_move_return |
|
push dword [edi + WDATA.box.left] ; save old coordinates |
push dword [edi + WDATA.box.top] |
push dword [edi + WDATA.box.width] |
push dword [edi + WDATA.box.height] |
|
cmp eax,-1 ; set new position and size |
je .no_x_reposition |
mov [edi + WDATA.box.left], eax |
.no_x_reposition: |
cmp ebx,-1 |
je .no_y_reposition |
mov [edi + WDATA.box.top], ebx |
.no_y_reposition: |
|
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz .no_y_resizing |
|
cmp ecx,-1 |
je .no_x_resizing |
mov [edi + WDATA.box.width], ecx |
.no_x_resizing: |
cmp edx,-1 |
je .no_y_resizing |
mov [edi + WDATA.box.height], edx |
.no_y_resizing: |
|
call check_window_position |
call set_window_clientbox |
|
pushad ; save for window fullscreen/resize |
mov esi,edi |
sub edi,window_data |
shr edi,5 |
shl edi,8 |
add edi, SLOT_BASE + APPDATA.saved_box |
mov ecx,4 |
cld |
rep movsd |
popad |
|
pushad ; calculcate screen at new position |
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 |
popad |
|
pop edx ; calculcate screen at old position |
pop ecx |
pop ebx |
pop eax |
add ecx,eax |
add edx,ebx |
mov [draw_limits.left],eax ; save for drawlimits |
mov [draw_limits.top],ebx |
mov [draw_limits.right],ecx |
mov [draw_limits.bottom],edx |
call calculatescreen |
|
mov [edi + WDATA.fl_redraw], 1 ; flag the process as redraw |
|
mov eax,edi ; redraw screen at old position |
xor esi,esi |
call redrawscreen |
|
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 |
|
call [draw_pointer] |
|
mov [window_move_pr],0 |
|
.window_move_return: |
|
ret |
|
uglobal |
window_move_pr dd 0x0 |
window_move_eax dd 0x0 |
window_move_ebx dd 0x0 |
window_move_ecx dd 0x0 |
window_move_edx dd 0x0 |
endg |
|
;ok - 100% work |
;nt - not tested |
;--------------------------------------------------------------------------------------------- |