From e463be0ae5727198040eb9d004a0e40c56400a3b Mon Sep 17 00:00:00 2001 From: wj32 Date: Wed, 30 Jun 2010 12:11:47 +0000 Subject: [PATCH] fixed process properties layout bug (occurs after maximizing then restoring) git-svn-id: svn://svn.code.sf.net/p/processhacker/code@3252 21ef857c-d57f-4fe0-8362-d861dc6d29cd --- 2.x/trunk/ProcessHacker/procprp.c | 2 +- 2.x/trunk/phlib/guisup.c | 25 +++++++++++++++++++------ 2.x/trunk/phlib/include/phgui.h | 1 + 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/2.x/trunk/ProcessHacker/procprp.c b/2.x/trunk/ProcessHacker/procprp.c index fa3548332..0a58c41b9 100644 --- a/2.x/trunk/ProcessHacker/procprp.c +++ b/2.x/trunk/ProcessHacker/procprp.c @@ -280,7 +280,7 @@ BOOLEAN PhpInitializePropSheetLayoutStage1( tabControlHandle = PropSheet_GetTabControl(hwnd); tabControlItem = PhAddLayoutItem(layoutManager, tabControlHandle, - NULL, PH_ANCHOR_ALL); + NULL, PH_ANCHOR_ALL | PH_LAYOUT_IMMEDIATE_RESIZE); tabPageItem = PhAddLayoutItem(layoutManager, tabControlHandle, NULL, PH_LAYOUT_TAB_CONTROL); // dummy item to fix multiline tab control diff --git a/2.x/trunk/phlib/guisup.c b/2.x/trunk/phlib/guisup.c index b54259e8e..b2f77533e 100644 --- a/2.x/trunk/phlib/guisup.c +++ b/2.x/trunk/phlib/guisup.c @@ -828,12 +828,25 @@ VOID PhpLayoutItemLayout( PhConvertRect(&rect, &Item->LayoutParentItem->Rect); Item->Rect = rect; - Item->LayoutParentItem->DeferHandle = DeferWindowPos( - Item->LayoutParentItem->DeferHandle, Item->Handle, - NULL, rect.left, rect.top, - rect.right - rect.left, rect.bottom - rect.top, - SWP_NOACTIVATE | SWP_NOZORDER - ); + if (!(Item->Anchor & PH_LAYOUT_IMMEDIATE_RESIZE)) + { + Item->LayoutParentItem->DeferHandle = DeferWindowPos( + Item->LayoutParentItem->DeferHandle, Item->Handle, + NULL, rect.left, rect.top, + rect.right - rect.left, rect.bottom - rect.top, + SWP_NOACTIVATE | SWP_NOZORDER + ); + } + else + { + // This is needed for tab controls, so that TabCtrl_AdjustRect will give us an up-to-date result. + SetWindowPos( + Item->Handle, + NULL, rect.left, rect.top, + rect.right - rect.left, rect.bottom - rect.top, + SWP_NOACTIVATE | SWP_NOZORDER + ); + } } Item->LayoutNumber = Manager->LayoutNumber; diff --git a/2.x/trunk/phlib/include/phgui.h b/2.x/trunk/phlib/include/phgui.h index 6948e50b2..9c325b70b 100644 --- a/2.x/trunk/phlib/include/phgui.h +++ b/2.x/trunk/phlib/include/phgui.h @@ -413,6 +413,7 @@ VOID PhImageListWrapperRemove( #define PH_LAYOUT_FORCE_INVALIDATE 0x1000 // invalidate the control when it is resized #define PH_LAYOUT_TAB_CONTROL 0x2000 // this is a dummy item, a hack for the tab control +#define PH_LAYOUT_IMMEDIATE_RESIZE 0x4000 // needed for the tab control hack #define PH_LAYOUT_DUMMY_MASK (PH_LAYOUT_TAB_CONTROL) // determines which items don't get resized at all; just dummy