]> code.delx.au - refind/commitdiff
New "editor" option to the "hideui" configuration file token.
authorsrs5694 <srs5694@users.sourceforge.net>
Sat, 15 Dec 2012 04:39:21 +0000 (23:39 -0500)
committersrs5694 <srs5694@users.sourceforge.net>
Sat, 15 Dec 2012 04:39:21 +0000 (23:39 -0500)
NEWS.txt
docs/refind/configfile.html
libeg/screen.c
refind.conf-sample
refind/config.c
refind/config.h
refind/main.c
refind/menu.c
refind/screen.c

index 2598bc99c10e31e4cf1811cc9ed16df5e7313f4b..7abbcc3c4211de6784414bd2fd551300cf99b0a2 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -22,6 +22,9 @@
 - Fixed bug that caused tools (shell, etc.) to launch when they were
   highlighted and F2 or Insert was pressed.
 
+- Added "editor" option to the "hideui" token in refind.conf, which
+  disables the boot options editor.
+
 - Added hints text to rEFInd main menu and sub-menus. This can be disabled
   by setting the new "hints" option to the "hideui" token in refind.conf.
 
index 682b962f0f7c0193d00e2d1f5b0163e48c347aea..b21e8333c29463aa2304a8a795643e3b1aa37fb7 100644 (file)
@@ -145,8 +145,8 @@ timeout 20
 </tr>
 <tr>
    <td><tt>hideui</tt></td>
-   <td><tt>banner</tt>, <tt>label</tt>, <tt>singleuser</tt>, <tt>hwtest</tt>, <tt>arrows</tt>, or <tt>all</tt></td>
-   <td>Removes the specified user interface features. <tt>banner</tt> removes the banner graphic, <tt>label</tt> removes the text description of each tag and the countdown timer, <tt>singleuser</tt> removes the single-user option from the Mac OS sub-menu, <tt>hwtest</tt> removes the Mac OS hardware test option, <tt>arrows</tt> removes the arrows to the right or left of the OS tags when rEFInd finds too many OSes to display simultaneously, and <tt>all</tt> removes all of these options. You can specify multiple parameters with this option. The default is to set none of these values.</td>
+   <td><tt>banner</tt>, <tt>label</tt>, <tt>singleuser</tt>, <tt>hwtest</tt>, <tt>arrows</tt>, <tt>hints</tt>, <tt>editor</tt>, or <tt>all</tt></td>
+   <td>Removes the specified user interface features. <tt>banner</tt> removes the banner graphic, <tt>label</tt> removes the text description of each tag and the countdown timer, <tt>singleuser</tt> removes the single-user option from the Mac OS sub-menu, <tt>hwtest</tt> removes the Mac OS hardware test option, <tt>arrows</tt> removes the arrows to the right or left of the OS tags when rEFInd finds too many OSes to display simultaneously, <tt>hints</tt> removes the brief description of what basic keypressed do, <tt>editor</tt> disables the options editor, and <tt>all</tt> removes all of these options. You can specify multiple parameters with this option. The default is to set none of these values.</td>
 </tr>
 <tr>
    <td><tt>icons_dir</tt></td>
index bc097b551d645250af8c3e05ce41fced551f6f74..222895919b34496def2f04c7a7682836453f6fda 100644 (file)
@@ -176,6 +176,7 @@ BOOLEAN egSetScreenSize(IN OUT UINTN *ScreenWidth, IN OUT UINTN *ScreenHeight) {
          PauseForKey();
          SwitchToGraphics();
       } // if()
+
    } else if (UgaDraw != NULL) { // UGA mode (EFI 1.x)
       // Try to use current color depth & refresh rate for new mode. Maybe not the best choice
       // in all cases, but I don't know how to probe for alternatives....
@@ -304,9 +305,15 @@ VOID egClearScreen(IN EG_PIXEL *Color)
     if (!egHasGraphics)
         return;
 
-    FillColor.Red   = Color->r;
-    FillColor.Green = Color->g;
-    FillColor.Blue  = Color->b;
+    if (Color != NULL) {
+       FillColor.Red   = Color->r;
+       FillColor.Green = Color->g;
+       FillColor.Blue  = Color->b;
+    } else {
+       FillColor.Red   = 0x0;
+       FillColor.Green = 0x0;
+       FillColor.Blue  = 0x0;
+    }
     FillColor.Reserved = 0;
 
     if (GraphicsOutput != NULL) {
@@ -314,10 +321,9 @@ VOID egClearScreen(IN EG_PIXEL *Color)
         // layout, and the header from TianoCore actually defines them
         // to be the same type.
         refit_call10_wrapper(GraphicsOutput->Blt, GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)&FillColor, EfiBltVideoFill,
-                            0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
+                             0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
     } else if (UgaDraw != NULL) {
-        refit_call10_wrapper(UgaDraw->Blt, UgaDraw, &FillColor, EfiUgaVideoFill,
-                     0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
+        refit_call10_wrapper(UgaDraw->Blt, UgaDraw, &FillColor, EfiUgaVideoFill, 0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
     }
 }
 
index c15d905b54a263e799fa0da1f0ae2fd6823ea323..7d2950aa6bd6dc70dd0bb51437d86b81b5b374da 100644 (file)
@@ -17,7 +17,9 @@ timeout 20
 #  hwtest      - the submenu option to run Apple's hardware test
 #  arrows      - scroll arrows on the OS selection tag line
 #  hints       - brief command summary in the menu
+#  editor      - the options editor (+, F2, or Insert on boot options menu)
 #  all         - all of the above
+# Default is none of these (all elements active)
 #
 #hideui singleuser
 #hideui all
index 416461df8a0e36b0b58d6805cd1214d9b59687be..2f314e8bf6dc40ba45de3b08f59d230971bb191b 100644 (file)
@@ -376,15 +376,17 @@ VOID ReadConfig(CHAR16 *FileName)
                 } else if (StriCmp(FlagName, L"label") == 0) {
                    GlobalConfig.HideUIFlags |= HIDEUI_FLAG_LABEL;
                 } else if (StriCmp(FlagName, L"singleuser") == 0) {
-                    GlobalConfig.HideUIFlags |= HIDEUI_FLAG_SINGLEUSER;
+                   GlobalConfig.HideUIFlags |= HIDEUI_FLAG_SINGLEUSER;
                 } else if (StriCmp(FlagName, L"hwtest") == 0) {
-                    GlobalConfig.HideUIFlags |= HIDEUI_FLAG_HWTEST;
+                   GlobalConfig.HideUIFlags |= HIDEUI_FLAG_HWTEST;
                 } else if (StriCmp(FlagName, L"arrows") == 0) {
                    GlobalConfig.HideUIFlags |= HIDEUI_FLAG_ARROWS;
                 } else if (StriCmp(FlagName, L"hints") == 0) {
                    GlobalConfig.HideUIFlags |= HIDEUI_FLAG_HINTS;
+                } else if (StriCmp(FlagName, L"editor") == 0) {
+                   GlobalConfig.HideUIFlags |= HIDEUI_FLAG_EDITOR;
                 } else if (StriCmp(FlagName, L"all") == 0) {
-                    GlobalConfig.HideUIFlags = HIDEUI_ALL;
+                   GlobalConfig.HideUIFlags = HIDEUI_FLAG_ALL;
                 } else {
                     Print(L" unknown hideui flag: '%s'\n", FlagName);
                 }
index 35c61e4d7779e7f9e3e81aab42e73d44c331cee4..ce3f880748c6a50be39ce25d0d9eec72d0d1498b 100644 (file)
@@ -67,13 +67,15 @@ typedef struct {
     CHAR16  *End16Ptr;
 } REFIT_FILE;
 
+#define HIDEUI_FLAG_NONE       (0x0000)
 #define HIDEUI_FLAG_BANNER     (0x0001)
 #define HIDEUI_FLAG_LABEL      (0x0002)
 #define HIDEUI_FLAG_SINGLEUSER (0x0004)
 #define HIDEUI_FLAG_HWTEST     (0x0008)
 #define HIDEUI_FLAG_ARROWS     (0x0010)
 #define HIDEUI_FLAG_HINTS      (0x0020)
-#define HIDEUI_ALL             ((0xffff))
+#define HIDEUI_FLAG_EDITOR     (0x0040)
+#define HIDEUI_FLAG_ALL       ((0xffff))
 
 #define CONFIG_FILE_NAME         L"refind.conf"
 #define DONT_SCAN_FILES L"shim.efi,MokManager.efi,TextMode.efi,ebounce.efi,GraphicsConsole.efi"
index 87d64ceb736380c9b775e4d09afda19dcd9bd462..4a5c0cb7677cb14cf15e7a14fd5c28d04fbec7ca 100644 (file)
@@ -215,8 +215,8 @@ static EFI_STATUS StartEFIImageList(IN EFI_DEVICE_PATH **DevicePaths,
        // TODO: Track down the cause of this error and fix it, if possible.
        // ReturnStatus = Status = refit_call6_wrapper(BS->LoadImage, FALSE, SelfImageHandle, DevicePaths[DevicePathIndex],
        //                                            ImageData, ImageSize, &ChildImageHandle);
-        ReturnStatus = Status = refit_call6_wrapper(BS->LoadImage, FALSE, SelfImageHandle, DevicePaths[DevicePathIndex],
-                                                    NULL, 0, &ChildImageHandle);
+       ReturnStatus = Status = refit_call6_wrapper(BS->LoadImage, FALSE, SelfImageHandle, DevicePaths[DevicePathIndex],
+                                                   NULL, 0, &ChildImageHandle);
        if ((Status == EFI_ACCESS_DENIED) && (ShimLoaded())) {
           FindVolumeAndFilename(DevicePaths[DevicePathIndex], &DeviceVolume, &loader);
           if (DeviceVolume != NULL) {
index 83498583f29417c17d2de358609eb5f190cac50c..7b74e517940b8a9bfe77b9e921107e7ec4bb0636 100644 (file)
@@ -358,7 +358,8 @@ static VOID IdentifyRows(IN SCROLL_STATE *State, IN REFIT_MENU_SCREEN *Screen) {
 //
 // generic menu function
 //
-static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC StyleFunc, IN INTN DefaultEntryIndex, OUT REFIT_MENU_ENTRY **ChosenEntry)
+static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC StyleFunc, IN OUT INTN *DefaultEntryIndex,
+                            OUT REFIT_MENU_ENTRY **ChosenEntry)
 {
     SCROLL_STATE State;
     EFI_STATUS Status;
@@ -380,8 +381,8 @@ static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC Sty
     StyleFunc(Screen, &State, MENU_FUNCTION_INIT, NULL);
     IdentifyRows(&State, Screen);
     // override the starting selection with the default index, if any
-    if (DefaultEntryIndex >= 0 && DefaultEntryIndex <= State.MaxIndex) {
-        State.CurrentSelection = DefaultEntryIndex;
+    if (*DefaultEntryIndex >= 0 && *DefaultEntryIndex <= State.MaxIndex) {
+        State.CurrentSelection = *DefaultEntryIndex;
         UpdateScroll(&State, SCROLL_NONE);
     }
     State.PaintAll = TRUE;
@@ -487,6 +488,7 @@ static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC Sty
 
     if (ChosenEntry)
         *ChosenEntry = Screen->Entries[State.CurrentSelection];
+    *DefaultEntryIndex = State.CurrentSelection;
     return MenuExit;
 } /* static UINTN RunGenericMenu() */
 
@@ -595,7 +597,7 @@ static VOID TextMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State,
             if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_HINTS)) {
                refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, 0, ConHeight - 1);
                refit_call2_wrapper(ST->ConOut->OutputString, ST->ConOut,
-                                   L"arrow keys to move cursor; Enter to boot; Insert or F2 for more options");
+                                   L"Use arrow keys to move cursor; Enter to boot; Insert or F2 for more options");
             }
             break;
 
