X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=Usermode%2FApplications%2Fgui_shell_src%2Fmain.c;h=ec88bf3272619b4d25b56b47831ed401bee3b4a6;hb=eeef7163c8753db933444accba0488f3e2d1b1e1;hp=3729d70209be3d3333bb9a5d6454ebd469a1ed6d;hpb=55ef4dd6e0ce70e703d79129ba66bed63b296e45;p=tpg%2Facess2.git diff --git a/Usermode/Applications/gui_shell_src/main.c b/Usermode/Applications/gui_shell_src/main.c index 3729d702..ec88bf32 100644 --- a/Usermode/Applications/gui_shell_src/main.c +++ b/Usermode/Applications/gui_shell_src/main.c @@ -57,9 +57,10 @@ int main(int argc, char *argv[], const char **envp) // AxWin3_RichText_SetLineCount(gMainWindow, 3); AxWin3_RichText_SendLine(gMainWindow, 0, "First line!"); - AxWin3_RichText_SendLine(gMainWindow, 2, "Third line! \x01""ff0000A red"); + AxWin3_RichText_SendLine(gMainWindow, 2, "Third line! \1ff0000A red"); // + Display_Init(80, 25, 100); AxWin3_ResizeWindow(gMainWindow, 80*8, 25*16); AxWin3_MoveWindow(gMainWindow, 20, 50); AxWin3_ShowWindow(gMainWindow, 1); @@ -95,7 +96,7 @@ int main(int argc, char *argv[], const char **envp) { _SysDebug("Activity on child stdout"); // Read and update screen - char buf[32]; + char buf[128]; int len = _SysRead(giChildStdout, buf, sizeof(buf)); if( len <= 0 ) break; @@ -111,14 +112,14 @@ int Term_KeyHandler(tHWND Window, int bPress, uint32_t KeySym, uint32_t Translat static int ctrl_state = 0; // Handle modifiers - #define _bitset(var,bit,set) do{if(set)var|=1<<(bit);else var&=1<<(bit);}while(0) + #define _bitset(var,bit,set) do{if(set)var|=1<<(bit);else var&=~(1<<(bit));}while(0) switch(KeySym) { case KEYSYM_LEFTCTRL: - _bitset(ctrl_state, 0, bPress); + _bitset(ctrl_state, 0, bPress!=0); return 0; case KEYSYM_RIGHTCTRL: - _bitset(ctrl_state, 0, bPress); + _bitset(ctrl_state, 1, bPress!=0); return 0; } #undef _bitset @@ -128,32 +129,38 @@ int Term_KeyHandler(tHWND Window, int bPress, uint32_t KeySym, uint32_t Translat if( ctrl_state && KeySym >= KEYSYM_a && KeySym <= KEYSYM_z ) { Translated = KeySym - KEYSYM_a + 1; + _SysDebug("Ctrl-%c: KS %x => Trans %x", 'A'+(KeySym-KEYSYM_a), KeySym, Translated); } - if( Translated ) + // == 2 :: FIRE + if( bPress == 2 ) { - char buf[6]; - int len; - - // Encode and send - len = WriteUTF8(buf, Translated); - - _SysWrite(giChildStdin, buf, len); + if( Translated ) + { + char buf[6]; + int len; + + // Encode and send + len = WriteUTF8(buf, Translated); + + _SysDebug("Keystroke %x:%x translated to '%.*s'", KeySym, Translated, len, buf); + _SysWrite(giChildStdin, buf, len); + + return 0; + } - return 0; - } - - // No translation, look for escape sequences to send - const char *str = NULL; - switch(KeySym) - { - case KEYSYM_LEFTARROW: - str = "\x1b[D"; - break; - } - if( str ) - { - _SysWrite(giChildStdin, str, strlen(str)); + // No translation, look for escape sequences to send + const char *str = NULL; + switch(KeySym) + { + case KEYSYM_LEFTARROW: + str = "\x1b[D"; + break; + } + if( str ) + { + _SysWrite(giChildStdin, str, strlen(str)); + } } return 0; } @@ -177,8 +184,8 @@ void Term_HandleOutput(int Len, const char *Buf) Display_AddText(-esc_len, Buf + ofs); esc_len = -esc_len; } - Len -= esc_len; ofs += esc_len; + //_SysDebug("Len = %i, ofs = %i", Len, ofs); } Display_Flush();