Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 383 → Rev 384

/kernel/branches/gfx_kernel/gui/button.inc
68,7 → 68,7
 
shr eax,16
shr ebx,16
mov edx,[0x3010]
mov edx,[TASK_BASE]
 
add eax,[edx-twdw + WDATA.box.left]
add ebx,[edx-twdw + WDATA.box.top]
164,13 → 164,13
sys_button:
 
push edi
mov edi,[0x3000]
mov edi,[CURRENT_TASK]
shl edi,8
rol eax,16
add ax,word[edi+0x80000+APPDATA.wnd_clientbox.left]
add ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.left]
rol eax,16
rol ebx,16
add bx,word[edi+0x80000+APPDATA.wnd_clientbox.top]
add bx,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
rol ebx,16
pop edi
.forced:
197,7 → 197,7
push ebx
sar eax,16
sar ebx,16
mov edx,[0x3010]
mov edx,[TASK_BASE]
mov esi,[edx-twdw + WDATA.box.left]
mov edi,[edx-twdw + WDATA.box.top]
add eax,esi
238,7 → 238,7
 
and ecx,0xffff
 
mov edi,[0xfe88]
mov edi,[BTN_ADDR]
movzx eax,word [edi]
cmp eax,max_buttons
jge noaddbutt
248,7 → 248,7
shl eax,4
add eax,edi
 
mov bx,[0x3000]
mov bx,[CURRENT_TASK]
mov [eax],bx
 
add eax,2 ; save button id number
287,7 → 287,7
 
rnewba2:
 
mov edi,[0xfe88]
mov edi,[BTN_ADDR]
mov eax,edi
movzx ebx,word [edi]
inc bx
299,7 → 299,7
 
add eax,0x10
 
mov dx,[0x3000]
mov dx,[CURRENT_TASK]
cmp dx,[eax]
jnz rnewba
 
457,7 → 457,7
 
checkbuttons:
 
cmp [0xfb40],byte 0 ; mouse buttons pressed
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed
jnz @f
ret
@@:
465,7 → 465,7
pushad
 
xor esi, esi
mov edi, [0xfe88]
mov edi, [BTN_ADDR]
movzx edx, word [edi]
test edx, edx
jne @f
504,8 → 504,8
; check that button is at top of windowing stack
 
movzx ebx,word [eax]
movzx ecx,word [0xC000 + ebx * 2]
cmp ecx,[0x3004]
movzx ecx,word [WIN_STACK + ebx * 2]
cmp ecx,[TASK_COUNT]
jne buttonnewcheck
 
; check that button start is inside window x/y end
570,7 → 570,7
mov bx,[eax+2] ; button id : bits 00-16
push ebx
 
mov [0xfb44],byte 1 ; no mouse down checks
mov [MOUSE_DOWN],byte 1 ; no mouse down checks
call find_pressed_button_frames
call negativebutton
 
585,13 → 585,13
call stack_handler
popad
 
cmp [0xfb40],byte 0 ; mouse buttons pressed ?
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ?
jnz cbwaitmouseup
popad
 
call negativebutton
mov [0xfff4],byte 0 ; no mouse background
mov [0xfff5],byte 0 ; draw mouse
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse
;..................................... start 2/2 : modified by vhanla .............................
; check coordinates
jmp afterbuttonid
631,16 → 631,16
cmp ecx,edx
jg no_on_button
popa
mov [0xf500],byte 1 ; no of buttons in buffer
mov [BTN_COUNT],byte 1 ; no of buttons in buffer
pop ebx
mov [0xf501],ebx ; lets put the button id in buffer
mov [BTN_BUFF],ebx ; lets put the button id in buffer
push ebx
pusha
jmp yes_on_button
no_on_button:
mov [0xf500],byte 0 ; no of buttons in buffer
mov [BTN_COUNT],byte 0 ; no of buttons in buffer
yes_on_button:
mov [0xfb44],byte 0 ; mouse down -> do not draw
mov [MOUSE_DOWN],byte 0 ; mouse down -> do not draw
popa
pop ebx
popa
/kernel/branches/gfx_kernel/gui/event.inc
1,3 → 1,465
 
align 4
init_events:
stdcall kernel_alloc, 512*EVENT_SIZE
mov [events], eax
xor eax, eax
mov [event_uid], eax
not eax
mov edi, event_map
mov [event_start], edi
mov ecx, 64/4
cld
rep stosd
mov [event_end], edi
ret
 
align 4
proc alloc_event
 
pushfd
cli
mov ebx, [event_start]
mov ecx, [event_end]
.l1:
bsf eax,[ebx]
jnz .found
add ebx,4
cmp ebx, ecx
jb .l1
popfd
xor eax,eax
ret
.found:
btr [ebx], eax
mov [event_start],ebx
inc [event_uid]
 
sub ebx, event_map
lea eax,[eax+ebx*8]
 
lea ebx, [eax+eax*4]
shl eax,5
lea eax,[eax+ebx*4] ;eax*=52 (EVENT_SIZE)
add eax, [events]
mov ebx, [event_uid]
popfd
ret
endp
 
align 4
free_event:
sub eax, [events]
mov ecx, EVENT_SIZE
mov ebx, event_map
cdq
div ecx
 
pushfd
cli
bts [ebx], eax
shr eax, 3
and eax, not 3
add eax, ebx
cmp [event_start], eax
ja @f
popfd
ret
@@:
mov [event_start], eax
popfd
ret
 
EVENT_WATCHED equ 0x10000000
EVENT_SIGNALED equ 0x20000000
MANUAL_RESET equ 0x40000000
MANUAL_DESTROY equ 0x80000000
 
 
; param
; eax= event data
; ebx= flags
;
; retval
; eax= event
; edx= id
 
create_event:
.flags equ esp+4
.data equ esp
 
push ebx
push eax
 
call alloc_event
test eax, eax
jz .fail
 
mov [eax+APPOBJ.magic], 'EVNT'
mov [eax+APPOBJ.destroy], destroy_event.internal
mov [eax+EVENT.id], ebx
 
mov ebx, [CURRENT_TASK]
shl ebx, 5
mov ebx, [CURRENT_TASK+ebx+4]
mov [eax+APPOBJ.pid], ebx
mov edx, [.flags]
mov [eax+EVENT.state], edx
 
mov esi, [.data]
test esi, esi
jz @F
lea edi, [eax+EVENT.code]
mov ecx, 6
cld
rep movsd
@@:
mov ecx, [CURRENT_TASK]
shl ecx,8
add ecx, SLOT_BASE+APP_OBJ_OFFSET
 
pushfd
cli
mov edx, [ecx+APPOBJ.fd]
mov [eax+APPOBJ.fd], edx
mov [eax+APPOBJ.bk], ecx
mov [ecx+APPOBJ.fd], eax
mov [edx+APPOBJ.bk], eax
popfd
mov edx, [eax+EVENT.id]
.fail:
add esp, 8
ret
 
restore .flags
restore .data
 
; param
; eax= event
; ebx= id
 
destroy_event:
 
cmp [eax+APPOBJ.magic], 'EVNT'
jne .fail
cmp [eax+EVENT.id], ebx
jne .fail
.internal:
mov ebx, [eax+APPOBJ.fd]
mov ecx, [eax+APPOBJ.bk]
mov [ebx+APPOBJ.bk], ecx
mov [ecx+APPOBJ.fd], ebx
.force:
xor edx, edx ;clear common header
mov [eax], edx
mov [eax+4], edx
mov [eax+8], edx
mov [eax+12], edx
mov [eax+16], edx
 
call free_event ;release object memory
.fail:
ret
 
align 4
proc send_event stdcall pid:dword, event:dword
locals
slot dd ?
endl
 
mov eax, [pid]
call pid_to_slot
test eax, eax
jz .fail
 
shl eax, 8
cmp [SLOT_BASE+eax+APPDATA.ev_count], 32
ja .fail
 
mov [slot], eax
 
call alloc_event
test eax, eax
jz .fail
 
lea edi, [eax+EVENT.code]
mov ecx, 6
mov esi, [event]
cld
rep movsd
 
mov ecx, [slot]
add ecx, SLOT_BASE+APP_EV_OFFSET
 
mov [eax+APPOBJ.magic], 'EVNT'
mov [eax+APPOBJ.destroy], destroy_event
mov ebx, [pid]
mov [eax+APPOBJ.pid], ebx
mov [eax+EVENT.state], EVENT_SIGNALED
 
pushfd
cli ;insert event into
mov edx, [ecx+APPOBJ.fd] ;events list
mov [eax+APPOBJ.fd], edx ;and set events flag
mov [eax+APPOBJ.bk], ecx
mov [ecx+APPOBJ.fd], eax
mov [edx+APPOBJ.bk], eax
inc [ecx+APPDATA.ev_count-APP_EV_OFFSET]
or [ecx+APPDATA.event_mask-APP_EV_OFFSET], EVENT_EXTENDED
popfd
.fail:
ret
endp
 
; timeout ignored
 
align 4
proc get_event_ex stdcall, p_ev:dword, timeout:dword
 
.wait:
mov edx,[CURRENT_TASK]
shl edx,8
; cmp [SLOT_BASE+edx+APPDATA.ev_count], 0
; je .switch
 
add edx, SLOT_BASE+APP_EV_OFFSET
 
mov eax, [edx+APPOBJ.fd]
cmp eax, edx
je .switch
 
lea esi, [eax+EVENT.code]
mov edi, [p_ev] ;copy event data
mov ecx, 6
cld
rep movsd
 
and dword [edi-24], 0xFF00FFFF ;clear priority field
;
test [eax+EVENT.state], MANUAL_RESET
jnz .done
 
pushfd
cli ;remove event from events
mov ebx, [eax+APPOBJ.fd] ;list (reset event)
mov ecx, [eax+APPOBJ.bk] ;and clear events flag
mov [ebx+APPOBJ.bk], ecx ;if no active events
mov [ecx+APPOBJ.fd], ebx
 
and [eax+EVENT.state], not (EVENT_SIGNALED+EVENT_WATCHED)
 
dec [edx+APPDATA.ev_count-APP_EV_OFFSET]
jnz @F
and [edx+APPDATA.event_mask-APP_EV_OFFSET], not EVENT_EXTENDED
@@:
popfd
 
test [eax+EVENT.state], MANUAL_DESTROY
jz .destroy
 
add edx, (APP_OBJ_OFFSET-APP_EV_OFFSET)
 
pushfd
cli
mov ebx, [edx+APPOBJ.fd] ;insert event into
mov [eax+APPOBJ.fd], ebx ;objects list
mov [eax+APPOBJ.bk], edx
mov [edx+APPOBJ.fd], eax
mov [ebx+APPOBJ.bk], eax
popfd
.done:
ret
 
.destroy:
call destroy_event.force
ret
.switch:
mov eax, [TASK_BASE]
mov [eax+TASKDATA.state], byte 5
call change_task
jmp .wait
endp
 
; param
; eax= event
; ebx= id
 
align 4
wait_event:
.event equ esp
push eax
.wait:
cmp [eax+APPOBJ.magic], 'EVNT'
jne .done
cmp [eax+EVENT.id], ebx
jne .done
 
test [eax+EVENT.state], EVENT_SIGNALED
jz .switch
 
test [eax+EVENT.state], MANUAL_RESET
jnz .done
 
mov edx,[CURRENT_TASK]
shl edx,8
add edx, SLOT_BASE
 
