gtk+ r19973 - in branches/gtk-2-12: . gtk



Author: tml
Date: Thu Apr  3 13:45:42 2008
New Revision: 19973
URL: http://svn.gnome.org/viewvc/gtk+?rev=19973&view=rev

Log:
2008-04-03  Tor Lillqvist  <tml novell com>

	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.



Modified:
   branches/gtk-2-12/ChangeLog
   branches/gtk-2-12/gtk/gtkspinbutton.c

Modified: branches/gtk-2-12/gtk/gtkspinbutton.c
==============================================================================
--- branches/gtk-2-12/gtk/gtkspinbutton.c	(original)
+++ branches/gtk-2-12/gtk/gtkspinbutton.c	Thu Apr  3 13:45:42 2008
@@ -1424,6 +1424,26 @@
       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; i<entry_length; i++)
 	if ((entry->text[i] == neg_sign) ||
 	    (entry->text[i] == pos_sign))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]