Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5850 → Rev 5851

/kernel/trunk/docs/sysfuncr.txt
1045,6 → 1045,24
* бит 4 установлен = 5-я кнопка нажата
Возвращаемое значение:
* функция не возвращает значения
 
-------- Подподфункция 6 - получить задержку двойного щелчка. --------
Параметры:
* eax = 18 - номер функции
* ebx = 19 - номер подфункции
* ecx = 6 - номер подподфункции
Возвращаемое значение:
* eax = текущая задержка двойного щелчка (100 = секунда)
 
------- Подподфункция 7 - установить задержку двойного щелчка. -------
Параметры:
* eax = 18 - номер функции
* ebx = 19 - номер подфункции
* ecx = 7 - номер подподфункции
* dl = новое значение задержки двойного щелчка (100 = секунда)
Возвращаемое значение:
* функция не возвращает значения
 
Замечания:
* Рекомендуемая скорость мыши (в подподфункции 1) от 1 до 9.
Устанавливаемая величина не проверяется кодом ядра, поэтому
1667,19 → 1685,42
и всё равно содержит относительную 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 - загрузить курсор -------------------
Параметры:
* eax = 37 - номер функции
/kernel/trunk/docs/sysfuncs.txt
1041,6 → 1041,24
* 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,19 → 1671,42
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:
* eax = 37 - function number
/kernel/trunk/gui/mouse.inc
9,9 → 9,9
 
include 'mousepointer.inc'
 
;==============================================================================
;///// public functions ///////////////////////////////////////////////////////
;==============================================================================
;================================
;/////// public functions ///////
;================================
 
mouse.LEFT_BUTTON_FLAG = 0001b
mouse.RIGHT_BUTTON_FLAG = 0010b
36,14 → 36,10
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
; 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,9 → 158,9
jnz mouse._.middle_button_press_handler
jmp mouse._.middle_button_release_handler
 
;==============================================================================
;///// private functions //////////////////////////////////////////////////////
;==============================================================================
;===============================
;////// private functions //////
;===============================
 
uglobal
mouse.state:
172,7 → 168,7
.buttons db ?
 
; 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
; * coord - left (high 16 bits) and top (low 16 bits) coordinates pack
align 4
192,11 → 188,19
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
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
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
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
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
 
.exit:
mouse._.right_button_release_handler:
bts dword [BTN_DOWN], 17
@@:
ret
 
align 4
;------------------------------------------------------------------------------
mouse._.right_button_release_handler: ;////////////////////////////////////////
;------------------------------------------------------------------------------
;? Called when right mouse button has been released
;------------------------------------------------------------------------------
mouse._.middle_button_press_handler:
bts word [BTN_DOWN], 10
ret
 
align 4
;------------------------------------------------------------------------------
mouse._.middle_button_press_handler: ;/////////////////////////////////////////
;------------------------------------------------------------------------------
;? Called when middle mouse button has been pressed down
;------------------------------------------------------------------------------
mouse._.middle_button_release_handler:
bts dword [BTN_DOWN], 18
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
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,11 → 505,8
ret
 
align 4
;------------------------------------------------------------------------------
mouse._.activate_sys_window_under_cursor: ;////////////////////////////////////
;------------------------------------------------------------------------------
;? <description>
;------------------------------------------------------------------------------
;-----------------------------------------------------------------
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]
547,15 → 514,12
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
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,7 → 598,7
; 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;
; 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
/kernel/trunk/hid/mousedrv.inc
39,6 → 39,7
mouse_speed_factor:
dd 3
mouse_timer_ticks dd 0
mouse_doubleclick_delay db 64
endg
 
;-----------------------------------------------------------------------------
531,11 → 532,17
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
/kernel/trunk/kernel.asm
1959,7 → 1959,10
;-----------------------------------------------------------------------------
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
; 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
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,33 → 2009,23
rol eax, 16
mov [esp+36-4], eax
ret
 
msbutton:
movzx eax, byte [BTN_DOWN]
mov [esp+36-4], eax
ret
msz:
mov edi, [TASK_COUNT]
movzx edi, word [WIN_POS + edi*2]
cmp edi, [CURRENT_TASK]
jne @f
mov ax, [MOUSE_SCROLL_H]
shl eax, 16
mov ax, [MOUSE_SCROLL_V]
 
msbuttonExt:
mov eax, [BTN_DOWN]
mov [esp+36-4], eax
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
jae @f
stdcall load_cursor, ecx, edx
mov [esp+36-4], eax
@@:
ret
 
app_set_cursor:
2043,6 → 2038,22
mov [esp+36-4], eax
ret
 
msz:
mov edi, [TASK_COUNT]
movzx edi, word [WIN_POS + edi*2]
cmp edi, [CURRENT_TASK]
jne @f
mov ax, [MOUSE_SCROLL_H]
shl eax, 16
mov ax, [MOUSE_SCROLL_V]
mov [esp+36-4], eax
and [MOUSE_SCROLL_H], word 0
and [MOUSE_SCROLL_V], word 0
ret
@@:
and [esp+36-4], dword 0
ret
 
is_input:
 
push edx
2536,11 → 2547,6
;------------------------------------------------------------------------------
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
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
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
mov [mouse_speed_factor], dx
ret
.get_mouse_delay:
; cmp ecx,2 ; get mouse delay
dec ecx
jnz .set_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
mov [mouse_delay], edx
@@:
ret
.set_pointer_position:
; cmp ecx,4 ; set mouse pointer position
dec ecx
jnz .set_mouse_button
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
jmp wakeup_osloop
.set_mouse_button:
; cmp ecx,5 ; set mouse button features
dec ecx
jnz .end
mov [BTN_DOWN], dl
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]