summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--lib/keyboard.pm15
-rwxr-xr-xtools/keyboarddrake12
3 files changed, 26 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index 5629954..44ab00f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+- keyboarddrake:
+ o correctly handle default XkbModel
+ (so that we do not force pc105 when we should not)
+
Version 0.65 - 8 December 2008
- keyboarddrake:
diff --git a/lib/keyboard.pm b/lib/keyboard.pm
index a3c7f15..8d9460f 100644
--- a/lib/keyboard.pm
+++ b/lib/keyboard.pm
@@ -523,6 +523,16 @@ sub parse_xkb_rules() {
\%l;
}
+sub default_XkbModel {
+ my ($keyboard) = @_;
+
+ my $Layout = keyboard2xkb($keyboard);
+
+ (arch() =~ /sparc/ ? 'sun' :
+ $Layout eq 'jp' ? 'jp106' :
+ $Layout eq 'br' ? 'abnt2' : 'pc105');
+}
+
sub keyboard2full_xkb {
my ($keyboard) = @_;
@@ -531,10 +541,7 @@ sub keyboard2full_xkb {
$Layout = join(',', 'us', $Layout);
}
- my $Model = $keyboard->{XkbModel} ||
- (arch() =~ /sparc/ ? 'sun' :
- $Layout eq 'jp' ? 'jp106' :
- $Layout eq 'br' ? 'abnt2' : 'pc105');
+ my $Model = $keyboard->{XkbModel} || default_XkbModel($keyboard);
my $Options = join(',',
if_($keyboard->{GRP_TOGGLE}, "grp:$keyboard->{GRP_TOGGLE}", 'grp_led:scroll'),
diff --git a/tools/keyboarddrake b/tools/keyboarddrake
index fb5d9be..d508018 100755
--- a/tools/keyboarddrake
+++ b/tools/keyboarddrake
@@ -26,7 +26,11 @@ if (my ($kb) = grep { !/^-/ } @ARGV) {
my ($xkb_models, $model2text) = keyboard::xkb_models();
s/ /|/ foreach values %$model2text;
- $keyboard->{XkbModel} ||= 'pc105';
+ my $default_XkbModel;
+ if (!$keyboard->{XkbModel}) {
+ $default_XkbModel = 1;
+ $keyboard->{XkbModel} = keyboard::default_XkbModel($keyboard);
+ }
choose:
$in->ask_from(N("Keyboard"),
@@ -38,6 +42,11 @@ if (my ($kb) = grep { !/^-/ } @ARGV) {
format => sub { translate(keyboard::KEYBOARD2text($_[0])) },
list => [ keyboard::KEYBOARDs() ],
type => 'list',
+ changed => sub {
+ if ($default_XkbModel) {
+ $keyboard->{XkbModel} = keyboard::default_XkbModel($keyboard);
+ }
+ },
},
{ label => N("Keyboard type"),
title => 1,
@@ -45,6 +54,7 @@ if (my ($kb) = grep { !/^-/ } @ARGV) {
{ val => \$keyboard->{XkbModel},
format => sub { $model2text->{$_[0]} },
separator => '|',
+ changed => sub { $default_XkbModel = 0 },
list => $xkb_models },
]) or goto end;