[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,36 +75,40 @@ HSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
hdwp = BeginDeferWindowPos(3); hdwp = BeginDeferWindowPos(3);
/* Size HSplitBar */ /* Size HSplitBar */
DeferWindowPos(hdwp, if (hdwp)
hHSplitter, hdwp = DeferWindowPos(hdwp,
0, hHSplitter,
GetWindowWidth(hTreeView) + SPLIT_WIDTH, 0,
Point.y, GetWindowWidth(hTreeView) + SPLIT_WIDTH,
Width, Point.y,
SPLIT_WIDTH, Width,
SWP_NOZORDER|SWP_NOACTIVATE); SPLIT_WIDTH,
SWP_NOZORDER|SWP_NOACTIVATE);
/* Size ListView */ /* Size ListView */
DeferWindowPos(hdwp, if (hdwp)
hListView, hdwp = DeferWindowPos(hdwp,
0, hListView,
GetWindowWidth(hTreeView) + SPLIT_WIDTH, 0,
GetWindowHeight(hToolBar), GetWindowWidth(hTreeView) + SPLIT_WIDTH,
Width, GetWindowHeight(hToolBar),
Point.y - GetWindowHeight(hToolBar), Width,
SWP_NOZORDER|SWP_NOACTIVATE); Point.y - GetWindowHeight(hToolBar),
SWP_NOZORDER|SWP_NOACTIVATE);
/* Size RichEdit */ /* Size RichEdit */
DeferWindowPos(hdwp, if (hdwp)
hRichEdit, hdwp = DeferWindowPos(hdwp,
0, hRichEdit,
GetWindowWidth(hTreeView) + SPLIT_WIDTH, 0,
Point.y + SPLIT_WIDTH, GetWindowWidth(hTreeView) + SPLIT_WIDTH,
Width, Point.y + SPLIT_WIDTH,
GetClientWindowHeight(hMainWnd) - (Point.y + SPLIT_WIDTH + GetWindowHeight(hStatusBar)), Width,
SWP_NOZORDER|SWP_NOACTIVATE); GetClientWindowHeight(hMainWnd) - (Point.y + SPLIT_WIDTH + GetWindowHeight(hStatusBar)),
SWP_NOZORDER|SWP_NOACTIVATE);
EndDeferWindowPos(hdwp); if (hdwp)
EndDeferWindowPos(hdwp);
} }
break; break;
} }
@ -192,54 +196,60 @@ VSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
hdwp = BeginDeferWindowPos(5); hdwp = BeginDeferWindowPos(5);
/* Size VSplitBar */ /* Size VSplitBar */
DeferWindowPos(hdwp, if (hdwp)
hwnd, hdwp = DeferWindowPos(hdwp,
0, hwnd,
Point.x, 0,
GetWindowHeight(hToolBar), Point.x,
SPLIT_WIDTH, GetWindowHeight(hToolBar),
GetClientWindowHeight(hMainWnd) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar), SPLIT_WIDTH,
SWP_NOZORDER|SWP_NOACTIVATE); GetClientWindowHeight(hMainWnd) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar),
SWP_NOZORDER|SWP_NOACTIVATE);
/* Size TreeView */ /* Size TreeView */
DeferWindowPos(hdwp, if (hdwp)
hTreeView, hdwp = DeferWindowPos(hdwp,
0, hTreeView,
0, 0,
GetWindowHeight(hToolBar), 0,
Point.x, GetWindowHeight(hToolBar),
GetClientWindowHeight(hMainWnd) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar), Point.x,
SWP_NOZORDER|SWP_NOACTIVATE); GetClientWindowHeight(hMainWnd) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar),
SWP_NOZORDER|SWP_NOACTIVATE);
/* Size ListView */ /* Size ListView */
DeferWindowPos(hdwp, if (hdwp)
hListView, hdwp = DeferWindowPos(hdwp,
0, hListView,
Point.x + SPLIT_WIDTH, 0,
GetWindowHeight(hToolBar), Point.x + SPLIT_WIDTH,
GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH), GetWindowHeight(hToolBar),
GetHSplitterPos() - GetWindowHeight(hToolBar), GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH),
SWP_NOZORDER|SWP_NOACTIVATE); GetHSplitterPos() - GetWindowHeight(hToolBar),
SWP_NOZORDER|SWP_NOACTIVATE);
DeferWindowPos(hdwp, if (hdwp)
hRichEdit, hdwp = DeferWindowPos(hdwp,
0, hRichEdit,
Point.x + SPLIT_WIDTH, 0,
GetHSplitterPos() + SPLIT_WIDTH, Point.x + SPLIT_WIDTH,
GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH), GetHSplitterPos() + SPLIT_WIDTH,
GetClientWindowHeight(hMainWnd) - (GetHSplitterPos() + SPLIT_WIDTH + GetWindowHeight(hStatusBar)), GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH),
SWP_NOZORDER|SWP_NOACTIVATE); GetClientWindowHeight(hMainWnd) - (GetHSplitterPos() + SPLIT_WIDTH + GetWindowHeight(hStatusBar)),
SWP_NOZORDER|SWP_NOACTIVATE);
DeferWindowPos(hdwp, if (hdwp)
hHSplitter, hdwp = DeferWindowPos(hdwp,
0, hHSplitter,
Point.x + SPLIT_WIDTH, 0,
GetHSplitterPos(), Point.x + SPLIT_WIDTH,
GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH), GetHSplitterPos(),
SPLIT_WIDTH, GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH),
SWP_NOZORDER|SWP_NOACTIVATE); SPLIT_WIDTH,
SWP_NOZORDER|SWP_NOACTIVATE);
EndDeferWindowPos(hdwp); if (hdwp)
EndDeferWindowPos(hdwp);
} }
break; break;
} }

