[tools 2/2] testbot/SetWinLocale: Take keyboard layouts preference order into account.

Francois Gouget fgouget at codeweavers.com
Thu Jan 27 06:55:26 CST 2022


See for instance the Armenian locale (hy).

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/bin/SetWinLocale | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale
index 654ec46a41..f725e30fd7 100755
--- a/testbot/bin/SetWinLocale
+++ b/testbot/bin/SetWinLocale
@@ -661,13 +661,17 @@ sub GetWinKeyboardIds($)
   }
 
   # Look for the locale's keyboard id(s).
+  my %WinLayouts;
   foreach my $VName (keys %$Values)
   {
-    next if ($VName !~ /^[0-9A-F]{4}:/);
-    $WinKeyboardIds{$Locale} = [$VName];
-    last;
+    # The value is the keyboard layout's preference order
+    $WinLayouts{hex($Values->{$VName})} = $VName if ($VName =~ /^[0-9A-F]{4}:/);
+  }
+  $WinKeyboardIds{$Locale} = %WinLayouts ? [] : $Keyboards{$Locale};
+  foreach my $Index (sort { $a cmp $b } keys %WinLayouts)
+  {
+    push @{$WinKeyboardIds{$Locale}}, $WinLayouts{$Index};
   }
-  $WinKeyboardIds{$Locale} ||= $Keyboards{$Locale};
   if (!$WinKeyboardIds{$Locale})
   {
     FatalError("could not find the $Locale LCID and keyboard ids. Maybe the locale is not installed?\n");
-- 
2.30.2



More information about the wine-devel mailing list