From: John Hodge Date: Mon, 21 Nov 2011 01:34:17 +0000 (+0800) Subject: Kernel - Fixing vterm bug with 32-bit input, slight fix to keymap X-Git-Tag: rel0.14~81 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=784b6fc9ee5221ed58ed7a118c0c856d483a2ea7;p=tpg%2Facess2.git Kernel - Fixing vterm bug with 32-bit input, slight fix to keymap --- diff --git a/Kernel/drv/vterm.c b/Kernel/drv/vterm.c index 4fd06167..57ce0828 100644 --- a/Kernel/drv/vterm.c +++ b/Kernel/drv/vterm.c @@ -482,7 +482,7 @@ Uint64 VT_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) ((char*)Buffer)[pos] = term->InputBuffer[term->InputRead]; pos ++; term->InputRead ++; - while(term->InputRead > MAX_INPUT_CHARS8) + while(term->InputRead >= MAX_INPUT_CHARS8) term->InputRead -= MAX_INPUT_CHARS8; } break; @@ -495,8 +495,9 @@ Uint64 VT_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) avail = term->InputWrite - term->InputRead; if(avail < 0) avail += MAX_INPUT_CHARS32; + Length /= 4; if(avail > Length - pos) - avail = Length/4 - pos; + avail = Length - pos; codepoint_in = (void*)term->InputBuffer; codepoint_buf = Buffer; @@ -506,7 +507,7 @@ Uint64 VT_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) codepoint_buf[pos] = codepoint_in[term->InputRead]; pos ++; term->InputRead ++; - while(term->InputRead > MAX_INPUT_CHARS32) + while(term->InputRead >= MAX_INPUT_CHARS32) term->InputRead -= MAX_INPUT_CHARS32; } pos *= 4; @@ -1053,13 +1054,26 @@ void VT_KBCallBack(Uint32 Codepoint) { // Encode the raw key event Uint32 *raw_in = (void*)term->InputBuffer; + + #if 0 + // Drop new keys + if( term->InputWrite == term->InputRead ) + return ; + #endif + raw_in[ term->InputWrite ] = Codepoint; term->InputWrite ++; - term->InputWrite %= MAX_INPUT_CHARS32; + if(term->InputWrite >= MAX_INPUT_CHARS32) + term->InputWrite -= MAX_INPUT_CHARS32; + + #if 1 + // TODO: Should old or new be dropped? if(term->InputRead == term->InputWrite) { term->InputRead ++; - term->InputRead %= MAX_INPUT_CHARS32; + if( term->InputRead >= MAX_INPUT_CHARS32 ) + term->InputRead -= MAX_INPUT_CHARS32; } + #endif } VFS_MarkAvaliable(&term->Node, 1); @@ -1324,6 +1338,9 @@ int VT_int_ParseEscape(tVTerm *Term, char *Buffer) if(argc != 1) break; switch(args[0]) { + case 25: + Term->Flags &= ~VT_FLAG_HIDECSR; + break; case 1047: VT_int_ToggleAltBuffer(Term, 1); break; @@ -1333,6 +1350,9 @@ int VT_int_ParseEscape(tVTerm *Term, char *Buffer) if(argc != 1) break; switch(args[0]) { + case 25: + Term->Flags |= VT_FLAG_HIDECSR; + break; case 1047: VT_int_ToggleAltBuffer(Term, 0); break; diff --git a/Kernel/include/api_drv_keyboard.h b/Kernel/include/api_drv_keyboard.h index 2085df66..57ca247e 100644 --- a/Kernel/include/api_drv_keyboard.h +++ b/Kernel/include/api_drv_keyboard.h @@ -116,7 +116,8 @@ enum eTplKeyboard_KeyCodes { KEY_KPENTER, KEY_KPSLASH, KEY_KPMINUS, KEY_KPPLUS, KEY_KPSTAR, KEY_KPHOME, KEY_KPUP, KEY_KPPGUP, KEY_KPLEFT, KEY_KP5, KEY_KPRIGHT, KEY_KPEND, KEY_KPDOWN, KEY_KPPGDN, KEY_KPINS, KEY_KPDEL, - KEY_WIN, KEY_MENU, + KEY_LWIN, KEY_RWIN, + KEY_MENU, /** * \} */ diff --git a/Modules/Input/PS2KbMouse/kb_kbdus.h b/Modules/Input/PS2KbMouse/kb_kbdus.h index 523935f4..5df32573 100644 --- a/Modules/Input/PS2KbMouse/kb_kbdus.h +++ b/Modules/Input/PS2KbMouse/kb_kbdus.h @@ -37,10 +37,8 @@ Uint32 gpKBDUS2[256] = { /*10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, KEY_KPENTER, KEY_RCTRL, 0, 0, /*20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*30*/ 0, 0, 0, 0, 0, KEY_KPSLASH, 0, 0, KEY_RALT, 0, 0, 0, 0, 0, 0, 0, -/*40*/ 0, 0, 0, 0, 0, 0, 0, KEY_HOME, - KEY_UP, KEY_PGUP, 0, KEY_LEFT, 0, KEY_RIGHT, 0, KEY_END, -/*50*/ KEY_DOWN, KEY_PGDOWN, KEY_INS, KEY_DEL, 0, 0, 0, 0, - 0, 0, KEY_WIN, 0, 0, KEY_MENU, 0, 0, +/*40*/ 0, 0, 0, 0, 0, 0, 0, KEY_HOME, KEY_UP, KEY_PGUP, 0, KEY_LEFT, 0, KEY_RIGHT, 0, KEY_END, +/*50*/ KEY_DOWN, KEY_PGDOWN, KEY_INS, KEY_DEL, 0, 0, 0, 0, 0, 0, 0, KEY_LWIN, KEY_RWIN, KEY_MENU, 0, 0, /*60*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*70*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };