bag-fix of commit 601

git-svn-id: svn://kolibrios.org@602 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Rus 2007-08-02 20:16:05 +00:00
parent 71e4e59cf3
commit e0479cff91
2 changed files with 254 additions and 0 deletions

View File

@ -0,0 +1,158 @@
context_menu_start:
mov eax, 40
mov ebx, 00100111b
int 0x40
;call draw_ctx_menu
mov ebp, 2 ; 2 ÷àñòî èñïîëüçóåòñÿ.
xor ecx, ecx
mov edx, [ctx_menu_PID]
find_slot:
inc ecx
mov eax, 9
mov ebx, process_info_buffer
int 0x40
cmp dword [process_info_buffer + 30], edx
jne find_slot
mov eax, 18
mov ebx, 3
;mov ecx, ecx ; :)
int 0x40
call draw_ctx_menu
ctx_menu_still:
mov eax, 10
int 0x40
cmp eax, ebp ; cmp eax, 2
jz ctx_menu_key
cmp eax, 3
jz ctx_menu_button
cmp eax, 6
jz ctx_menu_mouse
call draw_ctx_menu
jmp ctx_menu_still
ctx_menu_key:
mov eax, ebp ; mov eax, 2
int 0x40
ctx_menu_button:
mov eax, 17
int 0x40
cmp ah, 1
jne ctx_menu_still
mov eax, 18
mov ebx, ebp ; mov eax, 2
mov ecx, [n_slot]
int 0x40
jmp ctx_menu_exit
ctx_menu_mouse:
mov eax, 37
mov ebx, ebp ; mov ebx, 2
int 0x40
xchg eax, ecx ; cmp eax, 0 Åñëè íå îäíà èç êíîïîê íå íàæàòà âîçâðàùàåìñÿ
; â ãëàâíûé öèêë ïîòîêà
jecxz ctx_menu_still
mov eax, 37
xor ebx, ebx ; mov ebx, 1
inc ebx
int 0x40
cmp ax, 0 ; Òóò ïðîâåðÿåì ïðîèçîø¸ë-ëè êëèê çà ïðåäåëàìè îêíà êîíòåêñòíîãî
jb ctx_menu_exit ; ìåíþ, åñëè çà ïðåäåëàìè òî çàêðûâàåì êîíòåêñòíîå ìåíþ
cmp ax, 41
ja ctx_menu_exit
shr eax, 16
cmp ax, 0
jb ctx_menu_exit
cmp ax, 133
ja ctx_menu_exit
jmp ctx_menu_still
ctx_menu_exit:
xor eax, eax
dec eax ; mov eax, -1
int 0x40
func draw_ctx_menu
mov eax, 12
xor ebx, ebx ; mov ebx, 1
inc ebx
int 0x40
xor eax, eax ; mov eax, 0
movzx ebx, [x_coord]
shl ebx, 16
add ebx, 133
movzx ecx, [y_coord]
sub ecx, 41
shl ecx, 16
add ecx, 41
mov edx, [system_colours + 20] ; sc.work
mov esi, [system_colours + 4] ; sc.grab
or esi, 0x81000000
mov edi, [system_colours] ; sc.frame
int 0x40
mov eax, 8
mov ebx, 0 * 65536 + 133
mov ecx, 22 * 65536 + 18
mov edx, 0x40000001
int 0x40
shr eax, 1 ; mov eax, 4
mov ebx, 36 * 65536 + 7
mov ecx, [system_colours + 16] ; sc.grab_text
or ecx, 0x10000000
mov edx, ctx_menu_title
mov esi, ctx_menu_title_end - ctx_menu_title
int 0x40
add ebx, 1 * 65536
int 0x40
mov ebx, 4 * 65536 + 28
xor ecx, ecx ; mov ecx, 0x00000000
mov edx, ctx_menu_text
mov esi, ctx_menu_text_end - ctx_menu_text
int 0x40
mov eax, 12
mov ebx, ebp ; mov ebx, 2
int 0x40
ret
endf
x_coord rw 1
y_coord rw 1
n_slot rd 1
lsz ctx_menu_text,\
ru, "X ‡ ªàëâì Alt + F4",\
en, "X Close Alt + F4",\
et, "X Fine Alt + F4" ; May be its not correct
ctx_menu_text_end:
ctx_menu_PID rd 1
ctx_menu_title:
db 'KolibriOS'
ctx_menu_title_end:

View File

@ -0,0 +1,96 @@
; Detecting mouse right-clicks.
detect_start:
mov eax, 40
mov ebx, 00100000b
int 0x40
detect_still:
;mov eax, 10 ; Ðàáîòàåò íå ñîâñåì êîððåêòíî, ïî÷åìó õç.
mov eax, 23
mov ebx, 4
int 0x40
;cmp eax, 6
;jne detect_still
mov eax, 37
mov ebx, 2 ; Îïðàøèâàåì êíîïêè ìûøè
int 0x40
test eax, ebx ; test eax, 00000010b Èíòåðåñóåò òîëüêî ïðàâàÿ êíîïêà
jz detect_still ; Íåò - ? Âîçâðàùàåìñÿ â ãëàâíûé öèêë ïîòîêà
mouse_btn_up:
mov eax, 37
mov ebx, 2
int 0x40
test eax, ebx
jnz mouse_btn_up
mov eax, 37
xor ebx, ebx ; mov ebx, 0
int 0x40
mov ecx, [panel_y_pos]
shr ecx, 16
inc ecx
cmp ax, cx
jb detect_still
add ecx, 15
cmp ax, cx
ja detect_still
shr eax, 16
xor edx, edx ; mov edx, 1
inc edx
detect_button:
mov ebx, edx
imul ebx, 6 * 10
add ebx, 4
cmp eax, ebx
jb detect_still
add ebx, 60 - 1
cmp eax, ebx
ja @f
shl edx, 2
mov ecx, [app_list + edx - 4]
cmp ecx, -1
jz detect_still
mov [x_coord], ax
mov eax, 37
xor ebx, ebx ; mov ebx, 0
int 0x40
mov [y_coord], ax
mov [n_slot], ecx
mov eax, 51
mov ebx, 1
mov ecx, context_menu_start
mov edx, ctx_menu_stack
int 0x40
mov [ctx_menu_PID], eax
jmp detect_still
@@:
cmp edx, [max_applications]
jae detect_still
inc edx
jmp detect_button