From a8de84cc11dbe221c03108dcf3148c40897e4ebb Mon Sep 17 00:00:00 2001 From: 0CodErr <0CodErr@kolibrios.org> Date: Wed, 20 Nov 2013 21:13:33 +0000 Subject: [PATCH] auto switch keyboard mode git-svn-id: svn://kolibrios.org@4263 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/system/zkey/trunk/ZKEY.ASM | 31 ++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/programs/system/zkey/trunk/ZKEY.ASM b/programs/system/zkey/trunk/ZKEY.ASM index 12ac649f5c..513905ae50 100644 --- a/programs/system/zkey/trunk/ZKEY.ASM +++ b/programs/system/zkey/trunk/ZKEY.ASM @@ -25,6 +25,9 @@ C_KEYCOLOR equ 0x00344556 ; Control button color L_KEYCOLOR equ 0x00258778 ; Lock button color TEXTCOLOR equ 0x00FFFFFF ; Button caption color +ASCII_KEYMAP_SIZE equ 128 +PROCINFO_SIZE equ 1024 +PROCINFO_BUFF equ ascii_keymap + ASCII_KEYMAP_SIZE STARTAPP: mov ecx, 1 ; to send scancodes. @@ -164,12 +167,19 @@ draw_window: mul byte [keyboard_mode] add eax, SwitchText stdcall draw_button, 513,28,46,20,106,0x00700000,eax,6,TEXTCOLOR ; Scan/ASCII switch + + xor al, al + xchg al, [red_type] + test al, 2 + jnz .skip_end_draw_window ; if we draw switch button without redraw window then end_draw_window not need + @@: .draw_indicators_area: call lights_on - mov byte [red_type], 0 end_draw_window + +.skip_end_draw_window: ret get_zkey_window_slot_number: @@ -184,8 +194,15 @@ set_event_mask: still: call get_receiver_window_slot_number - - + call get_receiver_window_keyboard_mode ; return in ecx keyboard_mode for set_keyboard_mode + call set_keyboard_mode +; delete_switch_button + mov eax, 8 + mov edx, 0x80700000 + int 0x40 + mov byte [red_type], 2 + call draw_window.draw_switch_button + mov eax, 10 ; Wait for an event in the queue. int 0x40 @@ -369,6 +386,14 @@ get_receiver_window_slot_number: @@: ret +get_receiver_window_keyboard_mode: + mov eax, 9 + mov ebx, PROCINFO_BUFF + mov ecx, [receiver_window] + int 0x40 + movzx ecx, byte [ebx + 75] + ret + ;************************************ ;* input: edx = code of the key * ;************************************