From bef59ccfa21f51b9600bab1c11efae01379f01ca Mon Sep 17 00:00:00 2001 From: jief666 Date: Thu, 22 Oct 2020 14:33:57 +0300 Subject: [PATCH] Fix icons being light at the first display. --- rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp index 0c6f7f416..747efd8c7 100644 --- a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp +++ b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp @@ -792,7 +792,21 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN MENU_STYLE_FUNC StyleFunc, IN OUT INT // exhaust key buffer and be sure no key is pressed to prevent option selection // when coming with a key press from timeout=0, for example while (ReadAllKeyStrokes()) gBS->Stall(500 * 1000); - while (!MenuExit) { + while (!MenuExit) + { + // do this BEFORE calling StyleFunc. + EFI_TIME Now; + gRT->GetTime(&Now, NULL); + if (GlobalConfig.Timezone != 0xFF) { + INT32 NowHour = Now.Hour + GlobalConfig.Timezone; + if (NowHour < 0 ) NowHour += 24; + if (NowHour >= 24 ) NowHour -= 24; + Daylight = (NowHour > 8) && (NowHour < 20); //this is the screen member + } else { + Daylight = true; + } + + // update the screen if (ScrollState.PaintAll) { ((*this).*(StyleFunc))(MENU_FUNCTION_PAINT_ALL, NULL); @@ -820,17 +834,6 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN MENU_STYLE_FUNC StyleFunc, IN OUT INT DBG("GUI ready\n"); } - EFI_TIME Now; - gRT->GetTime(&Now, NULL); - if (GlobalConfig.Timezone != 0xFF) { - INT32 NowHour = Now.Hour + GlobalConfig.Timezone; - if (NowHour < 0 ) NowHour += 24; - if (NowHour >= 24 ) NowHour -= 24; - Daylight = (NowHour > 8) && (NowHour < 20); //this is the screen member - } else { - Daylight = true; - } - Status = WaitForInputEventPoll(1); //wait for 1 seconds. if (Status == EFI_TIMEOUT) { if (HaveTimeout) {