New mouse sysfunctions: 18.19.6, 18.19.7, 37.3

git-svn-id: svn://kolibrios.org@5851 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pathoswithin 2015-10-16 19:00:13 +00:00
parent 049255a106
commit 7aa566873d
5 changed files with 243 additions and 189 deletions

View File

@ -1045,6 +1045,24 @@ dd 1675
* бит 4 установлен = 5-я кнопка нажата
Возвращаемое значение:
* функция не возвращает значения
-------- Подподфункция 6 - получить задержку двойного щелчка. --------
Параметры:
* eax = 18 - номер функции
* ebx = 19 - номер подфункции
* ecx = 6 - номер подподфункции
Возвращаемое значение:
* eax = текущая задержка двойного щелчка (100 = секунда)
------- Подподфункция 7 - установить задержку двойного щелчка. -------
Параметры:
* eax = 18 - номер функции
* ebx = 19 - номер подфункции
* ecx = 7 - номер подподфункции
* dl = новое значение задержки двойного щелчка (100 = секунда)
Возвращаемое значение:
* функция не возвращает значения
Замечания:
* Рекомендуемая скорость мыши (в подподфункции 1) от 1 до 9.
Устанавливаемая величина не проверяется кодом ядра, поэтому
@ -1667,18 +1685,41 @@ dir_path1 db 'HD0/1',0
и всё равно содержит относительную y-координату,
а к старшему слову следует прибавить 1.
----------------- Подфункция 2 - нажатые кнопки мыши -----------------
---------------- Подфункция 2 - состояния кнопок мыши ----------------
Параметры:
* eax = 37 - номер функции
* ebx = 2 - номер подфункции
Возвращаемое значение:
* eax содержит информацию о нажатых кнопках мыши:
* бит 0 установлен = левая кнопка нажата
* бит 1 установлен = правая кнопка нажата
* бит 2 установлен = средняя кнопка нажата
* бит 3 установлен = 4-я кнопка нажата
* бит 4 установлен = 5-я кнопка нажата
* прочие биты сброшены
* eax = биты 0-4 соответствуют подфункции 3
----------- Подфункция 3 - состояния и события кнопок мыши -----------
Параметры:
* eax = 37 - номер функции
* ebx = 3 - номер подфункции
Возвращаемое значение:
* eax содержит следующую информацию:
состояния:
* бит 0 установлен = удерживается левая кнопка
* бит 1 установлен = удерживается правая кнопка
* бит 2 установлен = удерживается средняя кнопка
* бит 3 установлен = удерживается 4-я кнопка
* бит 4 установлен = удерживается 5-я кнопка
события:
* бит 8 установлен = нажата левая кнопка
* бит 9 установлен = нажата правая кнопка
* бит 10 установлен = нажата средняя кнопка
* бит 15 установлен = используется вертикальная прокрутка
* бит 16 установлен = отпущена левая кнопка
* бит 17 установлен = отпущена правая кнопка
* бит 18 установлен = отпущена средняя кнопка
* бит 23 установлен = используется горизонтальная прокрутка
* бит 24 установлен = двойной щелчёк левой кнопкой
------------------ Подфункция 4 - загрузить курсор -------------------
Параметры:

View File

@ -1041,6 +1041,24 @@ Parameters:
* bit 4 is set = 5th button is pressed
Returned value:
* function does not return value
-------------- Subsubfunction 6 - get doubleclick delay. -------------
Parameters:
* eax = 18 - function number
* ebx = 19 - subfunction number
* ecx = 6 - subsubfunction number
Returned value:
* eax = current doubleclick delay (100 = 1 second)
-------------- Subsubfunction 7 - set doubleclick delay. -------------
Parameters:
* eax = 18 - function number
* ebx = 19 - subfunction number
* ecx = 7 - subsubfunction number
* dl = new value for doubleclick delay (100 = 1 second)
Returned value:
* function does not return value
Remarks:
* It is recommended to set speed of the mouse (in subsubfunction 1)
from 1 up to 9. The installed value is not inspected by the kernel
@ -1653,18 +1671,41 @@ Remarks:
contains relative y-coordinate, and to the high word
1 should be added.
------------ Subfunction 2 - pressed buttons of the mouse ------------
------------- Subfunction 2 - states of the mouse buttons ------------
Parameters:
* eax = 37 - function number
* ebx = 2 - subfunction number
Returned value:
* eax contains information on the pressed mouse buttons:
* bit 0 is set = left button is pressed
* bit 1 is set = right button is pressed
* bit 2 is set = middle button is pressed
* bit 3 is set = 4th button is pressed
* bit 4 is set = 5th button is pressed
* other bits are cleared
* eax = bits 0-4 equal to subfunction 3
------- Subfunction 3 - states and events of the mouse buttons -------
Parameters:
* eax = 37 - function number
* ebx = 3 - subfunction number
Returned value:
* eax contains next information:
states:
* bit 0 is set = left button is held
* bit 1 is set = right button is held
* bit 2 is set = middle button is held
* bit 3 is set = 4th button is held
* bit 4 is set = 5th button is held
events:
* bit 8 is set = left button is pressed
* bit 9 is set = right button is pressed
* bit 10 is set = middle button is pressed
* bit 15 is set = vertical scroll is used
* bit 16 is set = left button is released
* bit 17 is set = right button is released
* bit 18 is set = middle button is released
* bit 23 is set = horisontal scroll is used
* bit 24 is set = doubleclick by left button
-------------------- Subfunction 4 - load cursor ---------------------
Parameters:

