mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
fixed incorrect handling of window positions (GetWindowPlacement and SetWindowPos don't go together well - e.g. when the taskbar is at the top of the screen)
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@4202 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
@@ -5,6 +5,7 @@ Process Hacker
|
||||
* Added version string to peview CLR tab
|
||||
* FIXED:
|
||||
* Fixed the IPv6-related workaround causing crashes
|
||||
* Incorrect handling of window positions
|
||||
|
||||
2.15
|
||||
* NEW/IMPROVED:
|
||||
|
||||
@@ -760,10 +760,18 @@ VOID PhSaveWindowPlacementToSetting(
|
||||
{
|
||||
WINDOWPLACEMENT placement = { sizeof(placement) };
|
||||
PH_RECTANGLE windowRectangle;
|
||||
MONITORINFO monitorInfo = { sizeof(MONITORINFO) };
|
||||
|
||||
GetWindowPlacement(WindowHandle, &placement);
|
||||
windowRectangle = PhRectToRectangle(placement.rcNormalPosition);
|
||||
|
||||
// The rectangle is in workspace coordinates. Convert the values back to screen coordinates.
|
||||
if (GetMonitorInfo(MonitorFromRect(&placement.rcNormalPosition, MONITOR_DEFAULTTOPRIMARY), &monitorInfo))
|
||||
{
|
||||
windowRectangle.Left += monitorInfo.rcWork.left;
|
||||
windowRectangle.Top += monitorInfo.rcWork.top;
|
||||
}
|
||||
|
||||
if (PositionSettingName)
|
||||
PhSetIntegerPairSetting(PositionSettingName, windowRectangle.Position);
|
||||
if (SizeSettingName)
|
||||
|
||||
@@ -2296,9 +2296,6 @@ VOID PhpSaveWindowState()
|
||||
|
||||
VOID PhpSaveAllSettings()
|
||||
{
|
||||
WINDOWPLACEMENT placement = { sizeof(placement) };
|
||||
PH_RECTANGLE windowRectangle;
|
||||
|
||||
PhSaveSettingsProcessTreeList();
|
||||
if (ServiceTreeListLoaded)
|
||||
PhSaveSettingsServiceTreeList();
|
||||
@@ -2307,11 +2304,7 @@ VOID PhpSaveAllSettings()
|
||||
PhSetIntegerSetting(L"IconMask", NotifyIconMask);
|
||||
PhSetIntegerSetting(L"IconNotifyMask", NotifyIconNotifyMask);
|
||||
|
||||
GetWindowPlacement(PhMainWndHandle, &placement);
|
||||
windowRectangle = PhRectToRectangle(placement.rcNormalPosition);
|
||||
|
||||
PhSetIntegerPairSetting(L"MainWindowPosition", windowRectangle.Position);
|
||||
PhSetIntegerPairSetting(L"MainWindowSize", windowRectangle.Size);
|
||||
PhSaveWindowPlacementToSetting(L"MainWindowPosition", L"MainWindowSize", PhMainWndHandle);
|
||||
|
||||
PhpSaveWindowState();
|
||||
|
||||
|
||||
@@ -230,19 +230,13 @@ LRESULT CALLBACK PhpPropSheetWndProc(
|
||||
RemoveProp(hwnd, L"LayoutManager");
|
||||
|
||||
{
|
||||
WINDOWPLACEMENT placement = { sizeof(placement) };
|
||||
PH_RECTANGLE windowRectangle;
|
||||
HWND tabControl;
|
||||
TCITEM tabItem;
|
||||
WCHAR text[32];
|
||||
WCHAR text[128];
|
||||
|
||||
// Save the window position and size.
|
||||
|
||||
GetWindowPlacement(hwnd, &placement);
|
||||
windowRectangle = PhRectToRectangle(placement.rcNormalPosition);
|
||||
|
||||
PhSetIntegerPairSetting(L"ProcPropPosition", windowRectangle.Position);
|
||||
PhSetIntegerPairSetting(L"ProcPropSize", windowRectangle.Size);
|
||||
PhSaveWindowPlacementToSetting(L"ProcPropPosition", L"ProcPropSize", hwnd);
|
||||
|
||||
// Save the selected tab.
|
||||
|
||||
|
||||
@@ -139,7 +139,6 @@ static INT_PTR CALLBACK PhpThreadStackDlgProc(
|
||||
PPH_STRING title;
|
||||
HWND lvHandle;
|
||||
PPH_LAYOUT_MANAGER layoutManager;
|
||||
PH_INTEGER_PAIR size;
|
||||
|
||||
threadStackContext = (PTHREAD_STACK_CONTEXT)lParam;
|
||||
SetProp(hwndDlg, PhMakeContextAtom(), (HANDLE)threadStackContext);
|
||||
@@ -183,8 +182,7 @@ static INT_PTR CALLBACK PhpThreadStackDlgProc(
|
||||
MinimumSize.left = 0;
|
||||
}
|
||||
|
||||
size = PhGetIntegerPairSetting(L"ThreadStackWindowSize");
|
||||
SetWindowPos(hwndDlg, NULL, 0, 0, size.X, size.Y, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
|
||||
PhLoadWindowPlacementFromSetting(NULL, L"ThreadStackWindowSize", hwndDlg);
|
||||
PhCenterWindow(hwndDlg, GetParent(hwndDlg));
|
||||
|
||||
PhpRefreshThreadStack(threadStackContext);
|
||||
@@ -194,8 +192,6 @@ static INT_PTR CALLBACK PhpThreadStackDlgProc(
|
||||
{
|
||||
PPH_LAYOUT_MANAGER layoutManager;
|
||||
PTHREAD_STACK_CONTEXT threadStackContext;
|
||||
WINDOWPLACEMENT windowPlacement = { sizeof(windowPlacement) };
|
||||
PH_RECTANGLE windowRectangle;
|
||||
ULONG i;
|
||||
|
||||
layoutManager = (PPH_LAYOUT_MANAGER)GetProp(hwndDlg, L"LayoutManager");
|
||||
@@ -208,10 +204,7 @@ static INT_PTR CALLBACK PhpThreadStackDlgProc(
|
||||
PhFree(threadStackContext->List->Items[i]);
|
||||
|
||||
PhSaveListViewColumnsToSetting(L"ThreadStackListViewColumns", GetDlgItem(hwndDlg, IDC_LIST));
|
||||
|
||||
GetWindowPlacement(hwndDlg, &windowPlacement);
|
||||
windowRectangle = PhRectToRectangle(windowPlacement.rcNormalPosition);
|
||||
PhSetIntegerPairSetting(L"ThreadStackWindowSize", windowRectangle.Size);
|
||||
PhSaveWindowPlacementToSetting(NULL, L"ThreadStackWindowSize", hwndDlg);
|
||||
|
||||
RemoveProp(hwndDlg, PhMakeContextAtom());
|
||||
RemoveProp(hwndDlg, L"LayoutManager");
|
||||
|
||||
Reference in New Issue
Block a user