automatically fix small negative y screen coordinate to avoid repeated recovery

This commit is contained in:
Kang Yu 2020-02-22 12:01:00 -08:00
parent 3056a1bbec
commit 11cd6f568d

View file

@ -439,6 +439,11 @@ namespace Ninjacrab.PersistentWindows.Common
// compensate for GetWindowPlacement() failure to get real coordinate of snapped window // compensate for GetWindowPlacement() failure to get real coordinate of snapped window
RECT screenPosition = new RECT(); RECT screenPosition = new RECT();
User32.GetWindowRect(hwnd, ref screenPosition); User32.GetWindowRect(hwnd, ref screenPosition);
if (screenPosition.Top < 0 && screenPosition.Top > -15)
{
// automatically fix small negative y coordinate to avoid repeated recovery failure
screenPosition.Top = 0;
}
uint processId = 0; uint processId = 0;
uint threadId = User32.GetWindowThreadProcessId(window.HWnd, out processId); uint threadId = User32.GetWindowThreadProcessId(window.HWnd, out processId);
@ -518,7 +523,8 @@ namespace Ninjacrab.PersistentWindows.Common
monitorApplications[displayKey][curDisplayMetrics.Key].RecoverWindowPlacement = true; monitorApplications[displayKey][curDisplayMetrics.Key].RecoverWindowPlacement = true;
} }
*/ */
monitorApplications[displayKey][curDisplayMetrics.Key].WindowPlacement = curDisplayMetrics.WindowPlacement; //monitorApplications[displayKey][curDisplayMetrics.Key].WindowPlacement = curDisplayMetrics.WindowPlacement;
needUpdate = true;
} }
else else
{ {