[MSPAINT] Don't copy bits on resizing (#5716)

- Fix the graphical glitches on resizing and moving toolbars.
- Add SWP_NOCOPYBITS flag on positioning controls on resizing of main window.
CORE-19137
This commit is contained in:
Katayama Hirofumi MZ 2023-09-22 07:35:03 +09:00 committed by GitHub
parent 4661bc006d
commit 98050f9139
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,6 +77,7 @@ void CMainWindow::alignChildrenToMainWindow()
RECT clientRect, rc; RECT clientRect, rc;
GetClientRect(&clientRect); GetClientRect(&clientRect);
RECT rcSpace = clientRect; RECT rcSpace = clientRect;
const UINT uFlags = (SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREPOSITION | SWP_NOCOPYBITS);
if (::IsWindowVisible(g_hStatusBar)) if (::IsWindowVisible(g_hStatusBar))
{ {
@ -93,7 +94,7 @@ void CMainWindow::alignChildrenToMainWindow()
hDWP = ::DeferWindowPos(hDWP, toolBoxContainer, NULL, hDWP = ::DeferWindowPos(hDWP, toolBoxContainer, NULL,
rcSpace.right - CX_TOOLBAR, rcSpace.top, rcSpace.right - CX_TOOLBAR, rcSpace.top,
CX_TOOLBAR, rcSpace.bottom - rcSpace.top, CX_TOOLBAR, rcSpace.bottom - rcSpace.top,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREPOSITION); uFlags);
rcSpace.right -= CX_TOOLBAR; rcSpace.right -= CX_TOOLBAR;
} }
else else
@ -101,7 +102,7 @@ void CMainWindow::alignChildrenToMainWindow()
hDWP = ::DeferWindowPos(hDWP, toolBoxContainer, NULL, hDWP = ::DeferWindowPos(hDWP, toolBoxContainer, NULL,
rcSpace.left, rcSpace.top, rcSpace.left, rcSpace.top,
CX_TOOLBAR, rcSpace.bottom - rcSpace.top, CX_TOOLBAR, rcSpace.bottom - rcSpace.top,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREPOSITION); uFlags);
rcSpace.left += CX_TOOLBAR; rcSpace.left += CX_TOOLBAR;
} }
} }
@ -113,7 +114,7 @@ void CMainWindow::alignChildrenToMainWindow()
hDWP = ::DeferWindowPos(hDWP, paletteWindow, NULL, hDWP = ::DeferWindowPos(hDWP, paletteWindow, NULL,
rcSpace.left, rcSpace.bottom - CY_PALETTE, rcSpace.left, rcSpace.bottom - CY_PALETTE,
rcSpace.right - rcSpace.left, CY_PALETTE, rcSpace.right - rcSpace.left, CY_PALETTE,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREPOSITION); uFlags);
rcSpace.bottom -= CY_PALETTE; rcSpace.bottom -= CY_PALETTE;
} }
else else
@ -121,7 +122,7 @@ void CMainWindow::alignChildrenToMainWindow()
hDWP = ::DeferWindowPos(hDWP, paletteWindow, NULL, hDWP = ::DeferWindowPos(hDWP, paletteWindow, NULL,
rcSpace.left, rcSpace.top, rcSpace.left, rcSpace.top,
rcSpace.right - rcSpace.left, CY_PALETTE, rcSpace.right - rcSpace.left, CY_PALETTE,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREPOSITION); uFlags);
rcSpace.top += CY_PALETTE; rcSpace.top += CY_PALETTE;
} }
} }
@ -131,7 +132,7 @@ void CMainWindow::alignChildrenToMainWindow()
hDWP = ::DeferWindowPos(hDWP, canvasWindow, NULL, hDWP = ::DeferWindowPos(hDWP, canvasWindow, NULL,
rcSpace.left, rcSpace.top, rcSpace.left, rcSpace.top,
rcSpace.right - rcSpace.left, rcSpace.bottom - rcSpace.top, rcSpace.right - rcSpace.left, rcSpace.bottom - rcSpace.top,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREPOSITION); uFlags);
} }
::EndDeferWindowPos(hDWP); ::EndDeferWindowPos(hDWP);