[RAPPS(_new)][REGEDIT]: Fix our usage of (Begin)DeferWindowPos. See https://blogs.msdn.microsoft.com/oldnewthing/20050706-26/?p=35023 for more details.

svn path=/trunk/; revision=71827
This commit is contained in:
Hermès Bélusca-Maïto 2016-07-05 21:30:44 +00:00
parent 8d68884908
commit 385c44897b
6 changed files with 210 additions and 184 deletions

View file

@ -75,7 +75,8 @@ HSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
hdwp = BeginDeferWindowPos(3); hdwp = BeginDeferWindowPos(3);
/* Size HSplitBar */ /* Size HSplitBar */
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hHSplitter, hHSplitter,
0, 0,
GetWindowWidth(hTreeView) + SPLIT_WIDTH, GetWindowWidth(hTreeView) + SPLIT_WIDTH,
@ -85,7 +86,8 @@ HSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
/* Size ListView */ /* Size ListView */
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hListView, hListView,
0, 0,
GetWindowWidth(hTreeView) + SPLIT_WIDTH, GetWindowWidth(hTreeView) + SPLIT_WIDTH,
@ -95,7 +97,8 @@ HSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
/* Size RichEdit */ /* Size RichEdit */
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hRichEdit, hRichEdit,
0, 0,
GetWindowWidth(hTreeView) + SPLIT_WIDTH, GetWindowWidth(hTreeView) + SPLIT_WIDTH,
@ -104,6 +107,7 @@ HSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
GetClientWindowHeight(hMainWnd) - (Point.y + SPLIT_WIDTH + GetWindowHeight(hStatusBar)), GetClientWindowHeight(hMainWnd) - (Point.y + SPLIT_WIDTH + GetWindowHeight(hStatusBar)),
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
if (hdwp)
EndDeferWindowPos(hdwp); EndDeferWindowPos(hdwp);
} }
break; break;
@ -192,7 +196,8 @@ VSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
hdwp = BeginDeferWindowPos(5); hdwp = BeginDeferWindowPos(5);
/* Size VSplitBar */ /* Size VSplitBar */
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hwnd, hwnd,
0, 0,
Point.x, Point.x,
@ -202,7 +207,8 @@ VSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
/* Size TreeView */ /* Size TreeView */
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hTreeView, hTreeView,
0, 0,
0, 0,
@ -212,7 +218,8 @@ VSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
/* Size ListView */ /* Size ListView */
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hListView, hListView,
0, 0,
Point.x + SPLIT_WIDTH, Point.x + SPLIT_WIDTH,
@ -221,7 +228,8 @@ VSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
GetHSplitterPos() - GetWindowHeight(hToolBar), GetHSplitterPos() - GetWindowHeight(hToolBar),
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hRichEdit, hRichEdit,
0, 0,
Point.x + SPLIT_WIDTH, Point.x + SPLIT_WIDTH,
@ -230,7 +238,8 @@ VSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
GetClientWindowHeight(hMainWnd) - (GetHSplitterPos() + SPLIT_WIDTH + GetWindowHeight(hStatusBar)), GetClientWindowHeight(hMainWnd) - (GetHSplitterPos() + SPLIT_WIDTH + GetWindowHeight(hStatusBar)),
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hHSplitter, hHSplitter,
0, 0,
Point.x + SPLIT_WIDTH, Point.x + SPLIT_WIDTH,
@ -239,6 +248,7 @@ VSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
SPLIT_WIDTH, SPLIT_WIDTH,
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
if (hdwp)
EndDeferWindowPos(hdwp); EndDeferWindowPos(hdwp);
} }
break; break;

View file

