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

View File

@ -1041,6 +1041,24 @@ Parameters:
* bit 4 is set = 5th button is pressed * bit 4 is set = 5th button is pressed
Returned value: Returned value:
* function does not return 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: Remarks:
* It is recommended to set speed of the mouse (in subsubfunction 1) * 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 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 contains relative y-coordinate, and to the high word
1 should be added. 1 should be added.
------------ Subfunction 2 - pressed buttons of the mouse ------------ ------------- Subfunction 2 - states of the mouse buttons ------------
Parameters: Parameters:
* eax = 37 - function number * eax = 37 - function number
* ebx = 2 - subfunction number * ebx = 2 - subfunction number
Returned value: Returned value:
* eax contains information on the pressed mouse buttons: * eax = bits 0-4 equal to subfunction 3
* bit 0 is set = left button is pressed
* bit 1 is set = right button is pressed ------- Subfunction 3 - states and events of the mouse buttons -------
* bit 2 is set = middle button is pressed Parameters:
* bit 3 is set = 4th button is pressed * eax = 37 - function number
* bit 4 is set = 5th button is pressed * ebx = 3 - subfunction number
* other bits are cleared 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 --------------------- -------------------- Subfunction 4 - load cursor ---------------------
Parameters: Parameters:

View File

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

View File

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

View File

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