Author: hbelusca Date: Tue Jul 5 21:30:44 2016 New Revision: 71827
URL: http://svn.reactos.org/svn/reactos?rev=71827&view=rev Log: [RAPPS(_new)][REGEDIT]: Fix our usage of (Begin)DeferWindowPos. See https://blogs.msdn.microsoft.com/oldnewthing/20050706-26/?p=35023 for more details.
Modified: trunk/reactos/base/applications/rapps/splitter.c trunk/reactos/base/applications/rapps/winmain.c trunk/reactos/base/applications/rapps_new/gui.cpp trunk/reactos/base/applications/rapps_new/rosui.h trunk/reactos/base/applications/rapps_new/splitter.cpp trunk/reactos/base/applications/regedit/childwnd.c
Modified: trunk/reactos/base/applications/rapps/splitter.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/spl... ============================================================================== --- trunk/reactos/base/applications/rapps/splitter.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/rapps/splitter.c [iso-8859-1] Tue Jul 5 21:30:44 2016 @@ -75,36 +75,40 @@ 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); - - EndDeferWindowPos(hdwp); + 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); + + if (hdwp) + EndDeferWindowPos(hdwp); } break; } @@ -192,54 +196,60 @@ 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); - - 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); - - EndDeferWindowPos(hdwp); + 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); + + 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); + + if (hdwp) + hdwp = DeferWindowPos(hdwp, + hHSplitter, + 0, + Point.x + SPLIT_WIDTH, + GetHSplitterPos(), + GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH), + SPLIT_WIDTH, + SWP_NOZORDER|SWP_NOACTIVATE); + + if (hdwp) + EndDeferWindowPos(hdwp); } break; }
Modified: trunk/reactos/base/applications/rapps/winmain.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/win... ============================================================================== --- trunk/reactos/base/applications/rapps/winmain.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/rapps/winmain.c [iso-8859-1] Tue Jul 5 21:30:44 2016 @@ -517,24 +517,26 @@ */
/* 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 @@ 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); - - EndDeferWindowPos(hdwp); + if (hdwp) + hdwp = DeferWindowPos(hdwp, + hHSplitter, + 0, + VSplitterPos + SPLIT_WIDTH, + GetHSplitterPos(), + LOWORD(lParam) - (VSplitterPos + SPLIT_WIDTH), + SPLIT_WIDTH, + SWP_NOZORDER|SWP_NOACTIVATE); + + if (hdwp) + EndDeferWindowPos(hdwp); }
BOOL IsSelectedNodeInstalled(void)
Modified: trunk/reactos/base/applications/rapps_new/gui.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_new... ============================================================================== --- trunk/reactos/base/applications/rapps_new/gui.cpp [iso-8859-1] (original) +++ trunk/reactos/base/applications/rapps_new/gui.cpp [iso-8859-1] Tue Jul 5 21:30:44 2016 @@ -600,14 +600,14 @@
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)
Modified: trunk/reactos/base/applications/rapps_new/rosui.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_new... ============================================================================== --- trunk/reactos/base/applications/rapps_new/rosui.h [iso-8859-1] (original) +++ trunk/reactos/base/applications/rapps_new/rosui.h [iso-8859-1] Tue Jul 5 21:30:44 2016 @@ -769,8 +769,8 @@
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:
Modified: trunk/reactos/base/applications/rapps_new/splitter.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_new... ============================================================================== --- trunk/reactos/base/applications/rapps_new/splitter.cpp [iso-8859-1] (original) +++ trunk/reactos/base/applications/rapps_new/splitter.cpp [iso-8859-1] Tue Jul 5 21:30:44 2016 @@ -75,36 +75,40 @@ 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); - - EndDeferWindowPos(hdwp); + 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); + + if (hdwp) + EndDeferWindowPos(hdwp); } break; } @@ -192,54 +196,60 @@ 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); - - 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); - - EndDeferWindowPos(hdwp); + 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); + + 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); + + if (hdwp) + hdwp = DeferWindowPos(hdwp, + hHSplitter, + 0, + Point.x + SPLIT_WIDTH, + GetHSplitterPos(), + GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH), + SPLIT_WIDTH, + SWP_NOZORDER|SWP_NOACTIVATE); + + if (hdwp) + EndDeferWindowPos(hdwp); } break; }
Modified: trunk/reactos/base/applications/regedit/childwnd.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/c... ============================================================================== --- trunk/reactos/base/applications/regedit/childwnd.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/regedit/childwnd.c [iso-8859-1] Tue Jul 5 21:30:44 2016 @@ -52,11 +52,11 @@ } 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); }
/*******************************************************************************