From 2503eac037f5f17ee1b3ac41b3caf59bceb0a4c9 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 3 Apr 2008 12:44:29 +0000 Subject: [PATCH] Bug 330743 - Up/down spinbuttons won't take zeros and exhibit very strange 2008-04-03 Tor Lillqvist Bug 330743 - Up/down spinbuttons won't take zeros and exhibit very strange behavior * gtk/gtkspinbutton.c (gtk_spin_button_insert_text) [Win32]: Add workaround for a specific kind of screwed up locale setting. svn path=/trunk/; revision=19972 --- ChangeLog | 8 ++++++++ gtk/gtkspinbutton.c | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/ChangeLog b/ChangeLog index aaccb2c6f3..740e83ec57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-04-03 Tor Lillqvist + + Bug 330743 - Up/down spinbuttons won't take zeros and exhibit very + strange behavior + + * gtk/gtkspinbutton.c (gtk_spin_button_insert_text) [Win32]: Add + workaround for a specific kind of screwed up locale setting. + 2008-04-02 Matthias Clasen * gdk/x11/gdkcolor-x11.c: Don't call XFreeColormap on foreign diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 455cb1baa1..8f30b7ad49 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -1453,6 +1453,26 @@ gtk_spin_button_insert_text (GtkEditable *editable, else pos_sign = '+'; +#ifdef G_OS_WIN32 + /* Workaround for bug caused by some Windows application messing + * up the positive sign of the current locale, more specifically + * HKEY_CURRENT_USER\Control Panel\International\sPositiveSign. + * See bug #330743 and for instance + * http://www.msnewsgroups.net/group/microsoft.public.dotnet.languages.csharp/topic36024.aspx + * + * I don't know if the positive sign always gets bogusly set to + * a digit when the above Registry value is corrupted as + * described. (In my test case, it got set to "8", and in the + * bug report above it presumably was set ot "0".) Probably it + * might get set to almost anything? So how to distinguish a + * bogus value from some correct one for some locale? That is + * probably hard, but at least we should filter out the + * digits... + */ + if (pos_sign >= '0' && pos_sign <= '9') + pos_sign = '+'; +#endif + for (sign=0, i=0; itext[i] == neg_sign) || (entry->text[i] == pos_sign))