pushfd
cli ;remove event from events
mov ebx, [eax+APPOBJ.fd] ;list (reset event)
mov ecx, [eax+APPOBJ.bk] ;and clear events flag
mov [ebx+APPOBJ.bk], ecx ;if no active events
mov [ecx+APPOBJ.fd], ebx
dec [edx+APPDATA.ev_count]
jnz @F
and [edx+APPDATA.event_mask], not EVENT_EXTENDED
@@:
and [eax+EVENT.state], not (EVENT_SIGNALED+EVENT_WATCHED)
popfd
 
test [eax+EVENT.state], MANUAL_DESTROY
jz .destroy
 
add edx, APP_OBJ_OFFSET
 
pushfd
cli
mov ecx, [edx+APPOBJ.fd] ;insert event into
mov [eax+APPOBJ.fd], ecx ;objects list
mov [eax+APPOBJ.bk], edx
mov [edx+APPOBJ.fd], eax
mov [ecx+APPOBJ.bk], eax
popfd
.done:
add esp, 4
ret
.destroy:
call destroy_event.force
add esp, 4
ret
.switch:
or [eax+EVENT.state], EVENT_WATCHED
mov eax, [TASK_BASE]
mov [eax+TASKDATA.state], byte 5
call change_task
mov eax, [.event]
jmp .wait
restore .event
 
; param
; eax= event
; ebx= id
; ecx= flags
; edx= event data
 
raise_event:
.event equ esp
push eax
 
cmp [eax+APPOBJ.magic], 'EVNT'
jne .fail
cmp [eax+EVENT.id], ebx
jne .fail
 
mov eax, [eax+APPOBJ.pid]
call pid_to_slot
test eax, eax
jz .fail
 
mov esi, edx
test esi, esi
mov edx, [.event]
jz @F
 
push ecx
lea edi, [edx+EVENT.code]
mov ecx, 6
cld
rep movsd
pop ecx
@@:
test [edx+EVENT.state], EVENT_SIGNALED
jnz .done
 
test ecx, EVENT_WATCHED
jz @F
test [edx+EVENT.state], EVENT_WATCHED
jz .done
@@:
shl eax, 8
add eax, SLOT_BASE+APP_EV_OFFSET
 
pushfd
cli
mov ebx, [edx+APPOBJ.fd]
mov ecx, [edx+APPOBJ.bk]
mov [ebx+APPOBJ.bk], ecx
mov [ecx+APPOBJ.fd], ebx
 
mov ecx, [eax+APPOBJ.fd]
mov [edx+APPOBJ.fd], ecx
mov [edx+APPOBJ.bk], eax
mov [eax+APPOBJ.fd], edx
mov [ecx+APPOBJ.bk], edx
or [edx+EVENT.state], EVENT_SIGNALED
 
inc [eax+APPDATA.ev_count-APP_EV_OFFSET]
or [eax+APPDATA.event_mask-APP_EV_OFFSET], EVENT_EXTENDED
popfd
.fail:
.done:
add esp, 4
ret
restore .event
 
; param
; eax= event
; ebx= id
align 4
clear_event:
.event equ esp
push eax
 
cmp [eax+APPOBJ.magic], 'EVNT'
jne .fail
cmp [eax+EVENT.id], ebx
jne .fail
 
mov eax, [eax+APPOBJ.pid]
call pid_to_slot
test eax, eax
jz .fail
 
shl eax, 8
add eax, SLOT_BASE+APP_EV_OFFSET
mov edx, [.event]
pushfd
cli ;remove event from events
mov ebx, [edx+APPOBJ.fd] ;list (reset event)
mov ecx, [edx+APPOBJ.bk] ;and clear events flag
mov [ebx+APPOBJ.bk], ecx ;if no active events
mov [ecx+APPOBJ.fd], ebx
 
and [edx+EVENT.state], not (EVENT_SIGNALED+EVENT_WATCHED)
 
dec [eax+APPDATA.ev_count-APP_EV_OFFSET]
jnz @F
and [eax+APPDATA.event_mask-APP_EV_OFFSET], not EVENT_EXTENDED
@@:
add eax, (APP_OBJ_OFFSET-APP_EV_OFFSET)
 
mov ecx, [eax+APPOBJ.fd] ;insert event into
mov [edx+APPOBJ.fd], ecx ;objects list
mov [edx+APPOBJ.bk], eax
mov [eax+APPOBJ.fd], edx
mov [ecx+APPOBJ.bk], edx
popfd
.fail:
.done:
add esp, 4
ret
restore .event
 
sys_getevent:
 
call get_event_for_app
6,7 → 468,6
 
 
align 4
 
sys_wait_event_timeout:
 
mov ebx,[timer_ticks]
36,7 → 497,7
jne eventoccur
newwait:
 
mov eax, [0x3010]
mov eax, [TASK_BASE]
mov [eax+TASKDATA.state], byte 5
call change_task
 
46,15 → 507,14
mov [esp+36],eax
ret
 
 
get_event_for_app:
 
pushad
 
mov edi,[0x3010] ; WINDOW REDRAW
mov edi,[TASK_BASE] ; WINDOW REDRAW
test [edi+TASKDATA.event_mask],dword 1
jz no_eventoccur1
;mov edi,[0x3010]
;mov edi,[TASK_BASE]
cmp [edi-twdw+WDATA.fl_redraw],byte 0
je no_eventoccur1
popad
62,15 → 522,15
ret
no_eventoccur1:
 
;mov edi,[0x3010] ; KEY IN BUFFER
;mov edi,[TASK_BASE] ; KEY IN BUFFER
test [edi+TASKDATA.event_mask],dword 2
jz no_eventoccur2
mov ecx, [0x3000]
movzx edx,word [0xC000+ecx*2]
mov eax, [0x3004]
mov ecx, [CURRENT_TASK]
movzx edx,word [WIN_STACK+ecx*2]
mov eax, [TASK_COUNT]
cmp eax,edx
jne no_eventoccur2x
cmp [0xf400],byte 0
cmp [KEY_COUNT],byte 0
je no_eventoccur2x
eventoccur2:
popad
86,18 → 546,18
jb @b
no_eventoccur2:
 
