]> code.delx.au - refind/blobdiff - refind/screen.c
Refinement to hint function for greater context sensitivity.
[refind] / refind / screen.c
index 6aa04bedc86d0a3418445cfb8e98866c9633e969..32711d60e43df1ef466db8d4e01e0f13770f5a3a 100644 (file)
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+/*
+ * Modifications copyright (c) 2012 Roderick W. Smith
+ *
+ * Modifications distributed under the terms of the GNU General Public
+ * License (GPL) version 3 (GPLv3), a copy of which must be distributed
+ * with this source code or binaries made from it.
+ *
+ */
 
 #include "global.h"
 #include "screen.h"
@@ -59,6 +67,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;
 
@@ -115,8 +124,8 @@ VOID SetupScreen(VOID)
 {
     GlobalConfig.RequestedTextMode = egSetTextMode(GlobalConfig.RequestedTextMode);
 
-    if ((GlobalConfig.RequestedScreenWidth > 0) && (GlobalConfig.RequestedScreenHeight > 0) &&
-        egSetScreenSize(GlobalConfig.RequestedScreenWidth, GlobalConfig.RequestedScreenHeight)) {
+    if ((GlobalConfig.RequestedScreenWidth > 0) &&
+        (egSetScreenSize(&GlobalConfig.RequestedScreenWidth, &GlobalConfig.RequestedScreenHeight))) {
           UGAWidth = GlobalConfig.RequestedScreenWidth;
           UGAHeight = GlobalConfig.RequestedScreenHeight;
     } // if user requested a particular screen resolution
@@ -181,8 +190,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;
 
@@ -194,9 +201,6 @@ VOID BeginExternalScreen(IN BOOLEAN UseGraphicsMode, IN CHAR16 *Title)
        DrawScreenHeader(Title);
     } // if/else
 
-    // show the header
-//    DrawScreenHeader(Title);
-
     if (!UseGraphicsMode)
         SwitchToText(TRUE);
 
@@ -214,6 +218,9 @@ VOID FinishExternalScreen(VOID)
         PauseForKey();
     }
 
+    // Reset the screen resolution, in case external program changed it....
+    SetupScreen();
+
     // reset error flag
     haveError = FALSE;
 }
@@ -233,8 +240,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);