mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-10 20:45:38 +02:00
Fix flickering window loop issue in V3.0 and V3.1
Restore window z order Restore maximized window indicator
This commit is contained in:
parent
56102d5296
commit
0dd37cf785
2 changed files with 24 additions and 2 deletions
|
@ -613,6 +613,15 @@ namespace Ninjacrab.PersistentWindows.Common
|
|||
|
||||
bool success;
|
||||
// recover NormalPosition (the workspace position prior to snap)
|
||||
if (windowPlacement.ShowCmd == ShowWindowCommands.Maximize)
|
||||
{
|
||||
// When restoring maximized windows, it occasionally switches res and when the maximized setting is restored
|
||||
// the window thinks it's maximized, but does not eat all the real estate. So we'll temporarily unmaximize then
|
||||
// re-apply that
|
||||
windowPlacement.ShowCmd = ShowWindowCommands.Normal;
|
||||
User32.SetWindowPlacement(hwnd, ref windowPlacement);
|
||||
windowPlacement.ShowCmd = ShowWindowCommands.Maximize;
|
||||
}
|
||||
success = User32.SetWindowPlacement(hwnd, ref windowPlacement);
|
||||
Log.Info("SetWindowPlacement({0} [{1}x{2}]-[{3}x{4}]) - {5}",
|
||||
window.Process.ProcessName,
|
||||
|
@ -632,7 +641,20 @@ namespace Ninjacrab.PersistentWindows.Common
|
|||
rect.Top,
|
||||
rect.Width,
|
||||
rect.Height,
|
||||
(uint)(SetWindowPosFlags.IgnoreZOrder | SetWindowPosFlags.AsynchronousWindowPosition));
|
||||
SetWindowPosFlags.DoNotActivate |
|
||||
SetWindowPosFlags.DoNotChangeOwnerZOrder |
|
||||
SetWindowPosFlags.AsynchronousWindowPosition);
|
||||
|
||||
success &= User32.SetWindowPos(
|
||||
window.HWnd,
|
||||
IntPtr.Zero,
|
||||
rect.Left,
|
||||
rect.Top,
|
||||
rect.Width,
|
||||
rect.Height,
|
||||
SetWindowPosFlags.DoNotActivate |
|
||||
SetWindowPosFlags.DoNotChangeOwnerZOrder);
|
||||
|
||||
Log.Info("MoveWindow({0} [{1}x{2}]-[{3}x{4}]) - {5}",
|
||||
window.Process.ProcessName,
|
||||
rect.Left,
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace Ninjacrab.PersistentWindows.Common.WinApiBridge
|
|||
[DllImport("user32.dll", SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy,
|
||||
uint uFlags);
|
||||
SetWindowPosFlags uFlags);
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue