USETUP: Do not ask to select language if just one language is available
authorEric Kohl <eric.kohl@reactos.org>
Sun, 18 Oct 2015 13:52:51 +0000 (13:52 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 18 Oct 2015 13:52:51 +0000 (13:52 +0000)
Patch by Carlo Bramini. Thanks a lot!
CORE-10322 #resolve

svn path=/trunk/; revision=69600

reactos/base/setup/usetup/genlist.c
reactos/base/setup/usetup/genlist.h
reactos/base/setup/usetup/interface/usetup.c

index e96b75e..240df1c 100644 (file)
@@ -653,4 +653,17 @@ RestoreGenericListState(
     List->CurrentEntry = List->BackupEntry;
 }
 
+
+BOOL
+GenericListHasSingleEntry(
+    PGENERIC_LIST List)
+{
+    if (!IsListEmpty(&List->ListHead) && List->ListHead.Flink == List->ListHead.Blink)
+        return TRUE;
+
+    /* if both list head pointers (which normally point to the first and last list member, respectively)
+       point to the same entry then it means that there's just a single thing in there, otherwise... false! */
+    return FALSE;
+}
+
 /* EOF */
index eda4aec..0361d2b 100644 (file)
@@ -54,10 +54,6 @@ DrawGenericList(
     SHORT Right,
     SHORT Bottom);
 
-VOID
-DrawScrollBarGenericLis(
-    PGENERIC_LIST List);
-
 VOID
 ScrollDownGenericList(
     PGENERIC_LIST List);
@@ -121,4 +117,8 @@ GenericListKeyPress(
     PGENERIC_LIST List,
     CHAR AsciChar);
 
+BOOL
+GenericListHasSingleEntry(
+    PGENERIC_LIST List);
+
 /* EOF */
index 84077f5..f71db84 100644 (file)
@@ -633,6 +633,12 @@ LanguagePage(PINPUT_RECORD Ir)
     /* Load the font */
     SelectedLanguageId = DefaultLanguage;
     SetConsoleCodePage();
+    UpdateKBLayout();
+
+    /* If there's just a single language in the list skip
+     * the language selection process altogether! */
+    if (GenericListHasSingleEntry(LanguageList))
+        return INTRO_PAGE;
 
     DrawGenericList(LanguageList,
                     2,