~eugenenuke/ubuntu/wily/console-setup/fix-for-1565542

« back to all changes in this revision

Viewing changes to Keyboard/kbdcompiler

  • Committer: Bazaar Package Importer
  • Author(s): Anton Zinoviev, Anton Zinoviev, Samuel Thibault
  • Date: 2011-03-21 07:08:43 UTC
  • mto: This revision was merged to the branch mainline in revision 125.
  • Revision ID: james.westby@ubuntu.com-20110321070843-dyzebcgrrm3dnvfx
Tags: 1.71
[ Anton Zinoviev ]
* FAQ: correct some typos and apply two patches by Jonathan Nieder.
  Thanks also to Vincent Lefevre.  Closes: #565391 (with apologies for
  the delay).
* New manual pages keyboard(5) and console-setup(5).  Updated ckbcomp(1)
  and setupcon(1). Remove README.fonts.  Common documentation directory
  for keyboard-configuration, console-setup-linux,
  console-setup-freebsd, console-setup and console-setup-mini.  New
  README.Debian.  Thanks to Jorgen Grahn, closes: #617580.
* Remove most of the comments in the default configuration files.  It is
  difficult to update these comments when the functionality of
  console-setup changes and the new manual pages make these comments
  less necessary.
* Remove the VERBOSE_OUTPUT option from the default configuration file
  (but it is still supported).
* Install *.bug-control files for reportbug.
* Ask the keyboard option question even when Debconf doesn't support the
  layout.  Thanks to Petr Baudis and Julien Cristau, closes: #581758.
* ckbcomp_mini: process properly empty layout and/or variant options.
  Thanks to Baptiste Carvello who reported the problem and traced its
  source.  Closes: #617499.
* ckbcomp: ignore actions[...] = ... specifications in key definitions.
  Thanks to Klaus Ethgen, closes: #607532.
* setupcon: accept all methods to state font size in the configuration
  file (8x14, 14x8, 14).
* Debconf: More human-friendly options for the font size question.  By
  default use 8x14 format for all sizes.
* setupcon: Improved test whether we are on the console.  Thanks to
  Michael Schutte and Julien Cristau for the suggestions.
* console-setup(-mini).postinst: add again commands to configure the
  console.
* ckbcomp: improved implementation for Alt+PrintScreen=SysRq and
  Ctrl+Pause=Break on AT keyboards.
* ckbcomp: more correct use of approximate().  This probably affects
  only some exotic key combination such as Ctrl+Alt+Shift+AltGr+F1.
* ckbcomp: lets try to remove some unnecessary and potentialy harmful on
  non-standard layouts mappings for Linux (Ctrl+'=^G, Ctrl+3=^[,
  Ctrl+4=^\, Ctrl+5=^], Ctrl+7=^_, Ctrl+8=^?).
* Do not source /etc/default/keyboard in /etc/default/console-setup
  (on new installs or upgrades from pre 1.47 versions).
* setupcon: do not cache automatically the keymap.  Instead add --save
  option the init script.
* Do not remove /etc/console-setup in postrm.
* setupcon, config, postinst: recognise 'guess' value in the
  configuration file.
* postinst: do not fail if setupcon fails.
* Include Terminus font in the compiled packages.  Do not depend, but
  conflict and provide console-terminus.  New upstream version of the
  Terminus font (4.32).
* Keyboard/ckb: update with keyboard data of version 2.1 of xkb files.
  (This change is not relevant for Debian.)
* New install targets in the Makefiles and debian/rules to better
  support non-Debian installs.
* Support for FreeBSD.  Packages for Debian GNU/kFreeBSD:
  - bdf2psf: new option --raw to generate raw fonts.  Try to use CP437
    code positions if possible.  When generating raw fonts with same
    codeset, use identical font map.
  - ckbcomp and setupcon: support for FreeBSD keymaps.
  - ckbcomp: new option -backspace [ del | bs ] to determine the
    behaviour of the keys BackSpace and Delete.
  - setupcon, postinst: A corresponding variable BACKSPACE in
    /etc/default/keyboard.
  - Termcap and Terminfo entries for FreeBSD.
  - setupcon: When UTF-8 is requested on FreeBSD, act as if the encoding
    is ISO-8859-1.
  - Debconf: Don't ask the question about font size on kFreeBSD (no need
    for this -- all available sizes will be loaded).
  - New configuration variable VIDEOMODE.  Currently it is most useful
    on FreeBSD because the default Linux framebuffer driver (VesaFB)
    doesn't permit changes of the videomode.
  - Support for 8-bit encodings in console-setup-mini and in the udebs
  - Udebs for kFreeBSD.

