Fix #27850: keyboards with a comma instead of a dot on the numpad now get
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 4 Jul 2011 10:56:59 +0000 (10:56 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 4 Jul 2011 10:56:59 +0000 (10:56 +0000)
converted to a dot when typing into number buttons, for easier number entry.

source/blender/editors/interface/interface_handlers.c

index 99a31e0..e9ec4cc 100644 (file)
@@ -1895,7 +1895,15 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
                }
 
                if(event->ascii && (retval == WM_UI_HANDLER_CONTINUE)) {
-                       changed= ui_textedit_type_ascii(but, data, event->ascii);
+                       char ascii = event->ascii;
+
+                       /* exception that's useful for number buttons, some keyboard
+                          numpads have a comma instead of a period */
+                       if(ELEM3(but->type, NUM, NUMABS, NUMSLI))
+                               if(event->type == PADPERIOD && ascii == ',')
+                                       ascii = '.';
+
+                       changed= ui_textedit_type_ascii(but, data, ascii);
                        retval= WM_UI_HANDLER_BREAK;
                        
                }