X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fdrv%2Fvterm.c;h=575d71f9ce28baef969bb881689e875e30a78a4a;hb=3045a1c5f05fa6f6e3cfe73da753b7500e87aff3;hp=afd53ffc26d0fc8cc0974d8aaa585c59b04ac5ff;hpb=3c777e58e6baba6760f43b8fdde4daf62081048b;p=tpg%2Facess2.git diff --git a/Kernel/drv/vterm.c b/Kernel/drv/vterm.c index afd53ffc..575d71f9 100644 --- a/Kernel/drv/vterm.c +++ b/Kernel/drv/vterm.c @@ -24,6 +24,7 @@ #define DEFAULT_COLOUR (VT_COL_BLACK|(0xAAA<<16)) #define VT_FLAG_HIDECSR 0x01 +#define VT_FLAG_HASFB 0x10 //!< Set if the VTerm has requested the Framebuffer enum eVT_InModes { VT_INMODE_TEXT8, // UTF-8 Text Mode (VT100 Emulation) @@ -184,7 +185,7 @@ int VT_Install(char **Arguments) DevFS_AddDevice( &gVT_DrvInfo ); // Set kernel output to VT0 - //Debug_SetKTerminal("/Devices/VTerm/0"); + Debug_SetKTerminal("/Devices/VTerm/0"); return 0; } @@ -196,7 +197,6 @@ int VT_Install(char **Arguments) void VT_InitOutput() { giVT_OutputDevHandle = VFS_Open(gsVT_OutputDevice, VFS_OPENFLAG_WRITE); - LOG("giVT_OutputDevHandle = %x\n", giVT_OutputDevHandle); VT_SetTerminal( 0 ); } @@ -207,7 +207,6 @@ void VT_InitOutput() void VT_InitInput() { giVT_InputDevHandle = VFS_Open(gsVT_InputDevice, VFS_OPENFLAG_READ); - LOG("giVT_InputDevHandle = %x\n", giVT_InputDevHandle); if(giVT_InputDevHandle == -1) return ; VFS_IOCtl(giVT_InputDevHandle, KB_IOCTL_SETCALLBACK, VT_KBCallBack); } @@ -493,6 +492,10 @@ void VT_KBCallBack(Uint32 Codepoint) case KEY_F10: VT_SetTerminal(9); return; case KEY_F11: VT_SetTerminal(10); return; case KEY_F12: VT_SetTerminal(11); return; + case KEY_PGUP: + return; + case KEY_PGDOWN: + return; } } @@ -500,7 +503,7 @@ void VT_KBCallBack(Uint32 Codepoint) if(term->Mode == TERM_MODE_TEXT) { Uint8 buf[6] = {0}; - int len; + int len = 0; // Ignore Modifer Keys if(Codepoint > KEY_MODIFIERS) return; @@ -509,20 +512,43 @@ void VT_KBCallBack(Uint32 Codepoint) switch(Codepoint) { case KEY_LEFT: - buf[0] = '\x1B'; buf[1] = '['; - buf[2] = 'D'; len = 3; + buf[0] = '\x1B'; buf[1] = '['; buf[2] = 'D'; + len = 3; break; case KEY_RIGHT: - buf[0] = '\x1B'; buf[1] = '['; - buf[2] = 'C'; len = 3; + buf[0] = '\x1B'; buf[1] = '['; buf[2] = 'C'; + len = 3; break; + case KEY_UP: + buf[0] = '\x1B'; buf[1] = '['; buf[2] = 'A'; + len = 3; + break; + case KEY_DOWN: + buf[0] = '\x1B'; buf[1] = '['; buf[2] = 'B'; + len = 3; + break; + + case KEY_PGUP: + buf[0] = '\x1B'; buf[1] = '['; buf[2] = '5'; // Some overline also + //len = 4; // Commented out until I'm sure + break; + case KEY_PGDOWN: + len = 0; + break; + + // Attempt to encode in UTF-8 default: len = WriteUTF8( buf, Codepoint ); - //Log("Codepoint = 0x%x", Codepoint); + if(len == 0) { + Warning("Codepoint (%x) is unrepresentable in UTF-8", Codepoint); + } break; } - //Log("len = %i, buf = %s", len, buf); + if(len == 0) { + // Unprintable / Don't Pass + return; + } // Write if( MAX_INPUT_CHARS8 - term->InputWrite >= len ) @@ -891,7 +917,7 @@ void VT_int_ChangeMode(tVTerm *Term, int NewMode) Uint8 *VT_Font_GetChar(Uint32 Codepoint); // === GLOBALS === -int giVT_CharWidth = FONT_WIDTH; +int giVT_CharWidth = FONT_WIDTH+1; int giVT_CharHeight = FONT_HEIGHT; // === CODE === @@ -904,13 +930,14 @@ void VT_Font_Render(Uint32 Codepoint, void *Buffer, int Pitch, Uint32 BGC, Uint3 Uint8 *font; Uint32 *buf = Buffer; int x, y; + font = VT_Font_GetChar(Codepoint); for(y = 0; y < FONT_HEIGHT; y ++) { for(x = 0; x < FONT_WIDTH; x ++) { - if(*font & (1 << (FONT_WIDTH-x))) + if(*font & (1 << (FONT_WIDTH-x-1))) buf[x] = FGC; else buf[x] = BGC;