;mov edi,[0x3010] ; BUTTON IN BUFFER
;mov edi,[TASK_BASE] ; BUTTON IN BUFFER
test [edi+TASKDATA.event_mask],dword 4
jz no_eventoccur3
cmp [0xf500],byte 0
cmp [BTN_COUNT],byte 0
je no_eventoccur3
mov ecx, [0x3000]
movzx edx, word [0xC000+ecx*2]
mov eax, [0x3004]
mov ecx, [CURRENT_TASK]
movzx edx, word [WIN_STACK+ecx*2]
mov eax, [TASK_COUNT]
cmp eax,edx
jnz no_eventoccur3
popad
mov eax,[0xf501]
mov eax,[BTN_BUFF]
cmp eax,65535
je no_event_1
mov eax,3
105,7 → 565,7
 
no_event_1:
mov [window_minimize],1
mov [0xf500],byte 0
mov [BTN_COUNT],byte 0
xor eax, eax
ret
 
112,14 → 572,14
no_eventoccur3:
;mov edi,[0x3010] ; mouse event
;mov edi,[TASK_BASE] ; mouse event
test [edi+TASKDATA.event_mask],dword 00100000b
jz no_mouse_event
mov eax,[0x3000]
mov eax,[CURRENT_TASK]
shl eax,8
test [eax+0x80000+APPDATA.event_mask],dword 00100000b
test [eax+SLOT_BASE+APPDATA.event_mask],dword 00100000b
jz no_mouse_event
and [eax+0x80000+APPDATA.event_mask],dword 0xffffffff-00100000b
and [eax+SLOT_BASE+APPDATA.event_mask],dword 0xffffffff-00100000b
popad
mov eax,6
ret
126,10 → 586,10
no_mouse_event:
 
;mov edi,[0x3010] ; DESKTOP BACKGROUND REDRAW
;mov edi,[TASK_BASE] ; DESKTOP BACKGROUND REDRAW
test [edi+TASKDATA.event_mask],dword 16
jz no_eventoccur5
cmp [0xfff0],byte 2
cmp [REDRAW_BACKGROUND],byte 2
jnz no_eventoccur5
popad
mov eax,5
136,14 → 596,14
ret
no_eventoccur5:
 
;mov edi,[0x3010] ; IPC
;mov edi,[TASK_BASE] ; IPC
test [edi+TASKDATA.event_mask],dword 01000000b
jz no_ipc
mov eax,[0x3000]
mov eax,[CURRENT_TASK]
shl eax,8
test [eax+0x80000+APPDATA.event_mask],dword 01000000b
test [eax+SLOT_BASE+APPDATA.event_mask],dword 01000000b
jz no_ipc
and [eax+0x80000+APPDATA.event_mask],dword 0xffffffff-01000000b
and [eax+SLOT_BASE+APPDATA.event_mask],dword 0xffffffff-01000000b
popad
mov eax,7
ret
150,14 → 610,14
no_ipc:
 
 
;mov edi,[0x3010] ; STACK
;mov edi,[TASK_BASE] ; STACK
test [edi+TASKDATA.event_mask],dword 10000000b
jz no_stack_event
mov eax,[0x3000]
mov eax,[CURRENT_TASK]
shl eax,8
test [eax+0x80000+APPDATA.event_mask],dword 10000000b
test [eax+SLOT_BASE+APPDATA.event_mask],dword 10000000b
jz no_stack_event
and [eax+0x80000+APPDATA.event_mask],dword 0xffffffff-10000000b
and [eax+SLOT_BASE+APPDATA.event_mask],dword 0xffffffff-10000000b
popad
mov eax,8
ret
164,25 → 624,34
no_stack_event:
 
test byte [edi+TASKDATA.event_mask+1], 1 ; DEBUG
jz no_debug_event
mov eax, [0x3000]
jz .test_IRQ
mov eax, [CURRENT_TASK]
shl eax, 8
test byte [eax+0x80000+APPDATA.event_mask+1], byte 1
jz no_debug_event
and byte [eax+0x80000+APPDATA.event_mask+1], not 1
test byte [eax+SLOT_BASE+APPDATA.event_mask+1], byte 1
jz .test_IRQ
and byte [eax+SLOT_BASE+APPDATA.event_mask+1], not 1
popad
mov eax, 9
ret
no_debug_event:
 
;.test_ext:
; mov eax, [CURRENT_TASK]
; shl eax, 8
; test dword [eax+SLOT_BASE+APPDATA.event_mask], EVENT_EXTENDED
; jz .test_IRQ
; popad
; mov eax, 10
; ret
 
.test_IRQ:
cmp dword [edi+TASKDATA.event_mask], 0xFFFF
jbe no_events
 
mov esi,0x2e0000 ; IRQ'S AND DATA
mov esi,IRQ_SAVE ; IRQ'S AND DATA
mov ebx,0x00010000
xor ecx, ecx
irq_event_test:
mov edi,[0x3010]
mov edi,[TASK_BASE]
test [edi+TASKDATA.event_mask],ebx
jz no_irq_event
mov edi,ecx
189,7 → 658,7
shl edi,2
add edi,irq_owner
mov edx,[edi]
mov eax,[0x3010]
mov eax,[TASK_BASE]
mov eax,[eax+TASKDATA.pid]
cmp edx,eax
jne no_irq_event
213,3 → 682,4
ret
 
 
 
/kernel/branches/gfx_kernel/gui/font.inc
36,7 → 36,7
jnz .font2
pushad
mov esi, 9
lea ebp, [0x3F600+8*edx+edx]
lea ebp, [FONT_I+8*edx+edx]
.symloop1:
mov dl, byte [ebp]
or dl, 1 shl 6
69,7 → 69,7
.font2:
pushad
add edx, edx
lea ebp, [0x3EC00+4*edx+edx+1]
lea ebp, [FONT_II+4*edx+edx+1]
push 9
movzx esi, byte [ebp-1]
.symloop2:
/kernel/branches/gfx_kernel/gui/skincode.inc
1,6 → 1,6
include "skindata.inc"
 
skin_data = 0x00778000
;skin_data = 0x00778000
 
load_skin_file:
; eax = filename
270,7 → 270,7
 
push edx
 
mov edi,[esp] ; RECTANGLE
mov edi,edx
 
mov ebp,skin_active
cmp byte [esp+32+4+4],0
290,6 → 290,7
; shr esi,1
; and esi,0x007f7f7f
mov esi,[ebp+SKIN_DATA.colors.outer]
or [edi+WDATA.fl_wdrawn], 4
call draw_rectangle
mov ecx,3
_dw3l:
345,6 → 346,8
sub ecx,4
sub edx,4
mov edi,[esi+WDATA.cl_workarea]
test edi,0x40000000
jnz _noinside2
call [drawbar]
_noinside2:
 
352,7 → 355,7
jne no_skin_add_button
 
;* close button
mov edi,[0xfe88]
mov edi,[BTN_ADDR]
movzx eax,word [edi]
cmp eax,1000
jge no_skin_add_button
362,7 → 365,7
shl eax,4
add eax,edi
 
mov bx,[0x3000]
mov bx,[CURRENT_TASK]
mov [eax],bx
 
add eax,2 ; save button id number
391,7 → 394,7
mov [eax],bx
 
;* minimize button
mov edi,[0xfe88]
mov edi,[BTN_ADDR]
movzx eax,word [edi]
cmp eax,1000
jge no_skin_add_button
401,7 → 404,7
shl eax,4
add eax,edi
 
mov bx,[0x3000]
mov bx,[CURRENT_TASK]
mov [eax],bx
 
add eax,2 ; save button id number
430,8 → 433,13
mov [eax],bx
 
no_skin_add_button:
pop edi
and [edi+WDATA.fl_wdrawn], not 4
test [edi+WDATA.fl_wdrawn], 2
jz @f
call drawwindowframes
@@:
 
add esp,4
popa
 
ret 4
/kernel/branches/gfx_kernel/gui/window.inc
30,13 → 30,13
pushad
 
xor eax,eax
mov ecx,0xc000
mov ecx,WIN_STACK
@@:
inc eax
add ecx,2
mov [ecx+0x000],ax ; process no
mov [ecx+0x400],ax ; positions in stack
cmp ecx,0xc400-2 ; the more high, the more surface
cmp ecx,WIN_POS-2 ; the more high, the more surface
jnz @b
 
popad
66,15 → 66,15
mov edx, [0xFE04]
call [setscreen]
 
mov ebp, [0x3004] ; number of processes
mov ebp, [TASK_COUNT] ; number of processes
cmp ebp, 1
jbe .finish
align 4
.new_wnd:
movzx edi, word [0xC400 + esi * 2]
movzx edi, word [WIN_POS + esi * 2]
shl edi, 5
 
cmp [0x3000+edi+TASKDATA.state], byte 9
cmp [CURRENT_TASK+edi+TASKDATA.state], byte 9
je .not_wnd
 
add edi, window_data
114,7 → 114,7
@@:
 
push esi
movzx esi, word [0xC400 + esi * 2]
movzx esi, word [WIN_POS + esi * 2]
call [setscreen]
pop esi
 
191,9 → 191,9
redraw_screen_direct:
mov [dlx],dword 0
mov [dly],dword 0
mov eax,[0xfe00]
mov eax,[ScreenWidth]
mov [dlxe],eax
mov eax,[0xfe04]
mov eax,[ScreenHeight]
mov [dlye],eax
mov eax,window_data
call redrawscreen
217,7 → 217,7
cmp eax,2 ; set common window colours
jne no_com_colours
mov [windowtypechanged],dword 1
mov esi,[0x3010]
mov esi,[TASK_BASE]
add esi,TASKDATA.mem_start
add ebx,[esi]
mov esi,ebx
231,7 → 231,7
 
