public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer 1/3] memorize keyboard layout selection
Date: Tue, 10 Nov 2020 15:15:28 +0100	[thread overview]
Message-ID: <20201110141530.30904-2-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20201110141530.30904-1-s.ivanov@proxmox.com>

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 | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/proxinstall b/proxinstall
index 9879df4..9977f44 100755
--- a/proxinstall
+++ b/proxinstall
@@ -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");
 	    }
-- 
2.20.1





  reply	other threads:[~2020-11-10 14:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10 14:15 [pve-devel] [PATCH installer 0/3] memorize keyboard layout and run setupcon in background Stoiko Ivanov
2020-11-10 14:15 ` Stoiko Ivanov [this message]
2020-11-10 14:15 ` [pve-devel] [PATCH installer 2/3] add run_in_background Stoiko Ivanov
2020-11-10 14:15 ` [pve-devel] [PATCH installer 3/3] set the keymap on the installer console Stoiko Ivanov
2020-11-10 14:33 ` [pve-devel] [PATCH installer 0/3] memorize keyboard layout and run setupcon in background Oguz Bektas
2020-12-10 19:07 ` [pve-devel] applied-series: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201110141530.30904-2-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal