3 # Updates http://git.gnome.org/cgit/gtk+/tree/gdk/gdkkeysyms.h from upstream (X.org 7.x),
4 # from http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h
6 # Author : Simos Xenitellis <simos at gnome dot org>.
7 # Authos : Bastien Nocera <hadess@hadess.net>
10 # Input : http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h
11 # Input : http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=XF86keysym.h
12 # Output : http://git.gnome.org/cgit/gtk+/tree/gdk/gdkkeysyms.h
14 # Notes : It downloads keysymdef.h from the Internet, if not found locally,
15 # Notes : and creates an updated gdkkeysyms.h
16 # Notes : This version updates the source of gdkkeysyms.h from CVS to the GIT server.
20 # Used for reading the keysymdef symbols.
23 if ( ! -f "keysymdef.h" )
25 print "Trying to download keysymdef.h from\n";
26 print "http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h\n";
27 die "Unable to download keysymdef.h from http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h\n"
28 unless system("wget -c -O keysymdef.h \"http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h\"") == 0;
33 print "We are using existing keysymdef.h found in this directory.\n";
34 print "It is assumed that you took care and it is a recent version\n";
35 print "as found at http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob;f=keysymdef.h\n\n";
38 if ( ! -f "XF86keysym.h" )
40 print "Trying to download XF86keysym.h from\n";
41 print "http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=XF86keysym.h\n";
42 die "Unable to download keysymdef.h from http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=XF86keysym.h\n"
43 unless system("wget -c -O XF86keysym.h \"http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=XF86keysym.h\"") == 0;
48 print "We are using existing XF86keysym.h found in this directory.\n";
49 print "It is assumed that you took care and it is a recent version\n";
50 print "as found at http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob;f=XF86keysym.h\n\n";
53 if ( -f "gdkkeysyms.h" )
55 print "There is already a gdkkeysyms.h file in this directory. We are not overwriting it.\n";
56 print "Please move it somewhere else in order to run this script.\n";
60 # Source: http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob;f=keysymdef.h
61 die "Could not open file keysymdef.h: $!\n" unless open(IN_KEYSYMDEF, "<:utf8", "keysymdef.h");
63 # Output: gtk+/gdk/gdkkeysyms.h
64 die "Could not open file gdkkeysyms.h: $!\n" unless open(OUT_GDKKEYSYMS, ">:utf8", "gdkkeysyms.h");
66 print OUT_GDKKEYSYMS<<EOF;
67 /* GDK - The GIMP Drawing Kit
68 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
69 * Copyright (C) 2005, 2006, 2007, 2009 GNOME Foundation
71 * This library is free software; you can redistribute it and/or
72 * modify it under the terms of the GNU Lesser General Public
73 * License as published by the Free Software Foundation; either
74 * version 2 of the License, or (at your option) any later version.
76 * This library is distributed in the hope that it will be useful,
77 * but WITHOUT ANY WARRANTY; without even the implied warranty of
78 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
79 * Lesser General Public License for more details.
81 * You should have received a copy of the GNU Lesser General Public
82 * License along with this library; if not, write to the
83 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
84 * Boston, MA 02111-1307, USA.
88 * File auto-generated from script http://git.gnome.org/cgit/gtk+/tree/gdk/gdkkeysyms-update.pl
89 * using the input file
90 * http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=keysymdef.h
92 * http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob_plain;f=XF86keysym.h
96 * Modified by the GTK+ Team and others 1997-2007. See the AUTHORS
97 * file for a list of people on the GTK+ Team. See the ChangeLog
98 * files for a list of changes. These files are distributed with
99 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
102 #ifndef __GDK_KEYSYMS_H__
103 #define __GDK_KEYSYMS_H__
109 while (<IN_KEYSYMDEF>)
111 next if ( ! /^#define / );
113 @keysymelements = split(/\s+/);
114 die "Internal error, no \@keysymelements: $_\n" unless @keysymelements;
116 $_ = $keysymelements[1];
117 die "Internal error, was expecting \"XC_*\", found: $_\n" if ( ! /^XK_/ );
119 $_ = $keysymelements[2];
120 die "Internal error, was expecting \"0x*\", found: $_\n" if ( ! /^0x/ );
122 $keysymelements[1] =~ s/^XK_/GDK_/g;
124 printf OUT_GDKKEYSYMS "#define %s 0x%03x\n", $keysymelements[1], hex($keysymelements[2]);
129 #$gdksyms{"0"} = "0000";
131 # Source: http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob;f=XF86keysym.h
132 die "Could not open file XF86keysym.h: $!\n" unless open(IN_XF86KEYSYM, "<:utf8", "XF86keysym.h");
134 while (<IN_XF86KEYSYM>)
136 next if ( ! /^#define / );
138 @keysymelements = split(/\s+/);
139 die "Internal error, no \@keysymelements: $_\n" unless @keysymelements;
141 $_ = $keysymelements[1];
142 die "Internal error, was expecting \"XF86XK_*\", found: $_\n" if ( ! /^XF86XK_/ );
144 # Work-around https://bugs.freedesktop.org/show_bug.cgi?id=11193
145 if ($_ eq "XF86XK_XF86BackForward") {
146 $keysymelements[1] = "XF86XK_AudioForward";
148 # XF86XK_Clear could end up a dupe of XK_Clear
149 # XF86XK_Select could end up a dupe of XK_Select
150 if ($_ eq "XF86XK_Clear") {
151 $keysymelements[1] = "XF86XK_WindowClear";
153 if ($_ eq "XF86XK_Select") {
154 $keysymelements[1] = "XF86XK_SelectButton";
158 next if ( $_ eq "XF86XK_Q");
159 # XF86XK_Calculater is misspelled, and a dupe
160 next if ( $_ eq "XF86XK_Calculater");
162 $_ = $keysymelements[2];
163 die "Internal error, was expecting \"0x*\", found: $_\n" if ( ! /^0x/ );
165 $keysymelements[1] =~ s/^XF86XK_/GDK_/g;
167 printf OUT_GDKKEYSYMS "#define %s 0x%03x\n", $keysymelements[1], hex($keysymelements[2]);
173 print OUT_GDKKEYSYMS<<EOF;
175 #endif /* __GDK_KEYSYMS_H__ */
178 printf "We just finished converting keysymdef.h to gdkkeysyms.h\nThank you\n";