@ -517,7 +517,8 @@ MainWndOnSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
*/ */
/* Size vertical splitter bar */ /* Size vertical splitter bar */
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hVSplitter, hVSplitter,
0, 0,
(VSplitterPos = GetWindowWidth(hTreeView)), (VSplitterPos = GetWindowWidth(hTreeView)),
@ -527,7 +528,8 @@ MainWndOnSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
/* Size TreeView */ /* Size TreeView */
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hTreeView, hTreeView,
0, 0,
0, 0,
@ -548,7 +550,8 @@ MainWndOnSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
SetHSplitterPos(NewPos); SetHSplitterPos(NewPos);
/* Size ListView */ /* Size ListView */
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hListView, hListView,
0, 0,
VSplitterPos + SPLIT_WIDTH, VSplitterPos + SPLIT_WIDTH,
@ -558,7 +561,8 @@ MainWndOnSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
/* Size RichEdit */ /* Size RichEdit */
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hRichEdit, hRichEdit,
0, 0,
VSplitterPos + SPLIT_WIDTH, VSplitterPos + SPLIT_WIDTH,
@ -568,7 +572,8 @@ MainWndOnSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
/* Size horizontal splitter bar */ /* Size horizontal splitter bar */
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hHSplitter, hHSplitter,
0, 0,
VSplitterPos + SPLIT_WIDTH, VSplitterPos + SPLIT_WIDTH,
@ -577,6 +582,7 @@ MainWndOnSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
SPLIT_WIDTH, SPLIT_WIDTH,
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
if (hdwp)
EndDeferWindowPos(hdwp); EndDeferWindowPos(hdwp);
} }

View file

@ -600,14 +600,14 @@ private:
int count = m_ClientPanel->CountSizableChildren(); int count = m_ClientPanel->CountSizableChildren();
hdwp = BeginDeferWindowPos(count); hdwp = BeginDeferWindowPos(count);
hdwp = m_ClientPanel->OnParentSize(r, hdwp); if (hdwp) hdwp = m_ClientPanel->OnParentSize(r, hdwp);
EndDeferWindowPos(hdwp); if (hdwp) EndDeferWindowPos(hdwp);
// TODO: Sub-layouts for children of children // TODO: Sub-layouts for children of children
count = m_SearchBar->CountSizableChildren(); count = m_SearchBar->CountSizableChildren();
hdwp = BeginDeferWindowPos(count); hdwp = BeginDeferWindowPos(count);
hdwp = m_SearchBar->OnParentSize(r, hdwp); if (hdwp) hdwp = m_SearchBar->OnParentSize(r, hdwp);
EndDeferWindowPos(hdwp); if (hdwp) EndDeferWindowPos(hdwp);
} }
BOOL ProcessWindowMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT& theResult, DWORD dwMapId) BOOL ProcessWindowMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT& theResult, DWORD dwMapId)

View file

@ -769,8 +769,8 @@ public:
HDWP hdwp = NULL; HDWP hdwp = NULL;
hdwp = BeginDeferWindowPos(count); hdwp = BeginDeferWindowPos(count);
hdwp = OnParentSize(m_LastRect, hdwp); if (hdwp) hdwp = OnParentSize(m_LastRect, hdwp);
EndDeferWindowPos(hdwp); if (hdwp) EndDeferWindowPos(hdwp);
} }
public: public:

View file

