]> git.proxmox.com Git - pve-installer.git/commitdiff
memorize keyboard layout selection
authorStoiko Ivanov <s.ivanov@proxmox.com>
Tue, 10 Nov 2020 14:15:28 +0000 (15:15 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 10 Dec 2020 19:04:52 +0000 (20:04 +0100)
currently when using the previous/next buttons the keyboard layout gets
defined based on the detected/selected country, even if it was set to a
different value explicitly.

This patch changes the behaviour to only update the layout and set it in
the installer if it got actively changed, or if a different country was
selected

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
proxinstall

index 38376716a234e933396ec322f2cc87a4d376e583..e82239a76a927e1b40a0f809a512eb662c3771c7 100755 (executable)
@@ -2549,6 +2549,8 @@ sub get_device_desc {
     }
 }
 
+my $last_layout;
+my $country_layout;
 sub update_layout {
     my ($cb, $kmap) = @_;
 
@@ -2562,7 +2564,14 @@ sub update_layout {
        $i++;
     }
 
-    $cb->set_active($ind || $def || 0);
+    my $val = $ind || $def || 0;
+
+    if (!defined($kmap)) {
+       $last_layout //= $val;
+    } elsif (!defined($country_layout) || $country_layout != $val) {
+       $last_layout = $country_layout = $val;
+    }
+    $cb->set_active($last_layout);
 }
 
 my $lastzonecb;
@@ -2699,6 +2708,7 @@ sub create_password_view {
 
 }
 
+my $installer_kmap;
 sub create_country_view {
 
     cleanup_view();
@@ -2744,11 +2754,16 @@ sub create_country_view {
 
     $kmapcb->signal_connect ('changed' => sub {
        my $sel = $kmapcb->get_active_text();
+       $last_layout = $kmapcb->get_active();
        if (my $kmap = $cmap->{kmaphash}->{$sel}) {
            my $xkmap = $cmap->{kmap}->{$kmap}->{x11};
            my $xvar = $cmap->{kmap}->{$kmap}->{x11var};
            $keymap = $kmap;
 
+           return if (defined($installer_kmap) && $installer_kmap eq $kmap);
+
+           $installer_kmap = $keymap;
+
            if (! $opt_testmode) {
                syscmd ("setxkbmap $xkmap $xvar");
            }