Bug 594668 - Add new Xorg keysyms

Add support for XF86keysym.h to gdkkeysyms-update.pl and
update the generated gdkkeysyms.h file for the latest sources.
This commit is contained in:
Bastien Nocera 2009-09-09 18:01:43 +01:00
parent 3dd459caea
commit 11898088a1
3 changed files with 891 additions and 643 deletions

View File

@ -15,6 +15,11 @@ header file. <filename>&lt;gdk/gdkkeysyms.h&gt;</filename> is not included in <f
it must be included independently, because the file is quite large. it must be included independently, because the file is quite large.
</para> </para>
<para> <para>
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_.
</para>
<para>
Key values can be converted into a string representation using Key values can be converted into a string representation using
gdk_keyval_name(). The reverse function, converting a string to a key value, gdk_keyval_name(). The reverse function, converting a string to a key value,
is provided by gdk_keyval_from_name(). is provided by gdk_keyval_from_name().

View File

@ -1,13 +1,15 @@
#!/usr/bin/env perl #!/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 # from http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h
# #
# Author : Simos Xenitellis <simos at gnome dot org>. # Author : Simos Xenitellis <simos at gnome dot org>.
# Authos : Bastien Nocera <hadess@hadess.net>
# Version : 1.2 # Version : 1.2
# #
# Input : http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h # 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 : It downloads keysymdef.h from the Internet, if not found locally,
# Notes : and creates an updated gdkkeysyms.h # 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"; 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" ) if ( -f "gdkkeysyms.h" )
{ {
@ -41,7 +57,7 @@ if ( -f "gdkkeysyms.h" )
die "Exiting...\n\n"; 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"); die "Could not open file keysymdef.h: $!\n" unless open(IN_KEYSYMDEF, "<:utf8", "keysymdef.h");
# Output: gtk+/gdk/gdkkeysyms.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<<EOF; print OUT_GDKKEYSYMS<<EOF;
/* GDK - The GIMP Drawing Kit /* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
* Copyright (C) 2005, 2006, 2007 GNOME Foundation * Copyright (C) 2005, 2006, 2007, 2009 GNOME Foundation
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -69,9 +85,11 @@ print OUT_GDKKEYSYMS<<EOF;
*/ */
/* /*
* File auto-generated from script http://svn.gnome.org/viewcvs/gtk%2B/trunk/gdk/gdkkeysyms-update.pl * File auto-generated from script http://git.gnome.org/cgit/gtk+/tree/gdk/gdkkeysyms-update.pl
* using the input file * using the input file
* http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h * http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h
* and
* http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=XF86keysym.h
*/ */
/* /*
@ -106,9 +124,40 @@ while (<IN_KEYSYMDEF>)
printf OUT_GDKKEYSYMS "#define %s 0x%03x\n", $keysymelements[1], hex($keysymelements[2]); printf OUT_GDKKEYSYMS "#define %s 0x%03x\n", $keysymelements[1], hex($keysymelements[2]);
} }
close IN_KEYSYMDEF;
#$gdksyms{"0"} = "0000"; #$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 (<IN_XF86KEYSYM>)
{
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<<EOF; print OUT_GDKKEYSYMS<<EOF;

File diff suppressed because it is too large Load Diff