@ -75,7 +75,8 @@ HSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
hdwp = BeginDeferWindowPos(3); hdwp = BeginDeferWindowPos(3);
/* Size HSplitBar */ /* Size HSplitBar */
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hHSplitter, hHSplitter,
0, 0,
GetWindowWidth(hTreeView) + SPLIT_WIDTH, GetWindowWidth(hTreeView) + SPLIT_WIDTH,
@ -85,7 +86,8 @@ HSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
/* Size ListView */ /* Size ListView */
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hListView, hListView,
0, 0,
GetWindowWidth(hTreeView) + SPLIT_WIDTH, GetWindowWidth(hTreeView) + SPLIT_WIDTH,
@ -95,7 +97,8 @@ HSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
/* Size RichEdit */ /* Size RichEdit */
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hRichEdit, hRichEdit,
0, 0,
GetWindowWidth(hTreeView) + SPLIT_WIDTH, GetWindowWidth(hTreeView) + SPLIT_WIDTH,
@ -104,6 +107,7 @@ HSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
GetClientWindowHeight(hMainWnd) - (Point.y + SPLIT_WIDTH + GetWindowHeight(hStatusBar)), GetClientWindowHeight(hMainWnd) - (Point.y + SPLIT_WIDTH + GetWindowHeight(hStatusBar)),
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
if (hdwp)
EndDeferWindowPos(hdwp); EndDeferWindowPos(hdwp);
} }
break; break;
@ -192,7 +196,8 @@ VSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
hdwp = BeginDeferWindowPos(5); hdwp = BeginDeferWindowPos(5);
/* Size VSplitBar */ /* Size VSplitBar */
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hwnd, hwnd,
0, 0,
Point.x, Point.x,
@ -202,7 +207,8 @@ VSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
/* Size TreeView */ /* Size TreeView */
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hTreeView, hTreeView,
0, 0,
0, 0,
@ -212,7 +218,8 @@ VSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
/* Size ListView */ /* Size ListView */
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hListView, hListView,
0, 0,
Point.x + SPLIT_WIDTH, Point.x + SPLIT_WIDTH,
@ -221,7 +228,8 @@ VSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
GetHSplitterPos() - GetWindowHeight(hToolBar), GetHSplitterPos() - GetWindowHeight(hToolBar),
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hRichEdit, hRichEdit,
0, 0,
Point.x + SPLIT_WIDTH, Point.x + SPLIT_WIDTH,
@ -230,7 +238,8 @@ VSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
GetClientWindowHeight(hMainWnd) - (GetHSplitterPos() + SPLIT_WIDTH + GetWindowHeight(hStatusBar)), GetClientWindowHeight(hMainWnd) - (GetHSplitterPos() + SPLIT_WIDTH + GetWindowHeight(hStatusBar)),
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
DeferWindowPos(hdwp, if (hdwp)
hdwp = DeferWindowPos(hdwp,
hHSplitter, hHSplitter,
0, 0,
Point.x + SPLIT_WIDTH, Point.x + SPLIT_WIDTH,
@ -239,6 +248,7 @@ VSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
SPLIT_WIDTH, SPLIT_WIDTH,
SWP_NOZORDER|SWP_NOACTIVATE); SWP_NOZORDER|SWP_NOACTIVATE);
if (hdwp)
EndDeferWindowPos(hdwp); EndDeferWindowPos(hdwp);
} }
break; break;

View file

@ -52,11 +52,11 @@ extern void ResizeWnd(int cx, int cy)
} }
GetWindowRect(g_pChildWnd->hAddressBtnWnd, &rb); GetWindowRect(g_pChildWnd->hAddressBtnWnd, &rb);
cx = g_pChildWnd->nSplitPos + SPLIT_WIDTH/2; cx = g_pChildWnd->nSplitPos + SPLIT_WIDTH/2;
DeferWindowPos(hdwp, g_pChildWnd->hAddressBarWnd, 0, rt.left, rt.top, rt.right-rt.left - 2*tHeight, tHeight, SWP_NOZORDER|SWP_NOACTIVATE); if (hdwp) hdwp = DeferWindowPos(hdwp, g_pChildWnd->hAddressBarWnd, 0, rt.left, rt.top, rt.right-rt.left - 2*tHeight, tHeight, SWP_NOZORDER|SWP_NOACTIVATE);
DeferWindowPos(hdwp, g_pChildWnd->hAddressBtnWnd, 0, rt.right - 2*tHeight, rt.top, 2*tHeight, tHeight, SWP_NOZORDER|SWP_NOACTIVATE); if (hdwp) hdwp = DeferWindowPos(hdwp, g_pChildWnd->hAddressBtnWnd, 0, rt.right - 2*tHeight, rt.top, 2*tHeight, tHeight, SWP_NOZORDER|SWP_NOACTIVATE);
DeferWindowPos(hdwp, g_pChildWnd->hTreeWnd, 0, rt.left, rt.top + tHeight+2, g_pChildWnd->nSplitPos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top-cy, SWP_NOZORDER|SWP_NOACTIVATE); if (hdwp) hdwp = DeferWindowPos(hdwp, g_pChildWnd->hTreeWnd, 0, rt.left, rt.top + tHeight+2, g_pChildWnd->nSplitPos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top-cy, SWP_NOZORDER|SWP_NOACTIVATE);
DeferWindowPos(hdwp, g_pChildWnd->hListWnd, 0, rt.left+cx, rt.top + tHeight+2, rt.right-cx, rt.bottom-rt.top-cy, SWP_NOZORDER|SWP_NOACTIVATE); if (hdwp) hdwp = DeferWindowPos(hdwp, g_pChildWnd->hListWnd, 0, rt.left+cx, rt.top + tHeight+2, rt.right-cx, rt.bottom-rt.top-cy, SWP_NOZORDER|SWP_NOACTIVATE);
EndDeferWindowPos(hdwp); if (hdwp) EndDeferWindowPos(hdwp);
} }
/******************************************************************************* /*******************************************************************************