fixes for unicode input, should work for operator textinput now.
authorCampbell Barton <ideasman42@gmail.com>
Thu, 20 Oct 2011 11:18:57 +0000 (11:18 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 20 Oct 2011 11:18:57 +0000 (11:18 +0000)
source/blender/editors/curve/editfont.c
source/blender/editors/interface/interface_handlers.c
source/blender/windowmanager/intern/wm_event_system.c

index dff5be059c3e24da2d382bafd130d446c29924fb..c80f5c85c25f2fd213fcca3547e94848969726ac 100644 (file)
@@ -1289,7 +1289,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
        else if(event==BACKSPACEKEY)
                ascii= 0;
 
-       if(val && ascii) {
+       if(val && (ascii || evt->utf8_buf[0])) {
                /* handle case like TAB (== 9) */
                if(     (ascii > 31 && ascii < 254 && ascii != 127) ||
                        (ascii==13) ||
index 1f30f8a5109c6a2a5c2ada4269317c36a1240af2..c02bbafce15426feea30261282c6dccfda60bb99 100644 (file)
@@ -1930,7 +1930,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
                                break;
                }
 
-               if(event->ascii && (retval == WM_UI_HANDLER_CONTINUE)) {
+               if((event->ascii || event->utf8_buf[0]) && (retval == WM_UI_HANDLER_CONTINUE)) {
                        char ascii = event->ascii;
 
                        /* exception that's useful for number buttons, some keyboard
@@ -1939,7 +1939,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
                                if(event->type == PADPERIOD && ascii == ',')
                                        ascii = '.';
 
-                       if(event->utf8_buf[0] || 1) {
+                       if(event->utf8_buf[0]) {
                                /* keep this printf until utf8 is well tested */
                                printf("%s: utf8 char '%s'\n", __func__, event->utf8_buf);
                                // strcpy(event->utf8_buf, "12345");
index 7dcb4cf091f84403388c2fdd8200f32dac7dc215..6fd84b4c315bb45e03ac2fabc3aa92bd5db5b121 100644 (file)
@@ -1146,7 +1146,7 @@ static int wm_eventmatch(wmEvent *winevent, wmKeyMapItem *kmi)
 
        /* the matching rules */
        if(kmitype==KM_TEXTINPUT)
-               if(ISTEXTINPUT(winevent->type) && winevent->ascii) return 1;
+               if(ISTEXTINPUT(winevent->type) && (winevent->ascii || winevent->utf8_buf[0])) return 1;
        if(kmitype!=KM_ANY)
                if(winevent->type!=kmitype) return 0;