Fix white flash on Notepad++ startup in darkmode issue

Fix #3955, fix #10601, close #10639
This commit is contained in:
Ashfaaq18 2021-10-09 02:42:11 +05:30 committed by Don Ho
parent d692b5060f
commit 35e3fb9688
1 changed files with 10 additions and 0 deletions

View File

@ -141,6 +141,16 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
::SetWindowPlacement(_hSelf,&posInfo);
}
//when npp starts up in dark mode, draw dark background to client area temporarily.
if (NppDarkMode::isEnabled())
{
RECT windowClientArea;
HDC hdc = GetDCEx(_hSelf, NULL, DCX_CACHE | DCX_LOCKWINDOWUPDATE); //lock window update flag due to line 36 and 111 in this file
GetClientRect(_hSelf, &windowClientArea);
FillRect(hdc, &windowClientArea, CreateSolidBrush(NppDarkMode::getBackgroundColor()));
ReleaseDC(_hSelf, hdc);
}
if ((nppGUI._tabStatus & TAB_MULTILINE) != 0)
::SendMessage(_hSelf, WM_COMMAND, IDM_VIEW_DRAWTABBAR_MULTILINE, 0);