@@ -713,11 +715,16 @@ static VOID GraphicsMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *Sta
                              EntriesPosX, EntriesPosY + i * TEXT_LINE_HEIGHT);
             }
             if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_HINTS)) {
-               DrawMenuText(L"arrow keys to move cursor; Enter to boot;", 0,
-                            (UGAWidth - (41 * FONT_CELL_WIDTH)) / 2, UGAHeight - (FONT_CELL_HEIGHT * 3));
-               DrawMenuText(L"Insert or F2 to edit options", 0,
-                            (UGAWidth - (28 * FONT_CELL_WIDTH)) / 2, UGAHeight - (FONT_CELL_HEIGHT * 2));
-            }
+               if (GlobalConfig.HideUIFlags & HIDEUI_FLAG_EDITOR) {
+                  DrawMenuText(L"Use arrow keys to move cursor; Enter to boot", 0,
+                               (UGAWidth - (45 * FONT_CELL_WIDTH)) / 2, UGAHeight - (FONT_CELL_HEIGHT * 3));
+               } else {
+                  DrawMenuText(L"Use arrow keys to move cursor; Enter to boot;", 0,
+                               (UGAWidth - (45 * FONT_CELL_WIDTH)) / 2, UGAHeight - (FONT_CELL_HEIGHT * 3));
+                  DrawMenuText(L"Insert or F2 to edit options", 0,
+                               (UGAWidth - (28 * FONT_CELL_WIDTH)) / 2, UGAHeight - (FONT_CELL_HEIGHT * 2));
+               } // if/else
+            } // if
             break;
 
         case MENU_FUNCTION_PAINT_SELECTION:
@@ -790,7 +797,7 @@ static VOID PaintAll(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, UINTN
                        (UGAWidth - LAYOUT_TEXT_WIDTH) >> 1, textPosY);
 
    if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_HINTS)) {
-      DrawMainMenuText(L"arrow keys to move cursor; Enter to boot;",
+      DrawMainMenuText(L"Use arrow keys to move cursor; Enter to boot;",
                        (UGAWidth - LAYOUT_TEXT_WIDTH) / 2, UGAHeight - (FONT_CELL_HEIGHT * 3));
       DrawMainMenuText(L"Insert or F2 for more options",
                        (UGAWidth - LAYOUT_TEXT_WIDTH) / 2, UGAHeight - (FONT_CELL_HEIGHT * 2));
@@ -946,6 +953,10 @@ static BOOLEAN EditOptions(LOADER_ENTRY *MenuEntry) {
    CHAR16 *EditedOptions;
    BOOLEAN retval = FALSE;
 
+   if (GlobalConfig.HideUIFlags & HIDEUI_FLAG_EDITOR) {
+      return FALSE;
+   }
+
    refit_call4_wrapper(ST->ConOut->QueryMode, ST->ConOut, ST->ConOut->Mode->Mode, &x_max, &y_max);
 
    if (!GlobalConfig.TextOnly)
@@ -967,12 +978,13 @@ static BOOLEAN EditOptions(LOADER_ENTRY *MenuEntry) {
 
 UINTN RunMenu(IN REFIT_MENU_SCREEN *Screen, OUT REFIT_MENU_ENTRY **ChosenEntry)
 {
+    INTN            DefaultEntry = -1;
     MENU_STYLE_FUNC Style = TextMenuStyle;
 
     if (AllowGraphicsMode)
         Style = GraphicsMenuStyle;
 
-    return RunGenericMenu(Screen, Style, -1, ChosenEntry);
+    return RunGenericMenu(Screen, Style, &DefaultEntry, ChosenEntry);
 }
 
 UINTN RunMainMenu(IN REFIT_MENU_SCREEN *Screen, IN CHAR16* DefaultSelection, OUT REFIT_MENU_ENTRY **ChosenEntry)
@@ -981,12 +993,12 @@ UINTN RunMainMenu(IN REFIT_MENU_SCREEN *Screen, IN CHAR16* DefaultSelection, OUT
     MENU_STYLE_FUNC MainStyle = TextMenuStyle;
     REFIT_MENU_ENTRY *TempChosenEntry;
     UINTN MenuExit = 0;
-    UINTN DefaultEntryIndex = -1;
+    INTN DefaultEntryIndex = -1;
+    INTN DefaultSubmenuIndex = -1;
 
     if (DefaultSelection != NULL) {
         // Find a menu entry that includes *DefaultSelection as a substring
         DefaultEntryIndex = FindMenuShortcutEntry(Screen, DefaultSelection);
-        // If that didn't work, should we scan more characters?  For now, no.
     }
 
     if (AllowGraphicsMode) {
@@ -995,12 +1007,12 @@ UINTN RunMainMenu(IN REFIT_MENU_SCREEN *Screen, IN CHAR16* DefaultSelection, OUT
     }
 
     while (!MenuExit) {
-        MenuExit = RunGenericMenu(Screen, MainStyle, DefaultEntryIndex, &TempChosenEntry);
+        MenuExit = RunGenericMenu(Screen, MainStyle, &DefaultEntryIndex, &TempChosenEntry);
         Screen->TimeoutSeconds = 0;
 
         if (MenuExit == MENU_EXIT_DETAILS) {
             if (TempChosenEntry->SubScreen != NULL) {
-               MenuExit = RunGenericMenu(TempChosenEntry->SubScreen, Style, -1, &TempChosenEntry);
+               MenuExit = RunGenericMenu(TempChosenEntry->SubScreen, Style, &DefaultSubmenuIndex, &TempChosenEntry);
                if (MenuExit == MENU_EXIT_ESCAPE || TempChosenEntry->Tag == TAG_RETURN)
                    MenuExit = 0;
                if (MenuExit == MENU_EXIT_DETAILS) {
index dc1f21d987bb421ba6d3b115d79cb2945c20778c..4656e0190be0ce09ec784ac035ef23b3b016f697 100644 (file)
@@ -59,6 +59,7 @@ BOOLEAN AllowGraphicsMode;
 
 EG_PIXEL StdBackgroundPixel  = { 0xbf, 0xbf, 0xbf, 0 };
 EG_PIXEL MenuBackgroundPixel = { 0xbf, 0xbf, 0xbf, 0 };
+EG_PIXEL DarkBackgroundPixel = { 0x0, 0x0, 0x0, 0 };
 
 static BOOLEAN GraphicsScreenDirty;
 
@@ -181,8 +182,6 @@ VOID FinishTextScreen(IN BOOLEAN WaitAlways)
 
 VOID BeginExternalScreen(IN BOOLEAN UseGraphicsMode, IN CHAR16 *Title)
 {
-    EG_PIXEL DarkBackgroundPixel  = { 0x0, 0x0, 0x0, 0 };
-
     if (!AllowGraphicsMode)
         UseGraphicsMode = FALSE;
 
@@ -236,8 +235,9 @@ static VOID DrawScreenHeader(IN CHAR16 *Title)
     UINTN y;
 
     // clear to black background
+    egClearScreen(&DarkBackgroundPixel); // first clear in graphics mode
     refit_call2_wrapper(ST->ConOut->SetAttribute, ST->ConOut, ATTR_BASIC);
-    refit_call1_wrapper(ST->ConOut->ClearScreen, ST->ConOut);
+    refit_call1_wrapper(ST->ConOut->ClearScreen, ST->ConOut); // then clear in text mode
 
     // paint header background
     refit_call2_wrapper(ST->ConOut->SetAttribute, ST->ConOut, ATTR_BANNER);