~ubuntu-branches/ubuntu/precise/virtualbox/precise-updates

« back to all changes in this revision

Viewing changes to src/VBox/RDP/client/keymaps/convert-map

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-07-04 13:02:31 UTC
  • mfrom: (3.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20110704130231-l843es6wqhx614n7
Tags: 4.0.10-dfsg-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add Apport hook.
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Drop *-source packages.
* Add the Modaliases control field manually for maximum backportability.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python2
2
 
# -*-Python-*-
3
 
#
4
 
5
 
# Copyright (C) 2001  Peter Åstrand <astrand@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()