X-Git-Url: https://code.delx.au/refind/blobdiff_plain/2a9f0905f01f51c3f831af471ddfb2cab416e386..c1935b0f6d9272cfa51e9a6c1e342c252ea41b1f:/refind/screen.c diff --git a/refind/screen.c b/refind/screen.c index e1154ff..cd5c698 100644 --- a/refind/screen.c +++ b/refind/screen.c @@ -107,6 +107,12 @@ VOID InitScreen(VOID) VOID SetupScreen(VOID) { + if ((GlobalConfig.RequestedScreenWidth > 0) && (GlobalConfig.RequestedScreenHeight > 0) && + egSetScreenSize(GlobalConfig.RequestedScreenWidth, GlobalConfig.RequestedScreenHeight)) { + UGAWidth = GlobalConfig.RequestedScreenWidth; + UGAHeight = GlobalConfig.RequestedScreenHeight; + } // if user requested a particular screen resolution + if (GlobalConfig.TextOnly) { // switch to text mode if requested AllowGraphicsMode = FALSE; @@ -115,11 +121,6 @@ VOID SetupScreen(VOID) } else if (AllowGraphicsMode) { // clear screen and show banner // (now we know we'll stay in graphics mode) - if ((GlobalConfig.RequestedScreenWidth > 0) && (GlobalConfig.RequestedScreenHeight > 0) && - egSetScreenSize(GlobalConfig.RequestedScreenWidth, GlobalConfig.RequestedScreenHeight)) { - UGAWidth = GlobalConfig.RequestedScreenWidth; - UGAHeight = GlobalConfig.RequestedScreenHeight; - } // if user requested a particular screen resolution SwitchToGraphics(); BltClearScreen(TRUE); } @@ -129,6 +130,12 @@ VOID SwitchToText(IN BOOLEAN CursorEnabled) { egSetGraphicsModeEnabled(FALSE); refit_call2_wrapper(ST->ConOut->EnableCursor, ST->ConOut, CursorEnabled); + // get size of text console + if (refit_call4_wrapper(ST->ConOut->QueryMode, ST->ConOut, ST->ConOut->Mode->Mode, &ConWidth, &ConHeight) != EFI_SUCCESS) { + // use default values on error + ConWidth = 80; + ConHeight = 25; + } } VOID SwitchToGraphics(VOID) @@ -155,8 +162,8 @@ VOID BeginTextScreen(IN CHAR16 *Title) VOID FinishTextScreen(IN BOOLEAN WaitAlways) { if (haveError || WaitAlways) { - SwitchToText(FALSE); - PauseForKey(); + PauseForKey(); + SwitchToText(FALSE); } // reset error flag @@ -496,7 +503,9 @@ VOID BltImageCompositeBadge(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN EG GraphicsScreenDirty = TRUE; } -// Line-editing functions borrowed from gummiboot (cursor_left(), cursor_right(), & line_edit()) +// Line-editing functions borrowed from gummiboot (cursor_left(), cursor_right(), & line_edit()). +// gummiboot is copyright (c) 2012 by Kay Sievers and Harald Hoyer +// and is licensed under the LGPL 2.1. static void cursor_left(UINTN *cursor, UINTN *first) { @@ -620,10 +629,8 @@ BOOLEAN line_edit(CHAR16 *line_in, CHAR16 **line_out, UINTN x_max, UINTN y_pos) switch (key.UnicodeChar) { case CHAR_LINEFEED: case CHAR_CARRIAGE_RETURN: - if (StrCmp(line, line_in) != 0) { - *line_out = line; - line = NULL; - } + *line_out = line; + line = NULL; enter = TRUE; exit = TRUE; break;