[ Samuel Thibault ]
* Fonts/bdf2psf: Fix typo.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
use File::Temp ();
7
7
 
 
8
 
8
9
BEGIN {
9
10
    my $file;
10
11
    if ($ARGV[1]) {
15
16
    do "$file";
16
17
}
17
18
 
 
19
my $freebsd = '';
18
20
my $model = $ARGV[0];
19
 
my $dir = 'keymaps';
 
21
if ($model =~ s/^freebsd-//) {
 
22
    $freebsd = '-freebsd -backspace del';
 
23
}
 
24
my $dir = $freebsd ? 'freebsd-keymaps' : 'linux-keymaps';
20
25
 
21
26
my $xkbdir;
22
27
if ($ARGV[2]) {
56
61
sub read_temp_kmap {
57
62
    my $name = $_[0];
58
63
    open (KMAP, "$dir/$model-$name") or die  "$0: $dir/$model-$name: $!\n"; 
59
 
    while (<KMAP>) {
60
 
        if (/^keycode ([0-9]+) =.*/) {
61
 
            $keymaps{$name}[$1] = $_;
62
 
        }
 
64
    if ($freebsd) {
 
65
        while (<KMAP>) {
 
66
            if (/^ *([0-9]+) .*/) {
 
67
                $keymaps{$name}[$1] = $_;
 
68
            }
 
69
        }
 
70
    } else {
 
71
        while (<KMAP>) {
 
72
            if (/^keycode ([0-9]+) =.*/) {
 
73
                $keymaps{$name}[$1] = $_;
 
74
            }
 
75
        }
63
76
    }
64
77
    close KMAP;
65
78
}
75
88
                         : (($layout eq 'lt') ? 'lt,lt'
76
89
                            : (($nonlatin =~ / $layout /)
77
90
                               ? "us,$layout" : $layout)));
78
 
    if (! -f "$dir/$model-$layout") {
79
 
        if ($layout eq 'cs') {
80
 
            execute ("./ckbcomp -compact -I. -I${xkbdir} -rules xorg"
81
 
                     ." -model $model"
82
 
                     ." -layout $actual_layout -variant latin,"
83
 
                     ." >$dir/$model-$layout.new");
84
 
        } elsif ($layout eq 'lt') {
85
 
            execute ("./ckbcomp -compact -I. -I${xkbdir} -rules xorg"
86
 
                     ." -model $model"
87
 
                     ." -layout $actual_layout -variant ,us"
88
 
                     ." >$dir/$model-$layout.new");
89
 
        } else {
90
 
            execute ("./ckbcomp -compact -I. -I${xkbdir} -rules xorg"
91
 
                     ." -model $model -layout $actual_layout"
92
 
                     ." >$dir/$model-$layout.new");
93
 
        }
94
 
        die "$0: ckbcomp failed\n" if (! -f "$dir/$model-$layout.new");
95
 
        checkrename "$dir/$model-$layout.new", "$dir/$model-$layout";
96
 
    }
97
 
    if (-f "$dir/$model-$layout") {
98
 
        read_temp_kmap $layout;
99
 
    }
100
 
    for my $variant (values %{$KeyboardNames::variants{$layout}}) {
 
91
    for my $variant ('', values %{$KeyboardNames::variants{$layout}}) {
101
92
        my $actual_variant;
102
93
        if ($actual_layout eq 'cs,cs') {
103
94
            if ($variant =~ /latin/) {
120
111
        } else {
121
112
            $actual_variant = $variant;
122
113
        }
 
114
        $actual_variant = "'$actual_variant'";
123
115
        if (! -f "$dir/$model-$layout:$variant") {
124
 
            execute ("./ckbcomp -compact -I. -I${xkbdir} -rules xorg"
 
116
            execute ("./ckbcomp $freebsd -compact -I. -I${xkbdir} -rules xorg"
125
117
                     ." -model $model"
126
118
                     ." -layout $actual_layout -variant $actual_variant"
127
119
                     ." >$dir/$model-$layout:$variant.new")
146
138
        } elsif (defined $kmap2->[$k]) {
147
139
            # kmap1 not a superset of kmap2, so not eligible for reduction
148
140
            return 10000000;
 
141
 
 
142
            # I don't think it will be a problem if one additional key
 
143
            # is defined in kmap1, a key that would be otherwise
 
144
            # undefined.  However, the size reduction when this code is
 
145
            # removed, is not that big: 127Kb -> 117Kb. (Anton Zinoviev)
149
146
        }
150
147
    }
151
148
    return $result;
177
174
    my $mink1 = '';
178
175
    my $mink2 = '';
179
176
    my $minsub = 10000000;
180
 
    for $k1 (keys %kmaps, '') {
 
177
    for $k1 (keys %kmaps) {
181
178
        for $k2 (keys %kmaps) {
182
179
            next if ($k1 eq $k2);
183
 
            if ($k1 eq '') {
184
 
                if ($mink1 eq '') {
185
 
                    $mink1 = $k2;
186
 
                }
187
 
            } elsif ($matrice{$k1}{$k2} < $minsub) {
 
180
            if ($matrice{$k1}{$k2} < $minsub) {
188
181
                $mink1 = $k1;
189
182
                $mink2 = $k2;
190
183
                $minsub = $matrice{$k1}{$k2};
191
184
            }
192
185
        }
193
186
    }
 
187
    if ($mink1 eq '') {
 
188
        for $k2 (keys %kmaps) {
 
189
            $mink1 = $k2;
 
190
            last;
 
191
        }
 
192
    }
194
193
    $reduce{$mink1} = $mink2;
195
194
    delete $kmaps{$mink1};
196
195
}
231
230
    'grp:alts_toggle' => [ 'ralt', 'lalt' ],
232
231
    'grp:ctrl_shift_toggle' => [ 'lshift', 'rshift', 'lctrl', 'rctrl' ],
233
232
    'grp:caps_toggle' => [ 'caps' ],
 
233
    'grp:caps_switch' => [ 'caps' ],
234
234
    'grp:shift_caps_toggle' => [ 'caps' ],
 
235
    'grp:shift_caps_switch' => [ 'caps' ],
 
236
    'grp:win_menu_switch' => [ 'rwin', 'lwin', 'menu' ],
 
237
    'grp:alt_caps_toggle' => [ 'caps' ],
235
238
    'grp:ctrl_alt_toggle' => [ 'lalt', 'ralt', 'lctrl', 'rctrl' ],
236
239
    'grp:alt_shift_toggle' => [ 'lalt', 'ralt', 'lshift', 'rshift' ],
 
240
    'grp:alt_space_toggle' => [ 'empty' ],
237
241
    'grp:menu_toggle' => [ 'menu' ],
238
242
    'grp:lwin_toggle' => [ 'lwin' ],
239
243
    'grp:rwin_toggle' => [ 'rwin' ],
240
244
    'grp:lshift_toggle' => [ 'lshift' ],
241
245
    'grp:rshift_toggle' => [ 'rshift' ],
 
246
    'grp:rctrl_switch' => [ 'rctrl' ],
242
247
    'grp:lctrl_toggle' => [ 'lctrl' ],
243
248
    'grp:rctrl_toggle' => [ 'rctrl' ],
244
249
    'grp:lalt_toggle' => [ 'lalt' ],
 
250
    'grp:sclk_toggle' => [ 'sclk' ],
 
251
    'grp:lctrl_rctrl_switch' => [ 'rctrl', 'lctrl' ],
245
252
    'lv3:switch' => [ 'rctrl' ],
 
253
    'lv3:ralt_switch' => [ 'ralt' ],
 
254
    'lv3:ralt_switch_multikey' => [ 'ralt' ],
 
255
    'lv3:ralt_alt' => [ 'ralt' ],
 
256
    'lv3:lalt_switch' => [ 'lalt' ],
 
257
    'lv3:alt_switch' => [ 'lalt', 'ralt' ],
246
258
    'lv3:menu_switch' => [ 'menu' ],
247
259
    'lv3:win_switch' => [ 'lwin', 'rwin' ],
248
260
    'lv3:lwin_switch' => [ 'lwin' ],
249
261
    'lv3:rwin_switch' => [ 'rwin' ],
250
 
    'lv3:ralt_switch' => [ 'ralt' ],
251
 
    'lv3:alt_switch' => [ 'lalt', 'ralt' ],
 
262
    'lv3:enter_switch' => [ 'empty' ],
252
263
    'ctrl:nocaps' => [ 'caps', 'lctrl' ],
253
264
    'ctrl:swapcaps' => [ 'caps', 'lctrl' ],
254
265
    'compose:ralt' => [ 'ralt' ],
293
304
        $layout = $layout . "+eurosign($1)";
294
305
    }
295
306
    my $tmp = new File::Temp(TEMPLATE => 'kbdcompilerXXXXXX');
296
 
    execute ("./ckbcomp -compact -I. -I${xkbdir}"
 
307
    execute ("./ckbcomp $freebsd -compact -I. -I${xkbdir}"
297
308
             ." -keycodes '$keycodes' -symbols '$layout' >$tmp");
298
309
    if (! -f $tmp->filename) {
299
310
        die "$0: ckbcomp failed\n" if (! -f $tmp->filename);