--- gdk/gdkkeysyms-update.pl.ORIGINAL	2009-01-11 15:19:39.000000000 +0000
+++ gdk/gdkkeysyms-update.pl	2009-01-11 15:19:56.000000000 +0000
@@ -16,7 +16,11 @@
 use strict;
 
 # Used for reading the keysymdef symbols.
+my %keysyms;
 my @keysymelements;
+my $value;
+my %registry;
+my $val;
 
 if ( ! -f "keysymdef.h" )
 {
@@ -84,7 +88,6 @@
 #ifndef __GDK_KEYSYMS_H__
 #define __GDK_KEYSYMS_H__
 
-
 EOF
 
 
@@ -103,9 +106,35 @@
 
 	$keysymelements[1] =~ s/^XK_/GDK_/g;
 
-	printf OUT_GDKKEYSYMS "#define %s 0x%03x\n", $keysymelements[1], hex($keysymelements[2]);
+	$value = hex($keysymelements[2]);
+	#if ($value >= 0x1000000)
+	#{
+	#	$value = $value - 0x1000000;
+	#}
+	if (exists($keysyms{$keysymelements[1]}))
+	{
+		print "ERROR: Got DUP for keysym $keysymelements[1]: values $value and $keysyms{$keysymelements[1]}\n";
+	}
+	@keysyms{$keysymelements[1]} = $value;
+
+	if (exists($registry{$value}))
+	{
+		print "Got possible DUP for $value: $keysymelements[1] and $registry{$value}\n";
+	}
+	@registry{$value} = $keysymelements[1];
+
+	$val = sprintf("0x%04X", $keysyms{$keysymelements[1]});
+	printf OUT_GDKKEYSYMS "#define %-32s %9s\n", $keysymelements[1], $val;
 }
 
+# my @sorted = sort { $keysyms{$a} cmp $keysyms{$b} } keys %keysyms;
+#
+#foreach my $i (keys %keysyms)
+#{
+#	$val = sprintf("0x%04X", $keysyms{$i});	
+#	printf OUT_GDKKEYSYMS "#define %-32s %9s\n", $i, $val;
+#}
+#
 #$gdksyms{"0"} = "0000";
 
 close IN_KEYSYMDEF;
