Make the translation of GDK_KP_Decimal dependent on LC_NUMERIC. (#101225)

Wed Jan 29 17:02:41 2003  Owen Taylor  <otaylor@redhat.com>

        * gdk/gdkkeyuni.c (get_decimal_char): Make the
        translation of GDK_KP_Decimal dependent on LC_NUMERIC.
        (#101225)
This commit is contained in:
Owen Taylor 2003-01-29 22:24:36 +00:00 committed by Owen Taylor
parent f9a399961e
commit 68eabf07e0
6 changed files with 57 additions and 0 deletions

View File

@ -1,3 +1,9 @@
Wed Jan 29 17:02:41 2003 Owen Taylor <otaylor@redhat.com>
* gdk/gdkkeyuni.c (get_decimal_char): Make the
translation of GDK_KP_Decimal dependent on LC_NUMERIC.
(#101225)
Wed Jan 29 15:43:56 2003 Owen Taylor <otaylor@redhat.com> Wed Jan 29 15:43:56 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current): * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):

View File

@ -1,3 +1,9 @@
Wed Jan 29 17:02:41 2003 Owen Taylor <otaylor@redhat.com>
* gdk/gdkkeyuni.c (get_decimal_char): Make the
translation of GDK_KP_Decimal dependent on LC_NUMERIC.
(#101225)
Wed Jan 29 15:43:56 2003 Owen Taylor <otaylor@redhat.com> Wed Jan 29 15:43:56 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current): * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):

View File

@ -1,3 +1,9 @@
Wed Jan 29 17:02:41 2003 Owen Taylor <otaylor@redhat.com>
* gdk/gdkkeyuni.c (get_decimal_char): Make the
translation of GDK_KP_Decimal dependent on LC_NUMERIC.
(#101225)
Wed Jan 29 15:43:56 2003 Owen Taylor <otaylor@redhat.com> Wed Jan 29 15:43:56 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current): * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):

View File

@ -1,3 +1,9 @@
Wed Jan 29 17:02:41 2003 Owen Taylor <otaylor@redhat.com>
* gdk/gdkkeyuni.c (get_decimal_char): Make the
translation of GDK_KP_Decimal dependent on LC_NUMERIC.
(#101225)
Wed Jan 29 15:43:56 2003 Owen Taylor <otaylor@redhat.com> Wed Jan 29 15:43:56 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current): * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):

View File

@ -1,3 +1,9 @@
Wed Jan 29 17:02:41 2003 Owen Taylor <otaylor@redhat.com>
* gdk/gdkkeyuni.c (get_decimal_char): Make the
translation of GDK_KP_Decimal dependent on LC_NUMERIC.
(#101225)
Wed Jan 29 15:43:56 2003 Owen Taylor <otaylor@redhat.com> Wed Jan 29 15:43:56 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current): * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):

View File

@ -1,4 +1,7 @@
#include <locale.h>
#include "gdk.h" #include "gdk.h"
#include "gdkkeysyms.h"
/* Thanks to Markus G. Kuhn <mkuhn@acm.org> for the ksysym<->Unicode /* Thanks to Markus G. Kuhn <mkuhn@acm.org> for the ksysym<->Unicode
* mapping functions, from the xterm sources. * mapping functions, from the xterm sources.
@ -823,6 +826,25 @@ static struct {
/* End numeric keypad */ /* End numeric keypad */
}; };
static gunichar
get_decimal_char (void)
{
struct lconv *locale_data;
gunichar result = '.';
gchar *utf8;
locale_data = localeconv ();
utf8 = g_locale_to_utf8 (locale_data->decimal_point, -1, NULL, NULL, NULL);
if (utf8)
{
if (g_utf8_strlen (utf8, -1) == 1)
result = g_utf8_get_char (utf8);
g_free (utf8);
}
return result;
}
/** /**
* gdk_keyval_to_unicode: * gdk_keyval_to_unicode:
* @keyval: a GDK key symbol * @keyval: a GDK key symbol
@ -850,6 +872,11 @@ gdk_keyval_to_unicode (guint keyval)
if ((keyval & 0xff000000) == 0x01000000) if ((keyval & 0xff000000) == 0x01000000)
return keyval & 0x00ffffff; return keyval & 0x00ffffff;
/* Translation of KP_Decimal depends on locale.
*/
if (keyval == GDK_KP_Decimal)
return get_decimal_char ();
/* binary search in table */ /* binary search in table */
while (max >= min) { while (max >= min) {
mid = (min + max) / 2; mid = (min + max) / 2;