4545#include " DPIAware.h"
4646#include " Monitor.h"
4747#include " ResString.h"
48+ #include " AutoCloakWindow.h"
4849#include " ../ext/tinyexpr/tinyexpr.h"
4950
5051#include < memory>
@@ -632,13 +633,9 @@ bool CMainWindow::RegisterAndCreateWindow()
632633 // monitor but that monitor is not connected now).
633634 if (CreateEx (WS_EX_ACCEPTFILES | WS_EX_NOINHERITLAYOUT, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, nullptr ))
634635 {
636+ CAutoCloakWindow autoCloak (*this );
637+
635638 SetFileTreeWidth (static_cast <int >(CIniSettings::Instance ().GetInt64 (L" View" , L" FileTreeWidth" , 200 )));
636- // hide the tab and status bar so they won't show right away when
637- // restoring the window: those two show a white background until properly painted.
638- // After restoring and showing the main window, ResizeChildControls() is called
639- // which will show those controls again.
640- ShowWindow (m_tabBar, SW_HIDE);
641- ShowWindow (m_statusBar, SW_HIDE);
642639 std::wstring winPosKey = L" MainWindow_" + GetMonitorSetupHash ();
643640 CIniSettings::Instance ().RestoreWindowPos (winPosKey.c_str (), *this , 0 );
644641 UpdateWindow (*this );
@@ -1878,11 +1875,7 @@ void CMainWindow::ResizeChildWindows()
18781875{
18791876 RECT rect;
18801877 GetClientRect (*this , &rect);
1881- // if the main window is not visible (yet) or the UI is blocked,
1882- // then don't resize the child controls.
1883- // as soon as the UI is unblocked, ResizeChildWindows() is called
1884- // again.
1885- if (!IsRectEmpty (&rect) && IsWindowVisible (*this ))
1878+ if (!IsRectEmpty (&rect) )
18861879 {
18871880 constexpr UINT flags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOCOPYBITS;
18881881 constexpr UINT noShowFlags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOCOPYBITS;
@@ -1900,6 +1893,8 @@ void CMainWindow::ResizeChildWindows()
19001893 const int mainWidth = rect.right - rect.left ;
19011894 const int btnMargin = CDPIAware::Instance ().Scale (*this , 2 );
19021895
1896+ OutputDebugString ((L" ResizeChildWindows: " + std::to_wstring (treeWidth) + L" " + std::to_wstring (mainWidth) + L" \n " ).c_str ());
1897+
19031898 HDWP hDwp = BeginDeferWindowPos (7 );
19041899 DeferWindowPos (hDwp, m_statusBar, nullptr , rect.left , rect.bottom - m_statusBar.GetHeight (), mainWidth, m_statusBar.GetHeight (), flags);
19051900 DeferWindowPos (hDwp, m_tabBar, nullptr , treeWidth + rect.left , rect.top + m_ribbonHeight, mainWidth - treeWidth - (3 * (tabBtnWidth + btnMargin)) - btnMargin, rect.bottom - rect.top , flags);
@@ -2321,7 +2316,7 @@ void CMainWindow::UpdateStatusBar(bool bEverything)
23212316 }
23222317 else
23232318 {
2324- auto text = selByte ? CStringUtils::Format (rsStatusSelectionLong, numberColor, sSelByte .c_str (), numberColor, sSelLine .c_str (), (selTextMarkerCount ? 0x008000 : numberColor), sSelTextMarkerCount .c_str ()) : sNoSel ;
2319+ auto text = selByte ? CStringUtils::Format (rsStatusSelectionLong, numberColor, sSelByte .c_str (), numberColor, sSelLine .c_str (), (selTextMarkerCount ? 0x008000 : numberColor), sSelTextMarkerCount .c_str ()) : sNoSel ;
23252320 auto shortText = selByte ? CStringUtils::Format (rsStatusSelection, numberColor, sSelByte .c_str (), numberColor, sSelLine .c_str (), (selTextMarkerCount ? 0x008000 : numberColor), sSelTextMarkerCount .c_str ()) : sNoSel ;
23262321 m_statusBar.SetPart (STATUSBAR_SEL,
23272322 text,
@@ -4805,10 +4800,16 @@ void CMainWindow::OpenFiles(const std::vector<std::wstring>& paths)
48054800
48064801void CMainWindow::BlockAllUIUpdates (bool block)
48074802{
4803+ std::vector<HWND> windows = {m_fileTree, m_statusBar};
48084804 if (block)
48094805 {
48104806 if (m_blockCount == 0 )
4811- SendMessage (*this , WM_SETREDRAW, FALSE , 0 );
4807+ {
4808+ // don't block the main window, because WM_SETREDRAW with FALSE actually sets the WS_VISIBLE flag to false!
4809+ // Which for a main window means that the taskbar representation gets drawn empty.
4810+ for (auto window : windows)
4811+ SendMessage (window, WM_SETREDRAW, FALSE , 0 );
4812+ }
48124813 FileTreeBlockRefresh (block);
48134814 ++m_blockCount;
48144815 }
@@ -4819,11 +4820,12 @@ void CMainWindow::BlockAllUIUpdates(bool block)
48194820 if (m_blockCount == 0 )
48204821 {
48214822 // unblock
4822- SendMessage (*this , WM_SETREDRAW, TRUE , 0 );
4823+ for (auto window : windows)
4824+ SendMessage (window, WM_SETREDRAW, TRUE , 0 );
48234825 // force a redraw
48244826 RedrawWindow (*this , nullptr , nullptr , RDW_INVALIDATE | RDW_ERASE | RDW_INTERNALPAINT | RDW_ALLCHILDREN | RDW_UPDATENOW);
48254827 }
4826- // FileTreeBlockRefresh maintains it's own count.
4828+ // FileTreeBlockRefresh maintains its own count.
48274829 FileTreeBlockRefresh (block);
48284830 if (m_blockCount == 0 )
48294831 ResizeChildWindows ();
0 commit comments