cmp eax,3 ; get common window colours
jne no_get_com
mov esi,[0x3010]
mov esi,[TASK_BASE]
add esi,TASKDATA.mem_start
add ebx,[esi]
mov edi,ebx
269,10 → 269,10
movsx ebx,word[esp+16]
cmp eax,ebx
jge .lp1
or eax,eax;[0xFE00]
or eax,eax;[ScreenWidth]
jl @f
mov [screen_workarea.left],eax
@@: cmp ebx,[0xFE00]
@@: cmp ebx,[ScreenWidth]
jg .lp1
mov [screen_workarea.right],ebx
.lp1: movsx eax,word[esp+24+2]
282,14 → 282,14
or eax,eax;[0xFE04]
jl @f
mov [screen_workarea.top],eax
@@: cmp ebx,[0xFE04]
@@: cmp ebx,[ScreenHeight]
jg .lp2
mov [screen_workarea.bottom],ebx
.lp2: call repos_windows
mov eax, 0
mov ebx, 0
mov ecx, [0xfe00]
mov edx, [0xfe04]
mov ecx, [ScreenWidth]
mov edx, [ScreenHeight]
call [calculatescreen]
; jmp redraw_screen_direct
.exit:
310,7 → 310,7
cmp eax,8 ; set window skin
jne no_set_skin
mov eax,ebx
mov edi,[0x3010]
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
340,8 → 340,8
pushad
mov eax, 0
mov ebx, 0
mov ecx, [0xfe00]
mov edx, [0xfe04]
mov ecx, [ScreenWidth]
mov edx, [ScreenHeight]
call [calculatescreen]
popad
mov dword[esp+32+36],0
357,57 → 357,57
 
 
repos_windows:
mov ecx,[0x3004]
mov esi,0x20*2
mov byte[0x0000fff0],1
mov ecx,[TASK_COUNT]
mov edi,0x20*2
mov byte[REDRAW_BACKGROUND],1
dec ecx
jge @f
ret
@@: mov [esi+WDATA.fl_redraw],1
test [esi+WDATA.fl_wstate],WSTATE_MAXIMIZED
@@: mov [edi+WDATA.fl_redraw],1
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
jz .lp2
mov eax,[screen_workarea.left]
mov [esi+WDATA.box.left],eax
mov [edi+WDATA.box.left],eax
sub eax,[screen_workarea.right]
neg eax
mov [esi+WDATA.box.width],eax
mov [edi+WDATA.box.width],eax
mov eax,[screen_workarea.top]
mov [esi+WDATA.box.top],eax
test [esi+WDATA.fl_wstate],WSTATE_ROLLEDUP
mov [edi+WDATA.box.top],eax
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
jnz .lp1
sub eax,[screen_workarea.bottom]
neg eax
mov [esi+WDATA.box.height],eax
.lp1: add esi,0x20
mov [edi+WDATA.box.height],eax
.lp1:
call set_window_clientbox
add edi,0x20
loop @b
ret
.lp2: mov eax,[esi+WDATA.box.left]
add eax,[esi+WDATA.box.width]
mov ebx,[0x0000fe00]
.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,[esi+WDATA.box.width]
mov eax,[edi+WDATA.box.width]
sub eax,ebx
jle .lp3
mov [esi+WDATA.box.width],ebx
.lp3: sub ebx,[esi+WDATA.box.width]
mov [esi+WDATA.box.left],ebx
.lp4: mov eax,[esi+WDATA.box.top]
add eax,[esi+WDATA.box.height]
mov ebx,[0x0000fe04]
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,[esi+WDATA.box.height]
mov eax,[edi+WDATA.box.height]
sub eax,ebx
jle .lp5
mov [esi+WDATA.box.height],ebx
.lp5: sub ebx,[esi+WDATA.box.height]
mov [esi+WDATA.box.top],ebx
.lp6: add esi,0x20
loop @b
ret
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:
434,8 → 434,8
cmp [new_window_starting],eax
jb swml1
 
mov [0xfff4],byte 0 ; no mouse background
mov [0xfff5],byte 0 ; draw mouse
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse
 
mov [new_window_starting],eax
 
474,14 → 474,22
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]
test ecx,0x80000000
jz .nofa
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
.faj:
and ecx,0x00ffffff
pop edx
mov edi,0
call [draw_line]
inc edx
497,6 → 505,7
drawwindow_I:
 
pushad
or [edx+WDATA.fl_wdrawn], 4
 
mov esi,[edx+WDATA.cl_frames] ; rectangle
mov eax,[edx+WDATA.box.left]
509,6 → 518,12
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 drawwindowframes
@@:
 
call drawwindow_I_caption
 
mov edx,[esi+WDATA.box.top] ; inside work area
522,6 → 537,8
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]
noinside:
 
638,7 → 655,13
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 drawwindowframes
@@:
mov ecx,3
dw3l:
add eax,1*65536-1
667,6 → 690,8
sub ecx,4
sub edx,4
mov edi,[esi+WDATA.cl_workarea]
test edi,0x40000000
jnz noinside2
call [drawbar]
noinside2:
 
686,8 → 711,8
 
; if type of current active window is 3,
; it must be redrawn
mov eax, [0x3004]
movzx eax, word [0xC400 + eax*2]
mov eax, [TASK_COUNT]
movzx eax, word [WIN_POS + eax*2]
shl eax, 5
add eax, window_data
mov ebx, [eax + WDATA.cl_workarea]
699,14 → 724,14
 
push esi
movzx eax, word [esi] ; ax <- process no
movzx eax, word [0xC000+eax*2] ; ax <- position in window stack
movzx eax, word [WIN_STACK+eax*2] ; ax <- position in window stack
 
xor esi, esi ; drop others
waloop:
cmp esi, dword [0x3004]
cmp esi, dword [TASK_COUNT]
jae wacont
inc esi
lea edi, [0xC000 + esi*2]
lea edi, [WIN_STACK + esi*2]
mov bx, [edi] ; position of the current process
cmp bx, ax
jbe @f
719,21 → 744,22
pop esi ; esi = pointer at 0xC400
 