View File

@ -9,9 +9,9 @@ $Revision$
include 'mousepointer.inc'
;==============================================================================
;///// public functions ///////////////////////////////////////////////////////
;==============================================================================
;================================
;/////// public functions ///////
;================================
mouse.LEFT_BUTTON_FLAG = 0001b
mouse.RIGHT_BUTTON_FLAG = 0010b
@ -36,14 +36,10 @@ mouse.WINDOW_RESIZE_SE_FLAG = \
mouse.WINDOW_RESIZE_E_FLAG
align 4
;------------------------------------------------------------------------------
mouse_check_events: ;//////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
;? Check if mouse buttons state or cursor position has changed and call
;? appropriate handlers
;------------------------------------------------------------------------------
;-----------------------------------------------------------------
mouse_check_events:
; Check if mouse buttons state or cursor position has changed
push eax ebx
mov al, [BTN_DOWN]
mov bl, [mouse.state.buttons]
and al, mouse.BUTTONS_MASK
@ -63,8 +59,8 @@ mouse_check_events: ;//////////////////////////////////////////////////////////
; yes it is, activate window user is pointing at, if needed
call mouse._.activate_sys_window_under_cursor
; NOTE: this code wouldn't be necessary if we knew window did
; already redraw itself after call above
; NOTE: this code wouldn't be necessary if we knew
; that window did already redraw itself after call above
or eax, eax
jnz .exit
@ -162,19 +158,19 @@ mouse_check_events: ;//////////////////////////////////////////////////////////
jnz mouse._.middle_button_press_handler
jmp mouse._.middle_button_release_handler
;==============================================================================
;///// private functions //////////////////////////////////////////////////////
;==============================================================================
;===============================
;////// private functions //////
;===============================
uglobal
mouse.state:
.pos POINT
.buttons db ?
; NOTE: since there's no unique and lifetime-constant button identifiers,
; we're using two dwords to identify each of them:
; * pbid - process slot (high 8 bits) and button id (low 24 bits) pack
; * coord - left (high 16 bits) and top (low 16 bits) coordinates pack
; NOTE: since there's no unique and lifetime-constant button identifiers,
; we are using two dwords to identify each of them:
; * pbid - process slot (high 8 bits) and button id (low 24 bits) pack
; * coord - left (high 16 bits) and top (low 16 bits) coordinates pack
align 4
mouse.active_sys_button:
.pbid dd ?
@ -192,11 +188,19 @@ uglobal
endg
align 4
;------------------------------------------------------------------------------
mouse._.left_button_press_handler: ;///////////////////////////////////////////
;------------------------------------------------------------------------------
;? Called when left mouse button has been pressed down
;------------------------------------------------------------------------------
;-----------------------------------------------------------------
mouse._.left_button_press_handler:
; Called when left mouse button has been pressed down
bts word [BTN_DOWN], 8
mov eax, [timer_ticks]
mov ebx, eax
xchg ebx, [mouse.active_sys_window.last_ticks]
sub eax, ebx
movzx ebx, [mouse_doubleclick_delay]
cmp eax, ebx
jg @f
bts dword [BTN_DOWN], 24
@@:
test [mouse.state.buttons], not mouse.LEFT_BUTTON_FLAG
jnz .exit
@ -210,12 +214,8 @@ mouse._.left_button_press_handler: ;///////////////////////////////////////////
test dl, mouse.WINDOW_MOVE_FLAG
jz @f
mov eax, [timer_ticks]
mov ebx, eax
xchg ebx, [mouse.active_sys_window.last_ticks]
sub eax, ebx
cmp eax, 50
jg @f
bt dword [BTN_DOWN], 24
jnc @f
mov [mouse.active_sys_window.last_ticks], 0
call sys_window_maximize_handler
@ -254,9 +254,6 @@ mouse._.left_button_press_handler: ;///////////////////////////////////////////
call .calculate_e_delta
.call_window_handler:
; mov eax, mouse.active_sys_window.old_box
; call sys_window_start_moving_handler
.exit:
ret
@ -287,11 +284,10 @@ mouse._.left_button_press_handler: ;///////////////////////////////////////////
ret
align 4
;------------------------------------------------------------------------------
mouse._.left_button_release_handler: ;/////////////////////////////////////////
;------------------------------------------------------------------------------
;? Called when left mouse button has been released
;------------------------------------------------------------------------------
;-----------------------------------------------------------------
mouse._.left_button_release_handler:
; Called when left mouse button has been released
bts dword [BTN_DOWN], 16
xor esi, esi
xchg esi, [mouse.active_sys_window.pslot]
or esi, esi
@ -312,58 +308,35 @@ mouse._.left_button_release_handler: ;/////////////////////////////////////////
and [mouse.active_sys_window.action], 0
ret
align 4
;------------------------------------------------------------------------------
mouse._.right_button_press_handler: ;//////////////////////////////////////////
;------------------------------------------------------------------------------
;? Called when right mouse button has been pressed down
;------------------------------------------------------------------------------
mouse._.right_button_press_handler:
bts word [BTN_DOWN], 9
test [mouse.state.buttons], not mouse.RIGHT_BUTTON_FLAG
jnz .exit
jnz @f
call mouse._.find_sys_window_under_cursor
call mouse._.check_sys_window_actions
test al, mouse.WINDOW_MOVE_FLAG
jz .exit
jz @f
jmp sys_window_rollup_handler
call sys_window_rollup_handler
mouse._.right_button_release_handler:
bts dword [BTN_DOWN], 17
@@:
ret
.exit:
mouse._.middle_button_press_handler:
bts word [BTN_DOWN], 10
ret
mouse._.middle_button_release_handler:
bts dword [BTN_DOWN], 18
ret
align 4
;------------------------------------------------------------------------------
mouse._.right_button_release_handler: ;////////////////////////////////////////
;------------------------------------------------------------------------------
;? Called when right mouse button has been released
;------------------------------------------------------------------------------
ret
align 4
;------------------------------------------------------------------------------
mouse._.middle_button_press_handler: ;/////////////////////////////////////////
;------------------------------------------------------------------------------
;? Called when middle mouse button has been pressed down
;------------------------------------------------------------------------------
ret
align 4
;------------------------------------------------------------------------------
mouse._.middle_button_release_handler: ;///////////////////////////////////////
;------------------------------------------------------------------------------
;? Called when middle mouse button has been released
;------------------------------------------------------------------------------
ret
align 4
;------------------------------------------------------------------------------
mouse._.move_handler: ;////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
;? Called when cursor has been moved
;------------------------------------------------------------------------------
;-----------------------------------------------------------------
mouse._.move_handler:
; Called when cursor has been moved
;> eax = old x coord
;> ebx = old y coord
;------------------------------------------------------------------------------
cmp [mouse.active_sys_button.pbid], 0
jnz .exit
@ -514,15 +487,12 @@ mouse._.move_handler: ;////////////////////////////////////////////////////////
ret
align 4
;------------------------------------------------------------------------------
mouse._.find_sys_window_under_cursor: ;////////////////////////////////////////
;------------------------------------------------------------------------------
;? Find system window object which is currently visible on screen and has
;? mouse cursor within its bounds
;------------------------------------------------------------------------------
;-----------------------------------------------------------------
mouse._.find_sys_window_under_cursor:
; Find system window object which is currently visible on screen
; and has mouse cursor within its bounds
;< esi = process slot
;< edi = pointer to WDATA struct
;------------------------------------------------------------------------------
mov esi, [mouse.state.pos.y]
mov esi, [d_width_calc_area + esi*4]
@ -535,27 +505,21 @@ mouse._.find_sys_window_under_cursor: ;////////////////////////////////////////
ret
align 4
;------------------------------------------------------------------------------
mouse._.activate_sys_window_under_cursor: ;////////////////////////////////////
;------------------------------------------------------------------------------
;? <description>
;------------------------------------------------------------------------------
; activate and redraw window under cursor (if necessary)
;-----------------------------------------------------------------
mouse._.activate_sys_window_under_cursor:
; activate and redraw window under cursor (if necessary)
call mouse._.find_sys_window_under_cursor
movzx esi, word[WIN_STACK + esi * 2]
lea esi, [WIN_POS + esi * 2]
jmp waredraw
align 4
;------------------------------------------------------------------------------
mouse._.find_sys_button_under_cursor: ;////////////////////////////////////////
;------------------------------------------------------------------------------
;? Find system button object which is currently visible on screen and has
;? mouse cursor within its bounds
;------------------------------------------------------------------------------
;-----------------------------------------------------------------
mouse._.find_sys_button_under_cursor:
; Find system button object which is currently visible on screen
; and has mouse cursor within its bounds
;< eax = pack[8(process slot), 24(button id)] or 0
;< ebx = pack[16(button x coord), 16(button y coord)]
;------------------------------------------------------------------------------
push ecx edx esi edi
call mouse._.find_sys_window_under_cursor
@ -612,13 +576,9 @@ mouse._.find_sys_button_under_cursor: ;////////////////////////////////////////
ret
align 4
;------------------------------------------------------------------------------
mouse._.check_sys_window_actions: ;////////////////////////////////////////////
;------------------------------------------------------------------------------
;? <description>
;------------------------------------------------------------------------------
;-----------------------------------------------------------------
mouse._.check_sys_window_actions:
;< eax = action flags or 0
;------------------------------------------------------------------------------
; is window movable?
test byte[edi + WDATA.cl_titlebar + 3], 0x01
jnz .no_action
@ -638,8 +598,8 @@ mouse._.check_sys_window_actions: ;////////////////////////////////////////////
; no there isn't, can it be resized then?
mov dl, [edi + WDATA.fl_wstyle]
and dl, 0x0f
; NOTE: dangerous optimization, revise if window types changed;
; this currently implies only types 2 and 3 could be resized
; NOTE: dangerous optimization, revise if window types changed
; this currently implies only types 2 and 3 could be resized
test dl, 2
jz .no_action

