Skip to content

Commit 7d7a73c

Browse files
authored
Merge pull request #1219 from MarceloAlejandroJorquera/fix/tray-restore-white-area
Fix white area when restoring from tray
2 parents c1d3f2e + 4102bfc commit 7d7a73c

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

src/apps/mplayerc/MainFrm.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5752,9 +5752,35 @@ LRESULT CMainFrame::OnRestore(WPARAM wParam, LPARAM lParam)
57525752
{
57535753
if (m_bTrayIcon) {
57545754
if (!IsWindowVisible()) {
5755+
// Rebuild the frame/view layout before exposing the hidden window.
5756+
RecalcLayout();
5757+
5758+
// Keep the frame compositor-cloaked on Windows 8+ until its final child
5759+
// layout and renderer destination have been painted.
5760+
bool bCloakedForRestore = false;
5761+
if (SysVersion::IsWin8orLater()) {
5762+
const BOOL bCloak = TRUE;
5763+
bCloakedForRestore = SUCCEEDED(DwmSetWindowAttribute(
5764+
m_hWnd, DWMWA_CLOAK, &bCloak, sizeof(bCloak)));
5765+
}
5766+
57555767
ShowWindow(SW_SHOW);
5768+
5769+
// Showing the frame can change the effective client metrics.
5770+
RecalcLayout();
5771+
MoveVideoWindow(false, true);
5772+
RepaintVideo(true);
5773+
RedrawWindow(nullptr, nullptr,
5774+
RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN | RDW_UPDATENOW);
5775+
5776+
if (bCloakedForRestore) {
5777+
// Present only the completed frame, never the intermediate restore state.
5778+
DwmFlush();
5779+
const BOOL bCloak = FALSE;
5780+
DwmSetWindowAttribute(m_hWnd, DWMWA_CLOAK, &bCloak, sizeof(bCloak));
5781+
}
5782+
57565783
CreateThumbnailToolbar();
5757-
MoveVideoWindow();
57585784
SetForegroundWindow();
57595785

57605786
for (const auto& pDockingBar : m_dockingbarsVisible) {

0 commit comments

Comments
 (0)