diff --git a/Include/Library/OcConsoleLib.h b/Include/Library/OcConsoleLib.h index 056f1010..facd5050 100644 --- a/Include/Library/OcConsoleLib.h +++ b/Include/Library/OcConsoleLib.h @@ -30,8 +30,8 @@ typedef enum { /** Special commands sent to Builtin text renderer through TestString. **/ -#define OC_CONSOLE_CLEAR_AND_CLIP L"ClearAndClip" -#define OC_CONSOLE_CLEAR_WHOLE_AND_CLIP L"ClearWholeAndClip" +#define OC_CONSOLE_MARK_CONTROLLED L"MarkControlled" +#define OC_CONSOLE_MARK_UNCONTROLLED L"MarkUncontrolled" /** Configure console control protocol with given options. diff --git a/Library/OcBootManagementLib/OcBootManagementLib.c b/Library/OcBootManagementLib/OcBootManagementLib.c index 74ac1df5..9bf22b2e 100644 --- a/Library/OcBootManagementLib/OcBootManagementLib.c +++ b/Library/OcBootManagementLib/OcBootManagementLib.c @@ -156,7 +156,8 @@ OcShowSimpleBootMenu ( // // Extension for OpenCore direct text render for faster redraw with custom background. // - gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_CLEAR_AND_CLIP); + gST->ConOut->ClearScreen (gST->ConOut); + gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_CONTROLLED); while (TRUE) { gST->ConOut->ClearScreen (gST->ConOut); @@ -355,8 +356,8 @@ OcShowSimplePasswordRequest ( OcConsoleControlSetMode (EfiConsoleControlScreenText); gST->ConOut->EnableCursor (gST->ConOut, FALSE); - gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_CLEAR_AND_CLIP); gST->ConOut->ClearScreen (gST->ConOut); + gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_CONTROLLED); for (Index = 0; Index < 3; ++Index) { PwIndex = 0; @@ -648,10 +649,17 @@ OcRunBootPicker ( } // - // Clear screen from picker contents before loading the entry. + // Do screen clearing for builtin menu here, so that it is possible to see the action. + // TODO: Probably remove that completely. // - gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_CLEAR_WHOLE_AND_CLIP); - gST->ConOut->ClearScreen (gST->ConOut); + if (Context->ShowMenu == OcShowSimpleBootMenu) { + // + // Clear screen from picker contents before loading the entry. + // + gST->ConOut->ClearScreen (gST->ConOut); + gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_UNCONTROLLED); + } + // // Voice chosen information. // diff --git a/Library/OcConsoleLib/TextOutputBuiltin.c b/Library/OcConsoleLib/TextOutputBuiltin.c index 7acf267d..e25a39d1 100644 --- a/Library/OcConsoleLib/TextOutputBuiltin.c +++ b/Library/OcConsoleLib/TextOutputBuiltin.c @@ -566,16 +566,12 @@ AsciiTextTestString ( IN CHAR16 *String ) { - if (StrCmp (String, OC_CONSOLE_CLEAR_AND_CLIP) == 0) { - This->ClearScreen (This); - mConsoleMaxPosX = 0; - mConsoleMaxPosY = 0; - } else if (StrCmp (String, OC_CONSOLE_CLEAR_WHOLE_AND_CLIP) == 0) { + if (StrCmp (String, OC_CONSOLE_MARK_UNCONTROLLED) == 0) { mConsoleMaxPosX = mGraphicsOutput->Mode->Info->HorizontalResolution / TGT_CHAR_WIDTH; mConsoleMaxPosY = mGraphicsOutput->Mode->Info->VerticalResolution / TGT_CHAR_HEIGHT; - This->ClearScreen (This); + } else if (StrCmp (String, OC_CONSOLE_MARK_CONTROLLED) == 0) { + mConsoleMaxPosX = 0; mConsoleMaxPosX = 0; - mConsoleMaxPosY = 0; } return EFI_SUCCESS; diff --git a/Platform/OpenCanopy/OcBootstrap.c b/Platform/OpenCanopy/OcBootstrap.c index d35ce011..dbc97bff 100644 --- a/Platform/OpenCanopy/OcBootstrap.c +++ b/Platform/OpenCanopy/OcBootstrap.c @@ -15,6 +15,8 @@ #include #include +#include +#include #include #include #include @@ -29,6 +31,7 @@ #include "GuiApp.h" extern BOOT_PICKER_GUI_CONTEXT mGuiContext; +extern CONST GUI_IMAGE mBackgroundImage; STATIC GUI_DRAWING_CONTEXT @@ -58,6 +61,11 @@ OcShowMenuByOc ( return Status; } + // + // Extension for OpenCore builtin renderer to mark that we control text output here. + // + gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_CONTROLLED); + Status = BootPickerViewInitialize ( &mDrawContext, &mGuiContext, @@ -88,9 +96,15 @@ OcShowMenuByOc ( // Note, it is important to destruct GUI here, as we must ensure // that keyboard/mouse polling does not conflict with FV2 ui. // + GuiClearScreen (&mDrawContext, mBackgroundImage.Buffer); BootPickerViewDeinitialize (&mDrawContext, &mGuiContext); GuiLibDestruct (); + // + // Extension for OpenCore builtin renderer to mark that we no longer control text output here. + // + gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_UNCONTROLLED); + *ChosenBootEntry = mGuiContext.BootEntry; BootContext->PickerContext->HideAuxiliary = mGuiContext.HideAuxiliary; if (mGuiContext.Refresh) { diff --git a/Platform/OpenCanopy/OpenCanopy.c b/Platform/OpenCanopy/OpenCanopy.c index c23775e4..3ddd9cc3 100644 --- a/Platform/OpenCanopy/OpenCanopy.c +++ b/Platform/OpenCanopy/OpenCanopy.c @@ -1256,6 +1256,26 @@ GuiDrawLoop ( } while (!DrawContext->ExitLoop (DrawContext->GuiContext)); } +VOID +GuiClearScreen ( + IN OUT GUI_DRAWING_CONTEXT *DrawContext, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Pixel + ) +{ + GuiOutputBlt ( + mOutputContext, + Pixel, + EfiBltVideoFill, + 0, + 0, + 0, + 0, + DrawContext->Screen->Width, + DrawContext->Screen->Height, + 0 + ); +} + EFI_STATUS GuiIcnsToImageIcon ( OUT GUI_IMAGE *Image, diff --git a/Platform/OpenCanopy/OpenCanopy.h b/Platform/OpenCanopy/OpenCanopy.h index d508a9e7..f3c8ae7d 100644 --- a/Platform/OpenCanopy/OpenCanopy.h +++ b/Platform/OpenCanopy/OpenCanopy.h @@ -251,6 +251,12 @@ GuiDrawLoop ( IN UINT32 TimeoutSeconds ); +VOID +GuiClearScreen ( + IN OUT GUI_DRAWING_CONTEXT *DrawContext, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Pixel + ); + EFI_STATUS GuiLibConstruct ( IN UINT32 CursorDefaultX,