/[rdesktop]/sourceforge.net/trunk/rdesktop/keymaps/convert-map
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /sourceforge.net/trunk/rdesktop/keymaps/convert-map

Parent Directory Parent Directory | Revision Log Revision Log


Revision 66 - (hide annotations)
Thu Jul 18 18:28:12 2002 UTC (21 years, 11 months ago) by astrand
File size: 1811 byte(s)
Merged new keysym-based keyboard handling (from alt. CVS repos)

1 astrand 66 #!/usr/bin/env python2
2     # -*-Python-*-
3     #
4     #
5     # Copyright (C) 2001 Peter Åstrand <peter@cendio.se>
6     #
7     # This program is free software; you can redistribute it and/or modify
8     # it under the terms of the GNU General Public License as published by
9     # the Free Software Foundation; version 2 of the License.
10     #
11     # This program is distributed in the hope that it will be useful,
12     # but WITHOUT ANY WARRANTY; without even the implied warranty of
13     # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     # GNU General Public License for more details.
15     #
16     # You should have received a copy of the GNU General Public License
17     # along with this program; if not, write to the Free Software
18     # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19    
20     import sys
21    
22     def main():
23     f = open(sys.argv[1])
24     while 1:
25     line = f.readline()
26     if not line: break
27    
28     if line.startswith("#") or line.startswith("include"):
29     print line,
30     continue
31    
32     fields = line.split()
33    
34     if line.startswith("map"):
35     print "map 0x%s" % fields[1]
36     continue
37    
38     scancode = fields[0]
39     for pos in range(1, len(fields)):
40     keysym = fields[pos]
41    
42     if pos == 1:
43     modifiers = ""
44     elif pos == 2:
45     modifiers = "shift"
46     elif pos == 3:
47     modifiers = "altgr"
48     elif pos == 4:
49     modifiers = "shift altgr"
50     else:
51     raise("Invalid line: %s" % line)
52    
53     print "%s 0x%s %s" % (keysym, scancode, modifiers)
54    
55    
56    
57     if __name__ == "__main__":
58     if len(sys.argv) < 2:
59     print "Convert old-style keymaps to new style"
60     print "Usage: %s <old-style-keymap>" % sys.argv[0]
61     sys.exit(1)
62     else:
63     main()

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26