GNOME Bugzilla – Bug 652362
gcalctool needs to interpret comma (",") as a decimal dot (".")
Last modified: 2014-06-08 20:10:34 UTC
When using the Swedish (among others) keyboard layout, the numerical keyboard sends comma (",") as decimal dot ("."). Gcalctool does not accept the comma as a decimal dot and you need to type the dot from the main keyboard. Suggestion: Translate comma into a dot, while typing.
Created attachment 204032 [details] [review] Convert commas and dots (periods) into decimal separator regardless the locale
If I understood well, the problem comes out from the fact that your keypad sends a 'dot' that in your locale is the thousand separator instead than sending the decimal separator. I've done some trials, and it seems that: - the parser recognizes both commas and dots as decimal separator. For example, using the Italian locale, it works both by inserting a comma and a dot as dec sep (also if the standard decimal separator here is comma, the thousand separator is a space) - but when the comma\dot\whatever is used in the locale settings as the thousands separator (e.g the dot in German and Spanish locale, or the comma in English), when inserting it it is thrown somewhere a GTK-warning "Invalid text buffer iterator" and nothing is inserted. - usually, keypads send a "KP_Decimal" keycode that the code parses as the standard decimal separator of your locale (or at least my keyboard does so) So, I tried to patch oddly the code to treat dots and commas as decimal separator REGARDLESS THE LOCALE, and converting into the standard dec sep. I don't know if this could have odd side effects somewhere in the code and\or make confusion in some locales with thousands separator (here in Italy we are used to see both comma and dot as decimal separator, I don't know in other countries...)
I looked at the patch and from that I can say that you understood me perfectly. Good!
*** Bug 666830 has been marked as a duplicate of this bug. ***
> Suggestion: Translate comma into a dot, while typing. Sounds very error prone for those using it as a thousands separator.
(In reply to comment #5) > > Suggestion: Translate comma into a dot, while typing. > > Sounds very error prone for those using it as a thousands separator. It is easier to avoid comma when you don't need it, than a dot.
Any progress on this? The input really should follow keyboard layout rather than locale, as the current model makes the numpad almost useless. I don't know how gtk does it, but X11 sends XK_KP_Separator rather than XK_KP_Decimal on these layouts. So the comment "/* Numeric keypad will often insert '.' regardless of locale */" is most likely incorrect.
Created attachment 243932 [details] [review] Recognize keypad decimal key This small patch makes sure that the keypad decimal key works no matter the layout. If you could so kindly apply. =)
Hello, Any progress?
(In reply to comment #8) > Created an attachment (id=243932) [details] [review] > Recognize keypad decimal key > > This small patch makes sure that the keypad decimal key works no matter the > layout. If you could so kindly apply. =) Arth, what do you think? I don't have a number pad so I can't test this, but it looks like the patch causes Calculator to insert the correct localized decimal character when hitting the number pad decimal key, which I think should prevent confusion.
Michael, Neither do I have a full keyboard with me right now. Agreeing to the fact that it should work. Applying the fix. Marking as resolved. Re-open the bug, if the patch doesn't work.