From dfaeeb56ffb0b0ec57f6b1611a70b5a5d59f13f3 Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Fri, 1 Jun 2012 00:58:16 +0000 Subject: [PATCH] Functions 66.6, 66.7 - control input from the keyboard for hotkeys git-svn-id: svn://kolibrios.org@2709 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/sys32.inc | 11 +++++ kernel/trunk/docs/sysfuncr.txt | 21 +++++++++ kernel/trunk/docs/sysfuncs.txt | 20 +++++++++ kernel/trunk/hid/keyboard.inc | 7 +++ kernel/trunk/kernel.asm | 79 ++++++++++++++++++++++++---------- 5 files changed, 115 insertions(+), 23 deletions(-) diff --git a/kernel/trunk/core/sys32.inc b/kernel/trunk/core/sys32.inc index fb3313edf8..e52fea7664 100644 --- a/kernel/trunk/core/sys32.inc +++ b/kernel/trunk/core/sys32.inc @@ -425,6 +425,17 @@ term9: add eax, 16 cmp eax, hotkey_list+256*16 jb .loop +; get process PID + mov eax, esi + shl eax, 5 + mov eax, [eax+CURRENT_TASK+TASKDATA.pid] +; compare current lock input with process PID + cmp eax, [PID_lock_input] + jne @f + + xor eax, eax + mov [PID_lock_input], eax +@@: ; remove hotkeys in buffer mov eax, hotkey_buffer .loop2: diff --git a/kernel/trunk/docs/sysfuncr.txt b/kernel/trunk/docs/sysfuncr.txt index e3647cceea..af28fd05b8 100644 --- a/kernel/trunk/docs/sysfuncr.txt +++ b/kernel/trunk/docs/sysfuncr.txt @@ -3468,6 +3468,27 @@ IPC Если другое приложение определило эту же комбинацию, оно по-прежнему будет получать уведомления. +------------- Подфункция 6 - заблокировать обычный ввод. ------------- +Параметры: + * eax = 66 - номер функции + * ebx = 6 - номер подфункции +Возвращаемое значение: + * функция не возвращает значения +Замечания: + * Блокируется обычный ввод данных с клавиатуры для установленных + "горячих" клавиш + * Для эмуляции мыши через клавиатуру, приложение MOUSEMUL + +--------- Подфункция 7 - разблокировать обычный ввод. ---------------- +Параметры: + * eax = 66 - номер функции + * ebx = 7 - номер подфункции +Возвращаемое значение: + * функция не возвращает значения +Замечания: + * Разблокирование результатов ф. 66.6 + * Для эмуляции мыши через клавиатуру, приложение MOUSEMUL + ====================================================================== ============ Функция 67 - изменить положение/размеры окна. =========== ====================================================================== diff --git a/kernel/trunk/docs/sysfuncs.txt b/kernel/trunk/docs/sysfuncs.txt index 047c036f6f..1e74c0e90a 100644 --- a/kernel/trunk/docs/sysfuncs.txt +++ b/kernel/trunk/docs/sysfuncs.txt @@ -3448,6 +3448,26 @@ Remarks: If other application has defined the same combination, it will still receive notices. +--------------- Subfunction 6 - block the normal input. -------------- +Parameters: + * eax = 66 - function number + * ebx = 6 - subfunction number +Returned value: + * function does not return value +Remarks: + * Blocking the normal keyboard input for installed hotkeys + * To emulate a mouse via the keyboard, the application MOUSEMUL + +------------ Subfunction 7 - unlock the normal input. ---------------- +Parameters: + * eax = 66 - function number + * ebx = 7 - subfunction number +Returned value: + * function does not return value +Remarks: + * Unlocking the results of the f. 66.6 + * To emulate a mouse via the keyboard, the application MOUSEMUL + ====================================================================== ========= Function 67 - change position/sizes of the window. ========= ====================================================================== diff --git a/kernel/trunk/hid/keyboard.inc b/kernel/trunk/hid/keyboard.inc index f1fd2bdbfd..ddba3da8e3 100644 --- a/kernel/trunk/hid/keyboard.inc +++ b/kernel/trunk/hid/keyboard.inc @@ -416,9 +416,16 @@ send_scancode: mov [edi+4], ax mov eax, [kb_state] mov [edi+6], ax + + cmp [PID_lock_input], dword 0 + je .nohotkey + + popad + jmp .exit.irq1 ;-------------------------------------- .nohotkey: popad + cmp [keyboard_mode], 0; return from keymap jne .scancode diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 35fe6db00d..4d01f33a74 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -4617,17 +4617,17 @@ f66call: dd sys_process_def.1 ; 1 = set keyboard mode dd sys_process_def.2 ; 2 = get keyboard mode dd sys_process_def.3 ; 3 = get keyboard ctrl, alt, shift - dd sys_process_def.4 - dd sys_process_def.5 + dd sys_process_def.4 ; 4 = set system-wide hotkey + dd sys_process_def.5 ; 5 = delete installed hotkey + dd sys_process_def.6 ; 6 = disable input, work only hotkeys + dd sys_process_def.7 ; 7 = enable input, opposition to f.66.6 endg - - - - +;----------------------------------------------------------------------------- +align 4 sys_process_def: dec ebx - cmp ebx, 5 - jae .not_support ;if >=6 then or eax,-1 + cmp ebx, 7 + jae .not_support ;if >=8 then or eax,-1 mov edi, [CURRENT_TASK] jmp dword [f66call+ebx*4] @@ -4635,33 +4635,28 @@ sys_process_def: .not_support: or eax, -1 ret - +;----------------------------------------------------------------------------- +align 4 .1: shl edi, 8 mov [edi+SLOT_BASE + APPDATA.keyboard_mode], cl ret - +;----------------------------------------------------------------------------- +align 4 .2: ; 2 = get keyboard mode shl edi, 8 movzx eax, byte [SLOT_BASE+edi + APPDATA.keyboard_mode] mov [esp+32], eax ret -; xor eax,eax -; movzx eax,byte [shift] -; movzx ebx,byte [ctrl] -; shl ebx,2 -; add eax,ebx -; movzx ebx,byte [alt] -; shl ebx,3 -; add eax,ebx +;----------------------------------------------------------------------------- +align 4 .3: ;3 = get keyboard ctrl, alt, shift - ;// mike.dld [ mov eax, [kb_state] - ;// mike.dld ] mov [esp+32], eax ret - +;----------------------------------------------------------------------------- +align 4 .4: mov eax, hotkey_list @@: @@ -4686,7 +4681,8 @@ sys_process_def: @@: and dword [esp+32], 0 ret - +;----------------------------------------------------------------------------- +align 4 .5: movzx ebx, cl lea ebx, [hotkey_scancodes+ebx*4] @@ -4720,8 +4716,45 @@ sys_process_def: mov [eax], edx mov [esp+32], edx ret +;----------------------------------------------------------------------------- +align 4 +.6: + pushfd + cli + mov eax, [PID_lock_input] + test eax, eax + jnz @f +; get current PID + mov eax, [CURRENT_TASK] + shl eax, 5 + mov eax, [eax+CURRENT_TASK+TASKDATA.pid] +; set current PID for lock input + mov [PID_lock_input], eax +@@: + popfd + ret +;----------------------------------------------------------------------------- +align 4 +.7: + mov eax, [PID_lock_input] + test eax, eax + jz @f +; get current PID + mov ebx, [CURRENT_TASK] + shl ebx, 5 + mov ebx, [ebx+CURRENT_TASK+TASKDATA.pid] +; compare current lock input with current PID + cmp ebx, eax + jne @f - + xor eax, eax + mov [PID_lock_input], eax +@@: + ret +;----------------------------------------------------------------------------- +uglobal + PID_lock_input dd 0x0 +endg ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 61 sys function. ;; ;; in eax=61,ebx in [1..3] ;;