View file

@ -517,24 +517,26 @@ MainWndOnSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
*/ */
/* Size vertical splitter bar */ /* Size vertical splitter bar */
DeferWindowPos(hdwp, if (hdwp)
hVSplitter, hdwp = DeferWindowPos(hdwp,
0, hVSplitter,
(VSplitterPos = GetWindowWidth(hTreeView)), 0,
GetWindowHeight(hToolBar), (VSplitterPos = GetWindowWidth(hTreeView)),
SPLIT_WIDTH, GetWindowHeight(hToolBar),
HIWORD(lParam) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar), SPLIT_WIDTH,
SWP_NOZORDER|SWP_NOACTIVATE); HIWORD(lParam) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar),
SWP_NOZORDER|SWP_NOACTIVATE);
/* Size TreeView */ /* Size TreeView */
DeferWindowPos(hdwp, if (hdwp)
hTreeView, hdwp = DeferWindowPos(hdwp,
0, hTreeView,
0, 0,
GetWindowHeight(hToolBar), 0,
VSplitterPos, GetWindowHeight(hToolBar),
HIWORD(lParam) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar), VSplitterPos,
SWP_NOZORDER|SWP_NOACTIVATE); HIWORD(lParam) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar),
SWP_NOZORDER|SWP_NOACTIVATE);
if(wParam != SIZE_MINIMIZED) if(wParam != SIZE_MINIMIZED)
{ {
@ -548,36 +550,40 @@ MainWndOnSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
SetHSplitterPos(NewPos); SetHSplitterPos(NewPos);
/* Size ListView */ /* Size ListView */
DeferWindowPos(hdwp, if (hdwp)
hListView, hdwp = DeferWindowPos(hdwp,
0, hListView,
VSplitterPos + SPLIT_WIDTH, 0,
GetWindowHeight(hToolBar), VSplitterPos + SPLIT_WIDTH,
LOWORD(lParam) - (VSplitterPos + SPLIT_WIDTH), GetWindowHeight(hToolBar),
GetHSplitterPos() - GetWindowHeight(hToolBar), LOWORD(lParam) - (VSplitterPos + SPLIT_WIDTH),
SWP_NOZORDER|SWP_NOACTIVATE); GetHSplitterPos() - GetWindowHeight(hToolBar),
SWP_NOZORDER|SWP_NOACTIVATE);
/* Size RichEdit */ /* Size RichEdit */
DeferWindowPos(hdwp, if (hdwp)
hRichEdit, hdwp = DeferWindowPos(hdwp,
0, hRichEdit,
VSplitterPos + SPLIT_WIDTH, 0,
GetHSplitterPos() + SPLIT_WIDTH, VSplitterPos + SPLIT_WIDTH,
LOWORD(lParam) - (VSplitterPos + SPLIT_WIDTH), GetHSplitterPos() + SPLIT_WIDTH,
RichPos, LOWORD(lParam) - (VSplitterPos + SPLIT_WIDTH),
SWP_NOZORDER|SWP_NOACTIVATE); RichPos,
SWP_NOZORDER|SWP_NOACTIVATE);
/* Size horizontal splitter bar */ /* Size horizontal splitter bar */
DeferWindowPos(hdwp, if (hdwp)
hHSplitter, hdwp = DeferWindowPos(hdwp,
0, hHSplitter,
VSplitterPos + SPLIT_WIDTH, 0,
GetHSplitterPos(), VSplitterPos + SPLIT_WIDTH,
LOWORD(lParam) - (VSplitterPos + SPLIT_WIDTH), GetHSplitterPos(),
SPLIT_WIDTH, LOWORD(lParam) - (VSplitterPos + SPLIT_WIDTH),
SWP_NOZORDER|SWP_NOACTIVATE); SPLIT_WIDTH,
SWP_NOZORDER|SWP_NOACTIVATE);
EndDeferWindowPos(hdwp); if (hdwp)
EndDeferWindowPos(hdwp);
} }
BOOL IsSelectedNodeInstalled(void) BOOL IsSelectedNodeInstalled(void)

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,36 +75,40 @@ HSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
hdwp = BeginDeferWindowPos(3); hdwp = BeginDeferWindowPos(3);
/* Size HSplitBar */ /* Size HSplitBar */
DeferWindowPos(hdwp, if (hdwp)
hHSplitter, hdwp = DeferWindowPos(hdwp,
0, hHSplitter,
GetWindowWidth(hTreeView) + SPLIT_WIDTH, 0,
Point.y, GetWindowWidth(hTreeView) + SPLIT_WIDTH,
Width, Point.y,
SPLIT_WIDTH, Width,
SWP_NOZORDER|SWP_NOACTIVATE); SPLIT_WIDTH,
SWP_NOZORDER|SWP_NOACTIVATE);
/* Size ListView */ /* Size ListView */
DeferWindowPos(hdwp, if (hdwp)
hListView, hdwp = DeferWindowPos(hdwp,
0, hListView,
GetWindowWidth(hTreeView) + SPLIT_WIDTH, 0,
GetWindowHeight(hToolBar), GetWindowWidth(hTreeView) + SPLIT_WIDTH,
Width, GetWindowHeight(hToolBar),
Point.y - GetWindowHeight(hToolBar), Width,
SWP_NOZORDER|SWP_NOACTIVATE); Point.y - GetWindowHeight(hToolBar),
SWP_NOZORDER|SWP_NOACTIVATE);
/* Size RichEdit */ /* Size RichEdit */
DeferWindowPos(hdwp, if (hdwp)
hRichEdit, hdwp = DeferWindowPos(hdwp,
0, hRichEdit,
GetWindowWidth(hTreeView) + SPLIT_WIDTH, 0,
Point.y + SPLIT_WIDTH, GetWindowWidth(hTreeView) + SPLIT_WIDTH,
Width, Point.y + SPLIT_WIDTH,
GetClientWindowHeight(hMainWnd) - (Point.y + SPLIT_WIDTH + GetWindowHeight(hStatusBar)), Width,
SWP_NOZORDER|SWP_NOACTIVATE); GetClientWindowHeight(hMainWnd) - (Point.y + SPLIT_WIDTH + GetWindowHeight(hStatusBar)),
SWP_NOZORDER|SWP_NOACTIVATE);
EndDeferWindowPos(hdwp); if (hdwp)
EndDeferWindowPos(hdwp);
} }
break; break;
} }
@ -192,54 +196,60 @@ VSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
hdwp = BeginDeferWindowPos(5); hdwp = BeginDeferWindowPos(5);
/* Size VSplitBar */ /* Size VSplitBar */
DeferWindowPos(hdwp, if (hdwp)
hwnd, hdwp = DeferWindowPos(hdwp,
0, hwnd,
Point.x, 0,
GetWindowHeight(hToolBar), Point.x,
SPLIT_WIDTH, GetWindowHeight(hToolBar),
GetClientWindowHeight(hMainWnd) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar), SPLIT_WIDTH,
SWP_NOZORDER|SWP_NOACTIVATE); GetClientWindowHeight(hMainWnd) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar),
SWP_NOZORDER|SWP_NOACTIVATE);
/* Size TreeView */ /* Size TreeView */
DeferWindowPos(hdwp, if (hdwp)
hTreeView, hdwp = DeferWindowPos(hdwp,
0, hTreeView,
0, 0,
GetWindowHeight(hToolBar), 0,
Point.x, GetWindowHeight(hToolBar),
GetClientWindowHeight(hMainWnd) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar), Point.x,
SWP_NOZORDER|SWP_NOACTIVATE); GetClientWindowHeight(hMainWnd) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar),
SWP_NOZORDER|SWP_NOACTIVATE);
/* Size ListView */ /* Size ListView */
DeferWindowPos(hdwp, if (hdwp)
hListView, hdwp = DeferWindowPos(hdwp,
0, hListView,
Point.x + SPLIT_WIDTH, 0,
GetWindowHeight(hToolBar), Point.x + SPLIT_WIDTH,
GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH), GetWindowHeight(hToolBar),
GetHSplitterPos() - GetWindowHeight(hToolBar), GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH),
SWP_NOZORDER|SWP_NOACTIVATE); GetHSplitterPos() - GetWindowHeight(hToolBar),
SWP_NOZORDER|SWP_NOACTIVATE);
DeferWindowPos(hdwp, if (hdwp)
hRichEdit, hdwp = DeferWindowPos(hdwp,
0, hRichEdit,
Point.x + SPLIT_WIDTH, 0,
GetHSplitterPos() + SPLIT_WIDTH, Point.x + SPLIT_WIDTH,
GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH), GetHSplitterPos() + SPLIT_WIDTH,
GetClientWindowHeight(hMainWnd) - (GetHSplitterPos() + SPLIT_WIDTH + GetWindowHeight(hStatusBar)), GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH),
SWP_NOZORDER|SWP_NOACTIVATE); GetClientWindowHeight(hMainWnd) - (GetHSplitterPos() + SPLIT_WIDTH + GetWindowHeight(hStatusBar)),
SWP_NOZORDER|SWP_NOACTIVATE);
DeferWindowPos(hdwp, if (hdwp)
hHSplitter, hdwp = DeferWindowPos(hdwp,
0, hHSplitter,
Point.x + SPLIT_WIDTH, 0,
GetHSplitterPos(), Point.x + SPLIT_WIDTH,
GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH), GetHSplitterPos(),
SPLIT_WIDTH, GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH),
SWP_NOZORDER|SWP_NOACTIVATE); SPLIT_WIDTH,
SWP_NOZORDER|SWP_NOACTIVATE);
EndDeferWindowPos(hdwp); if (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);
} }
/******************************************************************************* /*******************************************************************************