From d77dd5decc236d2eb86aadd5fdadf87168a293fc Mon Sep 17 00:00:00 2001 From: "Rustem Gimadutdinov (rgimad)" Date: Thu, 23 Jun 2022 15:18:20 +0000 Subject: [PATCH] [KERNEL] Use specific cursors for window borders git-svn-id: svn://kolibrios.org@9848 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/const.inc | 2 +- kernel/trunk/data32.inc | 4 ++ kernel/trunk/gui/mouse.inc | 83 ++++++++++++++++++++++++++++++++ kernel/trunk/hid/mousedrv.inc | 21 ++++++-- kernel/trunk/video/cursors.inc | 25 ++++++++++ kernel/trunk/video/dresize1.cur | Bin 0 -> 766 bytes kernel/trunk/video/dresize2.cur | Bin 0 -> 766 bytes kernel/trunk/video/hresize.cur | Bin 0 -> 766 bytes kernel/trunk/video/vresize.cur | Bin 0 -> 766 bytes 9 files changed, 131 insertions(+), 4 deletions(-) create mode 100644 kernel/trunk/video/dresize1.cur create mode 100644 kernel/trunk/video/dresize2.cur create mode 100644 kernel/trunk/video/hresize.cur create mode 100644 kernel/trunk/video/vresize.cur diff --git a/kernel/trunk/const.inc b/kernel/trunk/const.inc index 0e379596f2..03d2bf2114 100644 --- a/kernel/trunk/const.inc +++ b/kernel/trunk/const.inc @@ -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 diff --git a/kernel/trunk/data32.inc b/kernel/trunk/data32.inc index 6e2199cbd5..978959deaf 100644 --- a/kernel/trunk/data32.inc +++ b/kernel/trunk/data32.inc @@ -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 ? diff --git a/kernel/trunk/gui/mouse.inc b/kernel/trunk/gui/mouse.inc index e4294a0328..a87f36904b 100644 --- a/kernel/trunk/gui/mouse.inc +++ b/kernel/trunk/gui/mouse.inc @@ -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 diff --git a/kernel/trunk/hid/mousedrv.inc b/kernel/trunk/hid/mousedrv.inc index 9756626489..2ed5ef5089 100644 --- a/kernel/trunk/hid/mousedrv.inc +++ b/kernel/trunk/hid/mousedrv.inc @@ -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 diff --git a/kernel/trunk/video/cursors.inc b/kernel/trunk/video/cursors.inc index 9b05479846..39e59771bf 100644 --- a/kernel/trunk/video/cursors.inc +++ b/kernel/trunk/video/cursors.inc @@ -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' ;------------------------------------------------------------------------------ diff --git a/kernel/trunk/video/dresize1.cur b/kernel/trunk/video/dresize1.cur new file mode 100644 index 0000000000000000000000000000000000000000..d0c44d9ddd057425983f87269be760a39828b3a8 GIT binary patch literal 766 zcmd^-u?@m76hto(2qX$q(GrP<5$MPUh>7q7%#?mZ+@3T*~ zzAa0&Dm9HXr}ee8lC%Yu)Iy~RS&De?SRxW*L`+nS<3L72RM&MFes$SN0WB@1^qik3(;j6g?LU?O`0W^zN%3{)vI0OImYL}5oX6f~Uu&Y$mW z`B$n{scoedrLU!}qyrFA2bCJU6v(}8gGfvkNTNcR8axt$VvHp0Rb`eGP*NzlKeMJd zud^YGxZ+A?edXgNm(8d1ivh)=vt3%3?dtPG^9R1RikS;o!xHvzh9f+@+4F?h!Nr?h M;SK}zaD(V=1nwY~ga7~l literal 0 HcmV?d00001 diff --git a/kernel/trunk/video/hresize.cur b/kernel/trunk/video/hresize.cur new file mode 100644 index 0000000000000000000000000000000000000000..7adec8fb8f7aa7b7a9c902250e63b9cccfef797d GIT binary patch literal 766 zcmeH^yA1*{5JcadOmx8!5no6dTbjEdgbrxIJp$GC@AeIS`q>|T^_!pk!sNzo(-=oR{1>pbo_zoS literal 0 HcmV?d00001 diff --git a/kernel/trunk/video/vresize.cur b/kernel/trunk/video/vresize.cur new file mode 100644 index 0000000000000000000000000000000000000000..1eaf617cda01e218f8d9fd522f039886bbe3fcd4 GIT binary patch literal 766 zcmdUtF%H5o5Ck_-Itr+$Q}PUW8GZ{d@h5lzO{6pwNR(!lh{Bh`G!(3}&YtgX<&!M+ z>NJkhppB+p+Dke>j&y__86%PVV23alB$B9CD4{H}to3z5Cp6AN$$& E1;_2AS^xk5 literal 0 HcmV?d00001