[KERNEL] Use specific cursors for window borders

git-svn-id: svn://kolibrios.org@9848 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Rustem Gimadutdinov (rgimad) 2022-06-23 15:18:20 +00:00
parent a6ec4967a1
commit d77dd5decc
9 changed files with 131 additions and 4 deletions

View File

@ -538,7 +538,7 @@ struct APPDATA
in_schedule LHEAD ;+236
counter_add dd ? ;+244 ; R
cpu_usage dd ? ;+248 ; R
dd ? ;+252
temp_cursor dd 0 ;+252 ; temporary place to save cursor
ends
assert sizeof.APPDATA = 256

View File

@ -400,6 +400,10 @@ MOUSE_PICTURE dd ?
def_cursor dd ?
def_cursor_clock dd ?
def_cursor_hresize dd ?
def_cursor_vresize dd ?
def_cursor_dresize1 dd ?
def_cursor_dresize2 dd ?
current_cursor dd ?
hw_cursor dd ?
cur_saved_base dd ?

View File

@ -338,6 +338,89 @@ mouse._.move_handler:
; Called when cursor has been moved
;> eax = old x coord
;> ebx = old y coord
push eax ebx
call mouse._.find_sys_window_under_cursor
call mouse._.check_sys_window_actions
cmp al, mouse.WINDOW_RESIZE_SW_FLAG
jne .not_sw
; DEBUGF 1, "RESIZE SOUTH-WEST\n"
mov eax, [def_cursor_dresize2]
jmp .set_resizing_cursor
.not_sw:
cmp al, mouse.WINDOW_RESIZE_SE_FLAG
jne .not_se
; DEBUGF 1, "RESIZE SOUTH-EAST\n"
mov eax, [def_cursor_dresize1]
jmp .set_resizing_cursor
.not_se:
cmp al, mouse.WINDOW_RESIZE_W_FLAG
jne .not_w
; DEBUGF 1, "RESIZE WEST\n"
mov eax, [def_cursor_hresize]
jmp .set_resizing_cursor
.not_w:
cmp al, mouse.WINDOW_RESIZE_S_FLAG
jne .not_s
; DEBUGF 1, "RESIZE SOUTH\n"
mov eax, [def_cursor_vresize]
jmp .set_resizing_cursor
.not_s:
cmp al, mouse.WINDOW_RESIZE_E_FLAG
jne .not_in_resize_area
; DEBUGF 1, "RESIZE EAST\n"
mov eax, [def_cursor_hresize]
.set_resizing_cursor:
; change cursor to resizing cursor
shl esi, BSF sizeof.APPDATA
add esi, SLOT_BASE
; if resizing cursor we need (eax) isnt set already, set it
cmp eax, [esi + APPDATA.cursor]
je @f
xchg eax, [esi + APPDATA.cursor] ; set resizing cursor, prev cursor goes to eax
; save previous cursor (will be restored when we'll get out of the resizing area)
; if we change resizing cursor to resizing cursor then dont update previous cursor
cmp eax, [def_cursor_hresize]
je @f
cmp eax, [def_cursor_vresize]
je @f
cmp eax, [def_cursor_dresize1]
je @f
cmp eax, [def_cursor_dresize2]
je @f
mov [esi + APPDATA.temp_cursor], eax ; save prev cursor
@@:
jmp .end1
.not_in_resize_area:
shl esi, BSF sizeof.APPDATA
add esi, SLOT_BASE
mov eax, [esi + APPDATA.temp_cursor]
test eax, eax
jz .end1
; restore prev cursor
mov [esi + APPDATA.temp_cursor], 0
mov [esi + APPDATA.cursor], eax
.end1:
pop ebx eax
cmp [mouse.active_sys_button.pbid], 0
jnz .exit

View File

@ -117,18 +117,33 @@ save_draw_mouse:
add eax, [_display.win_map]
movzx edx, byte [ebx + eax]
shl edx, BSF sizeof.APPDATA
mov esi, [SLOT_BASE + edx + APPDATA.cursor]
; edx - thread slot of window under cursor
mov esi, [SLOT_BASE + edx + APPDATA.cursor] ; cursor of window under cursor
; if cursor of window under cursor already equal to the
; current_cursor then just draw it
cmp esi, [current_cursor]
je .draw
; eax = thread slot of current active window
mov eax, [thread_count]
movzx eax, word [WIN_POS + eax*2]
shl eax, 8
shl eax, BSF sizeof.APPDATA
; window under cursor == active window ?
cmp eax, edx
je @F
je @F ; if yes then just draw cursor of app
mov bl, [mouse.active_sys_window.action]
and bl, mouse.WINDOW_RESIZE_S_FLAG or mouse.WINDOW_RESIZE_W_FLAG or mouse.WINDOW_RESIZE_E_FLAG
test bl, bl
jz .set_def_cursor ; if active window is not being resized now
; esi = cursor of active window:
mov esi, [SLOT_BASE + eax + APPDATA.cursor]
jmp .draw
.set_def_cursor:
mov esi, [def_cursor]
cmp esi, [current_cursor]
je .draw

View File

@ -1188,6 +1188,15 @@ end if
je @f
mov [PUTPIXEL], edx
@@:
stdcall load_cursor, def_hresize, dword LOAD_FROM_MEM
mov [def_cursor_hresize], eax
stdcall load_cursor, def_vresize, dword LOAD_FROM_MEM
mov [def_cursor_vresize], eax
stdcall load_cursor, def_dresize1, dword LOAD_FROM_MEM
mov [def_cursor_dresize1], eax
stdcall load_cursor, def_dresize2, dword LOAD_FROM_MEM
mov [def_cursor_dresize2], eax
stdcall load_cursor, clock_arrow, dword LOAD_FROM_MEM
mov [def_cursor_clock], eax
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
@ -1230,6 +1239,22 @@ def_arrow:
file 'arrow.cur'
;------------------------------------------------------------------------------
align 4
def_hresize:
file 'hresize.cur'
;------------------------------------------------------------------------------
align 4
def_vresize:
file 'vresize.cur'
;------------------------------------------------------------------------------
align 4
def_dresize1:
file 'dresize1.cur'
;------------------------------------------------------------------------------
align 4
def_dresize2:
file 'dresize2.cur'
;------------------------------------------------------------------------------
align 4
clock_arrow:
file 'arrow_clock.cur'
;------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B