Keyboard input seems to work, even dead keys, not tested IM, onscreen keyboard not working...

This commit is contained in:
Pere Pujal i Carabantes 2015-01-19 23:47:24 +01:00
parent 4c69fdbb43
commit b08ddf00dd
3 changed files with 10 additions and 21 deletions

View file

@ -676,11 +676,12 @@ static int im_event_c(IM_DATA* im, SDL_Event event)
case SDLK_BACKSPACE: im->s[0] = L'\b'; break;
case SDLK_TAB: im->s[0] = L'\t'; break;
case SDLK_RETURN: im->s[0] = L'\r'; break;
default: strncpy(im->s , event.text.text, 16);
default: mbstowcs(im->s , event.text.text, 16);
//default: wcsncpy(im->s , event.text.text, 16);
}
//im->s[1] = L'\0';
printf("im->s %s, event.text.text %s\n", im->s, event.text.text);
printf("im->s %ls, event.text.text %s\n", im->s, event.text.text);
im->buf[0] = L'\0';
return 0;
@ -708,8 +709,6 @@ static int im_event_c(IM_DATA* im, SDL_Event event)
*/
int im_read(IM_DATA* im, SDL_Event event)
{
SDL_Keysym ks = event.key.keysym;
IM_EVENT_FN im_event_fp = NULL;
int redraw = 0;
@ -932,7 +931,7 @@ static int im_event_zh_tw(IM_DATA* im, SDL_Event event)
default:
/* English mode */
if(cm.section == SEC_ENGLISH) {
strncpy(im->s , event.text.text, 16);
mbstowcs(im->s , event.text.text, 16);
// im->s[0] = event.text.text[0];
// im->s[1] = L'\0';
im->buf[0] = L'\0';
@ -1121,7 +1120,7 @@ static int im_event_th(IM_DATA* im, SDL_Event event)
/* English mode */
if(cm.section == SEC_ENGLISH) {
// im->s[0] = event.text.text[0];
strncpy(im->s , event.text.text, 16);
mbstowcs(im->s , event.text.text, 16);
//im->s[1] = L'\0';
im->buf[0] = L'\0';
}
@ -1309,7 +1308,7 @@ static int im_event_ja(IM_DATA* im, SDL_Event event)
default:
/* English mode */
if(cm.section == SEC_ENGLISH) {
strncpy(im->s , event.text.text, 16);
mbstowcs(im->s , event.text.text, 16);
// im->s[0] = event.text.text[0];
// im->s[1] = L'\0';
im->buf[0] = L'\0';
@ -1520,7 +1519,7 @@ static int im_event_ko(IM_DATA* im, SDL_Event event)
default:
/* English mode */
if(cm.section == SEC_ENGLISH) {
strncpy(im->s , event.text.text, 16);
mbstowcs(im->s , event.text.text, 16);
// im->s[0] = event.text.text[0];
// im->s[1] = L'\0';
im->buf[0] = L'\0';

View file

@ -3,7 +3,7 @@
#endif
#include "onscreen_keyboard.h"
//#define DEBUG_OSK_COMPOSEMAP
#define DEBUG_OSK_COMPOSEMAP
static SDL_Color def_bgcolor = {255, 255, 255, 255};
static SDL_Color def_fgcolor = {0, 0, 0, 0};

View file

@ -899,7 +899,7 @@ static void SDL_UpdateRect(SDL_Surface * screen, Sint32 x, Sint32 y, Sint32 w, S
SDL_UpdateTexture(texture, NULL, screen->pixels, screen->pitch);
// FIXME docs says one should clear the renderer, however this means a refresh of the whole thing.
// NOTE docs says one should clear the renderer, however this means a refresh of the whole thing.
// SDL_RenderClear(renderer);
// SDL_RenderCopy(renderer, texture, NULL, NULL);
SDL_RenderCopy(renderer, texture, &r, &r);
@ -8164,16 +8164,6 @@ static unsigned draw_colors(unsigned action)
SDL_BlitSurface((colors_state == COLORSEL_ENABLE)
? img_color_btns[i + (i == cur_color) * NUM_COLORS]
: img_color_btn_off, NULL, screen, &dest);
// SDL_BlitSurface(img_paintwell, NULL, screen, &dest);
SDL_Rect rectt;
rectt.x = 50;
rectt.y = 50;
rectt.w = 50;
rectt.h = 50;
SDL_BlitSurface(img_color_btns[6], NULL, screen, &rectt);
rectt.y = 200;
SDL_BlitSurface(img_color_btns[6 + NUM_COLORS], NULL, screen, &rectt);
#else
dest.w = color_button_w;
dest.h = color_button_h;
@ -17084,7 +17074,7 @@ static void handle_active(SDL_Event * event)
{
if (event->window.event == SDL_WINDOWEVENT_EXPOSED)
{
if (fullscreen)
// if (fullscreen)
SDL_Flip(screen);
}
if (event->window.event == SDL_WINDOWEVENT_FOCUS_GAINED)