forked from bartvdbraak/blender
fixes for unicode input, should work for operator textinput now.
This commit is contained in:
parent
3d501ca70f
commit
2f92b5bc3f
@ -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) ||
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user