movzx eax, word [esi]
mov bx, [0x3004] ; number of processes
mov [0xC000+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
waloop2:
cmp esi,[0x3004]
mov edi, [TASK_COUNT]
cmp esi, edi
jae wacont2
inc esi
movzx ebx, word [esi*2 + 0xC000]
mov [ebx*2 + 0xC400], si
movzx ebx, word [esi*2 + WIN_STACK]
mov [ebx*2 + WIN_POS], si
jmp waloop2
wacont2:
mov [0xf400], byte 0 ; empty keyboard buffer
mov [0xf500], byte 0 ; empty button buffer
mov [KEY_COUNT], byte 0 ; empty keyboard buffer
mov [BTN_COUNT], byte 0 ; empty button buffer
popad
ret
 
755,8 → 781,8
 
; esi = process number
 
movzx eax, word [0xC000 + esi * 2] ; get value of the curr process
lea esi, [0xC400 + 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
 
766,8 → 792,8
add esi, 2
push esi
 
mov eax, [0x3004]
lea eax, word [0xC400 + 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
774,7 → 800,7
 
movzx eax, word [esi]
shl eax, 5
cmp [0x3000 + eax + TASKDATA.state], byte 9
cmp [CURRENT_TASK + eax + TASKDATA.state], byte 9
je .new_check ; skip dead windows
 
lea esi, [eax+window_data]
827,14 → 853,14
jz .do_not_draw
 
popad
mov [0xfb44], byte 1 ; do draw mouse
mov [MOUSE_DOWN], byte 1 ; do draw mouse
call windowactivate
 
; update screen info
call [calc_clipping_rects]
pushad
mov edi, [0x3004] ; the last process (number)
movzx esi, word [0xC400 + edi * 2]
mov edi, [TASK_COUNT] ; the last process (number)
movzx esi, word [WIN_POS + edi * 2]
shl esi, 5
add esi, window_data
 
847,13 → 873,13
add ecx, eax ; ecx = x_end
add edx, ebx ; edx = y_end
 
mov edi, [0x3004]
movzx esi, word [0xC400 + edi * 2]
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 [0xfb44],byte 0 ; mouse down checks
mov [MOUSE_DOWN],byte 0 ; mouse down checks
 
ret
 
862,9 → 888,9
popad
 
call windowactivate
mov [0xfb44],byte 0 ; mouse down checks
mov [0xfff4],byte 0 ; no mouse background
mov [0xfff5],byte 0 ; draw mouse
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
 
 
871,7 → 897,7
; eax = window number on screen
; corrupts registers and [dl*]
minimize_window:
movzx eax, word [0xC400+eax*2]
movzx eax, word [WIN_POS+eax*2]
shl eax, 5
add eax, window_data
test [eax+WDATA.fl_wstate], WSTATE_MINIMIZED
904,7 → 930,7
restore_minimized_window:
pushfd
cli
movzx esi, word [0xC400+eax*2]
movzx esi, word [WIN_POS+eax*2]
mov edi, esi
shl edi, 5
add edi, window_data
912,7 → 938,7
jz .skip_redrawings
mov [edi+WDATA.fl_redraw], 1
and [edi+WDATA.fl_wstate], not WSTATE_MINIMIZED
cmp eax, [0x3004] ; the uppermost window
cmp eax, [TASK_COUNT] ; the uppermost window
jnz .no_uppermost
mov eax, [edi+WDATA.box.left]
mov ebx, [edi+WDATA.box.top]
931,7 → 957,7
add edx, [edi+WDATA.box.height]
call [calculatescreen]
.done:
mov [0xfff4],byte 0 ; no mouse under
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under
.skip_redrawings:
popfd
ret
949,7 → 975,7
 
cmp [window_minimize], 0
je .no_minimizing
mov eax, [0x3004] ; the uppermost window
mov eax, [TASK_COUNT] ; the uppermost window
mov bl, 0
xchg [window_minimize], bl
cmp bl, 1
961,13 → 987,13
.continue:
.no_minimizing:
 
cmp [0xfb40],byte 0 ; mouse buttons pressed ?
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ?
jne .mouse_buttons_pressed
popad
ret
.mouse_buttons_pressed:
 
mov esi,[0x3004]
mov esi,[TASK_COUNT]
inc esi
 
cwloop:
975,7 → 1001,7
jb .exit
 
dec esi
movzx edi, word [0xC400 + esi * 2] ; ebx
movzx edi, word [WIN_POS + esi * 2] ; ebx
shl edi, 5
add edi, window_data
; mov edi, ebx
987,8 → 1013,8
test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED
jnz cwloop
 
movzx eax, word [0xfb0a]
movzx ebx, word [0xfb0c]
movzx eax, word [MOUSE_X]
movzx ebx, word [MOUSE_Y]
cmp eax,ecx
jl cwloop
1003,13 → 1029,13
 
pushad
mov eax, esi
mov ebx, [0x3004]
mov ebx, [TASK_COUNT]
cmp eax, ebx ; is this window active?
jz .move_resize_window
 
; eax = position in windowing stack
; redraw must ?
lea esi, [0xC400 + esi * 2]
lea esi, [WIN_POS + esi * 2]
call waredraw
add esp, 32
 
1018,7 → 1044,6
ret
 
.move_resize_window: ; MOVE OR RESIZE WINDOW
 
popad
 
; Check for user enabled fixed window
1068,7 → 1093,7
mov [latest_window_touch], ecx
mov [latest_window_touch_delta], edx
 
mov cl, [0xfb40] ; save for shade check
mov cl, [BTN_DOWN] ; save for shade check
mov [do_resize], cl
no_emulation_righ_button:
mov ecx, [edi + WDATA.box.left]
1086,8 → 1111,8
sub eax, ecx
sub ebx, edx
 
mov esi, [0xfb0a]
mov [0xf300], esi
mov esi, [MOUSE_X]
mov [WIN_TEMP_XY], esi
 
push eax;ad ; wait for putimages to finish
; mov eax,5
1116,19 → 1141,19
@@:
 
mov [reposition],0
mov [0xfb44],byte 1 ; no reaction to mouse up/down
mov [MOUSE_DOWN],byte 1 ; no reaction to mouse up/down
 
; move window
 
newchm:
 
mov [0xfff5],byte 1
mov [DONT_DRAW_MOUSE],byte 1
 
call checkidle
 
call checkVga_N13
 
mov [0xfff4],byte 0
mov [MOUSE_BACKGROUND],byte 0
 
call [draw_pointer]
 
1136,12 → 1161,12
call stack_handler
popad
 
mov esi,[0xf300]
cmp esi,[0xfb0a]
mov esi,[WIN_TEMP_XY]
cmp esi,[MOUSE_X]
je cwb
 
movzx ecx,word[0xfb0a]
movzx edx,word[0xfb0c]
movzx ecx,word[MOUSE_X]
movzx edx,word[MOUSE_Y]
sub ecx,eax
sub edx,ebx
push eax
1151,8 → 1176,8
call drawwindowframes
@@:
 
mov ax,[0xfe00]
mov bx,[0xfe04]
movzx eax,word[ScreenWidth]
movzx ebx,word[ScreenHeight]
 
cmp [do_resize_from_corner],1
je no_new_position
1178,9 → 1203,9
;shr edx,5
;shl edx,8
;add edx,0x80000 ; process base at 0x80000+
lea edx, [0x80000 + edx*8]
lea edx, [SLOT_BASE + edx*8]
 
movzx eax,word [0xfb0a]
movzx eax,word [MOUSE_X]
cmp eax,[edi + WDATA.box.left]
jl nnepx
sub eax,[edi + WDATA.box.left]
1193,7 → 1218,7
 
call get_rolledup_height
mov ebx,eax
movzx eax,word [0xfb0c]
movzx eax,word [MOUSE_Y]
cmp eax,[edi + WDATA.box.top]
jl nnepy
sub eax,[edi + WDATA.box.top]
1216,14 → 1241,14
call drawwindowframes
@@:
 
mov esi,[0xfb0a]
mov [0xf300],esi
mov esi,[MOUSE_X]
mov [WIN_TEMP_XY],esi
 
cwb:
cmp [0xfb40],byte 0
cmp [BTN_DOWN],byte 0
jne newchm
; new position done
mov [0xfff5],byte 1
mov [DONT_DRAW_MOUSE],byte 1
mov cl,0
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
jnz @f
1238,6 → 1263,7
mov [edi + WDATA.box.width],eax
mov eax,[npye]
mov [edi + WDATA.box.height],eax
call set_window_clientbox
 
@@: mov [reposition],cl
 
1252,7 → 1278,7
@@: sub edi,window_data
shr edi,5
shl edi,8
add edi,0x80000+APPDATA.saved_box
add edi,SLOT_BASE+APPDATA.saved_box
cld
rep movsd
pop ecx edi esi
1266,7 → 1292,7
sub edx,window_data
shr edx,5
shl edx,8
add edx,0x80000 ; process base at 0x80000+
add edx,SLOT_BASE ; process base at 0x80000+
 
cmp [do_resize],2 ; window shade ?
jne no_window_shade
1286,6 → 1312,7
mov eax,[screen_workarea.bottom]
sub eax,[screen_workarea.top]
@@: mov [edi+WDATA.box.height],eax
call set_window_clientbox
 
no_window_shade:
 
1310,7 → 1337,7
neg eax
mov [edi+WDATA.box.height],eax
@@:
jmp no_fullscreen_restore
jmp restore_from_fullscreen.clientbox
restore_from_fullscreen:
and [edi+WDATA.fl_wstate],not WSTATE_MAXIMIZED
push [edi+WDATA.box.height]
1325,6 → 1352,8
jz @f
mov [edi+WDATA.box.height],eax
@@:
.clientbox:
call set_window_clientbox
 
no_fullscreen_restore:
 
1335,7 → 1364,7
cmp [reposition],0
je retwm
 
mov [0xfff5],byte 1 ; no mouse
mov [DONT_DRAW_MOUSE],byte 1 ; no mouse
call [calc_clipping_rects]
 
mov eax,edi
1346,7 → 1375,7
 
mov ecx,100 ; wait to avoid mouse residuals
waitre2:
mov [0xfff5],byte 1
mov [DONT_DRAW_MOUSE],byte 1
call checkidle
cmp [edi+WDATA.fl_redraw],0
jz retwm
1354,9 → 1383,9
 
retwm:
 
mov [0xfff5],byte 0 ; mouse pointer
mov [0xfff4],byte 0 ; no mouse under
mov [0xfb44],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
1393,11 → 1422,13
 
 
; draw negative window frames
 
drawwindowframes:
 
pushad
cli
 
mov ecx,0x01000000
mov edi,1
 
mov eax,[npx]
shl eax,16
add eax,[npx]
1406,11 → 1437,7
mov ebx,[npy]
shl ebx,16
add ebx,[npy]
mov ecx,0x01000000
push edi
mov edi,1
call [draw_line]
pop edi
 
mov eax,[npx]
shl eax,16
1422,11 → 1449,7
shl ebx,16
add ebx,[npy]
add ebx,[npye]
mov ecx,0x01000000
push edi
mov edi,1
call [draw_line]
pop edi
 
mov eax,[npx]
shl eax,16
1435,11 → 1458,7
shl ebx,16
add ebx,[npy]
add ebx,[npye]
mov ecx,0x01000000
push edi
mov edi,1
call [draw_line]
pop edi
 
mov eax,[npx]
add eax,[npxe]
1450,18 → 1469,11
shl ebx,16
add ebx,[npy]
add ebx,[npye]
mov ecx,0x01000000
push edi
mov edi,1
call [draw_line]
mov edi,[0x3000]
shl edi,5
add edi,window_data
mov [edi+WDATA.fl_wdrawn],byte 1
pop edi
 
.ret:
sti
popad
 
ret
 
 
1476,17 → 1488,17
 
test eax, eax
jne rsw_no_address
mov eax,[0x3000]
mov eax,[CURRENT_TASK]
shl eax,8
 
mov [eax+0x80000+APPDATA.wnd_shape],ebx
mov [eax+SLOT_BASE+APPDATA.wnd_shape],ebx
rsw_no_address:
 
cmp eax,1
jne rsw_no_scale
mov eax,[0x3000]
mov eax,[CURRENT_TASK]
shl eax,8
mov byte [eax+0x80000+APPDATA.wnd_shape_scale], bl
mov byte [eax+SLOT_BASE+APPDATA.wnd_shape_scale], bl
rsw_no_scale:
 
ret