Index: src/Cube.mm ================================================================== --- src/Cube.mm +++ src/Cube.mm @@ -237,12 +237,16 @@ break; case SDL_KEYDOWN: case SDL_KEYUP: if (_repeatsKeys || event.key.repeat == 0) keypress(event.key.keysym.sym, - event.key.state == SDL_PRESSED, - event.key.keysym.sym); + event.key.state == SDL_PRESSED); + break; + case SDL_TEXTINPUT: + @autoreleasepool { + input(@(event.text.text)); + } break; case SDL_MOUSEMOTION: if (ignore) { ignore--; break; @@ -255,11 +259,11 @@ lastbut == event.button.button) // why?? get event twice without it break; keypress(-event.button.button, - event.button.state != 0, 0); + event.button.state != 0); lasttype = event.type; lastbut = event.button.button; break; } } Index: src/console.mm ================================================================== --- src/console.mm +++ src/console.mm @@ -179,15 +179,15 @@ } } COMMAND(history, ARG_1INT) void -keypress(int code, bool isdown, int cooked) +keypress(int code, bool isDown) { - if (saycommandon) // keystrokes go to commandline - { - if (isdown) { + // keystrokes go to commandline + if (saycommandon) { + if (isDown) { switch (code) { case SDLK_RETURN: break; case SDLK_BACKSPACE: @@ -224,12 +224,10 @@ return; } default: resetcomplete(); - if (cooked) - [commandbuf appendFormat:@"%c", cooked]; } } else { if (code == SDLK_RETURN) { if (commandbuf.length > 0) { @autoreleasepool { @@ -257,23 +255,30 @@ saycommand(NULL); } else if (code == SDLK_ESCAPE) { saycommand(NULL); } } - } else if (!menukey(code, isdown)) { + } else if (!menukey(code, isDown)) { // keystrokes go to menu for (KeyMapping *mapping in keyMappings) { if (mapping.code == code) { // keystrokes go to game, lookup in keymap and // execute - execute(mapping.action, isdown); + execute(mapping.action, isDown); return; } } } } + +void +input(OFString *text) +{ + if (saycommandon) + [commandbuf appendString:text]; +} OFString * getcurcommand() { return saycommandon ? commandbuf : NULL; Index: src/protos.h ================================================================== --- src/protos.h +++ src/protos.h @@ -15,11 +15,12 @@ extern void alias(OFString *name, OFString *action); extern OFString *getalias(OFString *name); extern void writecfg(); // console -extern void keypress(int code, bool isdown, int cooked); +extern void keypress(int code, bool isDown); +extern void input(OFString *text); extern void renderconsole(); extern void conoutf(OFConstantString *format, ...); extern OFString *getcurcommand(); extern void writebinds(OFStream *stream);