View File

@ -39,6 +39,7 @@ mouse_delay dd 10
mouse_speed_factor:
dd 3
mouse_timer_ticks dd 0
mouse_doubleclick_delay db 64
endg
;-----------------------------------------------------------------------------
@ -531,11 +532,17 @@ proc set_mouse_data stdcall uses edx, BtnState:dword, XMoving:dword, YMoving:dwo
mov [MOUSE_Y], ax
;--------------------------------------
mov eax, [VScroll]
test eax, eax
jz @f
add [MOUSE_SCROLL_V], ax
bts word [BTN_DOWN], 15
@@:
mov eax, [HScroll]
test eax, eax
jz @f
add [MOUSE_SCROLL_H], ax
bts dword [BTN_DOWN], 23
@@:
mov [mouse_active], 1
mov eax, [timer_ticks]
mov [mouse_timer_ticks], eax

View File

@ -1959,7 +1959,10 @@ get_timer_ticks:
;-----------------------------------------------------------------------------
iglobal
align 4
mousefn dd msscreen, mswin, msbutton, msset
mousefn dd msscreen
dd mswin
dd msbutton
dd msbuttonExt
dd app_load_cursor
dd app_set_cursor
dd app_delete_cursor
@ -1971,21 +1974,24 @@ readmousepos:
; eax=0 screen relative
; eax=1 window relative
; eax=2 buttons pressed
; eax=3 set mouse pos ; reserved
; eax=3 buttons pressed ext
; eax=4 load cursor
; eax=5 set cursor
; eax=6 delete cursor ; reserved
; eax=6 delete cursor
; eax=7 get mouse_z
cmp ebx, 7
ja msset
ja @f
jmp [mousefn+ebx*4]
msscreen:
mov eax, [MOUSE_X]
shl eax, 16
mov ax, [MOUSE_Y]
mov [esp+36-4], eax
@@:
ret
mswin:
mov eax, [MOUSE_X]
shl eax, 16
@ -1995,7 +2001,6 @@ mswin:
shl ebx, 16
mov bx, word [esi-twdw+WDATA.box.top]
sub eax, ebx
mov edi, [CURRENT_TASK]
shl edi, 8
sub ax, word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
@ -2004,10 +2009,35 @@ mswin:
rol eax, 16
mov [esp+36-4], eax
ret
msbutton:
movzx eax, byte [BTN_DOWN]
mov [esp+36-4], eax
ret
msbuttonExt:
mov eax, [BTN_DOWN]
mov [esp+36-4], eax
ret
app_load_cursor:
cmp ecx, OS_BASE
jae @f
stdcall load_cursor, ecx, edx
mov [esp+36-4], eax
@@:
ret
app_set_cursor:
stdcall set_cursor, ecx
mov [esp+36-4], eax
ret
app_delete_cursor:
stdcall delete_cursor, ecx
mov [esp+36-4], eax
ret
msz:
mov edi, [TASK_COUNT]
movzx edi, word [WIN_POS + edi*2]
@ -2020,27 +2050,8 @@ msz:
and [MOUSE_SCROLL_H], word 0
and [MOUSE_SCROLL_V], word 0
ret
@@:
@@:
and [esp+36-4], dword 0
; ret
msset:
ret
app_load_cursor:
cmp ecx, OS_BASE
jae msset
stdcall load_cursor, ecx, edx
mov [esp+36-4], eax
ret
app_set_cursor:
stdcall set_cursor, ecx
mov [esp+36-4], eax
ret
app_delete_cursor:
stdcall delete_cursor, ecx
mov [esp+36-4], eax
ret
is_input:
@ -2536,11 +2547,6 @@ sysfn_waitretrace: ; 18.14 = sys wait retrace
;------------------------------------------------------------------------------
align 4
sysfn_centermouse: ; 18.15 = mouse centered
; removed here by <Lrz>
; call mouse_centered
;* mouse centered - start code- Mario79
;mouse_centered:
; push eax
mov eax, [_display.width]
shr eax, 1
mov [MOUSE_X], ax
@ -2548,62 +2554,61 @@ sysfn_centermouse: ; 18.15 = mouse centered
shr eax, 1
mov [MOUSE_Y], ax
call wakeup_osloop
; ret
;* mouse centered - end code- Mario79
xor eax, eax
and [esp+32], eax
; pop eax
ret
;------------------------------------------------------------------------------
align 4
sysfn_mouse_acceleration: ; 18.19 = set/get mouse features
test ecx, ecx; get mouse speed factor
jnz .set_mouse_acceleration
sysfn_mouse_acceleration: ; 18.19 = set/get mouse features
cmp ecx, 8
jnc @f
jmp dword [.table+ecx*4]
.get_mouse_acceleration:
xor eax, eax
mov ax, [mouse_speed_factor]
mov [esp+32], eax
ret
.set_mouse_acceleration:
; cmp ecx,1 ; set mouse speed factor
dec ecx
jnz .get_mouse_delay
.set_mouse_acceleration:
mov [mouse_speed_factor], dx
ret
.get_mouse_delay:
; cmp ecx,2 ; get mouse delay
dec ecx
jnz .set_mouse_delay
.get_mouse_delay:
mov eax, [mouse_delay]
mov [esp+32], eax
ret
.set_mouse_delay:
; cmp ecx,3 ; set mouse delay
dec ecx
jnz .set_pointer_position
.set_mouse_delay:
mov [mouse_delay], edx
@@:
ret
.set_pointer_position:
; cmp ecx,4 ; set mouse pointer position
dec ecx
jnz .set_mouse_button
.set_pointer_position:
cmp dx, word[_display.height]
jae .end
jae @b
rol edx, 16
cmp dx, word[_display.width]
jae .end
jae @b
mov [MOUSE_X], edx
mov [mouse_active], 1
call wakeup_osloop
ret
.set_mouse_button:
; cmp ecx,5 ; set mouse button features
dec ecx
jnz .end
mov [BTN_DOWN], dl
jmp wakeup_osloop
.set_mouse_button:
mov [BTN_DOWN], edx
mov [mouse_active], 1
call wakeup_osloop
.end:
jmp wakeup_osloop
.get_doubleclick_delay:
xor eax, eax
mov al, [mouse_doubleclick_delay]
mov [esp+32], eax
ret
.set_doubleclick_delay:
mov [mouse_doubleclick_delay], dl
ret
align 4
.table:
dd .get_mouse_acceleration
dd .set_mouse_acceleration
dd .get_mouse_delay
dd .set_mouse_delay
dd .set_pointer_position
dd .set_mouse_button
dd .get_doubleclick_delay
dd .set_doubleclick_delay
;------------------------------------------------------------------------------
sysfn_getfreemem:
mov eax, [pg_data.pages_free]