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

View file

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

View file

@ -600,14 +600,14 @@ private:
int count = m_ClientPanel->CountSizableChildren();
hdwp = BeginDeferWindowPos(count);
hdwp = m_ClientPanel->OnParentSize(r, hdwp);
EndDeferWindowPos(hdwp);
if (hdwp) hdwp = m_ClientPanel->OnParentSize(r, hdwp);
if (hdwp) EndDeferWindowPos(hdwp);
// TODO: Sub-layouts for children of children
count = m_SearchBar->CountSizableChildren();
hdwp = BeginDeferWindowPos(count);
hdwp = m_SearchBar->OnParentSize(r, hdwp);
EndDeferWindowPos(hdwp);
if (hdwp) hdwp = m_SearchBar->OnParentSize(r, hdwp);
if (hdwp) EndDeferWindowPos(hdwp);
}
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 = BeginDeferWindowPos(count);
hdwp = OnParentSize(m_LastRect, hdwp);
EndDeferWindowPos(hdwp);
if (hdwp) hdwp = OnParentSize(m_LastRect, hdwp);
if (hdwp) EndDeferWindowPos(hdwp);
}
public:

View file

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

View file

@ -52,11 +52,11 @@ extern void ResizeWnd(int cx, int cy)
}
GetWindowRect(g_pChildWnd->hAddressBtnWnd, &rb);
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);
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);
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) hdwp = 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->hAddressBtnWnd, 0, rt.right - 2*tHeight, rt.top, 2*tHeight, tHeight, 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);
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);
if (hdwp) EndDeferWindowPos(hdwp);
}
/*******************************************************************************