Bug 799399 - Windows Keypad decimal locale error

On Windows, the keypad decimal isn't a comma in dialogs that use the
GncAmountEdit widget for locales that calls for it.

This appears to be a problem with Gtk so instead do the entry update
in the key press call back instead of trying to change the event and
passing it on.
pull/2017/head
Robert Fewell 2 years ago
parent f2aff99b4c
commit 4314bf1c9f

@ -285,15 +285,40 @@ gnc_amount_edit_key_press (GtkWidget *widget, GdkEventKey *event, gpointer user_
#endif
if (event->keyval == GDK_KEY_KP_Decimal)
{
gchar *decimal;
if (gae->print_info.monetary)
{
struct lconv *lc = gnc_localeconv ();
event->keyval = lc->mon_decimal_point[0];
event->string[0] = lc->mon_decimal_point[0];
decimal = g_strdup_printf ("%c", lc->mon_decimal_point[0]);
}
}
else
decimal = g_strdup_printf ("%c",'.');
GtkEditable *editable = GTK_EDITABLE(widget);
gint start_pos, end_pos;
gint position = gtk_editable_get_position (editable);
if (gtk_editable_get_selection_bounds (editable,
&start_pos, &end_pos))
{
position = start_pos;
result = (* GTK_WIDGET_GET_CLASS(widget)->key_press_event)(widget, event);
gtk_editable_delete_selection (editable);
gtk_editable_insert_text (editable,
decimal, -1, &position);
}
else
gtk_editable_insert_text (editable,
decimal, -1, &position);
gtk_editable_set_position (editable, position);
g_free (decimal);
result = TRUE;
}
else
result = (* GTK_WIDGET_GET_CLASS(widget)->key_press_event)(widget, event);
switch (event->keyval)
{

Loading…
Cancel
Save