From 11898088a1ac30eff17e7f24dd906aba476ae384 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Wed, 9 Sep 2009 18:01:43 +0100 Subject: [PATCH] =?UTF-8?q?Bug=C2=A0594668=20-=20Add=20new=20Xorg=20keysym?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for XF86keysym.h to gdkkeysyms-update.pl and update the generated gdkkeysyms.h file for the latest sources. --- docs/reference/gdk/tmpl/keys.sgml | 5 + gdk/gdkkeysyms-update.pl | 61 +- gdk/gdkkeysyms.h | 1468 ++++++++++++++++------------- 3 files changed, 891 insertions(+), 643 deletions(-) diff --git a/docs/reference/gdk/tmpl/keys.sgml b/docs/reference/gdk/tmpl/keys.sgml index b8ade0ccbe..bea4930c7c 100644 --- a/docs/reference/gdk/tmpl/keys.sgml +++ b/docs/reference/gdk/tmpl/keys.sgml @@ -15,6 +15,11 @@ header file. <gdk/gdkkeysyms.h> is not included in +Key values are regularly updated from the upstream X.org X11 implementation, +so new values are added regularly. They will be prefixed with GDK_ rather than +XF86XK_. + + Key values can be converted into a string representation using gdk_keyval_name(). The reverse function, converting a string to a key value, is provided by gdk_keyval_from_name(). diff --git a/gdk/gdkkeysyms-update.pl b/gdk/gdkkeysyms-update.pl index 4f59fd2b79..62d05daffd 100755 --- a/gdk/gdkkeysyms-update.pl +++ b/gdk/gdkkeysyms-update.pl @@ -1,13 +1,15 @@ #!/usr/bin/env perl -# Updates http://svn.gnome.org/viewcvs/gtk%2B/trunk/gdk/gdkkeysyms.h?view=log from upstream (X.org 7.x), +# Updates http://git.gnome.org/cgit/gtk+/tree/gdk/gdkkeysyms.h from upstream (X.org 7.x), # from http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h # # Author : Simos Xenitellis . +# Authos : Bastien Nocera # Version : 1.2 # # Input : http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h -# Output : http://svn.gnome.org/svn/gtk+/trunk/gdk/gdkkeysyms.h +# Input : http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=XF86keysym.h +# Output : http://git.gnome.org/cgit/gtk+/tree/gdk/gdkkeysyms.h # # Notes : It downloads keysymdef.h from the Internet, if not found locally, # Notes : and creates an updated gdkkeysyms.h @@ -33,6 +35,20 @@ else print "as found at http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob;f=keysymdef.h\n\n"; } +if ( ! -f "XF86keysym.h" ) +{ + print "Trying to download XF86keysym.h from\n"; + print "http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=XF86keysym.h\n"; + die "Unable to download keysymdef.h from http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=XF86keysym.h\n" + unless system("wget -c -O XF86keysym.h \"http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=XF86keysym.h\"") == 0; + print " done.\n\n"; +} +else +{ + print "We are using existing XF86keysym.h found in this directory.\n"; + print "It is assumed that you took care and it is a recent version\n"; + print "as found at http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob;f=XF86keysym.h\n\n"; +} if ( -f "gdkkeysyms.h" ) { @@ -41,7 +57,7 @@ if ( -f "gdkkeysyms.h" ) die "Exiting...\n\n"; } -# Source: http://cvs.freedesktop.org/xorg/xc/include/keysymdef.h +# Source: http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob;f=keysymdef.h die "Could not open file keysymdef.h: $!\n" unless open(IN_KEYSYMDEF, "<:utf8", "keysymdef.h"); # Output: gtk+/gdk/gdkkeysyms.h @@ -50,7 +66,7 @@ die "Could not open file gdkkeysyms.h: $!\n" unless open(OUT_GDKKEYSYMS, ">:utf8 print OUT_GDKKEYSYMS<) printf OUT_GDKKEYSYMS "#define %s 0x%03x\n", $keysymelements[1], hex($keysymelements[2]); } +close IN_KEYSYMDEF; + #$gdksyms{"0"} = "0000"; -close IN_KEYSYMDEF; +# Source: http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob;f=XF86keysym.h +die "Could not open file XF86keysym.h: $!\n" unless open(IN_XF86KEYSYM, "<:utf8", "XF86keysym.h"); + +while () +{ + next if ( ! /^#define / ); + + @keysymelements = split(/\s+/); + die "Internal error, no \@keysymelements: $_\n" unless @keysymelements; + + $_ = $keysymelements[1]; + die "Internal error, was expecting \"XF86XK_*\", found: $_\n" if ( ! /^XF86XK_/ ); + + # Work-around https://bugs.freedesktop.org/show_bug.cgi?id=11193 + if ($_ eq "XF86XK_XF86BackForward") { + $keysymelements[1] = "XF86XK_AudioForward"; + } + + # Ignore XF86XK_Q + next if ( $_ eq "XF86XK_Q"); + + $_ = $keysymelements[2]; + die "Internal error, was expecting \"0x*\", found: $_\n" if ( ! /^0x/ ); + + $keysymelements[1] =~ s/^XF86XK_/GDK_/g; + + printf OUT_GDKKEYSYMS "#define %s 0x%03x\n", $keysymelements[1], hex($keysymelements[2]); +} + +close IN_XF86KEYSYM; print OUT_GDKKEYSYMS<